dracox 0.0.1__cp39-cp39-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bin/draco_decoder.exe +0 -0
- bin/draco_encoder.exe +0 -0
- dracox/__init__.py +252 -0
- dracox/dracox_ext.cp39-win_amd64.pyd +0 -0
- dracox-0.0.1.dist-info/METADATA +14 -0
- dracox-0.0.1.dist-info/RECORD +214 -0
- dracox-0.0.1.dist-info/WHEEL +5 -0
- include/draco/animation/keyframe_animation.h +107 -0
- include/draco/animation/keyframe_animation_decoder.h +34 -0
- include/draco/animation/keyframe_animation_encoder.h +39 -0
- include/draco/attributes/attribute_octahedron_transform.h +81 -0
- include/draco/attributes/attribute_quantization_transform.h +102 -0
- include/draco/attributes/attribute_transform.h +76 -0
- include/draco/attributes/attribute_transform_data.h +71 -0
- include/draco/attributes/attribute_transform_type.h +30 -0
- include/draco/attributes/geometry_attribute.h +541 -0
- include/draco/attributes/geometry_indices.h +54 -0
- include/draco/attributes/point_attribute.h +196 -0
- include/draco/compression/attributes/attributes_decoder.h +97 -0
- include/draco/compression/attributes/attributes_decoder_interface.h +62 -0
- include/draco/compression/attributes/attributes_encoder.h +154 -0
- include/draco/compression/attributes/kd_tree_attributes_decoder.h +50 -0
- include/draco/compression/attributes/kd_tree_attributes_encoder.h +51 -0
- include/draco/compression/attributes/kd_tree_attributes_shared.h +28 -0
- include/draco/compression/attributes/linear_sequencer.h +51 -0
- include/draco/compression/attributes/mesh_attribute_indices_encoding_data.h +58 -0
- include/draco/compression/attributes/normal_compression_utils.h +372 -0
- include/draco/compression/attributes/point_d_vector.h +288 -0
- include/draco/compression/attributes/points_sequencer.h +63 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_constrained_multi_parallelogram_decoder.h +236 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_constrained_multi_parallelogram_encoder.h +413 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_constrained_multi_parallelogram_shared.h +34 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_data.h +72 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_decoder.h +46 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_encoder.h +46 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_decoder.h +176 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_encoder.h +180 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_predictor_area.h +117 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_predictor_base.h +96 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_multi_parallelogram_decoder.h +128 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_multi_parallelogram_encoder.h +133 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_parallelogram_encoder.h +111 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_parallelogram_shared.h +78 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_decoder.h +372 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_encoder.h +318 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_portable_decoder.h +143 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_portable_encoder.h +136 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_portable_predictor.h +282 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_decoder.h +90 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_decoder_factory.h +194 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_decoder_interface.h +53 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_decoding_transform.h +65 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_delta_decoder.h +65 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_delta_encoder.h +69 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_encoder.h +90 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_encoder_factory.h +134 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_encoder_interface.h +55 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_encoding_transform.h +77 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_factory.h +85 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_interface.h +60 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_canonicalized_decoding_transform.h +118 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_canonicalized_encoding_transform.h +116 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_canonicalized_transform_base.h +102 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_decoding_transform.h +115 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_encoding_transform.h +105 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_transform_base.h +90 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_wrap_decoding_transform.h +88 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_wrap_encoding_transform.h +81 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_wrap_transform_base.h +120 -0
- include/draco/compression/attributes/sequential_attribute_decoder.h +86 -0
- include/draco/compression/attributes/sequential_attribute_decoders_controller.h +61 -0
- include/draco/compression/attributes/sequential_attribute_encoder.h +134 -0
- include/draco/compression/attributes/sequential_attribute_encoders_controller.h +115 -0
- include/draco/compression/attributes/sequential_integer_attribute_decoder.h +76 -0
- include/draco/compression/attributes/sequential_integer_attribute_encoder.h +67 -0
- include/draco/compression/attributes/sequential_normal_attribute_decoder.h +83 -0
- include/draco/compression/attributes/sequential_normal_attribute_encoder.h +82 -0
- include/draco/compression/attributes/sequential_quantization_attribute_decoder.h +52 -0
- include/draco/compression/attributes/sequential_quantization_attribute_encoder.h +52 -0
- include/draco/compression/bit_coders/adaptive_rans_bit_coding_shared.h +43 -0
- include/draco/compression/bit_coders/adaptive_rans_bit_decoder.h +54 -0
- include/draco/compression/bit_coders/adaptive_rans_bit_encoder.h +61 -0
- include/draco/compression/bit_coders/direct_bit_decoder.h +89 -0
- include/draco/compression/bit_coders/direct_bit_encoder.h +89 -0
- include/draco/compression/bit_coders/folded_integer_bit_decoder.h +77 -0
- include/draco/compression/bit_coders/folded_integer_bit_encoder.h +82 -0
- include/draco/compression/bit_coders/rans_bit_decoder.h +55 -0
- include/draco/compression/bit_coders/rans_bit_encoder.h +57 -0
- include/draco/compression/bit_coders/symbol_bit_decoder.h +36 -0
- include/draco/compression/bit_coders/symbol_bit_encoder.h +36 -0
- include/draco/compression/config/compression_shared.h +155 -0
- include/draco/compression/config/decoder_options.h +34 -0
- include/draco/compression/config/draco_options.h +249 -0
- include/draco/compression/config/encoder_options.h +101 -0
- include/draco/compression/config/encoding_features.h +39 -0
- include/draco/compression/decode.h +80 -0
- include/draco/compression/draco_compression_options.h +141 -0
- include/draco/compression/encode.h +139 -0
- include/draco/compression/encode_base.h +131 -0
- include/draco/compression/entropy/ans.h +526 -0
- include/draco/compression/entropy/rans_symbol_coding.h +53 -0
- include/draco/compression/entropy/rans_symbol_decoder.h +171 -0
- include/draco/compression/entropy/rans_symbol_encoder.h +290 -0
- include/draco/compression/entropy/shannon_entropy.h +110 -0
- include/draco/compression/entropy/symbol_decoding.h +29 -0
- include/draco/compression/entropy/symbol_encoding.h +47 -0
- include/draco/compression/expert_encode.h +160 -0
- include/draco/compression/mesh/mesh_decoder.h +68 -0
- include/draco/compression/mesh/mesh_edgebreaker_decoder.h +54 -0
- include/draco/compression/mesh/mesh_edgebreaker_decoder_impl.h +228 -0
- include/draco/compression/mesh/mesh_edgebreaker_decoder_impl_interface.h +47 -0
- include/draco/compression/mesh/mesh_edgebreaker_encoder.h +73 -0
- include/draco/compression/mesh/mesh_edgebreaker_encoder_impl.h +209 -0
- include/draco/compression/mesh/mesh_edgebreaker_encoder_impl_interface.h +57 -0
- include/draco/compression/mesh/mesh_edgebreaker_shared.h +129 -0
- include/draco/compression/mesh/mesh_edgebreaker_traversal_decoder.h +201 -0
- include/draco/compression/mesh/mesh_edgebreaker_traversal_encoder.h +139 -0
- include/draco/compression/mesh/mesh_edgebreaker_traversal_predictive_decoder.h +134 -0
- include/draco/compression/mesh/mesh_edgebreaker_traversal_predictive_encoder.h +172 -0
- include/draco/compression/mesh/mesh_edgebreaker_traversal_valence_decoder.h +219 -0
- include/draco/compression/mesh/mesh_edgebreaker_traversal_valence_encoder.h +226 -0
- include/draco/compression/mesh/mesh_encoder.h +84 -0
- include/draco/compression/mesh/mesh_sequential_decoder.h +39 -0
- include/draco/compression/mesh/mesh_sequential_encoder.h +56 -0
- include/draco/compression/mesh/traverser/depth_first_traverser.h +172 -0
- include/draco/compression/mesh/traverser/max_prediction_degree_traverser.h +226 -0
- include/draco/compression/mesh/traverser/mesh_attribute_indices_encoding_observer.h +76 -0
- include/draco/compression/mesh/traverser/mesh_traversal_sequencer.h +113 -0
- include/draco/compression/mesh/traverser/traverser_base.h +87 -0
- include/draco/compression/point_cloud/algorithms/dynamic_integer_points_kd_tree_decoder.h +369 -0
- include/draco/compression/point_cloud/algorithms/dynamic_integer_points_kd_tree_encoder.h +372 -0
- include/draco/compression/point_cloud/algorithms/float_points_tree_decoder.h +141 -0
- include/draco/compression/point_cloud/algorithms/float_points_tree_encoder.h +126 -0
- include/draco/compression/point_cloud/algorithms/point_cloud_compression_method.h +34 -0
- include/draco/compression/point_cloud/algorithms/point_cloud_types.h +76 -0
- include/draco/compression/point_cloud/algorithms/quantize_points_3.h +84 -0
- include/draco/compression/point_cloud/algorithms/queuing_policy.h +75 -0
- include/draco/compression/point_cloud/point_cloud_decoder.h +118 -0
- include/draco/compression/point_cloud/point_cloud_encoder.h +158 -0
- include/draco/compression/point_cloud/point_cloud_kd_tree_decoder.h +31 -0
- include/draco/compression/point_cloud/point_cloud_kd_tree_encoder.h +45 -0
- include/draco/compression/point_cloud/point_cloud_sequential_decoder.h +33 -0
- include/draco/compression/point_cloud/point_cloud_sequential_encoder.h +43 -0
- include/draco/core/bit_utils.h +127 -0
- include/draco/core/bounding_box.h +77 -0
- include/draco/core/constants.h +6 -0
- include/draco/core/cycle_timer.h +51 -0
- include/draco/core/data_buffer.h +82 -0
- include/draco/core/decoder_buffer.h +216 -0
- include/draco/core/divide.h +42 -0
- include/draco/core/draco_index_type.h +184 -0
- include/draco/core/draco_index_type_vector.h +90 -0
- include/draco/core/draco_types.h +52 -0
- include/draco/core/draco_version.h +25 -0
- include/draco/core/encoder_buffer.h +152 -0
- include/draco/core/hash_utils.h +64 -0
- include/draco/core/macros.h +124 -0
- include/draco/core/math_utils.h +79 -0
- include/draco/core/options.h +151 -0
- include/draco/core/quantization_utils.h +82 -0
- include/draco/core/status.h +83 -0
- include/draco/core/status_or.h +81 -0
- include/draco/core/varint_decoding.h +81 -0
- include/draco/core/varint_encoding.h +61 -0
- include/draco/core/vector_d.h +355 -0
- include/draco/draco_features.h +25 -0
- include/draco/io/file_reader_factory.h +34 -0
- include/draco/io/file_reader_interface.h +32 -0
- include/draco/io/file_utils.h +86 -0
- include/draco/io/file_writer_factory.h +34 -0
- include/draco/io/file_writer_interface.h +26 -0
- include/draco/io/file_writer_utils.h +38 -0
- include/draco/io/mesh_io.h +107 -0
- include/draco/io/obj_decoder.h +147 -0
- include/draco/io/obj_encoder.h +107 -0
- include/draco/io/parser_utils.h +66 -0
- include/draco/io/ply_decoder.h +69 -0
- include/draco/io/ply_encoder.h +54 -0
- include/draco/io/ply_property_reader.h +96 -0
- include/draco/io/ply_property_writer.h +94 -0
- include/draco/io/ply_reader.h +155 -0
- include/draco/io/point_cloud_io.h +89 -0
- include/draco/io/stdio_file_reader.h +48 -0
- include/draco/io/stdio_file_writer.h +42 -0
- include/draco/io/stl_decoder.h +38 -0
- include/draco/io/stl_encoder.h +52 -0
- include/draco/mesh/corner_table.h +397 -0
- include/draco/mesh/corner_table_iterators.h +309 -0
- include/draco/mesh/mesh.h +378 -0
- include/draco/mesh/mesh_are_equivalent.h +71 -0
- include/draco/mesh/mesh_attribute_corner_table.h +202 -0
- include/draco/mesh/mesh_cleanup.h +61 -0
- include/draco/mesh/mesh_features.h +93 -0
- include/draco/mesh/mesh_indices.h +37 -0
- include/draco/mesh/mesh_misc_functions.h +105 -0
- include/draco/mesh/mesh_stripifier.h +258 -0
- include/draco/mesh/triangle_soup_mesh_builder.h +134 -0
- include/draco/mesh/valence_cache.h +142 -0
- include/draco/metadata/geometry_metadata.h +142 -0
- include/draco/metadata/metadata.h +209 -0
- include/draco/metadata/metadata_decoder.h +42 -0
- include/draco/metadata/metadata_encoder.h +41 -0
- include/draco/metadata/property_attribute.h +107 -0
- include/draco/metadata/property_table.h +222 -0
- include/draco/metadata/structural_metadata.h +78 -0
- include/draco/metadata/structural_metadata_schema.h +118 -0
- include/draco/point_cloud/point_cloud.h +289 -0
- include/draco/point_cloud/point_cloud_builder.h +101 -0
- lib/draco.lib +0 -0
- lib/pkgconfig/draco.pc +6 -0
- share/cmake/draco/draco-config-version.cmake +43 -0
- share/cmake/draco/draco-config.cmake +27 -0
- share/cmake/draco/draco-targets-release.cmake +19 -0
- share/cmake/draco/draco-targets.cmake +107 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
// Copyright 2016 The Draco Authors.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
//
|
|
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_
|
|
18
|
+
|
|
19
|
+
#include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_decoder.h"
|
|
20
|
+
#include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_parallelogram_shared.h"
|
|
21
|
+
#include "draco/core/math_utils.h"
|
|
22
|
+
#include "draco/draco_features.h"
|
|
23
|
+
|
|
24
|
+
namespace draco {
|
|
25
|
+
|
|
26
|
+
// Decoder for predictions encoded by multi-parallelogram encoding scheme.
|
|
27
|
+
// See the corresponding encoder for method description.
|
|
28
|
+
template <typename DataTypeT, class TransformT, class MeshDataT>
|
|
29
|
+
class MeshPredictionSchemeMultiParallelogramDecoder
|
|
30
|
+
: public MeshPredictionSchemeDecoder<DataTypeT, TransformT, MeshDataT> {
|
|
31
|
+
public:
|
|
32
|
+
using CorrType =
|
|
33
|
+
typename PredictionSchemeDecoder<DataTypeT, TransformT>::CorrType;
|
|
34
|
+
using CornerTable = typename MeshDataT::CornerTable;
|
|
35
|
+
|
|
36
|
+
explicit MeshPredictionSchemeMultiParallelogramDecoder(
|
|
37
|
+
const PointAttribute *attribute)
|
|
38
|
+
: MeshPredictionSchemeDecoder<DataTypeT, TransformT, MeshDataT>(
|
|
39
|
+
attribute) {}
|
|
40
|
+
MeshPredictionSchemeMultiParallelogramDecoder(const PointAttribute *attribute,
|
|
41
|
+
const TransformT &transform,
|
|
42
|
+
const MeshDataT &mesh_data)
|
|
43
|
+
: MeshPredictionSchemeDecoder<DataTypeT, TransformT, MeshDataT>(
|
|
44
|
+
attribute, transform, mesh_data) {}
|
|
45
|
+
|
|
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;
|
|
49
|
+
PredictionSchemeMethod GetPredictionMethod() const override {
|
|
50
|
+
return MESH_PREDICTION_MULTI_PARALLELOGRAM;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
bool IsInitialized() const override {
|
|
54
|
+
return this->mesh_data().IsInitialized();
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
template <typename DataTypeT, class TransformT, class MeshDataT>
|
|
59
|
+
bool MeshPredictionSchemeMultiParallelogramDecoder<DataTypeT, TransformT,
|
|
60
|
+
MeshDataT>::
|
|
61
|
+
ComputeOriginalValues(const CorrType *in_corr, DataTypeT *out_data,
|
|
62
|
+
int /* size */, int num_components,
|
|
63
|
+
const PointIndex * /* entry_to_point_id_map */) {
|
|
64
|
+
this->transform().Init(num_components);
|
|
65
|
+
|
|
66
|
+
// For storage of prediction values (already initialized to zero).
|
|
67
|
+
std::unique_ptr<DataTypeT[]> pred_vals(new DataTypeT[num_components]());
|
|
68
|
+
std::unique_ptr<DataTypeT[]> parallelogram_pred_vals(
|
|
69
|
+
new DataTypeT[num_components]());
|
|
70
|
+
|
|
71
|
+
this->transform().ComputeOriginalValue(pred_vals.get(), in_corr, out_data);
|
|
72
|
+
|
|
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();
|
|
76
|
+
|
|
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) {
|
|
80
|
+
const CornerIndex start_corner_id =
|
|
81
|
+
this->mesh_data().data_to_corner_map()->at(p);
|
|
82
|
+
|
|
83
|
+
CornerIndex corner_id(start_corner_id);
|
|
84
|
+
int num_parallelograms = 0;
|
|
85
|
+
for (int i = 0; i < num_components; ++i) {
|
|
86
|
+
pred_vals[i] = static_cast<DataTypeT>(0);
|
|
87
|
+
}
|
|
88
|
+
while (corner_id != kInvalidCornerIndex) {
|
|
89
|
+
if (ComputeParallelogramPrediction(
|
|
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) {
|
|
93
|
+
pred_vals[c] =
|
|
94
|
+
AddAsUnsigned(pred_vals[c], parallelogram_pred_vals[c]);
|
|
95
|
+
}
|
|
96
|
+
++num_parallelograms;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Proceed to the next corner attached to the vertex.
|
|
100
|
+
corner_id = table->SwingRight(corner_id);
|
|
101
|
+
if (corner_id == start_corner_id) {
|
|
102
|
+
corner_id = kInvalidCornerIndex;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const int dst_offset = p * num_components;
|
|
107
|
+
if (num_parallelograms == 0) {
|
|
108
|
+
// No parallelogram was valid.
|
|
109
|
+
// We use the last decoded point as a reference.
|
|
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);
|
|
113
|
+
} else {
|
|
114
|
+
// Compute the correction from the predicted value.
|
|
115
|
+
for (int c = 0; c < num_components; ++c) {
|
|
116
|
+
pred_vals[c] /= num_parallelograms;
|
|
117
|
+
}
|
|
118
|
+
this->transform().ComputeOriginalValue(
|
|
119
|
+
pred_vals.get(), in_corr + dst_offset, out_data + dst_offset);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
} // namespace draco
|
|
126
|
+
|
|
127
|
+
#endif // DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_MESH_PREDICTION_SCHEME_MULTI_PARALLELOGRAM_DECODER_H_
|
|
128
|
+
#endif
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// Copyright 2016 The Draco Authors.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
//
|
|
15
|
+
#ifndef DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_MESH_PREDICTION_SCHEME_MULTI_PARALLELOGRAM_ENCODER_H_
|
|
16
|
+
#define DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_MESH_PREDICTION_SCHEME_MULTI_PARALLELOGRAM_ENCODER_H_
|
|
17
|
+
|
|
18
|
+
#include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_encoder.h"
|
|
19
|
+
#include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_parallelogram_shared.h"
|
|
20
|
+
|
|
21
|
+
namespace draco {
|
|
22
|
+
|
|
23
|
+
// Multi parallelogram prediction predicts attribute values using information
|
|
24
|
+
// from all opposite faces to the predicted vertex, compared to the standard
|
|
25
|
+
// prediction scheme, where only one opposite face is used (see
|
|
26
|
+
// prediction_scheme_parallelogram.h). This approach is generally slower than
|
|
27
|
+
// the standard parallelogram prediction, but it usually results in better
|
|
28
|
+
// prediction (5 - 20% based on the quantization level. Better gains can be
|
|
29
|
+
// achieved when more aggressive quantization is used).
|
|
30
|
+
template <typename DataTypeT, class TransformT, class MeshDataT>
|
|
31
|
+
class MeshPredictionSchemeMultiParallelogramEncoder
|
|
32
|
+
: public MeshPredictionSchemeEncoder<DataTypeT, TransformT, MeshDataT> {
|
|
33
|
+
public:
|
|
34
|
+
using CorrType =
|
|
35
|
+
typename PredictionSchemeEncoder<DataTypeT, TransformT>::CorrType;
|
|
36
|
+
using CornerTable = typename MeshDataT::CornerTable;
|
|
37
|
+
|
|
38
|
+
explicit MeshPredictionSchemeMultiParallelogramEncoder(
|
|
39
|
+
const PointAttribute *attribute)
|
|
40
|
+
: MeshPredictionSchemeEncoder<DataTypeT, TransformT, MeshDataT>(
|
|
41
|
+
attribute) {}
|
|
42
|
+
MeshPredictionSchemeMultiParallelogramEncoder(const PointAttribute *attribute,
|
|
43
|
+
const TransformT &transform,
|
|
44
|
+
const MeshDataT &mesh_data)
|
|
45
|
+
: MeshPredictionSchemeEncoder<DataTypeT, TransformT, MeshDataT>(
|
|
46
|
+
attribute, transform, mesh_data) {}
|
|
47
|
+
|
|
48
|
+
bool ComputeCorrectionValues(
|
|
49
|
+
const DataTypeT *in_data, CorrType *out_corr, int size,
|
|
50
|
+
int num_components, const PointIndex *entry_to_point_id_map) override;
|
|
51
|
+
PredictionSchemeMethod GetPredictionMethod() const override {
|
|
52
|
+
return MESH_PREDICTION_MULTI_PARALLELOGRAM;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
bool IsInitialized() const override {
|
|
56
|
+
return this->mesh_data().IsInitialized();
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
template <typename DataTypeT, class TransformT, class MeshDataT>
|
|
61
|
+
bool MeshPredictionSchemeMultiParallelogramEncoder<DataTypeT, TransformT,
|
|
62
|
+
MeshDataT>::
|
|
63
|
+
ComputeCorrectionValues(const DataTypeT *in_data, CorrType *out_corr,
|
|
64
|
+
int size, int num_components,
|
|
65
|
+
const PointIndex * /* entry_to_point_id_map */) {
|
|
66
|
+
this->transform().Init(in_data, size, num_components);
|
|
67
|
+
const CornerTable *const table = this->mesh_data().corner_table();
|
|
68
|
+
const std::vector<int32_t> *const vertex_to_data_map =
|
|
69
|
+
this->mesh_data().vertex_to_data_map();
|
|
70
|
+
|
|
71
|
+
// For storage of prediction values (already initialized to zero).
|
|
72
|
+
std::unique_ptr<DataTypeT[]> pred_vals(new DataTypeT[num_components]());
|
|
73
|
+
std::unique_ptr<DataTypeT[]> parallelogram_pred_vals(
|
|
74
|
+
new DataTypeT[num_components]());
|
|
75
|
+
|
|
76
|
+
// We start processing from the end because this prediction uses data from
|
|
77
|
+
// previous entries that could be overwritten when an entry is processed.
|
|
78
|
+
for (int p =
|
|
79
|
+
static_cast<int>(this->mesh_data().data_to_corner_map()->size() - 1);
|
|
80
|
+
p > 0; --p) {
|
|
81
|
+
const CornerIndex start_corner_id =
|
|
82
|
+
this->mesh_data().data_to_corner_map()->at(p);
|
|
83
|
+
|
|
84
|
+
// Go over all corners attached to the vertex and compute the predicted
|
|
85
|
+
// value from the parallelograms defined by their opposite faces.
|
|
86
|
+
CornerIndex corner_id(start_corner_id);
|
|
87
|
+
int num_parallelograms = 0;
|
|
88
|
+
for (int i = 0; i < num_components; ++i) {
|
|
89
|
+
pred_vals[i] = static_cast<DataTypeT>(0);
|
|
90
|
+
}
|
|
91
|
+
while (corner_id != kInvalidCornerIndex) {
|
|
92
|
+
if (ComputeParallelogramPrediction(
|
|
93
|
+
p, corner_id, table, *vertex_to_data_map, in_data, num_components,
|
|
94
|
+
parallelogram_pred_vals.get())) {
|
|
95
|
+
for (int c = 0; c < num_components; ++c) {
|
|
96
|
+
pred_vals[c] += parallelogram_pred_vals[c];
|
|
97
|
+
}
|
|
98
|
+
++num_parallelograms;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Proceed to the next corner attached to the vertex.
|
|
102
|
+
corner_id = table->SwingRight(corner_id);
|
|
103
|
+
if (corner_id == start_corner_id) {
|
|
104
|
+
corner_id = kInvalidCornerIndex;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const int dst_offset = p * num_components;
|
|
108
|
+
if (num_parallelograms == 0) {
|
|
109
|
+
// No parallelogram was valid.
|
|
110
|
+
// We use the last encoded point as a reference.
|
|
111
|
+
const int src_offset = (p - 1) * num_components;
|
|
112
|
+
this->transform().ComputeCorrection(
|
|
113
|
+
in_data + dst_offset, in_data + src_offset, out_corr + dst_offset);
|
|
114
|
+
} else {
|
|
115
|
+
// Compute the correction from the predicted value.
|
|
116
|
+
for (int c = 0; c < num_components; ++c) {
|
|
117
|
+
pred_vals[c] /= num_parallelograms;
|
|
118
|
+
}
|
|
119
|
+
this->transform().ComputeCorrection(in_data + dst_offset, pred_vals.get(),
|
|
120
|
+
out_corr + dst_offset);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
// First element is always fixed because it cannot be predicted.
|
|
124
|
+
for (int i = 0; i < num_components; ++i) {
|
|
125
|
+
pred_vals[i] = static_cast<DataTypeT>(0);
|
|
126
|
+
}
|
|
127
|
+
this->transform().ComputeCorrection(in_data, pred_vals.get(), out_corr);
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
} // namespace draco
|
|
132
|
+
|
|
133
|
+
#endif // DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_MESH_PREDICTION_SCHEME_MULTI_PARALLELOGRAM_ENCODER_H_
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// Copyright 2016 The Draco Authors.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
//
|
|
15
|
+
#ifndef DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_MESH_PREDICTION_SCHEME_PARALLELOGRAM_ENCODER_H_
|
|
16
|
+
#define DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_MESH_PREDICTION_SCHEME_PARALLELOGRAM_ENCODER_H_
|
|
17
|
+
|
|
18
|
+
#include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_encoder.h"
|
|
19
|
+
#include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_parallelogram_shared.h"
|
|
20
|
+
|
|
21
|
+
namespace draco {
|
|
22
|
+
|
|
23
|
+
// Parallelogram prediction predicts an attribute value V from three vertices
|
|
24
|
+
// on the opposite face to the predicted vertex. The values on the three
|
|
25
|
+
// vertices are used to construct a parallelogram V' = O - A - B, where O is the
|
|
26
|
+
// value on the opposite vertex, and A, B are values on the shared vertices:
|
|
27
|
+
// V
|
|
28
|
+
// / \
|
|
29
|
+
// / \
|
|
30
|
+
// / \
|
|
31
|
+
// A-------B
|
|
32
|
+
// \ /
|
|
33
|
+
// \ /
|
|
34
|
+
// \ /
|
|
35
|
+
// O
|
|
36
|
+
//
|
|
37
|
+
template <typename DataTypeT, class TransformT, class MeshDataT>
|
|
38
|
+
class MeshPredictionSchemeParallelogramEncoder
|
|
39
|
+
: public MeshPredictionSchemeEncoder<DataTypeT, TransformT, MeshDataT> {
|
|
40
|
+
public:
|
|
41
|
+
using CorrType =
|
|
42
|
+
typename PredictionSchemeEncoder<DataTypeT, TransformT>::CorrType;
|
|
43
|
+
using CornerTable = typename MeshDataT::CornerTable;
|
|
44
|
+
explicit MeshPredictionSchemeParallelogramEncoder(
|
|
45
|
+
const PointAttribute *attribute)
|
|
46
|
+
: MeshPredictionSchemeEncoder<DataTypeT, TransformT, MeshDataT>(
|
|
47
|
+
attribute) {}
|
|
48
|
+
MeshPredictionSchemeParallelogramEncoder(const PointAttribute *attribute,
|
|
49
|
+
const TransformT &transform,
|
|
50
|
+
const MeshDataT &mesh_data)
|
|
51
|
+
: MeshPredictionSchemeEncoder<DataTypeT, TransformT, MeshDataT>(
|
|
52
|
+
attribute, transform, mesh_data) {}
|
|
53
|
+
|
|
54
|
+
bool ComputeCorrectionValues(
|
|
55
|
+
const DataTypeT *in_data, CorrType *out_corr, int size,
|
|
56
|
+
int num_components, const PointIndex *entry_to_point_id_map) override;
|
|
57
|
+
PredictionSchemeMethod GetPredictionMethod() const override {
|
|
58
|
+
return MESH_PREDICTION_PARALLELOGRAM;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
bool IsInitialized() const override {
|
|
62
|
+
return this->mesh_data().IsInitialized();
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
template <typename DataTypeT, class TransformT, class MeshDataT>
|
|
67
|
+
bool MeshPredictionSchemeParallelogramEncoder<DataTypeT, TransformT,
|
|
68
|
+
MeshDataT>::
|
|
69
|
+
ComputeCorrectionValues(const DataTypeT *in_data, CorrType *out_corr,
|
|
70
|
+
int size, int num_components,
|
|
71
|
+
const PointIndex * /* entry_to_point_id_map */) {
|
|
72
|
+
this->transform().Init(in_data, size, num_components);
|
|
73
|
+
// For storage of prediction values (already initialized to zero).
|
|
74
|
+
std::unique_ptr<DataTypeT[]> pred_vals(new DataTypeT[num_components]());
|
|
75
|
+
|
|
76
|
+
// We start processing from the end because this prediction uses data from
|
|
77
|
+
// previous entries that could be overwritten when an entry is processed.
|
|
78
|
+
const CornerTable *const table = this->mesh_data().corner_table();
|
|
79
|
+
const std::vector<int32_t> *const vertex_to_data_map =
|
|
80
|
+
this->mesh_data().vertex_to_data_map();
|
|
81
|
+
for (int p =
|
|
82
|
+
static_cast<int>(this->mesh_data().data_to_corner_map()->size() - 1);
|
|
83
|
+
p > 0; --p) {
|
|
84
|
+
const CornerIndex corner_id = this->mesh_data().data_to_corner_map()->at(p);
|
|
85
|
+
const int dst_offset = p * num_components;
|
|
86
|
+
if (!ComputeParallelogramPrediction(p, corner_id, table,
|
|
87
|
+
*vertex_to_data_map, in_data,
|
|
88
|
+
num_components, pred_vals.get())) {
|
|
89
|
+
// Parallelogram could not be computed, Possible because some of the
|
|
90
|
+
// vertices are not valid (not encoded yet).
|
|
91
|
+
// We use the last encoded point as a reference (delta coding).
|
|
92
|
+
const int src_offset = (p - 1) * num_components;
|
|
93
|
+
this->transform().ComputeCorrection(
|
|
94
|
+
in_data + dst_offset, in_data + src_offset, out_corr + dst_offset);
|
|
95
|
+
} else {
|
|
96
|
+
// Apply the parallelogram prediction.
|
|
97
|
+
this->transform().ComputeCorrection(in_data + dst_offset, pred_vals.get(),
|
|
98
|
+
out_corr + dst_offset);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
// First element is always fixed because it cannot be predicted.
|
|
102
|
+
for (int i = 0; i < num_components; ++i) {
|
|
103
|
+
pred_vals[i] = static_cast<DataTypeT>(0);
|
|
104
|
+
}
|
|
105
|
+
this->transform().ComputeCorrection(in_data, pred_vals.get(), out_corr);
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
} // namespace draco
|
|
110
|
+
|
|
111
|
+
#endif // DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_MESH_PREDICTION_SCHEME_PARALLELOGRAM_ENCODER_H_
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Copyright 2016 The Draco Authors.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
//
|
|
15
|
+
// Shared functionality for different parallelogram prediction schemes.
|
|
16
|
+
|
|
17
|
+
#ifndef DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_MESH_PREDICTION_SCHEME_PARALLELOGRAM_SHARED_H_
|
|
18
|
+
#define DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_MESH_PREDICTION_SCHEME_PARALLELOGRAM_SHARED_H_
|
|
19
|
+
|
|
20
|
+
#include "draco/mesh/corner_table.h"
|
|
21
|
+
#include "draco/mesh/mesh.h"
|
|
22
|
+
|
|
23
|
+
namespace draco {
|
|
24
|
+
|
|
25
|
+
// TODO(draco-eng) consolidate Vertex/next/previous queries to one call
|
|
26
|
+
// (performance).
|
|
27
|
+
template <class CornerTableT>
|
|
28
|
+
inline void GetParallelogramEntries(
|
|
29
|
+
const CornerIndex ci, const CornerTableT *table,
|
|
30
|
+
const std::vector<int32_t> &vertex_to_data_map, int *opp_entry,
|
|
31
|
+
int *next_entry, int *prev_entry) {
|
|
32
|
+
// One vertex of the input |table| correspond to exactly one attribute value
|
|
33
|
+
// entry. The |table| can be either CornerTable for per-vertex attributes,
|
|
34
|
+
// or MeshAttributeCornerTable for attributes with interior seams.
|
|
35
|
+
*opp_entry = vertex_to_data_map[table->Vertex(ci).value()];
|
|
36
|
+
*next_entry = vertex_to_data_map[table->Vertex(table->Next(ci)).value()];
|
|
37
|
+
*prev_entry = vertex_to_data_map[table->Vertex(table->Previous(ci)).value()];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Computes parallelogram prediction for a given corner and data entry id.
|
|
41
|
+
// The prediction is stored in |out_prediction|.
|
|
42
|
+
// Function returns false when the prediction couldn't be computed, e.g. because
|
|
43
|
+
// not all entry points were available.
|
|
44
|
+
template <class CornerTableT, typename DataTypeT>
|
|
45
|
+
inline bool ComputeParallelogramPrediction(
|
|
46
|
+
int data_entry_id, const CornerIndex ci, const CornerTableT *table,
|
|
47
|
+
const std::vector<int32_t> &vertex_to_data_map, const DataTypeT *in_data,
|
|
48
|
+
int num_components, DataTypeT *out_prediction) {
|
|
49
|
+
const CornerIndex oci = table->Opposite(ci);
|
|
50
|
+
if (oci == kInvalidCornerIndex) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
int vert_opp, vert_next, vert_prev;
|
|
54
|
+
GetParallelogramEntries<CornerTableT>(oci, table, vertex_to_data_map,
|
|
55
|
+
&vert_opp, &vert_next, &vert_prev);
|
|
56
|
+
if (vert_opp < data_entry_id && vert_next < data_entry_id &&
|
|
57
|
+
vert_prev < data_entry_id) {
|
|
58
|
+
// Apply the parallelogram prediction.
|
|
59
|
+
const int v_opp_off = vert_opp * num_components;
|
|
60
|
+
const int v_next_off = vert_next * num_components;
|
|
61
|
+
const int v_prev_off = vert_prev * num_components;
|
|
62
|
+
for (int c = 0; c < num_components; ++c) {
|
|
63
|
+
const int64_t in_data_next_off = in_data[v_next_off + c];
|
|
64
|
+
const int64_t in_data_prev_off = in_data[v_prev_off + c];
|
|
65
|
+
const int64_t in_data_opp_off = in_data[v_opp_off + c];
|
|
66
|
+
const int64_t result =
|
|
67
|
+
(in_data_next_off + in_data_prev_off) - in_data_opp_off;
|
|
68
|
+
|
|
69
|
+
out_prediction[c] = static_cast<DataTypeT>(result);
|
|
70
|
+
}
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
return false; // Not all data is available for prediction
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
} // namespace draco
|
|
77
|
+
|
|
78
|
+
#endif // DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_MESH_PREDICTION_SCHEME_PARALLELOGRAM_SHARED_H_
|