15#ifndef DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_MESH_PREDICTION_SCHEME_CONSTRAINED_MULTI_PARALLELOGRAM_DECODER_H_
16#define DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_MESH_PREDICTION_SCHEME_CONSTRAINED_MULTI_PARALLELOGRAM_DECODER_H_
34template <
typename DataTypeT,
class TransformT,
class MeshDataT>
46 selected_mode_(Mode::OPTIMAL_MULTI_PARALLELOGRAM) {}
52 selected_mode_(Mode::OPTIMAL_MULTI_PARALLELOGRAM) {}
55 int size,
int num_components,
56 const PointIndex *entry_to_point_id_map)
override;
70 static constexpr int kMaxNumParallelograms =
71 constrained_multi_parallelogram::kMaxNumParallelograms;
77 std::vector<bool> is_crease_edge_[kMaxNumParallelograms];
81template <
typename DataTypeT,
class TransformT,
class MeshDataT>
82bool MeshPredictionSchemeConstrainedMultiParallelogramDecoder<
83 DataTypeT, TransformT, MeshDataT>::
84 ComputeOriginalValues(
const CorrType *in_corr, DataTypeT *out_data,
85 int ,
int num_components,
91 std::vector<DataTypeT> pred_vals[kMaxNumParallelograms];
92 for (
int i = 0; i < kMaxNumParallelograms; ++i) {
93 pred_vals[i].resize(num_components, 0);
95 this->
transform().ComputeOriginalValue(pred_vals[0].
data(), in_corr,
99 const std::vector<int32_t> *
const vertex_to_data_map =
103 std::vector<int> is_crease_edge_pos(kMaxNumParallelograms, 0);
106 std::vector<DataTypeT> multi_pred_vals(num_components);
108 const int corner_map_size =
109 static_cast<int>(this->
mesh_data().data_to_corner_map()->size());
110 for (
int p = 1; p < corner_map_size; ++p) {
112 this->
mesh_data().data_to_corner_map()->at(p);
115 int num_parallelograms = 0;
116 bool first_pass =
true;
117 while (corner_id != kInvalidCornerIndex) {
119 p, corner_id, table, *vertex_to_data_map, out_data,
120 num_components, &(pred_vals[num_parallelograms][0]))) {
123 ++num_parallelograms;
126 if (num_parallelograms == kMaxNumParallelograms) {
134 corner_id = table->SwingLeft(corner_id);
136 corner_id = table->SwingRight(corner_id);
138 if (corner_id == start_corner_id) {
141 if (corner_id == kInvalidCornerIndex && first_pass) {
143 corner_id = table->SwingRight(start_corner_id);
149 int num_used_parallelograms = 0;
150 if (num_parallelograms > 0) {
151 for (
int i = 0; i < num_components; ++i) {
152 multi_pred_vals[i] = 0;
155 for (
int i = 0; i < num_parallelograms; ++i) {
156 const int context = num_parallelograms - 1;
157 const int pos = is_crease_edge_pos[context]++;
158 if (is_crease_edge_[context].
size() <= pos) {
161 const bool is_crease = is_crease_edge_[context][pos];
163 ++num_used_parallelograms;
164 for (
int j = 0; j < num_components; ++j) {
171 const int dst_offset = p * num_components;
172 if (num_used_parallelograms == 0) {
175 const int src_offset = (p - 1) * num_components;
177 out_data + src_offset, in_corr + dst_offset, out_data + dst_offset);
180 for (
int c = 0; c < num_components; ++c) {
181 multi_pred_vals[c] /= num_used_parallelograms;
184 multi_pred_vals.data(), in_corr + dst_offset, out_data + dst_offset);
190template <
typename DataTypeT,
class TransformT,
class MeshDataT>
194#ifdef DRACO_BACKWARDS_COMPATIBILITY_SUPPORTED
198 if (!buffer->
Decode(&mode)) {
202 if (mode != Mode::OPTIMAL_MULTI_PARALLELOGRAM) {
210 for (
int i = 0; i < kMaxNumParallelograms; ++i) {
215 if (num_flags > this->
mesh_data().corner_table()->num_corners()) {
219 is_crease_edge_[i].resize(num_flags);
224 for (uint32_t j = 0; j < num_flags; ++j) {
Definition decoder_buffer.h:30
uint16_t bitstream_version() const
Definition decoder_buffer.h:120
bool Decode(T *out_val)
Definition decoder_buffer.h:68
Definition mesh_prediction_scheme_constrained_multi_parallelogram_decoder.h:36
PredictionSchemeMethod GetPredictionMethod() const override
Definition mesh_prediction_scheme_constrained_multi_parallelogram_decoder.h:60
bool IsInitialized() const override
Definition mesh_prediction_scheme_constrained_multi_parallelogram_decoder.h:64
typename PredictionSchemeDecoder< DataTypeT, TransformT >::CorrType CorrType
Definition mesh_prediction_scheme_constrained_multi_parallelogram_decoder.h:38
bool DecodePredictionData(DecoderBuffer *buffer) override
Definition mesh_prediction_scheme_constrained_multi_parallelogram_decoder.h:192
bool ComputeOriginalValues(const CorrType *in_corr, DataTypeT *out_data, int size, int num_components, const PointIndex *entry_to_point_id_map) override
Definition mesh_prediction_scheme_constrained_multi_parallelogram_decoder.h:84
MeshPredictionSchemeConstrainedMultiParallelogramDecoder(const PointAttribute *attribute)
Definition mesh_prediction_scheme_constrained_multi_parallelogram_decoder.h:42
typename MeshDataT::CornerTable CornerTable
Definition mesh_prediction_scheme_constrained_multi_parallelogram_decoder.h:40
MeshPredictionSchemeConstrainedMultiParallelogramDecoder(const PointAttribute *attribute, const TransformT &transform, const MeshDataT &mesh_data)
Definition mesh_prediction_scheme_constrained_multi_parallelogram_decoder.h:47
const MeshData & mesh_data() const
Definition mesh_prediction_scheme_decoder.h:38
MeshPredictionSchemeDecoder(const PointAttribute *attribute, const TransformT &transform, const MeshDataT &mesh_data)
Definition mesh_prediction_scheme_decoder.h:31
Definition point_attribute.h:33
Transform::CorrType CorrType
Definition prediction_scheme_decoder.h:41
const Transform & transform() const
Definition prediction_scheme_decoder.h:80
const PointAttribute * attribute() const
Definition prediction_scheme_decoder.h:79
Definition rans_bit_decoder.h:28
bool StartDecoding(DecoderBuffer *source_buffer)
Definition rans_bit_decoder.cc:29
void EndDecoding()
Definition rans_bit_decoder.h:44
bool DecodeNextBit()
Definition rans_bit_decoder.cc:65
#define DRACO_BITSTREAM_VERSION(MAJOR, MINOR)
Definition macros.h:114
lazy data
Definition meshpage.php:1583
n< br > font size
Definition meshpage.php:3536
Mode
Definition mesh_prediction_scheme_constrained_multi_parallelogram_shared.h:23
Definition attribute_octahedron_transform.cc:21
bool ComputeParallelogramPrediction(int data_entry_id, const CornerIndex ci, const CornerTableT *table, const std::vector< int32_t > &vertex_to_data_map, const DataTypeT *in_data, int num_components, DataTypeT *out_prediction)
Definition mesh_prediction_scheme_parallelogram_shared.h:45
bool DecodeVarint(IntTypeT *out_val, DecoderBuffer *buffer)
Definition varint_decoding.h:63
CornerIndex CornerIndex
Definition mesh_edgebreaker_encoder_impl.cc:35
PredictionSchemeMethod
Definition compression_shared.h:80
@ MESH_PREDICTION_CONSTRAINED_MULTI_PARALLELOGRAM
Definition compression_shared.h:89
DataTypeT AddAsUnsigned(DataTypeT a, DataTypeT b)
Definition math_utils.h:63
Definition GameApi_pl.cc:29382