15#ifdef DRACO_BACKWARDS_COMPATIBILITY_SUPPORTED
16#ifndef DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_MESH_PREDICTION_SCHEME_MULTI_PARALLELOGRAM_DECODER_H_
17#define DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_MESH_PREDICTION_SCHEME_MULTI_PARALLELOGRAM_DECODER_H_
28template <
typename DataTypeT,
class TransformT,
class MeshDataT>
29class MeshPredictionSchemeMultiParallelogramDecoder
33 typename PredictionSchemeDecoder<DataTypeT, TransformT>::CorrType;
34 using CornerTable =
typename MeshDataT::CornerTable;
36 explicit MeshPredictionSchemeMultiParallelogramDecoder(
37 const PointAttribute *attribute)
38 : MeshPredictionSchemeDecoder<DataTypeT, TransformT, MeshDataT>(
40 MeshPredictionSchemeMultiParallelogramDecoder(
const PointAttribute *attribute,
41 const TransformT &transform,
42 const MeshDataT &mesh_data)
43 : MeshPredictionSchemeDecoder<DataTypeT, TransformT, MeshDataT>(
44 attribute, transform, mesh_data) {}
46 bool ComputeOriginalValues(
const CorrType *in_corr, DataTypeT *out_data,
47 int size,
int num_components,
48 const PointIndex *entry_to_point_id_map)
override;
53 bool IsInitialized()
const override {
54 return this->mesh_data().IsInitialized();
58template <
typename DataTypeT,
class TransformT,
class MeshDataT>
59bool MeshPredictionSchemeMultiParallelogramDecoder<DataTypeT, TransformT,
61 ComputeOriginalValues(
const CorrType *in_corr, DataTypeT *out_data,
62 int ,
int num_components,
63 const PointIndex * ) {
64 this->transform().Init(num_components);
67 std::unique_ptr<DataTypeT[]> pred_vals(
new DataTypeT[num_components]());
68 std::unique_ptr<DataTypeT[]> parallelogram_pred_vals(
69 new DataTypeT[num_components]());
71 this->transform().ComputeOriginalValue(pred_vals.get(), in_corr, out_data);
73 const CornerTable *
const table = this->mesh_data().corner_table();
74 const std::vector<int32_t> *
const vertex_to_data_map =
75 this->mesh_data().vertex_to_data_map();
77 const int corner_map_size =
78 static_cast<int>(this->mesh_data().data_to_corner_map()->size());
79 for (
int p = 1; p < corner_map_size; ++p) {
81 this->mesh_data().data_to_corner_map()->at(p);
84 int num_parallelograms = 0;
85 for (
int i = 0; i < num_components; ++i) {
86 pred_vals[i] =
static_cast<DataTypeT
>(0);
88 while (corner_id != kInvalidCornerIndex) {
90 p, corner_id, table, *vertex_to_data_map, out_data,
91 num_components, parallelogram_pred_vals.get())) {
92 for (
int c = 0; c < num_components; ++c) {
100 corner_id = table->SwingRight(corner_id);
101 if (corner_id == start_corner_id) {
102 corner_id = kInvalidCornerIndex;
106 const int dst_offset = p * num_components;
107 if (num_parallelograms == 0) {
110 const int src_offset = (p - 1) * num_components;
111 this->transform().ComputeOriginalValue(
112 out_data + src_offset, in_corr + dst_offset, out_data + dst_offset);
115 for (
int c = 0; c < num_components; ++c) {
116 pred_vals[c] /= num_parallelograms;
118 this->transform().ComputeOriginalValue(
119 pred_vals.get(), in_corr + dst_offset, out_data + dst_offset);
Definition corner_table.h:53
Definition mesh_prediction_scheme_decoder.h:28
n< br > font size
Definition meshpage.php:3536
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
CornerIndex CornerIndex
Definition mesh_edgebreaker_encoder_impl.cc:35
PredictionSchemeMethod
Definition compression_shared.h:80
@ MESH_PREDICTION_MULTI_PARALLELOGRAM
Definition compression_shared.h:87
DataTypeT AddAsUnsigned(DataTypeT a, DataTypeT b)
Definition math_utils.h:63