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.
Files changed (214) hide show
  1. bin/draco_decoder.exe +0 -0
  2. bin/draco_encoder.exe +0 -0
  3. dracox/__init__.py +252 -0
  4. dracox/dracox_ext.cp39-win_amd64.pyd +0 -0
  5. dracox-0.0.1.dist-info/METADATA +14 -0
  6. dracox-0.0.1.dist-info/RECORD +214 -0
  7. dracox-0.0.1.dist-info/WHEEL +5 -0
  8. include/draco/animation/keyframe_animation.h +107 -0
  9. include/draco/animation/keyframe_animation_decoder.h +34 -0
  10. include/draco/animation/keyframe_animation_encoder.h +39 -0
  11. include/draco/attributes/attribute_octahedron_transform.h +81 -0
  12. include/draco/attributes/attribute_quantization_transform.h +102 -0
  13. include/draco/attributes/attribute_transform.h +76 -0
  14. include/draco/attributes/attribute_transform_data.h +71 -0
  15. include/draco/attributes/attribute_transform_type.h +30 -0
  16. include/draco/attributes/geometry_attribute.h +541 -0
  17. include/draco/attributes/geometry_indices.h +54 -0
  18. include/draco/attributes/point_attribute.h +196 -0
  19. include/draco/compression/attributes/attributes_decoder.h +97 -0
  20. include/draco/compression/attributes/attributes_decoder_interface.h +62 -0
  21. include/draco/compression/attributes/attributes_encoder.h +154 -0
  22. include/draco/compression/attributes/kd_tree_attributes_decoder.h +50 -0
  23. include/draco/compression/attributes/kd_tree_attributes_encoder.h +51 -0
  24. include/draco/compression/attributes/kd_tree_attributes_shared.h +28 -0
  25. include/draco/compression/attributes/linear_sequencer.h +51 -0
  26. include/draco/compression/attributes/mesh_attribute_indices_encoding_data.h +58 -0
  27. include/draco/compression/attributes/normal_compression_utils.h +372 -0
  28. include/draco/compression/attributes/point_d_vector.h +288 -0
  29. include/draco/compression/attributes/points_sequencer.h +63 -0
  30. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_constrained_multi_parallelogram_decoder.h +236 -0
  31. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_constrained_multi_parallelogram_encoder.h +413 -0
  32. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_constrained_multi_parallelogram_shared.h +34 -0
  33. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_data.h +72 -0
  34. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_decoder.h +46 -0
  35. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_encoder.h +46 -0
  36. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_decoder.h +176 -0
  37. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_encoder.h +180 -0
  38. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_predictor_area.h +117 -0
  39. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_predictor_base.h +96 -0
  40. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_multi_parallelogram_decoder.h +128 -0
  41. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_multi_parallelogram_encoder.h +133 -0
  42. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_parallelogram_encoder.h +111 -0
  43. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_parallelogram_shared.h +78 -0
  44. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_decoder.h +372 -0
  45. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_encoder.h +318 -0
  46. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_portable_decoder.h +143 -0
  47. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_portable_encoder.h +136 -0
  48. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_portable_predictor.h +282 -0
  49. include/draco/compression/attributes/prediction_schemes/prediction_scheme_decoder.h +90 -0
  50. include/draco/compression/attributes/prediction_schemes/prediction_scheme_decoder_factory.h +194 -0
  51. include/draco/compression/attributes/prediction_schemes/prediction_scheme_decoder_interface.h +53 -0
  52. include/draco/compression/attributes/prediction_schemes/prediction_scheme_decoding_transform.h +65 -0
  53. include/draco/compression/attributes/prediction_schemes/prediction_scheme_delta_decoder.h +65 -0
  54. include/draco/compression/attributes/prediction_schemes/prediction_scheme_delta_encoder.h +69 -0
  55. include/draco/compression/attributes/prediction_schemes/prediction_scheme_encoder.h +90 -0
  56. include/draco/compression/attributes/prediction_schemes/prediction_scheme_encoder_factory.h +134 -0
  57. include/draco/compression/attributes/prediction_schemes/prediction_scheme_encoder_interface.h +55 -0
  58. include/draco/compression/attributes/prediction_schemes/prediction_scheme_encoding_transform.h +77 -0
  59. include/draco/compression/attributes/prediction_schemes/prediction_scheme_factory.h +85 -0
  60. include/draco/compression/attributes/prediction_schemes/prediction_scheme_interface.h +60 -0
  61. include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_canonicalized_decoding_transform.h +118 -0
  62. include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_canonicalized_encoding_transform.h +116 -0
  63. include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_canonicalized_transform_base.h +102 -0
  64. include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_decoding_transform.h +115 -0
  65. include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_encoding_transform.h +105 -0
  66. include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_transform_base.h +90 -0
  67. include/draco/compression/attributes/prediction_schemes/prediction_scheme_wrap_decoding_transform.h +88 -0
  68. include/draco/compression/attributes/prediction_schemes/prediction_scheme_wrap_encoding_transform.h +81 -0
  69. include/draco/compression/attributes/prediction_schemes/prediction_scheme_wrap_transform_base.h +120 -0
  70. include/draco/compression/attributes/sequential_attribute_decoder.h +86 -0
  71. include/draco/compression/attributes/sequential_attribute_decoders_controller.h +61 -0
  72. include/draco/compression/attributes/sequential_attribute_encoder.h +134 -0
  73. include/draco/compression/attributes/sequential_attribute_encoders_controller.h +115 -0
  74. include/draco/compression/attributes/sequential_integer_attribute_decoder.h +76 -0
  75. include/draco/compression/attributes/sequential_integer_attribute_encoder.h +67 -0
  76. include/draco/compression/attributes/sequential_normal_attribute_decoder.h +83 -0
  77. include/draco/compression/attributes/sequential_normal_attribute_encoder.h +82 -0
  78. include/draco/compression/attributes/sequential_quantization_attribute_decoder.h +52 -0
  79. include/draco/compression/attributes/sequential_quantization_attribute_encoder.h +52 -0
  80. include/draco/compression/bit_coders/adaptive_rans_bit_coding_shared.h +43 -0
  81. include/draco/compression/bit_coders/adaptive_rans_bit_decoder.h +54 -0
  82. include/draco/compression/bit_coders/adaptive_rans_bit_encoder.h +61 -0
  83. include/draco/compression/bit_coders/direct_bit_decoder.h +89 -0
  84. include/draco/compression/bit_coders/direct_bit_encoder.h +89 -0
  85. include/draco/compression/bit_coders/folded_integer_bit_decoder.h +77 -0
  86. include/draco/compression/bit_coders/folded_integer_bit_encoder.h +82 -0
  87. include/draco/compression/bit_coders/rans_bit_decoder.h +55 -0
  88. include/draco/compression/bit_coders/rans_bit_encoder.h +57 -0
  89. include/draco/compression/bit_coders/symbol_bit_decoder.h +36 -0
  90. include/draco/compression/bit_coders/symbol_bit_encoder.h +36 -0
  91. include/draco/compression/config/compression_shared.h +155 -0
  92. include/draco/compression/config/decoder_options.h +34 -0
  93. include/draco/compression/config/draco_options.h +249 -0
  94. include/draco/compression/config/encoder_options.h +101 -0
  95. include/draco/compression/config/encoding_features.h +39 -0
  96. include/draco/compression/decode.h +80 -0
  97. include/draco/compression/draco_compression_options.h +141 -0
  98. include/draco/compression/encode.h +139 -0
  99. include/draco/compression/encode_base.h +131 -0
  100. include/draco/compression/entropy/ans.h +526 -0
  101. include/draco/compression/entropy/rans_symbol_coding.h +53 -0
  102. include/draco/compression/entropy/rans_symbol_decoder.h +171 -0
  103. include/draco/compression/entropy/rans_symbol_encoder.h +290 -0
  104. include/draco/compression/entropy/shannon_entropy.h +110 -0
  105. include/draco/compression/entropy/symbol_decoding.h +29 -0
  106. include/draco/compression/entropy/symbol_encoding.h +47 -0
  107. include/draco/compression/expert_encode.h +160 -0
  108. include/draco/compression/mesh/mesh_decoder.h +68 -0
  109. include/draco/compression/mesh/mesh_edgebreaker_decoder.h +54 -0
  110. include/draco/compression/mesh/mesh_edgebreaker_decoder_impl.h +228 -0
  111. include/draco/compression/mesh/mesh_edgebreaker_decoder_impl_interface.h +47 -0
  112. include/draco/compression/mesh/mesh_edgebreaker_encoder.h +73 -0
  113. include/draco/compression/mesh/mesh_edgebreaker_encoder_impl.h +209 -0
  114. include/draco/compression/mesh/mesh_edgebreaker_encoder_impl_interface.h +57 -0
  115. include/draco/compression/mesh/mesh_edgebreaker_shared.h +129 -0
  116. include/draco/compression/mesh/mesh_edgebreaker_traversal_decoder.h +201 -0
  117. include/draco/compression/mesh/mesh_edgebreaker_traversal_encoder.h +139 -0
  118. include/draco/compression/mesh/mesh_edgebreaker_traversal_predictive_decoder.h +134 -0
  119. include/draco/compression/mesh/mesh_edgebreaker_traversal_predictive_encoder.h +172 -0
  120. include/draco/compression/mesh/mesh_edgebreaker_traversal_valence_decoder.h +219 -0
  121. include/draco/compression/mesh/mesh_edgebreaker_traversal_valence_encoder.h +226 -0
  122. include/draco/compression/mesh/mesh_encoder.h +84 -0
  123. include/draco/compression/mesh/mesh_sequential_decoder.h +39 -0
  124. include/draco/compression/mesh/mesh_sequential_encoder.h +56 -0
  125. include/draco/compression/mesh/traverser/depth_first_traverser.h +172 -0
  126. include/draco/compression/mesh/traverser/max_prediction_degree_traverser.h +226 -0
  127. include/draco/compression/mesh/traverser/mesh_attribute_indices_encoding_observer.h +76 -0
  128. include/draco/compression/mesh/traverser/mesh_traversal_sequencer.h +113 -0
  129. include/draco/compression/mesh/traverser/traverser_base.h +87 -0
  130. include/draco/compression/point_cloud/algorithms/dynamic_integer_points_kd_tree_decoder.h +369 -0
  131. include/draco/compression/point_cloud/algorithms/dynamic_integer_points_kd_tree_encoder.h +372 -0
  132. include/draco/compression/point_cloud/algorithms/float_points_tree_decoder.h +141 -0
  133. include/draco/compression/point_cloud/algorithms/float_points_tree_encoder.h +126 -0
  134. include/draco/compression/point_cloud/algorithms/point_cloud_compression_method.h +34 -0
  135. include/draco/compression/point_cloud/algorithms/point_cloud_types.h +76 -0
  136. include/draco/compression/point_cloud/algorithms/quantize_points_3.h +84 -0
  137. include/draco/compression/point_cloud/algorithms/queuing_policy.h +75 -0
  138. include/draco/compression/point_cloud/point_cloud_decoder.h +118 -0
  139. include/draco/compression/point_cloud/point_cloud_encoder.h +158 -0
  140. include/draco/compression/point_cloud/point_cloud_kd_tree_decoder.h +31 -0
  141. include/draco/compression/point_cloud/point_cloud_kd_tree_encoder.h +45 -0
  142. include/draco/compression/point_cloud/point_cloud_sequential_decoder.h +33 -0
  143. include/draco/compression/point_cloud/point_cloud_sequential_encoder.h +43 -0
  144. include/draco/core/bit_utils.h +127 -0
  145. include/draco/core/bounding_box.h +77 -0
  146. include/draco/core/constants.h +6 -0
  147. include/draco/core/cycle_timer.h +51 -0
  148. include/draco/core/data_buffer.h +82 -0
  149. include/draco/core/decoder_buffer.h +216 -0
  150. include/draco/core/divide.h +42 -0
  151. include/draco/core/draco_index_type.h +184 -0
  152. include/draco/core/draco_index_type_vector.h +90 -0
  153. include/draco/core/draco_types.h +52 -0
  154. include/draco/core/draco_version.h +25 -0
  155. include/draco/core/encoder_buffer.h +152 -0
  156. include/draco/core/hash_utils.h +64 -0
  157. include/draco/core/macros.h +124 -0
  158. include/draco/core/math_utils.h +79 -0
  159. include/draco/core/options.h +151 -0
  160. include/draco/core/quantization_utils.h +82 -0
  161. include/draco/core/status.h +83 -0
  162. include/draco/core/status_or.h +81 -0
  163. include/draco/core/varint_decoding.h +81 -0
  164. include/draco/core/varint_encoding.h +61 -0
  165. include/draco/core/vector_d.h +355 -0
  166. include/draco/draco_features.h +25 -0
  167. include/draco/io/file_reader_factory.h +34 -0
  168. include/draco/io/file_reader_interface.h +32 -0
  169. include/draco/io/file_utils.h +86 -0
  170. include/draco/io/file_writer_factory.h +34 -0
  171. include/draco/io/file_writer_interface.h +26 -0
  172. include/draco/io/file_writer_utils.h +38 -0
  173. include/draco/io/mesh_io.h +107 -0
  174. include/draco/io/obj_decoder.h +147 -0
  175. include/draco/io/obj_encoder.h +107 -0
  176. include/draco/io/parser_utils.h +66 -0
  177. include/draco/io/ply_decoder.h +69 -0
  178. include/draco/io/ply_encoder.h +54 -0
  179. include/draco/io/ply_property_reader.h +96 -0
  180. include/draco/io/ply_property_writer.h +94 -0
  181. include/draco/io/ply_reader.h +155 -0
  182. include/draco/io/point_cloud_io.h +89 -0
  183. include/draco/io/stdio_file_reader.h +48 -0
  184. include/draco/io/stdio_file_writer.h +42 -0
  185. include/draco/io/stl_decoder.h +38 -0
  186. include/draco/io/stl_encoder.h +52 -0
  187. include/draco/mesh/corner_table.h +397 -0
  188. include/draco/mesh/corner_table_iterators.h +309 -0
  189. include/draco/mesh/mesh.h +378 -0
  190. include/draco/mesh/mesh_are_equivalent.h +71 -0
  191. include/draco/mesh/mesh_attribute_corner_table.h +202 -0
  192. include/draco/mesh/mesh_cleanup.h +61 -0
  193. include/draco/mesh/mesh_features.h +93 -0
  194. include/draco/mesh/mesh_indices.h +37 -0
  195. include/draco/mesh/mesh_misc_functions.h +105 -0
  196. include/draco/mesh/mesh_stripifier.h +258 -0
  197. include/draco/mesh/triangle_soup_mesh_builder.h +134 -0
  198. include/draco/mesh/valence_cache.h +142 -0
  199. include/draco/metadata/geometry_metadata.h +142 -0
  200. include/draco/metadata/metadata.h +209 -0
  201. include/draco/metadata/metadata_decoder.h +42 -0
  202. include/draco/metadata/metadata_encoder.h +41 -0
  203. include/draco/metadata/property_attribute.h +107 -0
  204. include/draco/metadata/property_table.h +222 -0
  205. include/draco/metadata/structural_metadata.h +78 -0
  206. include/draco/metadata/structural_metadata_schema.h +118 -0
  207. include/draco/point_cloud/point_cloud.h +289 -0
  208. include/draco/point_cloud/point_cloud_builder.h +101 -0
  209. lib/draco.lib +0 -0
  210. lib/pkgconfig/draco.pc +6 -0
  211. share/cmake/draco/draco-config-version.cmake +43 -0
  212. share/cmake/draco/draco-config.cmake +27 -0
  213. share/cmake/draco/draco-targets-release.cmake +19 -0
  214. share/cmake/draco/draco-targets.cmake +107 -0
@@ -0,0 +1,194 @@
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
+ // Functions for creating prediction schemes for decoders using the provided
16
+ // prediction method id.
17
+
18
+ #ifndef DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_DECODER_FACTORY_H_
19
+ #define DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_DECODER_FACTORY_H_
20
+
21
+ #include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_constrained_multi_parallelogram_decoder.h"
22
+ #include "draco/draco_features.h"
23
+ #ifdef DRACO_NORMAL_ENCODING_SUPPORTED
24
+ #include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_decoder.h"
25
+ #endif
26
+ #include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_multi_parallelogram_decoder.h"
27
+ #include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_parallelogram_decoder.h"
28
+ #include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_decoder.h"
29
+ #include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_portable_decoder.h"
30
+ #include "draco/compression/attributes/prediction_schemes/prediction_scheme_decoder.h"
31
+ #include "draco/compression/attributes/prediction_schemes/prediction_scheme_delta_decoder.h"
32
+ #include "draco/compression/attributes/prediction_schemes/prediction_scheme_factory.h"
33
+ #include "draco/compression/mesh/mesh_decoder.h"
34
+
35
+ namespace draco {
36
+
37
+ // Factory class for creating mesh prediction schemes. The factory implements
38
+ // operator() that is used to create an appropriate mesh prediction scheme in
39
+ // CreateMeshPredictionScheme() function in prediction_scheme_factory.h
40
+ template <typename DataTypeT>
41
+ struct MeshPredictionSchemeDecoderFactory {
42
+ // Operator () specialized for the wrap transform. Wrap transform can be used
43
+ // for all mesh prediction schemes. The specialization is done in compile time
44
+ // to prevent instantiations of unneeded combinations of prediction schemes +
45
+ // prediction transforms.
46
+ template <class TransformT, class MeshDataT,
47
+ PredictionSchemeTransformType Method>
48
+ struct DispatchFunctor {
49
+ std::unique_ptr<PredictionSchemeDecoder<DataTypeT, TransformT>> operator()(
50
+ PredictionSchemeMethod method, const PointAttribute *attribute,
51
+ const TransformT &transform, const MeshDataT &mesh_data,
52
+ uint16_t bitstream_version) {
53
+ if (method == MESH_PREDICTION_PARALLELOGRAM) {
54
+ return std::unique_ptr<PredictionSchemeDecoder<DataTypeT, TransformT>>(
55
+ new MeshPredictionSchemeParallelogramDecoder<DataTypeT, TransformT,
56
+ MeshDataT>(
57
+ attribute, transform, mesh_data));
58
+ }
59
+ #ifdef DRACO_BACKWARDS_COMPATIBILITY_SUPPORTED
60
+ else if (method == MESH_PREDICTION_MULTI_PARALLELOGRAM) {
61
+ return std::unique_ptr<PredictionSchemeDecoder<DataTypeT, TransformT>>(
62
+ new MeshPredictionSchemeMultiParallelogramDecoder<
63
+ DataTypeT, TransformT, MeshDataT>(attribute, transform,
64
+ mesh_data));
65
+ }
66
+ #endif
67
+ else if (method == MESH_PREDICTION_CONSTRAINED_MULTI_PARALLELOGRAM) {
68
+ return std::unique_ptr<PredictionSchemeDecoder<DataTypeT, TransformT>>(
69
+ new MeshPredictionSchemeConstrainedMultiParallelogramDecoder<
70
+ DataTypeT, TransformT, MeshDataT>(attribute, transform,
71
+ mesh_data));
72
+ }
73
+ #ifdef DRACO_BACKWARDS_COMPATIBILITY_SUPPORTED
74
+ else if (method == MESH_PREDICTION_TEX_COORDS_DEPRECATED) {
75
+ return std::unique_ptr<PredictionSchemeDecoder<DataTypeT, TransformT>>(
76
+ new MeshPredictionSchemeTexCoordsDecoder<DataTypeT, TransformT,
77
+ MeshDataT>(
78
+ attribute, transform, mesh_data, bitstream_version));
79
+ }
80
+ #endif
81
+ else if (method == MESH_PREDICTION_TEX_COORDS_PORTABLE) {
82
+ return std::unique_ptr<PredictionSchemeDecoder<DataTypeT, TransformT>>(
83
+ new MeshPredictionSchemeTexCoordsPortableDecoder<
84
+ DataTypeT, TransformT, MeshDataT>(attribute, transform,
85
+ mesh_data));
86
+ }
87
+ #ifdef DRACO_NORMAL_ENCODING_SUPPORTED
88
+ else if (method == MESH_PREDICTION_GEOMETRIC_NORMAL) {
89
+ return std::unique_ptr<PredictionSchemeDecoder<DataTypeT, TransformT>>(
90
+ new MeshPredictionSchemeGeometricNormalDecoder<
91
+ DataTypeT, TransformT, MeshDataT>(attribute, transform,
92
+ mesh_data));
93
+ }
94
+ #endif
95
+ return nullptr;
96
+ }
97
+ };
98
+
99
+ #ifdef DRACO_NORMAL_ENCODING_SUPPORTED
100
+ // Operator () specialized for normal octahedron transforms. These transforms
101
+ // are currently used only by the geometric normal prediction scheme (the
102
+ // transform is also used by delta coding, but delta predictor is not
103
+ // constructed in this function).
104
+ template <class TransformT, class MeshDataT>
105
+ struct DispatchFunctor<TransformT, MeshDataT,
106
+ PREDICTION_TRANSFORM_NORMAL_OCTAHEDRON_CANONICALIZED> {
107
+ std::unique_ptr<PredictionSchemeDecoder<DataTypeT, TransformT>> operator()(
108
+ PredictionSchemeMethod method, const PointAttribute *attribute,
109
+ const TransformT &transform, const MeshDataT &mesh_data,
110
+ uint16_t bitstream_version) {
111
+ if (method == MESH_PREDICTION_GEOMETRIC_NORMAL) {
112
+ return std::unique_ptr<PredictionSchemeDecoder<DataTypeT, TransformT>>(
113
+ new MeshPredictionSchemeGeometricNormalDecoder<
114
+ DataTypeT, TransformT, MeshDataT>(attribute, transform,
115
+ mesh_data));
116
+ }
117
+ return nullptr;
118
+ }
119
+ };
120
+ template <class TransformT, class MeshDataT>
121
+ struct DispatchFunctor<TransformT, MeshDataT,
122
+ PREDICTION_TRANSFORM_NORMAL_OCTAHEDRON> {
123
+ std::unique_ptr<PredictionSchemeDecoder<DataTypeT, TransformT>> operator()(
124
+ PredictionSchemeMethod method, const PointAttribute *attribute,
125
+ const TransformT &transform, const MeshDataT &mesh_data,
126
+ uint16_t bitstream_version) {
127
+ if (method == MESH_PREDICTION_GEOMETRIC_NORMAL) {
128
+ return std::unique_ptr<PredictionSchemeDecoder<DataTypeT, TransformT>>(
129
+ new MeshPredictionSchemeGeometricNormalDecoder<
130
+ DataTypeT, TransformT, MeshDataT>(attribute, transform,
131
+ mesh_data));
132
+ }
133
+ return nullptr;
134
+ }
135
+ };
136
+ #endif
137
+
138
+ template <class TransformT, class MeshDataT>
139
+ std::unique_ptr<PredictionSchemeDecoder<DataTypeT, TransformT>> operator()(
140
+ PredictionSchemeMethod method, const PointAttribute *attribute,
141
+ const TransformT &transform, const MeshDataT &mesh_data,
142
+ uint16_t bitstream_version) {
143
+ return DispatchFunctor<TransformT, MeshDataT, TransformT::GetType()>()(
144
+ method, attribute, transform, mesh_data, bitstream_version);
145
+ }
146
+ };
147
+
148
+ // Creates a prediction scheme for a given decoder and given prediction method.
149
+ // The prediction schemes are automatically initialized with decoder specific
150
+ // data if needed.
151
+ template <typename DataTypeT, class TransformT>
152
+ std::unique_ptr<PredictionSchemeDecoder<DataTypeT, TransformT>>
153
+ CreatePredictionSchemeForDecoder(PredictionSchemeMethod method, int att_id,
154
+ const PointCloudDecoder *decoder,
155
+ const TransformT &transform) {
156
+ if (method == PREDICTION_NONE) {
157
+ return nullptr;
158
+ }
159
+ const PointAttribute *const att = decoder->point_cloud()->attribute(att_id);
160
+ if (decoder->GetGeometryType() == TRIANGULAR_MESH) {
161
+ // Cast the decoder to mesh decoder. This is not necessarily safe if there
162
+ // is some other decoder decides to use TRIANGULAR_MESH as the return type,
163
+ // but unfortunately there is not nice work around for this without using
164
+ // RTTI (double dispatch and similar concepts will not work because of the
165
+ // template nature of the prediction schemes).
166
+ const MeshDecoder *const mesh_decoder =
167
+ static_cast<const MeshDecoder *>(decoder);
168
+
169
+ auto ret = CreateMeshPredictionScheme<
170
+ MeshDecoder, PredictionSchemeDecoder<DataTypeT, TransformT>,
171
+ MeshPredictionSchemeDecoderFactory<DataTypeT>>(
172
+ mesh_decoder, method, att_id, transform, decoder->bitstream_version());
173
+ if (ret) {
174
+ return ret;
175
+ }
176
+ // Otherwise try to create another prediction scheme.
177
+ }
178
+ // Create delta decoder.
179
+ return std::unique_ptr<PredictionSchemeDecoder<DataTypeT, TransformT>>(
180
+ new PredictionSchemeDeltaDecoder<DataTypeT, TransformT>(att, transform));
181
+ }
182
+
183
+ // Create a prediction scheme using a default transform constructor.
184
+ template <typename DataTypeT, class TransformT>
185
+ std::unique_ptr<PredictionSchemeDecoder<DataTypeT, TransformT>>
186
+ CreatePredictionSchemeForDecoder(PredictionSchemeMethod method, int att_id,
187
+ const PointCloudDecoder *decoder) {
188
+ return CreatePredictionSchemeForDecoder<DataTypeT, TransformT>(
189
+ method, att_id, decoder, TransformT());
190
+ }
191
+
192
+ } // namespace draco
193
+
194
+ #endif // DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_DECODER_FACTORY_H_
@@ -0,0 +1,53 @@
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_PREDICTION_SCHEME_DECODER_INTERFACE_H_
16
+ #define DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_DECODER_INTERFACE_H_
17
+
18
+ #include "draco/compression/attributes/prediction_schemes/prediction_scheme_interface.h"
19
+ #include "draco/core/decoder_buffer.h"
20
+
21
+ // Prediction schemes can be used during encoding and decoding of attributes
22
+ // to predict attribute values based on the previously encoded/decoded data.
23
+ // See prediction_scheme.h for more details.
24
+ namespace draco {
25
+
26
+ // Abstract interface for all prediction schemes used during attribute encoding.
27
+ class PredictionSchemeDecoderInterface : public PredictionSchemeInterface {
28
+ public:
29
+ // Method that can be used to decode any prediction scheme specific data
30
+ // from the input buffer.
31
+ virtual bool DecodePredictionData(DecoderBuffer *buffer) = 0;
32
+ };
33
+
34
+ // A specialized version of the prediction scheme interface for specific
35
+ // input and output data types.
36
+ // |entry_to_point_id_map| is the mapping between value entries to point ids
37
+ // of the associated point cloud, where one entry is defined as |num_components|
38
+ // values of the |in_data|.
39
+ // DataTypeT is the data type of input and predicted values.
40
+ // CorrTypeT is the data type used for storing corrected values.
41
+ template <typename DataTypeT, typename CorrTypeT = DataTypeT>
42
+ class PredictionSchemeTypedDecoderInterface
43
+ : public PredictionSchemeDecoderInterface {
44
+ public:
45
+ // Reverts changes made by the prediction scheme during encoding.
46
+ virtual bool ComputeOriginalValues(
47
+ const CorrTypeT *in_corr, DataTypeT *out_data, int size,
48
+ int num_components, const PointIndex *entry_to_point_id_map) = 0;
49
+ };
50
+
51
+ } // namespace draco
52
+
53
+ #endif // DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_DECODER_INTERFACE_H_
@@ -0,0 +1,65 @@
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_PREDICTION_SCHEME_DECODING_TRANSFORM_H_
16
+ #define DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_DECODING_TRANSFORM_H_
17
+
18
+ #include "draco/compression/config/compression_shared.h"
19
+ #include "draco/core/decoder_buffer.h"
20
+
21
+ namespace draco {
22
+
23
+ // PredictionSchemeDecodingTransform is used to transform predicted values and
24
+ // correction values into the final original attribute values.
25
+ // DataTypeT is the data type of predicted values.
26
+ // CorrTypeT is the data type used for storing corrected values. It allows
27
+ // transforms to store corrections into a different type or format compared to
28
+ // the predicted data.
29
+ template <typename DataTypeT, typename CorrTypeT>
30
+ class PredictionSchemeDecodingTransform {
31
+ public:
32
+ typedef CorrTypeT CorrType;
33
+ PredictionSchemeDecodingTransform() : num_components_(0) {}
34
+
35
+ void Init(int num_components) { num_components_ = num_components; }
36
+
37
+ // Computes the original value from the input predicted value and the decoded
38
+ // corrections. The default implementation is equal to std:plus.
39
+ inline void ComputeOriginalValue(const DataTypeT *predicted_vals,
40
+ const CorrTypeT *corr_vals,
41
+ DataTypeT *out_original_vals) const {
42
+ static_assert(std::is_same<DataTypeT, CorrTypeT>::value,
43
+ "For the default prediction transform, correction and input "
44
+ "data must be of the same type.");
45
+ for (int i = 0; i < num_components_; ++i) {
46
+ out_original_vals[i] = predicted_vals[i] + corr_vals[i];
47
+ }
48
+ }
49
+
50
+ // Decodes any transform specific data. Called before Init() method.
51
+ bool DecodeTransformData(DecoderBuffer * /* buffer */) { return true; }
52
+
53
+ // Should return true if all corrected values are guaranteed to be positive.
54
+ bool AreCorrectionsPositive() const { return false; }
55
+
56
+ protected:
57
+ int num_components() const { return num_components_; }
58
+
59
+ private:
60
+ int num_components_;
61
+ };
62
+
63
+ } // namespace draco
64
+
65
+ #endif // DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_DECODING_TRANSFORM_H_
@@ -0,0 +1,65 @@
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_PREDICTION_SCHEME_DELTA_DECODER_H_
16
+ #define DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_DELTA_DECODER_H_
17
+
18
+ #include "draco/compression/attributes/prediction_schemes/prediction_scheme_decoder.h"
19
+
20
+ namespace draco {
21
+
22
+ // Decoder for values encoded with delta coding. See the corresponding encoder
23
+ // for more details.
24
+ template <typename DataTypeT, class TransformT>
25
+ class PredictionSchemeDeltaDecoder
26
+ : public PredictionSchemeDecoder<DataTypeT, TransformT> {
27
+ public:
28
+ using CorrType =
29
+ typename PredictionSchemeDecoder<DataTypeT, TransformT>::CorrType;
30
+ // Initialized the prediction scheme.
31
+ explicit PredictionSchemeDeltaDecoder(const PointAttribute *attribute)
32
+ : PredictionSchemeDecoder<DataTypeT, TransformT>(attribute) {}
33
+ PredictionSchemeDeltaDecoder(const PointAttribute *attribute,
34
+ const TransformT &transform)
35
+ : PredictionSchemeDecoder<DataTypeT, TransformT>(attribute, transform) {}
36
+
37
+ bool ComputeOriginalValues(const CorrType *in_corr, DataTypeT *out_data,
38
+ int size, int num_components,
39
+ const PointIndex *entry_to_point_id_map) override;
40
+ PredictionSchemeMethod GetPredictionMethod() const override {
41
+ return PREDICTION_DIFFERENCE;
42
+ }
43
+ bool IsInitialized() const override { return true; }
44
+ };
45
+
46
+ template <typename DataTypeT, class TransformT>
47
+ bool PredictionSchemeDeltaDecoder<DataTypeT, TransformT>::ComputeOriginalValues(
48
+ const CorrType *in_corr, DataTypeT *out_data, int size, int num_components,
49
+ const PointIndex *) {
50
+ this->transform().Init(num_components);
51
+ // Decode the original value for the first element.
52
+ std::unique_ptr<DataTypeT[]> zero_vals(new DataTypeT[num_components]());
53
+ this->transform().ComputeOriginalValue(zero_vals.get(), in_corr, out_data);
54
+
55
+ // Decode data from the front using D(i) = D(i) + D(i - 1).
56
+ for (int i = num_components; i < size; i += num_components) {
57
+ this->transform().ComputeOriginalValue(out_data + i - num_components,
58
+ in_corr + i, out_data + i);
59
+ }
60
+ return true;
61
+ }
62
+
63
+ } // namespace draco
64
+
65
+ #endif // DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_DELTA_DECODER_H_
@@ -0,0 +1,69 @@
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_PREDICTION_SCHEME_DELTA_ENCODER_H_
16
+ #define DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_DELTA_ENCODER_H_
17
+
18
+ #include "draco/compression/attributes/prediction_schemes/prediction_scheme_encoder.h"
19
+
20
+ namespace draco {
21
+
22
+ // Basic prediction scheme based on computing backward differences between
23
+ // stored attribute values (also known as delta-coding). Usually works better
24
+ // than the reference point prediction scheme, because nearby values are often
25
+ // encoded next to each other.
26
+ template <typename DataTypeT, class TransformT>
27
+ class PredictionSchemeDeltaEncoder
28
+ : public PredictionSchemeEncoder<DataTypeT, TransformT> {
29
+ public:
30
+ using CorrType =
31
+ typename PredictionSchemeEncoder<DataTypeT, TransformT>::CorrType;
32
+ // Initialized the prediction scheme.
33
+ explicit PredictionSchemeDeltaEncoder(const PointAttribute *attribute)
34
+ : PredictionSchemeEncoder<DataTypeT, TransformT>(attribute) {}
35
+ PredictionSchemeDeltaEncoder(const PointAttribute *attribute,
36
+ const TransformT &transform)
37
+ : PredictionSchemeEncoder<DataTypeT, TransformT>(attribute, transform) {}
38
+
39
+ bool ComputeCorrectionValues(
40
+ const DataTypeT *in_data, CorrType *out_corr, int size,
41
+ int num_components, const PointIndex *entry_to_point_id_map) override;
42
+ PredictionSchemeMethod GetPredictionMethod() const override {
43
+ return PREDICTION_DIFFERENCE;
44
+ }
45
+ bool IsInitialized() const override { return true; }
46
+ };
47
+
48
+ template <typename DataTypeT, class TransformT>
49
+ bool PredictionSchemeDeltaEncoder<
50
+ DataTypeT, TransformT>::ComputeCorrectionValues(const DataTypeT *in_data,
51
+ CorrType *out_corr,
52
+ int size,
53
+ int num_components,
54
+ const PointIndex *) {
55
+ this->transform().Init(in_data, size, num_components);
56
+ // Encode data from the back using D(i) = D(i) - D(i - 1).
57
+ for (int i = size - num_components; i > 0; i -= num_components) {
58
+ this->transform().ComputeCorrection(
59
+ in_data + i, in_data + i - num_components, out_corr + i);
60
+ }
61
+ // Encode correction for the first element.
62
+ std::unique_ptr<DataTypeT[]> zero_vals(new DataTypeT[num_components]());
63
+ this->transform().ComputeCorrection(in_data, zero_vals.get(), out_corr);
64
+ return true;
65
+ }
66
+
67
+ } // namespace draco
68
+
69
+ #endif // DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_DELTA_ENCODER_H_
@@ -0,0 +1,90 @@
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_PREDICTION_SCHEME_ENCODER_H_
16
+ #define DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_ENCODER_H_
17
+
18
+ #include <type_traits>
19
+
20
+ #include "draco/compression/attributes/prediction_schemes/prediction_scheme_encoder_interface.h"
21
+ #include "draco/compression/attributes/prediction_schemes/prediction_scheme_encoding_transform.h"
22
+
23
+ // Prediction schemes can be used during encoding and decoding of vertex
24
+ // attributes to predict attribute values based on the previously
25
+ // encoded/decoded data. The differences between the original and predicted
26
+ // attribute values are used to compute correction values that can be usually
27
+ // encoded with fewer bits compared to the original data.
28
+ namespace draco {
29
+
30
+ // Abstract base class for typed prediction schemes. It provides basic access
31
+ // to the encoded attribute and to the supplied prediction transform.
32
+ template <typename DataTypeT,
33
+ class TransformT =
34
+ PredictionSchemeEncodingTransform<DataTypeT, DataTypeT>>
35
+ class PredictionSchemeEncoder : public PredictionSchemeTypedEncoderInterface<
36
+ DataTypeT, typename TransformT::CorrType> {
37
+ public:
38
+ typedef DataTypeT DataType;
39
+ typedef TransformT Transform;
40
+ // Correction type needs to be defined in the prediction transform class.
41
+ typedef typename Transform::CorrType CorrType;
42
+ explicit PredictionSchemeEncoder(const PointAttribute *attribute)
43
+ : PredictionSchemeEncoder(attribute, Transform()) {}
44
+ PredictionSchemeEncoder(const PointAttribute *attribute,
45
+ const Transform &transform)
46
+ : attribute_(attribute), transform_(transform) {}
47
+
48
+ bool EncodePredictionData(EncoderBuffer *buffer) override {
49
+ if (!transform_.EncodeTransformData(buffer)) {
50
+ return false;
51
+ }
52
+ return true;
53
+ }
54
+
55
+ const PointAttribute *GetAttribute() const override { return attribute(); }
56
+
57
+ // Returns the number of parent attributes that are needed for the prediction.
58
+ int GetNumParentAttributes() const override { return 0; }
59
+
60
+ // Returns the type of each of the parent attribute.
61
+ GeometryAttribute::Type GetParentAttributeType(int /* i */) const override {
62
+ return GeometryAttribute::INVALID;
63
+ }
64
+
65
+ // Sets the required parent attribute.
66
+ bool SetParentAttribute(const PointAttribute * /* att */) override {
67
+ return false;
68
+ }
69
+
70
+ bool AreCorrectionsPositive() override {
71
+ return transform_.AreCorrectionsPositive();
72
+ }
73
+
74
+ PredictionSchemeTransformType GetTransformType() const override {
75
+ return transform_.GetType();
76
+ }
77
+
78
+ protected:
79
+ inline const PointAttribute *attribute() const { return attribute_; }
80
+ inline const Transform &transform() const { return transform_; }
81
+ inline Transform &transform() { return transform_; }
82
+
83
+ private:
84
+ const PointAttribute *attribute_;
85
+ Transform transform_;
86
+ };
87
+
88
+ } // namespace draco
89
+
90
+ #endif // DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_ENCODER_H_