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,288 @@
1
+ // Copyright 2018 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
+
16
+ #ifndef DRACO_COMPRESSION_ATTRIBUTES_POINT_D_VECTOR_H_
17
+ #define DRACO_COMPRESSION_ATTRIBUTES_POINT_D_VECTOR_H_
18
+
19
+ #include <cstddef>
20
+ #include <cstdint>
21
+ #include <cstring>
22
+ #include <iterator>
23
+ #include <memory>
24
+ #include <vector>
25
+
26
+ #include "draco/core/macros.h"
27
+
28
+ namespace draco {
29
+
30
+ // The main class of this file is PointDVector providing an interface similar to
31
+ // std::vector<PointD> for arbitrary number of dimensions (without a template
32
+ // argument). PointDVectorIterator is a random access iterator, which allows for
33
+ // compatibility with existing algorithms. PseudoPointD provides for a view on
34
+ // the individual items in a contiguous block of memory, which is compatible
35
+ // with the swap function and is returned by a dereference of
36
+ // PointDVectorIterator. Swap functions provide for compatibility/specialization
37
+ // that allows these classes to work with currently utilized STL functions.
38
+
39
+ // This class allows for swap functionality from the RandomIterator
40
+ // It seems problematic to bring this inside PointDVector due to templating.
41
+ template <typename internal_t>
42
+ class PseudoPointD {
43
+ public:
44
+ PseudoPointD(internal_t *mem, internal_t dimension)
45
+ : mem_(mem), dimension_(dimension) {}
46
+
47
+ // Specifically copies referenced memory
48
+ void swap(PseudoPointD &other) noexcept {
49
+ for (internal_t dim = 0; dim < dimension_; dim += 1) {
50
+ std::swap(mem_[dim], other.mem_[dim]);
51
+ }
52
+ }
53
+
54
+ PseudoPointD(const PseudoPointD &other)
55
+ : mem_(other.mem_), dimension_(other.dimension_) {}
56
+
57
+ const internal_t &operator[](const size_t &n) const {
58
+ DRACO_DCHECK_LT(n, dimension_);
59
+ return mem_[n];
60
+ }
61
+ internal_t &operator[](const size_t &n) {
62
+ DRACO_DCHECK_LT(n, dimension_);
63
+ return mem_[n];
64
+ }
65
+
66
+ bool operator==(const PseudoPointD &other) const {
67
+ for (auto dim = 0; dim < dimension_; dim += 1) {
68
+ if (mem_[dim] != other.mem_[dim]) {
69
+ return false;
70
+ }
71
+ }
72
+ return true;
73
+ }
74
+ bool operator!=(const PseudoPointD &other) const {
75
+ return !this->operator==(other);
76
+ }
77
+
78
+ private:
79
+ internal_t *const mem_;
80
+ const internal_t dimension_;
81
+ };
82
+
83
+ // It seems problematic to bring this inside PointDVector due to templating.
84
+ template <typename internal_t>
85
+ void swap(draco::PseudoPointD<internal_t> &&a,
86
+ draco::PseudoPointD<internal_t> &&b) noexcept {
87
+ a.swap(b);
88
+ };
89
+ template <typename internal_t>
90
+ void swap(draco::PseudoPointD<internal_t> &a,
91
+ draco::PseudoPointD<internal_t> &b) noexcept {
92
+ a.swap(b);
93
+ };
94
+
95
+ template <typename internal_t>
96
+ class PointDVector {
97
+ public:
98
+ PointDVector(const uint32_t n_items, const uint32_t dimensionality)
99
+ : n_items_(n_items),
100
+ dimensionality_(dimensionality),
101
+ item_size_bytes_(dimensionality * sizeof(internal_t)),
102
+ data_(n_items * dimensionality),
103
+ data0_(data_.data()) {}
104
+ // random access iterator
105
+ class PointDVectorIterator {
106
+ friend class PointDVector;
107
+
108
+ public:
109
+ // Iterator traits expected by std libraries.
110
+ using iterator_category = std::random_access_iterator_tag;
111
+ using value_type = size_t;
112
+ using difference_type = size_t;
113
+ using pointer = PointDVector *;
114
+ using reference = PointDVector &;
115
+
116
+ // std::iter_swap is called inside of std::partition and needs this
117
+ // specialized support
118
+ PseudoPointD<internal_t> operator*() const {
119
+ return PseudoPointD<internal_t>(vec_->data0_ + item_ * dimensionality_,
120
+ dimensionality_);
121
+ }
122
+ const PointDVectorIterator &operator++() {
123
+ item_ += 1;
124
+ return *this;
125
+ }
126
+ const PointDVectorIterator &operator--() {
127
+ item_ -= 1;
128
+ return *this;
129
+ }
130
+ PointDVectorIterator operator++(int32_t) {
131
+ PointDVectorIterator copy(*this);
132
+ item_ += 1;
133
+ return copy;
134
+ }
135
+ PointDVectorIterator operator--(int32_t) {
136
+ PointDVectorIterator copy(*this);
137
+ item_ -= 1;
138
+ return copy;
139
+ }
140
+ PointDVectorIterator &operator=(const PointDVectorIterator &other) {
141
+ this->item_ = other.item_;
142
+ return *this;
143
+ }
144
+
145
+ bool operator==(const PointDVectorIterator &ref) const {
146
+ return item_ == ref.item_;
147
+ }
148
+ bool operator!=(const PointDVectorIterator &ref) const {
149
+ return item_ != ref.item_;
150
+ }
151
+ bool operator<(const PointDVectorIterator &ref) const {
152
+ return item_ < ref.item_;
153
+ }
154
+ bool operator>(const PointDVectorIterator &ref) const {
155
+ return item_ > ref.item_;
156
+ }
157
+ bool operator<=(const PointDVectorIterator &ref) const {
158
+ return item_ <= ref.item_;
159
+ }
160
+ bool operator>=(const PointDVectorIterator &ref) const {
161
+ return item_ >= ref.item_;
162
+ }
163
+
164
+ PointDVectorIterator operator+(const int32_t &add) const {
165
+ PointDVectorIterator copy(vec_, item_ + add);
166
+ return copy;
167
+ }
168
+ PointDVectorIterator &operator+=(const int32_t &add) {
169
+ item_ += add;
170
+ return *this;
171
+ }
172
+ PointDVectorIterator operator-(const int32_t &sub) const {
173
+ PointDVectorIterator copy(vec_, item_ - sub);
174
+ return copy;
175
+ }
176
+ size_t operator-(const PointDVectorIterator &sub) const {
177
+ return (item_ - sub.item_);
178
+ }
179
+
180
+ PointDVectorIterator &operator-=(const int32_t &sub) {
181
+ item_ -= sub;
182
+ return *this;
183
+ }
184
+
185
+ internal_t *operator[](const size_t &n) const {
186
+ return vec_->data0_ + (item_ + n) * dimensionality_;
187
+ }
188
+
189
+ protected:
190
+ explicit PointDVectorIterator(PointDVector *vec, size_t start_item)
191
+ : item_(start_item), vec_(vec), dimensionality_(vec->dimensionality_) {}
192
+
193
+ private:
194
+ size_t item_; // this counts the item that should be referenced.
195
+ PointDVector *const vec_; // the thing that we're iterating on
196
+ const uint32_t dimensionality_; // local copy from vec_
197
+ };
198
+
199
+ PointDVectorIterator begin() { return PointDVectorIterator(this, 0); }
200
+ PointDVectorIterator end() { return PointDVectorIterator(this, n_items_); }
201
+
202
+ // operator[] allows for unprotected user-side usage of operator[] on the
203
+ // return value AS IF it were a natively indexable type like Point3*
204
+ internal_t *operator[](const uint32_t index) {
205
+ DRACO_DCHECK_LT(index, n_items_);
206
+ return data0_ + index * dimensionality_;
207
+ }
208
+ const internal_t *operator[](const uint32_t index) const {
209
+ DRACO_DCHECK_LT(index, n_items_);
210
+ return data0_ + index * dimensionality_;
211
+ }
212
+
213
+ uint32_t size() const { return n_items_; }
214
+ size_t GetBufferSize() const { return data_.size(); }
215
+
216
+ // copy a single contiguous 'item' from one PointDVector into this one.
217
+ void CopyItem(const PointDVector &source, const internal_t source_index,
218
+ const internal_t destination_index) {
219
+ DRACO_DCHECK(&source != this ||
220
+ (&source == this && source_index != destination_index));
221
+ DRACO_DCHECK_LT(destination_index, n_items_);
222
+ DRACO_DCHECK_LT(source_index, source.n_items_);
223
+
224
+ // DRACO_DCHECK_EQ(source.n_items_, n_items_); // not technically necessary
225
+ DRACO_DCHECK_EQ(source.dimensionality_, dimensionality_);
226
+
227
+ const internal_t *ref = source[source_index];
228
+ internal_t *const dest = this->operator[](destination_index);
229
+ std::memcpy(dest, ref, item_size_bytes_);
230
+ }
231
+
232
+ // Copy data directly off of an attribute buffer interleaved into internal
233
+ // memory.
234
+ void CopyAttribute(
235
+ // The dimensionality of the attribute being integrated
236
+ const internal_t attribute_dimensionality,
237
+ // The offset in dimensions to insert this attribute.
238
+ const internal_t offset_dimensionality, const internal_t index,
239
+ // The direct pointer to the data
240
+ const void *const attribute_item_data) {
241
+ // chunk copy
242
+ const size_t copy_size = sizeof(internal_t) * attribute_dimensionality;
243
+
244
+ // a multiply and add can be optimized away with an iterator
245
+ std::memcpy(data0_ + index * dimensionality_ + offset_dimensionality,
246
+ attribute_item_data, copy_size);
247
+ }
248
+ // Copy data off of a contiguous buffer interleaved into internal memory
249
+ void CopyAttribute(
250
+ // The dimensionality of the attribute being integrated
251
+ const internal_t attribute_dimensionality,
252
+ // The offset in dimensions to insert this attribute.
253
+ const internal_t offset_dimensionality,
254
+ const internal_t *const attribute_mem) {
255
+ DRACO_DCHECK_LT(offset_dimensionality,
256
+ dimensionality_ - attribute_dimensionality);
257
+ // degenerate case block copy the whole buffer.
258
+ if (dimensionality_ == attribute_dimensionality) {
259
+ DRACO_DCHECK_EQ(offset_dimensionality, 0);
260
+ const size_t copy_size =
261
+ sizeof(internal_t) * attribute_dimensionality * n_items_;
262
+ std::memcpy(data0_, attribute_mem, copy_size);
263
+ } else { // chunk copy
264
+ const size_t copy_size = sizeof(internal_t) * attribute_dimensionality;
265
+ internal_t *internal_data;
266
+ const internal_t *attribute_data;
267
+ internal_t item;
268
+ for (internal_data = data0_ + offset_dimensionality,
269
+ attribute_data = attribute_mem, item = 0;
270
+ item < n_items_; internal_data += dimensionality_,
271
+ attribute_data += attribute_dimensionality, item += 1) {
272
+ std::memcpy(internal_data, attribute_data, copy_size);
273
+ }
274
+ }
275
+ }
276
+
277
+ private:
278
+ // internal parameters.
279
+ const uint32_t n_items_;
280
+ const uint32_t dimensionality_; // The dimension of the points in the buffer
281
+ const uint32_t item_size_bytes_;
282
+ std::vector<internal_t> data_; // contiguously stored data. Never resized.
283
+ internal_t *const data0_; // raw pointer to base data.
284
+ };
285
+
286
+ } // namespace draco
287
+
288
+ #endif // DRACO_COMPRESSION_ATTRIBUTES_POINT_D_VECTOR_H_
@@ -0,0 +1,63 @@
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_POINTS_SEQUENCER_H_
16
+ #define DRACO_COMPRESSION_ATTRIBUTES_POINTS_SEQUENCER_H_
17
+
18
+ #include <vector>
19
+
20
+ #include "draco/attributes/point_attribute.h"
21
+
22
+ namespace draco {
23
+
24
+ // Class for generating a sequence of point ids that can be used to encode
25
+ // or decode attribute values in a specific order.
26
+ // See sequential_attribute_encoders/decoders_controller.h for more details.
27
+ class PointsSequencer {
28
+ public:
29
+ PointsSequencer() : out_point_ids_(nullptr) {}
30
+ virtual ~PointsSequencer() = default;
31
+
32
+ // Fills the |out_point_ids| with the generated sequence of point ids.
33
+ bool GenerateSequence(std::vector<PointIndex> *out_point_ids) {
34
+ out_point_ids_ = out_point_ids;
35
+ return GenerateSequenceInternal();
36
+ }
37
+
38
+ // Appends a point to the sequence.
39
+ void AddPointId(PointIndex point_id) { out_point_ids_->push_back(point_id); }
40
+
41
+ // Sets the correct mapping between point ids and value ids. I.e., the inverse
42
+ // of the |out_point_ids|. In general, |out_point_ids_| does not contain
43
+ // sufficient information to compute the inverse map, because not all point
44
+ // ids are necessarily contained within the map.
45
+ // Must be implemented for sequencers that are used by attribute decoders.
46
+ virtual bool UpdatePointToAttributeIndexMapping(PointAttribute * /* attr */) {
47
+ return false;
48
+ }
49
+
50
+ protected:
51
+ // Method that needs to be implemented by the derived classes. The
52
+ // implementation is responsible for filling |out_point_ids_| with the valid
53
+ // sequence of point ids.
54
+ virtual bool GenerateSequenceInternal() = 0;
55
+ std::vector<PointIndex> *out_point_ids() const { return out_point_ids_; }
56
+
57
+ private:
58
+ std::vector<PointIndex> *out_point_ids_;
59
+ };
60
+
61
+ } // namespace draco
62
+
63
+ #endif // DRACO_COMPRESSION_ATTRIBUTES_POINTS_SEQUENCER_H_
@@ -0,0 +1,236 @@
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_CONSTRAINED_MULTI_PARALLELOGRAM_DECODER_H_
16
+ #define DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_MESH_PREDICTION_SCHEME_CONSTRAINED_MULTI_PARALLELOGRAM_DECODER_H_
17
+
18
+ #include <algorithm>
19
+ #include <cmath>
20
+
21
+ #include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_constrained_multi_parallelogram_shared.h"
22
+ #include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_decoder.h"
23
+ #include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_parallelogram_shared.h"
24
+ #include "draco/compression/bit_coders/rans_bit_decoder.h"
25
+ #include "draco/core/math_utils.h"
26
+ #include "draco/core/varint_decoding.h"
27
+ #include "draco/draco_features.h"
28
+
29
+ namespace draco {
30
+
31
+ // Decoder for predictions encoded with the constrained multi-parallelogram
32
+ // encoder. See the corresponding encoder for more details about the prediction
33
+ // method.
34
+ template <typename DataTypeT, class TransformT, class MeshDataT>
35
+ class MeshPredictionSchemeConstrainedMultiParallelogramDecoder
36
+ : public MeshPredictionSchemeDecoder<DataTypeT, TransformT, MeshDataT> {
37
+ public:
38
+ using CorrType =
39
+ typename PredictionSchemeDecoder<DataTypeT, TransformT>::CorrType;
40
+ using CornerTable = typename MeshDataT::CornerTable;
41
+
42
+ explicit MeshPredictionSchemeConstrainedMultiParallelogramDecoder(
43
+ const PointAttribute *attribute)
44
+ : MeshPredictionSchemeDecoder<DataTypeT, TransformT, MeshDataT>(
45
+ attribute),
46
+ selected_mode_(Mode::OPTIMAL_MULTI_PARALLELOGRAM) {}
47
+ MeshPredictionSchemeConstrainedMultiParallelogramDecoder(
48
+ const PointAttribute *attribute, const TransformT &transform,
49
+ const MeshDataT &mesh_data)
50
+ : MeshPredictionSchemeDecoder<DataTypeT, TransformT, MeshDataT>(
51
+ attribute, transform, mesh_data),
52
+ selected_mode_(Mode::OPTIMAL_MULTI_PARALLELOGRAM) {}
53
+
54
+ bool ComputeOriginalValues(const CorrType *in_corr, DataTypeT *out_data,
55
+ int size, int num_components,
56
+ const PointIndex *entry_to_point_id_map) override;
57
+
58
+ bool DecodePredictionData(DecoderBuffer *buffer) override;
59
+
60
+ PredictionSchemeMethod GetPredictionMethod() const override {
61
+ return MESH_PREDICTION_CONSTRAINED_MULTI_PARALLELOGRAM;
62
+ }
63
+
64
+ bool IsInitialized() const override {
65
+ return this->mesh_data().IsInitialized();
66
+ }
67
+
68
+ private:
69
+ typedef constrained_multi_parallelogram::Mode Mode;
70
+ static constexpr int kMaxNumParallelograms =
71
+ constrained_multi_parallelogram::kMaxNumParallelograms;
72
+ // Crease edges are used to store whether any given edge should be used for
73
+ // parallelogram prediction or not. New values are added in the order in which
74
+ // the edges are processed. For better compression, the flags are stored in
75
+ // in separate contexts based on the number of available parallelograms at a
76
+ // given vertex.
77
+ std::vector<bool> is_crease_edge_[kMaxNumParallelograms];
78
+ Mode selected_mode_;
79
+ };
80
+
81
+ template <typename DataTypeT, class TransformT, class MeshDataT>
82
+ bool MeshPredictionSchemeConstrainedMultiParallelogramDecoder<
83
+ DataTypeT, TransformT, MeshDataT>::
84
+ ComputeOriginalValues(const CorrType *in_corr, DataTypeT *out_data,
85
+ int /* size */, int num_components,
86
+ const PointIndex * /* entry_to_point_id_map */) {
87
+ this->transform().Init(num_components);
88
+
89
+ // Predicted values for all simple parallelograms encountered at any given
90
+ // vertex.
91
+ std::vector<DataTypeT> pred_vals[kMaxNumParallelograms];
92
+ for (int i = 0; i < kMaxNumParallelograms; ++i) {
93
+ pred_vals[i].resize(num_components, 0);
94
+ }
95
+ this->transform().ComputeOriginalValue(pred_vals[0].data(), in_corr,
96
+ out_data);
97
+
98
+ const CornerTable *const table = this->mesh_data().corner_table();
99
+ const std::vector<int32_t> *const vertex_to_data_map =
100
+ this->mesh_data().vertex_to_data_map();
101
+
102
+ // Current position in the |is_crease_edge_| array for each context.
103
+ std::vector<int> is_crease_edge_pos(kMaxNumParallelograms, 0);
104
+
105
+ // Used to store predicted value for multi-parallelogram prediction.
106
+ std::vector<DataTypeT> multi_pred_vals(num_components);
107
+
108
+ const int corner_map_size =
109
+ static_cast<int>(this->mesh_data().data_to_corner_map()->size());
110
+ for (int p = 1; p < corner_map_size; ++p) {
111
+ const CornerIndex start_corner_id =
112
+ this->mesh_data().data_to_corner_map()->at(p);
113
+
114
+ CornerIndex corner_id(start_corner_id);
115
+ int num_parallelograms = 0;
116
+ bool first_pass = true;
117
+ while (corner_id != kInvalidCornerIndex) {
118
+ if (ComputeParallelogramPrediction(
119
+ p, corner_id, table, *vertex_to_data_map, out_data,
120
+ num_components, &(pred_vals[num_parallelograms][0]))) {
121
+ // Parallelogram prediction applied and stored in
122
+ // |pred_vals[num_parallelograms]|
123
+ ++num_parallelograms;
124
+ // Stop processing when we reach the maximum number of allowed
125
+ // parallelograms.
126
+ if (num_parallelograms == kMaxNumParallelograms) {
127
+ break;
128
+ }
129
+ }
130
+
131
+ // Proceed to the next corner attached to the vertex. First swing left
132
+ // and if we reach a boundary, swing right from the start corner.
133
+ if (first_pass) {
134
+ corner_id = table->SwingLeft(corner_id);
135
+ } else {
136
+ corner_id = table->SwingRight(corner_id);
137
+ }
138
+ if (corner_id == start_corner_id) {
139
+ break;
140
+ }
141
+ if (corner_id == kInvalidCornerIndex && first_pass) {
142
+ first_pass = false;
143
+ corner_id = table->SwingRight(start_corner_id);
144
+ }
145
+ }
146
+
147
+ // Check which of the available parallelograms are actually used and compute
148
+ // the final predicted value.
149
+ int num_used_parallelograms = 0;
150
+ if (num_parallelograms > 0) {
151
+ for (int i = 0; i < num_components; ++i) {
152
+ multi_pred_vals[i] = 0;
153
+ }
154
+ // Check which parallelograms are actually used.
155
+ for (int i = 0; i < num_parallelograms; ++i) {
156
+ const int context = num_parallelograms - 1;
157
+ const int pos = is_crease_edge_pos[context]++;
158
+ if (is_crease_edge_[context].size() <= pos) {
159
+ return false;
160
+ }
161
+ const bool is_crease = is_crease_edge_[context][pos];
162
+ if (!is_crease) {
163
+ ++num_used_parallelograms;
164
+ for (int j = 0; j < num_components; ++j) {
165
+ multi_pred_vals[j] =
166
+ AddAsUnsigned(multi_pred_vals[j], pred_vals[i][j]);
167
+ }
168
+ }
169
+ }
170
+ }
171
+ const int dst_offset = p * num_components;
172
+ if (num_used_parallelograms == 0) {
173
+ // No parallelogram was valid.
174
+ // We use the last decoded point as a reference.
175
+ const int src_offset = (p - 1) * num_components;
176
+ this->transform().ComputeOriginalValue(
177
+ out_data + src_offset, in_corr + dst_offset, out_data + dst_offset);
178
+ } else {
179
+ // Compute the correction from the predicted value.
180
+ for (int c = 0; c < num_components; ++c) {
181
+ multi_pred_vals[c] /= num_used_parallelograms;
182
+ }
183
+ this->transform().ComputeOriginalValue(
184
+ multi_pred_vals.data(), in_corr + dst_offset, out_data + dst_offset);
185
+ }
186
+ }
187
+ return true;
188
+ }
189
+
190
+ template <typename DataTypeT, class TransformT, class MeshDataT>
191
+ bool MeshPredictionSchemeConstrainedMultiParallelogramDecoder<
192
+ DataTypeT, TransformT, MeshDataT>::DecodePredictionData(DecoderBuffer
193
+ *buffer) {
194
+ #ifdef DRACO_BACKWARDS_COMPATIBILITY_SUPPORTED
195
+ if (buffer->bitstream_version() < DRACO_BITSTREAM_VERSION(2, 2)) {
196
+ // Decode prediction mode.
197
+ uint8_t mode;
198
+ if (!buffer->Decode(&mode)) {
199
+ return false;
200
+ }
201
+
202
+ if (mode != Mode::OPTIMAL_MULTI_PARALLELOGRAM) {
203
+ // Unsupported mode.
204
+ return false;
205
+ }
206
+ }
207
+ #endif
208
+
209
+ // Encode selected edges using separate rans bit coder for each context.
210
+ for (int i = 0; i < kMaxNumParallelograms; ++i) {
211
+ uint32_t num_flags;
212
+ if (!DecodeVarint<uint32_t>(&num_flags, buffer)) {
213
+ return false;
214
+ }
215
+ if (num_flags > this->mesh_data().corner_table()->num_corners()) {
216
+ return false;
217
+ }
218
+ if (num_flags > 0) {
219
+ is_crease_edge_[i].resize(num_flags);
220
+ RAnsBitDecoder decoder;
221
+ if (!decoder.StartDecoding(buffer)) {
222
+ return false;
223
+ }
224
+ for (uint32_t j = 0; j < num_flags; ++j) {
225
+ is_crease_edge_[i][j] = decoder.DecodeNextBit();
226
+ }
227
+ decoder.EndDecoding();
228
+ }
229
+ }
230
+ return MeshPredictionSchemeDecoder<DataTypeT, TransformT,
231
+ MeshDataT>::DecodePredictionData(buffer);
232
+ }
233
+
234
+ } // namespace draco
235
+
236
+ #endif // DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_MESH_PREDICTION_SCHEME_CONSTRAINED_MULTI_PARALLELOGRAM_DECODER_H_