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,102 @@
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_NORMAL_OCTAHEDRON_CANONICALIZED_TRANSFORM_BASE_H_
16
+ #define DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_NORMAL_OCTAHEDRON_CANONICALIZED_TRANSFORM_BASE_H_
17
+
18
+ #include <cmath>
19
+
20
+ #include "draco/compression/attributes/normal_compression_utils.h"
21
+ #include "draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_transform_base.h"
22
+ #include "draco/compression/config/compression_shared.h"
23
+ #include "draco/core/bit_utils.h"
24
+ #include "draco/core/macros.h"
25
+ #include "draco/core/vector_d.h"
26
+
27
+ namespace draco {
28
+
29
+ // Base class containing shared functionality used by both encoding and decoding
30
+ // canonicalized normal octahedron prediction scheme transforms. See the
31
+ // encoding transform for more details about the method.
32
+ template <typename DataTypeT>
33
+ class PredictionSchemeNormalOctahedronCanonicalizedTransformBase
34
+ : public PredictionSchemeNormalOctahedronTransformBase<DataTypeT> {
35
+ public:
36
+ typedef PredictionSchemeNormalOctahedronTransformBase<DataTypeT> Base;
37
+ typedef VectorD<DataTypeT, 2> Point2;
38
+ typedef DataTypeT DataType;
39
+
40
+ PredictionSchemeNormalOctahedronCanonicalizedTransformBase() : Base() {}
41
+ // We expect the mod value to be of the form 2^b-1.
42
+ explicit PredictionSchemeNormalOctahedronCanonicalizedTransformBase(
43
+ DataType mod_value)
44
+ : Base(mod_value) {}
45
+
46
+ static constexpr PredictionSchemeTransformType GetType() {
47
+ return PREDICTION_TRANSFORM_NORMAL_OCTAHEDRON_CANONICALIZED;
48
+ }
49
+
50
+ int32_t GetRotationCount(Point2 pred) const {
51
+ const DataType sign_x = pred[0];
52
+ const DataType sign_y = pred[1];
53
+
54
+ int32_t rotation_count = 0;
55
+ if (sign_x == 0) {
56
+ if (sign_y == 0) {
57
+ rotation_count = 0;
58
+ } else if (sign_y > 0) {
59
+ rotation_count = 3;
60
+ } else {
61
+ rotation_count = 1;
62
+ }
63
+ } else if (sign_x > 0) {
64
+ if (sign_y >= 0) {
65
+ rotation_count = 2;
66
+ } else {
67
+ rotation_count = 1;
68
+ }
69
+ } else {
70
+ if (sign_y <= 0) {
71
+ rotation_count = 0;
72
+ } else {
73
+ rotation_count = 3;
74
+ }
75
+ }
76
+ return rotation_count;
77
+ }
78
+
79
+ Point2 RotatePoint(Point2 p, int32_t rotation_count) const {
80
+ switch (rotation_count) {
81
+ case 1:
82
+ return Point2(p[1], -p[0]);
83
+ case 2:
84
+ return Point2(-p[0], -p[1]);
85
+ case 3:
86
+ return Point2(-p[1], p[0]);
87
+ default:
88
+ return p;
89
+ }
90
+ }
91
+
92
+ bool IsInBottomLeft(const Point2 &p) const {
93
+ if (p[0] == 0 && p[1] == 0) {
94
+ return true;
95
+ }
96
+ return (p[0] < 0 && p[1] <= 0);
97
+ }
98
+ };
99
+
100
+ } // namespace draco
101
+
102
+ #endif // DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_NORMAL_OCTAHEDRON_CANONICALIZED_TRANSFORM_BASE_H_
@@ -0,0 +1,115 @@
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_PREDICTION_SCHEME_NORMAL_OCTAHEDRON_DECODING_TRANSFORM_H_
17
+ #define DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_NORMAL_OCTAHEDRON_DECODING_TRANSFORM_H_
18
+
19
+ #include <cmath>
20
+
21
+ #include "draco/compression/attributes/normal_compression_utils.h"
22
+ #include "draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_transform_base.h"
23
+ #include "draco/core/decoder_buffer.h"
24
+ #include "draco/core/macros.h"
25
+ #include "draco/core/vector_d.h"
26
+ #include "draco/draco_features.h"
27
+
28
+ namespace draco {
29
+
30
+ // Class for converting correction values transformed by the octahedral normal
31
+ // transform back to the original values. See the corresponding encoder for more
32
+ // details.
33
+ template <typename DataTypeT>
34
+ class PredictionSchemeNormalOctahedronDecodingTransform
35
+ : public PredictionSchemeNormalOctahedronTransformBase<DataTypeT> {
36
+ public:
37
+ typedef VectorD<DataTypeT, 2> Point2;
38
+ typedef DataTypeT CorrType;
39
+ typedef DataTypeT DataType;
40
+
41
+ PredictionSchemeNormalOctahedronDecodingTransform() {}
42
+
43
+ // Dummy function to fulfill concept.
44
+ void Init(int num_components) {}
45
+ bool DecodeTransformData(DecoderBuffer *buffer) {
46
+ DataTypeT max_quantized_value, center_value;
47
+ if (!buffer->Decode(&max_quantized_value)) {
48
+ return false;
49
+ }
50
+ if (buffer->bitstream_version() < DRACO_BITSTREAM_VERSION(2, 2)) {
51
+ if (!buffer->Decode(&center_value)) {
52
+ return false;
53
+ }
54
+ }
55
+ (void)center_value;
56
+ return this->set_max_quantized_value(max_quantized_value);
57
+ }
58
+
59
+ inline void ComputeOriginalValue(const DataType *pred_vals,
60
+ const CorrType *corr_vals,
61
+ DataType *out_orig_vals) const {
62
+ DRACO_DCHECK_LE(pred_vals[0], 2 * this->center_value());
63
+ DRACO_DCHECK_LE(pred_vals[1], 2 * this->center_value());
64
+ DRACO_DCHECK_LE(corr_vals[0], 2 * this->center_value());
65
+ DRACO_DCHECK_LE(corr_vals[1], 2 * this->center_value());
66
+
67
+ DRACO_DCHECK_LE(0, pred_vals[0]);
68
+ DRACO_DCHECK_LE(0, pred_vals[1]);
69
+ DRACO_DCHECK_LE(0, corr_vals[0]);
70
+ DRACO_DCHECK_LE(0, corr_vals[1]);
71
+
72
+ const Point2 pred = Point2(pred_vals[0], pred_vals[1]);
73
+ const Point2 corr = Point2(corr_vals[0], corr_vals[1]);
74
+ const Point2 orig = ComputeOriginalValue(pred, corr);
75
+
76
+ out_orig_vals[0] = orig[0];
77
+ out_orig_vals[1] = orig[1];
78
+ }
79
+
80
+ private:
81
+ Point2 ComputeOriginalValue(Point2 pred, const Point2 &corr) const {
82
+ const Point2 t(this->center_value(), this->center_value());
83
+ typedef typename std::make_unsigned<DataTypeT>::type UnsignedDataTypeT;
84
+ typedef VectorD<UnsignedDataTypeT, 2> Point2u;
85
+
86
+ // Perform the addition in unsigned type to avoid signed integer overflow.
87
+ // Note that the result will be the same (for non-overflowing values).
88
+ pred = Point2(Point2u(pred) - Point2u(t));
89
+
90
+ const bool pred_is_in_diamond = this->IsInDiamond(pred[0], pred[1]);
91
+ if (!pred_is_in_diamond) {
92
+ this->InvertDiamond(&pred[0], &pred[1]);
93
+ }
94
+
95
+ // Perform the addition in unsigned type to avoid signed integer overflow.
96
+ // Note that the result will be the same (for non-overflowing values).
97
+ Point2 orig(Point2u(pred) + Point2u(corr));
98
+
99
+ orig[0] = this->ModMax(orig[0]);
100
+ orig[1] = this->ModMax(orig[1]);
101
+ if (!pred_is_in_diamond) {
102
+ this->InvertDiamond(&orig[0], &orig[1]);
103
+ }
104
+
105
+ // Perform the addition in unsigned type to avoid signed integer overflow.
106
+ // Note that the result will be the same (for non-overflowing values).
107
+ orig = Point2(Point2u(orig) + Point2u(t));
108
+ return orig;
109
+ }
110
+ };
111
+
112
+ } // namespace draco
113
+
114
+ #endif // DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_NORMAL_OCTAHEDRON_DECODING_TRANSFORM_H_
115
+ #endif
@@ -0,0 +1,105 @@
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_NORMAL_OCTAHEDRON_ENCODING_TRANSFORM_H_
16
+ #define DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_NORMAL_OCTAHEDRON_ENCODING_TRANSFORM_H_
17
+
18
+ #include <cmath>
19
+
20
+ #include "draco/compression/attributes/normal_compression_utils.h"
21
+ #include "draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_transform_base.h"
22
+ #include "draco/core/encoder_buffer.h"
23
+ #include "draco/core/macros.h"
24
+ #include "draco/core/vector_d.h"
25
+
26
+ namespace draco {
27
+
28
+ // The transform works on octahedral coordinates for normals. The square is
29
+ // subdivided into four inner triangles (diamond) and four outer triangles. The
30
+ // inner triangles are associated with the upper part of the octahedron and the
31
+ // outer triangles are associated with the lower part.
32
+ // Given a prediction value P and the actual value Q that should be encoded,
33
+ // this transform first checks if P is outside the diamond. If so, the outer
34
+ // triangles are flipped towards the inside and vice versa. The actual
35
+ // correction value is then based on the mapped P and Q values. This tends to
36
+ // result in shorter correction vectors.
37
+ // This is possible since the P value is also known by the decoder, see also
38
+ // ComputeCorrection and ComputeOriginalValue functions.
39
+ // Note that the tile is not periodic, which implies that the outer edges can
40
+ // not be identified, which requires us to use an odd number of values on each
41
+ // axis.
42
+ // DataTypeT is expected to be some integral type.
43
+ //
44
+ template <typename DataTypeT>
45
+ class PredictionSchemeNormalOctahedronEncodingTransform
46
+ : public PredictionSchemeNormalOctahedronTransformBase<DataTypeT> {
47
+ public:
48
+ typedef PredictionSchemeNormalOctahedronTransformBase<DataTypeT> Base;
49
+ typedef VectorD<DataTypeT, 2> Point2;
50
+ typedef DataTypeT CorrType;
51
+ typedef DataTypeT DataType;
52
+
53
+ // We expect the mod value to be of the form 2^b-1.
54
+ explicit PredictionSchemeNormalOctahedronEncodingTransform(
55
+ DataType max_quantized_value)
56
+ : Base(max_quantized_value) {}
57
+
58
+ void Init(const DataTypeT *orig_data, int size, int num_components) {}
59
+
60
+ bool EncodeTransformData(EncoderBuffer *buffer) {
61
+ buffer->Encode(this->max_quantized_value());
62
+ return true;
63
+ }
64
+
65
+ inline void ComputeCorrection(const DataType *orig_vals,
66
+ const DataType *pred_vals,
67
+ CorrType *out_corr_vals) const {
68
+ DRACO_DCHECK_LE(pred_vals[0], this->center_value() * 2);
69
+ DRACO_DCHECK_LE(pred_vals[1], this->center_value() * 2);
70
+ DRACO_DCHECK_LE(orig_vals[0], this->center_value() * 2);
71
+ DRACO_DCHECK_LE(orig_vals[1], this->center_value() * 2);
72
+ DRACO_DCHECK_LE(0, pred_vals[0]);
73
+ DRACO_DCHECK_LE(0, pred_vals[1]);
74
+ DRACO_DCHECK_LE(0, orig_vals[0]);
75
+ DRACO_DCHECK_LE(0, orig_vals[1]);
76
+
77
+ const Point2 orig = Point2(orig_vals[0], orig_vals[1]);
78
+ const Point2 pred = Point2(pred_vals[0], pred_vals[1]);
79
+ const Point2 corr = ComputeCorrection(orig, pred);
80
+
81
+ out_corr_vals[0] = corr[0];
82
+ out_corr_vals[1] = corr[1];
83
+ }
84
+
85
+ private:
86
+ Point2 ComputeCorrection(Point2 orig, Point2 pred) const {
87
+ const Point2 t(this->center_value(), this->center_value());
88
+ orig = orig - t;
89
+ pred = pred - t;
90
+
91
+ if (!this->IsInDiamond(pred[0], pred[1])) {
92
+ this->InvertDiamond(&orig[0], &orig[1]);
93
+ this->InvertDiamond(&pred[0], &pred[1]);
94
+ }
95
+
96
+ Point2 corr = orig - pred;
97
+ corr[0] = this->MakePositive(corr[0]);
98
+ corr[1] = this->MakePositive(corr[1]);
99
+ return corr;
100
+ }
101
+ };
102
+
103
+ } // namespace draco
104
+
105
+ #endif // DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_NORMAL_OCTAHEDRON_ENCODING_TRANSFORM_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_NORMAL_OCTAHEDRON_TRANSFORM_BASE_H_
16
+ #define DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_NORMAL_OCTAHEDRON_TRANSFORM_BASE_H_
17
+
18
+ #include <cmath>
19
+
20
+ #include "draco/compression/attributes/normal_compression_utils.h"
21
+ #include "draco/compression/config/compression_shared.h"
22
+ #include "draco/core/bit_utils.h"
23
+ #include "draco/core/macros.h"
24
+ #include "draco/core/vector_d.h"
25
+
26
+ namespace draco {
27
+
28
+ // Base class containing shared functionality used by both encoding and decoding
29
+ // octahedral normal prediction scheme transforms. See the encoding transform
30
+ // for more details about the method.
31
+ template <typename DataTypeT>
32
+ class PredictionSchemeNormalOctahedronTransformBase {
33
+ public:
34
+ typedef VectorD<DataTypeT, 2> Point2;
35
+ typedef DataTypeT DataType;
36
+
37
+ PredictionSchemeNormalOctahedronTransformBase() {}
38
+ // We expect the mod value to be of the form 2^b-1.
39
+ explicit PredictionSchemeNormalOctahedronTransformBase(
40
+ DataType max_quantized_value) {
41
+ this->set_max_quantized_value(max_quantized_value);
42
+ }
43
+
44
+ static constexpr PredictionSchemeTransformType GetType() {
45
+ return PREDICTION_TRANSFORM_NORMAL_OCTAHEDRON;
46
+ }
47
+
48
+ // We can return true as we keep correction values positive.
49
+ bool AreCorrectionsPositive() const { return true; }
50
+
51
+ inline DataTypeT max_quantized_value() const {
52
+ return octahedron_tool_box_.max_quantized_value();
53
+ }
54
+ inline DataTypeT center_value() const {
55
+ return octahedron_tool_box_.center_value();
56
+ }
57
+ inline int32_t quantization_bits() const {
58
+ return octahedron_tool_box_.quantization_bits();
59
+ }
60
+
61
+ protected:
62
+ inline bool set_max_quantized_value(DataTypeT max_quantized_value) {
63
+ if (max_quantized_value % 2 == 0) {
64
+ return false;
65
+ }
66
+ int q = MostSignificantBit(max_quantized_value) + 1;
67
+ return octahedron_tool_box_.SetQuantizationBits(q);
68
+ }
69
+
70
+ bool IsInDiamond(DataTypeT s, DataTypeT t) const {
71
+ return octahedron_tool_box_.IsInDiamond(s, t);
72
+ }
73
+ void InvertDiamond(DataTypeT *s, DataTypeT *t) const {
74
+ return octahedron_tool_box_.InvertDiamond(s, t);
75
+ }
76
+
77
+ int32_t ModMax(int32_t x) const { return octahedron_tool_box_.ModMax(x); }
78
+
79
+ // For correction values.
80
+ int32_t MakePositive(int32_t x) const {
81
+ return octahedron_tool_box_.MakePositive(x);
82
+ }
83
+
84
+ private:
85
+ OctahedronToolBox octahedron_tool_box_;
86
+ };
87
+
88
+ } // namespace draco
89
+
90
+ #endif // DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_NORMAL_OCTAHEDRON_TRANSFORM_BASE_H_
@@ -0,0 +1,88 @@
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_WRAP_DECODING_TRANSFORM_H_
16
+ #define DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_WRAP_DECODING_TRANSFORM_H_
17
+
18
+ #include "draco/compression/attributes/prediction_schemes/prediction_scheme_wrap_transform_base.h"
19
+ #include "draco/core/decoder_buffer.h"
20
+
21
+ namespace draco {
22
+
23
+ // PredictionSchemeWrapDecodingTransform unwraps values encoded with the
24
+ // PredictionSchemeWrapEncodingTransform.
25
+ // See prediction_scheme_wrap_transform_base.h for more details about the
26
+ // method.
27
+ template <typename DataTypeT, typename CorrTypeT = DataTypeT>
28
+ class PredictionSchemeWrapDecodingTransform
29
+ : public PredictionSchemeWrapTransformBase<DataTypeT> {
30
+ public:
31
+ typedef CorrTypeT CorrType;
32
+ PredictionSchemeWrapDecodingTransform() {}
33
+
34
+ // Computes the original value from the input predicted value and the decoded
35
+ // corrections. Values out of the bounds of the input values are unwrapped.
36
+ inline void ComputeOriginalValue(const DataTypeT *predicted_vals,
37
+ const CorrTypeT *corr_vals,
38
+ DataTypeT *out_original_vals) const {
39
+ // For now we assume both |DataTypeT| and |CorrTypeT| are equal.
40
+ static_assert(std::is_same<DataTypeT, CorrTypeT>::value,
41
+ "Predictions and corrections must have the same type.");
42
+
43
+ // The only valid implementation right now is for int32_t.
44
+ static_assert(std::is_same<DataTypeT, int32_t>::value,
45
+ "Only int32_t is supported for predicted values.");
46
+
47
+ predicted_vals = this->ClampPredictedValue(predicted_vals);
48
+
49
+ // Perform the wrapping using unsigned coordinates to avoid potential signed
50
+ // integer overflows caused by malformed input.
51
+ const uint32_t *const uint_predicted_vals =
52
+ reinterpret_cast<const uint32_t *>(predicted_vals);
53
+ const uint32_t *const uint_corr_vals =
54
+ reinterpret_cast<const uint32_t *>(corr_vals);
55
+ for (int i = 0; i < this->num_components(); ++i) {
56
+ out_original_vals[i] =
57
+ static_cast<DataTypeT>(uint_predicted_vals[i] + uint_corr_vals[i]);
58
+ if (out_original_vals[i] > this->max_value()) {
59
+ out_original_vals[i] -= this->max_dif();
60
+ } else if (out_original_vals[i] < this->min_value()) {
61
+ out_original_vals[i] += this->max_dif();
62
+ }
63
+ }
64
+ }
65
+
66
+ bool DecodeTransformData(DecoderBuffer *buffer) {
67
+ DataTypeT min_value, max_value;
68
+ if (!buffer->Decode(&min_value)) {
69
+ return false;
70
+ }
71
+ if (!buffer->Decode(&max_value)) {
72
+ return false;
73
+ }
74
+ if (min_value > max_value) {
75
+ return false;
76
+ }
77
+ this->set_min_value(min_value);
78
+ this->set_max_value(max_value);
79
+ if (!this->InitCorrectionBounds()) {
80
+ return false;
81
+ }
82
+ return true;
83
+ }
84
+ };
85
+
86
+ } // namespace draco
87
+
88
+ #endif // DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_WRAP_DECODING_TRANSFORM_H_
@@ -0,0 +1,81 @@
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_WRAP_ENCODING_TRANSFORM_H_
16
+ #define DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_WRAP_ENCODING_TRANSFORM_H_
17
+
18
+ #include "draco/compression/attributes/prediction_schemes/prediction_scheme_wrap_transform_base.h"
19
+ #include "draco/core/encoder_buffer.h"
20
+
21
+ namespace draco {
22
+
23
+ // PredictionSchemeWrapEncodingTransform wraps input values using the wrapping
24
+ // scheme described in: prediction_scheme_wrap_transform_base.h .
25
+ template <typename DataTypeT, typename CorrTypeT = DataTypeT>
26
+ class PredictionSchemeWrapEncodingTransform
27
+ : public PredictionSchemeWrapTransformBase<DataTypeT> {
28
+ public:
29
+ typedef CorrTypeT CorrType;
30
+ PredictionSchemeWrapEncodingTransform() {}
31
+
32
+ void Init(const DataTypeT *orig_data, int size, int num_components) {
33
+ PredictionSchemeWrapTransformBase<DataTypeT>::Init(num_components);
34
+ // Go over the original values and compute the bounds.
35
+ if (size == 0) {
36
+ return;
37
+ }
38
+ DataTypeT min_value = orig_data[0];
39
+ DataTypeT max_value = min_value;
40
+ for (int i = 1; i < size; ++i) {
41
+ if (orig_data[i] < min_value) {
42
+ min_value = orig_data[i];
43
+ } else if (orig_data[i] > max_value) {
44
+ max_value = orig_data[i];
45
+ }
46
+ }
47
+ this->set_min_value(min_value);
48
+ this->set_max_value(max_value);
49
+ this->InitCorrectionBounds();
50
+ }
51
+
52
+ // Computes the corrections based on the input original value and the
53
+ // predicted value. Out of bound correction values are wrapped around the max
54
+ // range of input values.
55
+ inline void ComputeCorrection(const DataTypeT *original_vals,
56
+ const DataTypeT *predicted_vals,
57
+ CorrTypeT *out_corr_vals) const {
58
+ for (int i = 0; i < this->num_components(); ++i) {
59
+ predicted_vals = this->ClampPredictedValue(predicted_vals);
60
+ out_corr_vals[i] = original_vals[i] - predicted_vals[i];
61
+ // Wrap around if needed.
62
+ DataTypeT &corr_val = out_corr_vals[i];
63
+ if (corr_val < this->min_correction()) {
64
+ corr_val += this->max_dif();
65
+ } else if (corr_val > this->max_correction()) {
66
+ corr_val -= this->max_dif();
67
+ }
68
+ }
69
+ }
70
+
71
+ bool EncodeTransformData(EncoderBuffer *buffer) {
72
+ // Store the input value range as it is needed by the decoder.
73
+ buffer->Encode(this->min_value());
74
+ buffer->Encode(this->max_value());
75
+ return true;
76
+ }
77
+ };
78
+
79
+ } // namespace draco
80
+
81
+ #endif // DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_WRAP_ENCODING_TRANSFORM_H_