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,196 @@
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_ATTRIBUTES_POINT_ATTRIBUTE_H_
16
+ #define DRACO_ATTRIBUTES_POINT_ATTRIBUTE_H_
17
+
18
+ #include <memory>
19
+
20
+ #include "draco/attributes/attribute_transform_data.h"
21
+ #include "draco/attributes/geometry_attribute.h"
22
+ #include "draco/core/draco_index_type_vector.h"
23
+ #include "draco/core/hash_utils.h"
24
+ #include "draco/core/macros.h"
25
+ #include "draco/draco_features.h"
26
+
27
+ namespace draco {
28
+
29
+ // Class for storing point specific data about each attribute. In general,
30
+ // multiple points stored in a point cloud can share the same attribute value
31
+ // and this class provides the necessary mapping between point ids and attribute
32
+ // value ids.
33
+ class PointAttribute : public GeometryAttribute {
34
+ public:
35
+ PointAttribute();
36
+ explicit PointAttribute(const GeometryAttribute &att);
37
+
38
+ // Make sure the move constructor is defined (needed for better performance
39
+ // when new attributes are added to PointCloud).
40
+ PointAttribute(PointAttribute &&attribute) = default;
41
+ PointAttribute &operator=(PointAttribute &&attribute) = default;
42
+
43
+ // Initializes a point attribute. By default the attribute will be set to
44
+ // identity mapping between point indices and attribute values. To set custom
45
+ // mapping use SetExplicitMapping() function.
46
+ void Init(Type attribute_type, int8_t num_components, DataType data_type,
47
+ bool normalized, size_t num_attribute_values);
48
+
49
+ // Copies attribute data from the provided |src_att| attribute.
50
+ void CopyFrom(const PointAttribute &src_att);
51
+
52
+ // Prepares the attribute storage for the specified number of entries.
53
+ bool Reset(size_t num_attribute_values);
54
+
55
+ size_t size() const { return num_unique_entries_; }
56
+ AttributeValueIndex mapped_index(PointIndex point_index) const {
57
+ if (identity_mapping_) {
58
+ return AttributeValueIndex(point_index.value());
59
+ }
60
+ return indices_map_[point_index];
61
+ }
62
+ DataBuffer *buffer() const { return attribute_buffer_.get(); }
63
+ bool is_mapping_identity() const { return identity_mapping_; }
64
+ size_t indices_map_size() const {
65
+ if (is_mapping_identity()) {
66
+ return 0;
67
+ }
68
+ return indices_map_.size();
69
+ }
70
+
71
+ const uint8_t *GetAddressOfMappedIndex(PointIndex point_index) const {
72
+ return GetAddress(mapped_index(point_index));
73
+ }
74
+
75
+ // Sets the new number of unique attribute entries for the attribute. The
76
+ // function resizes the attribute storage to hold |num_attribute_values|
77
+ // entries.
78
+ // All previous entries with AttributeValueIndex < |num_attribute_values|
79
+ // are preserved. Caller needs to ensure that the PointAttribute is still
80
+ // valid after the resizing operation (that is, each point is mapped to a
81
+ // valid attribute value).
82
+ void Resize(size_t new_num_unique_entries);
83
+
84
+ // Functions for setting the type of mapping between point indices and
85
+ // attribute entry ids.
86
+ // This function sets the mapping to implicit, where point indices are equal
87
+ // to attribute entry indices.
88
+ void SetIdentityMapping() {
89
+ identity_mapping_ = true;
90
+ indices_map_.clear();
91
+ }
92
+ // This function sets the mapping to be explicitly using the indices_map_
93
+ // array that needs to be initialized by the caller.
94
+ void SetExplicitMapping(size_t num_points) {
95
+ identity_mapping_ = false;
96
+ indices_map_.resize(num_points, kInvalidAttributeValueIndex);
97
+ }
98
+
99
+ // Set an explicit map entry for a specific point index.
100
+ void SetPointMapEntry(PointIndex point_index,
101
+ AttributeValueIndex entry_index) {
102
+ DRACO_DCHECK(!identity_mapping_);
103
+ indices_map_[point_index] = entry_index;
104
+ }
105
+
106
+ // Same as GeometryAttribute::GetValue(), but using point id as the input.
107
+ // Mapping to attribute value index is performed automatically.
108
+ void GetMappedValue(PointIndex point_index, void *out_data) const {
109
+ return GetValue(mapped_index(point_index), out_data);
110
+ }
111
+
112
+ #ifdef DRACO_ATTRIBUTE_VALUES_DEDUPLICATION_SUPPORTED
113
+ // Deduplicate |in_att| values into |this| attribute. |in_att| can be equal
114
+ // to |this|.
115
+ // Returns -1 if the deduplication failed.
116
+ AttributeValueIndex::ValueType DeduplicateValues(
117
+ const GeometryAttribute &in_att);
118
+
119
+ // Same as above but the values read from |in_att| are sampled with the
120
+ // provided offset |in_att_offset|.
121
+ AttributeValueIndex::ValueType DeduplicateValues(
122
+ const GeometryAttribute &in_att, AttributeValueIndex in_att_offset);
123
+ #endif
124
+
125
+ // Set attribute transform data for the attribute. The data is used to store
126
+ // the type and parameters of the transform that is applied on the attribute
127
+ // data (optional).
128
+ void SetAttributeTransformData(
129
+ std::unique_ptr<AttributeTransformData> transform_data) {
130
+ attribute_transform_data_ = std::move(transform_data);
131
+ }
132
+ const AttributeTransformData *GetAttributeTransformData() const {
133
+ return attribute_transform_data_.get();
134
+ }
135
+
136
+ #ifdef DRACO_TRANSCODER_SUPPORTED
137
+ // Removes unused values from the attribute. Value is unused when no point
138
+ // is mapped to the value. Only applicable when the mapping is not identity.
139
+ void RemoveUnusedValues();
140
+ #endif
141
+
142
+ private:
143
+ #ifdef DRACO_ATTRIBUTE_VALUES_DEDUPLICATION_SUPPORTED
144
+ template <typename T>
145
+ AttributeValueIndex::ValueType DeduplicateTypedValues(
146
+ const GeometryAttribute &in_att, AttributeValueIndex in_att_offset);
147
+ template <typename T, int COMPONENTS_COUNT>
148
+ AttributeValueIndex::ValueType DeduplicateFormattedValues(
149
+ const GeometryAttribute &in_att, AttributeValueIndex in_att_offset);
150
+ #endif
151
+
152
+ // Data storage for attribute values. GeometryAttribute itself doesn't own its
153
+ // buffer so we need to allocate it here.
154
+ std::unique_ptr<DataBuffer> attribute_buffer_;
155
+
156
+ // Mapping between point ids and attribute value ids.
157
+ IndexTypeVector<PointIndex, AttributeValueIndex> indices_map_;
158
+ AttributeValueIndex::ValueType num_unique_entries_;
159
+ // Flag when the mapping between point ids and attribute values is identity.
160
+ bool identity_mapping_;
161
+
162
+ // If an attribute contains transformed data (e.g. quantized), we can specify
163
+ // the attribute transform here and use it to transform the attribute back to
164
+ // its original format.
165
+ std::unique_ptr<AttributeTransformData> attribute_transform_data_;
166
+
167
+ friend struct PointAttributeHasher;
168
+ };
169
+
170
+ // Hash functor for the PointAttribute class.
171
+ struct PointAttributeHasher {
172
+ size_t operator()(const PointAttribute &attribute) const {
173
+ GeometryAttributeHasher base_hasher;
174
+ size_t hash = base_hasher(attribute);
175
+ hash = HashCombine(attribute.identity_mapping_, hash);
176
+ hash = HashCombine(attribute.num_unique_entries_, hash);
177
+ hash = HashCombine(attribute.indices_map_.size(), hash);
178
+ if (!attribute.indices_map_.empty()) {
179
+ const uint64_t indices_hash = FingerprintString(
180
+ reinterpret_cast<const char *>(attribute.indices_map_.data()),
181
+ attribute.indices_map_.size());
182
+ hash = HashCombine(indices_hash, hash);
183
+ }
184
+ if (attribute.attribute_buffer_ != nullptr) {
185
+ const uint64_t buffer_hash = FingerprintString(
186
+ reinterpret_cast<const char *>(attribute.attribute_buffer_->data()),
187
+ attribute.attribute_buffer_->data_size());
188
+ hash = HashCombine(buffer_hash, hash);
189
+ }
190
+ return hash;
191
+ }
192
+ };
193
+
194
+ } // namespace draco
195
+
196
+ #endif // DRACO_ATTRIBUTES_POINT_ATTRIBUTE_H_
@@ -0,0 +1,97 @@
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_ATTRIBUTES_DECODER_H_
16
+ #define DRACO_COMPRESSION_ATTRIBUTES_ATTRIBUTES_DECODER_H_
17
+
18
+ #include <vector>
19
+
20
+ #include "draco/compression/attributes/attributes_decoder_interface.h"
21
+ #include "draco/compression/point_cloud/point_cloud_decoder.h"
22
+ #include "draco/core/decoder_buffer.h"
23
+ #include "draco/draco_features.h"
24
+ #include "draco/point_cloud/point_cloud.h"
25
+
26
+ namespace draco {
27
+
28
+ // Base class for decoding one or more attributes that were encoded with a
29
+ // matching AttributesEncoder. It is a basic implementation of
30
+ // AttributesDecoderInterface that provides functionality that is shared between
31
+ // all AttributesDecoders.
32
+ class AttributesDecoder : public AttributesDecoderInterface {
33
+ public:
34
+ AttributesDecoder();
35
+ virtual ~AttributesDecoder() = default;
36
+
37
+ // Called after all attribute decoders are created. It can be used to perform
38
+ // any custom initialization.
39
+ bool Init(PointCloudDecoder *decoder, PointCloud *pc) override;
40
+
41
+ // Decodes any attribute decoder specific data from the |in_buffer|.
42
+ bool DecodeAttributesDecoderData(DecoderBuffer *in_buffer) override;
43
+
44
+ int32_t GetAttributeId(int i) const override {
45
+ return point_attribute_ids_[i];
46
+ }
47
+ int32_t GetNumAttributes() const override {
48
+ return static_cast<int32_t>(point_attribute_ids_.size());
49
+ }
50
+ PointCloudDecoder *GetDecoder() const override {
51
+ return point_cloud_decoder_;
52
+ }
53
+
54
+ // Decodes attribute data from the source buffer.
55
+ bool DecodeAttributes(DecoderBuffer *in_buffer) override {
56
+ if (!DecodePortableAttributes(in_buffer)) {
57
+ return false;
58
+ }
59
+ if (!DecodeDataNeededByPortableTransforms(in_buffer)) {
60
+ return false;
61
+ }
62
+ if (!TransformAttributesToOriginalFormat()) {
63
+ return false;
64
+ }
65
+ return true;
66
+ }
67
+
68
+ protected:
69
+ int32_t GetLocalIdForPointAttribute(int32_t point_attribute_id) const {
70
+ const int id_map_size =
71
+ static_cast<int>(point_attribute_to_local_id_map_.size());
72
+ if (point_attribute_id >= id_map_size) {
73
+ return -1;
74
+ }
75
+ return point_attribute_to_local_id_map_[point_attribute_id];
76
+ }
77
+ virtual bool DecodePortableAttributes(DecoderBuffer *in_buffer) = 0;
78
+ virtual bool DecodeDataNeededByPortableTransforms(DecoderBuffer *in_buffer) {
79
+ return true;
80
+ }
81
+ virtual bool TransformAttributesToOriginalFormat() { return true; }
82
+
83
+ private:
84
+ // List of attribute ids that need to be decoded with this decoder.
85
+ std::vector<int32_t> point_attribute_ids_;
86
+
87
+ // Map between point attribute id and the local id (i.e., the inverse of the
88
+ // |point_attribute_ids_|.
89
+ std::vector<int32_t> point_attribute_to_local_id_map_;
90
+
91
+ PointCloudDecoder *point_cloud_decoder_;
92
+ PointCloud *point_cloud_;
93
+ };
94
+
95
+ } // namespace draco
96
+
97
+ #endif // DRACO_COMPRESSION_ATTRIBUTES_ATTRIBUTES_DECODER_H_
@@ -0,0 +1,62 @@
1
+ // Copyright 2017 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_ATTRIBUTES_DECODER_INTERFACE_H_
16
+ #define DRACO_COMPRESSION_ATTRIBUTES_ATTRIBUTES_DECODER_INTERFACE_H_
17
+
18
+ #include <vector>
19
+
20
+ #include "draco/core/decoder_buffer.h"
21
+ #include "draco/point_cloud/point_cloud.h"
22
+
23
+ namespace draco {
24
+
25
+ class PointCloudDecoder;
26
+
27
+ // Interface class for decoding one or more attributes that were encoded with a
28
+ // matching AttributesEncoder. It provides only the basic interface
29
+ // that is used by the PointCloudDecoder. The actual decoding must be
30
+ // implemented in derived classes using the DecodeAttributes() method.
31
+ class AttributesDecoderInterface {
32
+ public:
33
+ AttributesDecoderInterface() = default;
34
+ virtual ~AttributesDecoderInterface() = default;
35
+
36
+ // Called after all attribute decoders are created. It can be used to perform
37
+ // any custom initialization.
38
+ virtual bool Init(PointCloudDecoder *decoder, PointCloud *pc) = 0;
39
+
40
+ // Decodes any attribute decoder specific data from the |in_buffer|.
41
+ virtual bool DecodeAttributesDecoderData(DecoderBuffer *in_buffer) = 0;
42
+
43
+ // Decode attribute data from the source buffer. Needs to be implemented by
44
+ // the derived classes.
45
+ virtual bool DecodeAttributes(DecoderBuffer *in_buffer) = 0;
46
+
47
+ virtual int32_t GetAttributeId(int i) const = 0;
48
+ virtual int32_t GetNumAttributes() const = 0;
49
+ virtual PointCloudDecoder *GetDecoder() const = 0;
50
+
51
+ // Returns an attribute containing data processed by the attribute transform.
52
+ // (see TransformToPortableFormat() method). This data is guaranteed to be
53
+ // same for encoder and decoder and it can be used by predictors.
54
+ virtual const PointAttribute *GetPortableAttribute(
55
+ int32_t /* point_attribute_id */) {
56
+ return nullptr;
57
+ }
58
+ };
59
+
60
+ } // namespace draco
61
+
62
+ #endif // DRACO_COMPRESSION_ATTRIBUTES_ATTRIBUTES_DECODER_INTERFACE_H_
@@ -0,0 +1,154 @@
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_ATTRIBUTES_ENCODER_H_
16
+ #define DRACO_COMPRESSION_ATTRIBUTES_ATTRIBUTES_ENCODER_H_
17
+
18
+ #include "draco/attributes/point_attribute.h"
19
+ #include "draco/core/encoder_buffer.h"
20
+ #include "draco/point_cloud/point_cloud.h"
21
+
22
+ namespace draco {
23
+
24
+ class PointCloudEncoder;
25
+
26
+ // Base class for encoding one or more attributes of a PointCloud (or other
27
+ // geometry). This base class provides only the basic interface that is used
28
+ // by the PointCloudEncoder.
29
+ class AttributesEncoder {
30
+ public:
31
+ AttributesEncoder();
32
+ // Constructs an attribute encoder associated with a given point attribute.
33
+ explicit AttributesEncoder(int point_attrib_id);
34
+ virtual ~AttributesEncoder() = default;
35
+
36
+ // Called after all attribute encoders are created. It can be used to perform
37
+ // any custom initialization, including setting up attribute dependencies.
38
+ // Note: no data should be encoded in this function, because the decoder may
39
+ // process encoders in a different order from the decoder.
40
+ virtual bool Init(PointCloudEncoder *encoder, const PointCloud *pc);
41
+
42
+ // Encodes data needed by the target attribute decoder.
43
+ virtual bool EncodeAttributesEncoderData(EncoderBuffer *out_buffer);
44
+
45
+ // Returns a unique identifier of the given encoder type, that is used during
46
+ // decoding to construct the corresponding attribute decoder.
47
+ virtual uint8_t GetUniqueId() const = 0;
48
+
49
+ // Encode attribute data to the target buffer.
50
+ virtual bool EncodeAttributes(EncoderBuffer *out_buffer) {
51
+ if (!TransformAttributesToPortableFormat()) {
52
+ return false;
53
+ }
54
+ if (!EncodePortableAttributes(out_buffer)) {
55
+ return false;
56
+ }
57
+ // Encode data needed by portable transforms after the attribute is encoded.
58
+ // This corresponds to the order in which the data is going to be decoded by
59
+ // the decoder.
60
+ if (!EncodeDataNeededByPortableTransforms(out_buffer)) {
61
+ return false;
62
+ }
63
+ return true;
64
+ }
65
+
66
+ // Returns the number of attributes that need to be encoded before the
67
+ // specified attribute is encoded.
68
+ // Note that the attribute is specified by its point attribute id.
69
+ virtual int NumParentAttributes(int32_t /* point_attribute_id */) const {
70
+ return 0;
71
+ }
72
+
73
+ virtual int GetParentAttributeId(int32_t /* point_attribute_id */,
74
+ int32_t /* parent_i */) const {
75
+ return -1;
76
+ }
77
+
78
+ // Marks a given attribute as a parent of another attribute.
79
+ virtual bool MarkParentAttribute(int32_t /* point_attribute_id */) {
80
+ return false;
81
+ }
82
+
83
+ // Returns an attribute containing data processed by the attribute transform.
84
+ // (see TransformToPortableFormat() method). This data is guaranteed to be
85
+ // encoded losslessly and it can be safely used for predictors.
86
+ virtual const PointAttribute *GetPortableAttribute(
87
+ int32_t /* point_attribute_id */) {
88
+ return nullptr;
89
+ }
90
+
91
+ void AddAttributeId(int32_t id) {
92
+ point_attribute_ids_.push_back(id);
93
+ if (id >= static_cast<int32_t>(point_attribute_to_local_id_map_.size())) {
94
+ point_attribute_to_local_id_map_.resize(id + 1, -1);
95
+ }
96
+ point_attribute_to_local_id_map_[id] =
97
+ static_cast<int32_t>(point_attribute_ids_.size()) - 1;
98
+ }
99
+
100
+ // Sets new attribute point ids (replacing the existing ones).
101
+ void SetAttributeIds(const std::vector<int32_t> &point_attribute_ids) {
102
+ point_attribute_ids_.clear();
103
+ point_attribute_to_local_id_map_.clear();
104
+ for (int32_t att_id : point_attribute_ids) {
105
+ AddAttributeId(att_id);
106
+ }
107
+ }
108
+
109
+ int32_t GetAttributeId(int i) const { return point_attribute_ids_[i]; }
110
+ uint32_t num_attributes() const {
111
+ return static_cast<uint32_t>(point_attribute_ids_.size());
112
+ }
113
+ PointCloudEncoder *encoder() const { return point_cloud_encoder_; }
114
+
115
+ protected:
116
+ // Transforms the input attribute data into a form that should be losslessly
117
+ // encoded (transform itself can be lossy).
118
+ virtual bool TransformAttributesToPortableFormat() { return true; }
119
+
120
+ // Losslessly encodes data of all portable attributes.
121
+ // Precondition: All attributes must have been transformed into portable
122
+ // format at this point (see TransformAttributesToPortableFormat() method).
123
+ virtual bool EncodePortableAttributes(EncoderBuffer *out_buffer) = 0;
124
+
125
+ // Encodes any data needed to revert the transform to portable format for each
126
+ // attribute (e.g. data needed for dequantization of quantized values).
127
+ virtual bool EncodeDataNeededByPortableTransforms(EncoderBuffer *out_buffer) {
128
+ return true;
129
+ }
130
+
131
+ int32_t GetLocalIdForPointAttribute(int32_t point_attribute_id) const {
132
+ const int id_map_size =
133
+ static_cast<int>(point_attribute_to_local_id_map_.size());
134
+ if (point_attribute_id >= id_map_size) {
135
+ return -1;
136
+ }
137
+ return point_attribute_to_local_id_map_[point_attribute_id];
138
+ }
139
+
140
+ private:
141
+ // List of attribute ids that need to be encoded with this encoder.
142
+ std::vector<int32_t> point_attribute_ids_;
143
+
144
+ // Map between point attribute id and the local id (i.e., the inverse of the
145
+ // |point_attribute_ids_|.
146
+ std::vector<int32_t> point_attribute_to_local_id_map_;
147
+
148
+ PointCloudEncoder *point_cloud_encoder_;
149
+ const PointCloud *point_cloud_;
150
+ };
151
+
152
+ } // namespace draco
153
+
154
+ #endif // DRACO_COMPRESSION_ATTRIBUTES_ATTRIBUTES_ENCODER_H_
@@ -0,0 +1,50 @@
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_KD_TREE_ATTRIBUTES_DECODER_H_
16
+ #define DRACO_COMPRESSION_ATTRIBUTES_KD_TREE_ATTRIBUTES_DECODER_H_
17
+
18
+ #include "draco/attributes/attribute_quantization_transform.h"
19
+ #include "draco/compression/attributes/attributes_decoder.h"
20
+
21
+ namespace draco {
22
+
23
+ // Decodes attributes encoded with the KdTreeAttributesEncoder.
24
+ class KdTreeAttributesDecoder : public AttributesDecoder {
25
+ public:
26
+ KdTreeAttributesDecoder();
27
+
28
+ protected:
29
+ bool DecodePortableAttributes(DecoderBuffer *in_buffer) override;
30
+ bool DecodeDataNeededByPortableTransforms(DecoderBuffer *in_buffer) override;
31
+ bool TransformAttributesToOriginalFormat() override;
32
+
33
+ private:
34
+ template <int level_t, typename OutIteratorT>
35
+ bool DecodePoints(int total_dimensionality, int num_expected_points,
36
+ DecoderBuffer *in_buffer, OutIteratorT *out_iterator);
37
+
38
+ template <typename SignedDataTypeT>
39
+ bool TransformAttributeBackToSignedType(PointAttribute *att,
40
+ int num_processed_signed_components);
41
+
42
+ std::vector<AttributeQuantizationTransform>
43
+ attribute_quantization_transforms_;
44
+ std::vector<int32_t> min_signed_values_;
45
+ std::vector<std::unique_ptr<PointAttribute>> quantized_portable_attributes_;
46
+ };
47
+
48
+ } // namespace draco
49
+
50
+ #endif // DRACO_COMPRESSION_ATTRIBUTES_KD_TREE_ATTRIBUTES_DECODER_H_
@@ -0,0 +1,51 @@
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_KD_TREE_ATTRIBUTES_ENCODER_H_
16
+ #define DRACO_COMPRESSION_ATTRIBUTES_KD_TREE_ATTRIBUTES_ENCODER_H_
17
+
18
+ #include "draco/attributes/attribute_quantization_transform.h"
19
+ #include "draco/compression/attributes/attributes_encoder.h"
20
+ #include "draco/compression/config/compression_shared.h"
21
+
22
+ namespace draco {
23
+
24
+ // Encodes all attributes of a given PointCloud using one of the available
25
+ // Kd-tree compression methods.
26
+ // See compression/point_cloud/point_cloud_kd_tree_encoder.h for more details.
27
+ class KdTreeAttributesEncoder : public AttributesEncoder {
28
+ public:
29
+ KdTreeAttributesEncoder();
30
+ explicit KdTreeAttributesEncoder(int att_id);
31
+
32
+ uint8_t GetUniqueId() const override { return KD_TREE_ATTRIBUTE_ENCODER; }
33
+
34
+ protected:
35
+ bool TransformAttributesToPortableFormat() override;
36
+ bool EncodePortableAttributes(EncoderBuffer *out_buffer) override;
37
+ bool EncodeDataNeededByPortableTransforms(EncoderBuffer *out_buffer) override;
38
+
39
+ private:
40
+ std::vector<AttributeQuantizationTransform>
41
+ attribute_quantization_transforms_;
42
+ // Min signed values are used to transform signed integers into unsigned ones
43
+ // (by subtracting the min signed value for each component).
44
+ std::vector<int32_t> min_signed_values_;
45
+ std::vector<std::unique_ptr<PointAttribute>> quantized_portable_attributes_;
46
+ int num_components_;
47
+ };
48
+
49
+ } // namespace draco
50
+
51
+ #endif // DRACO_COMPRESSION_ATTRIBUTES_KD_TREE_ATTRIBUTES_ENCODER_H_
@@ -0,0 +1,28 @@
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_KD_TREE_ATTRIBUTES_SHARED_H_
16
+ #define DRACO_COMPRESSION_ATTRIBUTES_KD_TREE_ATTRIBUTES_SHARED_H_
17
+
18
+ namespace draco {
19
+
20
+ // Defines types of kD-tree compression
21
+ enum KdTreeAttributesEncodingMethod {
22
+ kKdTreeQuantizationEncoding = 0,
23
+ kKdTreeIntegerEncoding
24
+ };
25
+
26
+ } // namespace draco
27
+
28
+ #endif // DRACO_COMPRESSION_ATTRIBUTES_KD_TREE_ATTRIBUTES_SHARED_H_