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,209 @@
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_MESH_MESH_EDGEBREAKER_ENCODER_IMPL_H_
16
+ #define DRACO_COMPRESSION_MESH_MESH_EDGEBREAKER_ENCODER_IMPL_H_
17
+
18
+ #include <unordered_map>
19
+
20
+ #include "draco/compression/attributes/mesh_attribute_indices_encoding_data.h"
21
+ #include "draco/compression/config/compression_shared.h"
22
+ #include "draco/compression/mesh/mesh_edgebreaker_encoder_impl_interface.h"
23
+ #include "draco/compression/mesh/mesh_edgebreaker_shared.h"
24
+ #include "draco/compression/mesh/traverser/mesh_traversal_sequencer.h"
25
+ #include "draco/core/encoder_buffer.h"
26
+ #include "draco/mesh/mesh_attribute_corner_table.h"
27
+
28
+ namespace draco {
29
+
30
+ // Class implementing the edgebreaker encoding as described in "3D Compression
31
+ // Made Simple: Edgebreaker on a Corner-Table" by Rossignac at al.'01.
32
+ // http://www.cc.gatech.edu/~jarek/papers/CornerTableSMI.pdf
33
+ template <class TraversalEncoderT>
34
+ class MeshEdgebreakerEncoderImpl : public MeshEdgebreakerEncoderImplInterface {
35
+ public:
36
+ MeshEdgebreakerEncoderImpl();
37
+ explicit MeshEdgebreakerEncoderImpl(
38
+ const TraversalEncoderT &traversal_encoder);
39
+ bool Init(MeshEdgebreakerEncoder *encoder) override;
40
+
41
+ const MeshAttributeCornerTable *GetAttributeCornerTable(
42
+ int att_id) const override;
43
+ const MeshAttributeIndicesEncodingData *GetAttributeEncodingData(
44
+ int att_id) const override;
45
+
46
+ bool GenerateAttributesEncoder(int32_t att_id) override;
47
+ bool EncodeAttributesEncoderIdentifier(int32_t att_encoder_id) override;
48
+ Status EncodeConnectivity() override;
49
+
50
+ const CornerTable *GetCornerTable() const override {
51
+ return corner_table_.get();
52
+ }
53
+ bool IsFaceEncoded(FaceIndex fi) const override {
54
+ return visited_faces_[fi.value()];
55
+ }
56
+ MeshEdgebreakerEncoder *GetEncoder() const override { return encoder_; }
57
+
58
+ private:
59
+ // Initializes data needed for encoding non-position attributes.
60
+ // Returns false on error.
61
+ bool InitAttributeData();
62
+
63
+ // Creates a vertex traversal sequencer for the specified |TraverserT| type.
64
+ template <class TraverserT>
65
+ std::unique_ptr<PointsSequencer> CreateVertexTraversalSequencer(
66
+ MeshAttributeIndicesEncodingData *encoding_data);
67
+
68
+ // Finds the configuration of the initial face that starts the traversal.
69
+ // Configurations are determined by location of holes around the init face
70
+ // and they are described in mesh_edgebreaker_shared.h.
71
+ // Returns true if the face configuration is interior and false if it is
72
+ // exterior.
73
+ bool FindInitFaceConfiguration(FaceIndex face_id,
74
+ CornerIndex *out_corner_id) const;
75
+
76
+ // Encodes the connectivity between vertices.
77
+ bool EncodeConnectivityFromCorner(CornerIndex corner_id);
78
+
79
+ // Encodes all vertices of a hole starting at start_corner_id.
80
+ // The vertex associated with the first corner is encoded only if
81
+ // |encode_first_vertex| is true.
82
+ // Returns the number of encoded hole vertices.
83
+ int EncodeHole(CornerIndex start_corner_id, bool encode_first_vertex);
84
+
85
+ // Encodes topology split data.
86
+ // Returns nullptr on error.
87
+ bool EncodeSplitData();
88
+
89
+ CornerIndex GetRightCorner(CornerIndex corner_id) const;
90
+ CornerIndex GetLeftCorner(CornerIndex corner_id) const;
91
+
92
+ bool IsRightFaceVisited(CornerIndex corner_id) const;
93
+ bool IsLeftFaceVisited(CornerIndex corner_id) const;
94
+ bool IsVertexVisited(VertexIndex vert_id) const {
95
+ return visited_vertex_ids_[vert_id.value()];
96
+ }
97
+
98
+ // Finds and stores data about all holes in the input mesh.
99
+ bool FindHoles();
100
+
101
+ // For faces encoded with symbol TOPOLOGY_S (split), this method returns
102
+ // the encoded symbol id or -1 if the face wasn't encoded by a split symbol.
103
+ int GetSplitSymbolIdOnFace(int face_id) const;
104
+
105
+ // Checks whether there is a topology split event on a neighboring face and
106
+ // stores the event data if necessary. For more info about topology split
107
+ // events, see description of TopologySplitEventData in
108
+ // mesh_edgebreaker_shared.h.
109
+ void CheckAndStoreTopologySplitEvent(int src_symbol_id, int src_face_id,
110
+ EdgeFaceName src_edge,
111
+ int neighbor_face_id);
112
+
113
+ // Encodes connectivity of all attributes on a newly traversed face.
114
+ bool EncodeAttributeConnectivitiesOnFace(CornerIndex corner);
115
+
116
+ // This function is used to to assign correct encoding order of attributes
117
+ // to unprocessed corners. The encoding order is equal to the order in which
118
+ // the attributes are going to be processed by the decoder and it is necessary
119
+ // for proper prediction of attribute values.
120
+ bool AssignPositionEncodingOrderToAllCorners();
121
+
122
+ // This function is used to generate encoding order for all non-position
123
+ // attributes.
124
+ // Returns false when one or more attributes failed to be processed.
125
+ bool GenerateEncodingOrderForAttributes();
126
+
127
+ // The main encoder that owns this class.
128
+ MeshEdgebreakerEncoder *encoder_;
129
+ // Mesh that's being encoded.
130
+ const Mesh *mesh_;
131
+ // Corner table stores the mesh face connectivity data.
132
+ std::unique_ptr<CornerTable> corner_table_;
133
+ // Stack used for storing corners that need to be traversed when encoding
134
+ // the connectivity. New corner is added for each initial face and a split
135
+ // symbol, and one corner is removed when the end symbol is reached.
136
+ // Stored as member variable to prevent frequent memory reallocations when
137
+ // handling meshes with lots of disjoint components. Originally, we used
138
+ // recursive functions to handle this behavior, but that can cause stack
139
+ // memory overflow when compressing huge meshes.
140
+ std::vector<CornerIndex> corner_traversal_stack_;
141
+ // Array for marking visited faces.
142
+ std::vector<bool> visited_faces_;
143
+
144
+ // Attribute data for position encoding.
145
+ MeshAttributeIndicesEncodingData pos_encoding_data_;
146
+
147
+ // Traversal method used for the position attribute.
148
+ MeshTraversalMethod pos_traversal_method_;
149
+
150
+ // Array storing corners in the order they were visited during the
151
+ // connectivity encoding (always storing the tip corner of each newly visited
152
+ // face).
153
+ std::vector<CornerIndex> processed_connectivity_corners_;
154
+
155
+ // Array for storing visited vertex ids of all input vertices.
156
+ std::vector<bool> visited_vertex_ids_;
157
+
158
+ // For each traversal, this array stores the number of visited vertices.
159
+ std::vector<int> vertex_traversal_length_;
160
+ // Array for storing all topology split events encountered during the mesh
161
+ // traversal.
162
+ std::vector<TopologySplitEventData> topology_split_event_data_;
163
+ // Map between face_id and symbol_id. Contains entries only for faces that
164
+ // were encoded with TOPOLOGY_S symbol.
165
+ std::unordered_map<int, int> face_to_split_symbol_map_;
166
+
167
+ // Array for marking holes that has been reached during the traversal.
168
+ std::vector<bool> visited_holes_;
169
+ // Array for mapping vertices to hole ids. If a vertex is not on a hole, the
170
+ // stored value is -1.
171
+ std::vector<int> vertex_hole_id_;
172
+
173
+ // Id of the last encoded symbol.
174
+ int last_encoded_symbol_id_;
175
+
176
+ // The number of encoded split symbols.
177
+ uint32_t num_split_symbols_;
178
+
179
+ // Struct holding data used for encoding each non-position attribute.
180
+ struct AttributeData {
181
+ AttributeData() : attribute_index(-1), is_connectivity_used(true) {}
182
+ int attribute_index;
183
+ MeshAttributeCornerTable connectivity_data;
184
+ // Flag that can mark the connectivity_data invalid. In such case the base
185
+ // corner table of the mesh should be used instead.
186
+ bool is_connectivity_used;
187
+ // Data about attribute encoding order.
188
+ MeshAttributeIndicesEncodingData encoding_data;
189
+ // Traversal method used to generate the encoding data for this attribute.
190
+ MeshTraversalMethod traversal_method;
191
+ };
192
+ std::vector<AttributeData> attribute_data_;
193
+
194
+ // Array storing mapping between attribute encoder id and attribute data id.
195
+ std::vector<int32_t> attribute_encoder_to_data_id_map_;
196
+
197
+ TraversalEncoderT traversal_encoder_;
198
+
199
+ // If set, the encoder is going to use the same connectivity for all
200
+ // attributes. This effectively breaks the mesh along all attribute seams.
201
+ // In general, this approach should be much faster compared to encoding each
202
+ // connectivity separately, but the decoded model may contain higher number of
203
+ // duplicate attribute values which may decrease the compression ratio.
204
+ bool use_single_connectivity_;
205
+ };
206
+
207
+ } // namespace draco
208
+
209
+ #endif // DRACO_COMPRESSION_MESH_MESH_EDGEBREAKER_ENCODER_IMPL_H_
@@ -0,0 +1,57 @@
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_MESH_MESH_EDGEBREAKER_ENCODER_IMPL_INTERFACE_H_
16
+ #define DRACO_COMPRESSION_MESH_MESH_EDGEBREAKER_ENCODER_IMPL_INTERFACE_H_
17
+
18
+ #include "draco/compression/attributes/mesh_attribute_indices_encoding_data.h"
19
+ #include "draco/mesh/corner_table.h"
20
+ #include "draco/mesh/mesh_attribute_corner_table.h"
21
+
22
+ namespace draco {
23
+
24
+ // Forward declaration is necessary here to avoid circular dependencies.
25
+ class MeshEdgebreakerEncoder;
26
+
27
+ // Abstract interface used by MeshEdgebreakerEncoder to interact with the actual
28
+ // implementation of the edgebreaker method. The implementations are in general
29
+ // specializations of a template class MeshEdgebreakerEncoderImpl where the
30
+ // template arguments control encoding of the connectivity data. Because the
31
+ // choice of the implementation is done in run-time, we need to hide it behind
32
+ // the abstract interface MeshEdgebreakerEncoderImplInterface.
33
+ class MeshEdgebreakerEncoderImplInterface {
34
+ public:
35
+ virtual ~MeshEdgebreakerEncoderImplInterface() = default;
36
+ virtual bool Init(MeshEdgebreakerEncoder *encoder) = 0;
37
+
38
+ virtual const MeshAttributeCornerTable *GetAttributeCornerTable(
39
+ int att_id) const = 0;
40
+ virtual const MeshAttributeIndicesEncodingData *GetAttributeEncodingData(
41
+ int att_id) const = 0;
42
+ virtual bool GenerateAttributesEncoder(int32_t att_id) = 0;
43
+ virtual bool EncodeAttributesEncoderIdentifier(int32_t att_encoder_id) = 0;
44
+ virtual Status EncodeConnectivity() = 0;
45
+
46
+ // Returns corner table of the encoded mesh.
47
+ virtual const CornerTable *GetCornerTable() const = 0;
48
+
49
+ // Returns true if a given face has been already encoded.
50
+ virtual bool IsFaceEncoded(FaceIndex fi) const = 0;
51
+
52
+ virtual MeshEdgebreakerEncoder *GetEncoder() const = 0;
53
+ };
54
+
55
+ } // namespace draco
56
+
57
+ #endif // DRACO_COMPRESSION_MESH_MESH_EDGEBREAKER_ENCODER_IMPL_INTERFACE_H_
@@ -0,0 +1,129 @@
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_MESH_MESH_EDGEBREAKER_SHARED_H_
16
+ #define DRACO_COMPRESSION_MESH_MESH_EDGEBREAKER_SHARED_H_
17
+
18
+ #include <stdint.h>
19
+
20
+ namespace draco {
21
+
22
+ // Shared declarations used by both edgebreaker encoder and decoder.
23
+
24
+ // A variable length encoding for storing all possible topology configurations
25
+ // during traversal of mesh's surface. The configurations are based on visited
26
+ // state of neighboring triangles around a currently processed face corner.
27
+ // Note that about half of the encountered configurations is expected to be of
28
+ // type TOPOLOGY_C. It's guaranteed that the encoding will use at most 2 bits
29
+ // per triangle for meshes with no holes and up to 6 bits per triangle for
30
+ // general meshes. In addition, the encoding will take up to 4 bits per triangle
31
+ // for each non-position attribute attached to the mesh.
32
+ //
33
+ // *-------* *-------* *-------*
34
+ // / \ / \ / \ / \ / \ / \
35
+ // / \ / \ / \ / \ / \ / \
36
+ // / \ / \ / \ / \ / \ / \
37
+ // *-------v-------* *-------v-------* *-------v-------*
38
+ // \ /x\ / /x\ / \ /x\
39
+ // \ / \ / / \ / \ / \
40
+ // \ / C \ / / L \ / \ / R \
41
+ // *-------* *-------* *-------*
42
+ //
43
+ // * *
44
+ // / \ / \
45
+ // / \ / \
46
+ // / \ / \
47
+ // *-------v-------* v
48
+ // \ /x\ / /x\
49
+ // \ / \ / / \
50
+ // \ / S \ / / E \
51
+ // *-------* *-------*
52
+ //
53
+ enum EdgebreakerTopologyBitPattern {
54
+ TOPOLOGY_C = 0x0, // 0
55
+ TOPOLOGY_S = 0x1, // 1 0 0
56
+ TOPOLOGY_L = 0x3, // 1 1 0
57
+ TOPOLOGY_R = 0x5, // 1 0 1
58
+ TOPOLOGY_E = 0x7, // 1 1 1
59
+ // A special symbol that's not actually encoded, but it can be used to mark
60
+ // the initial face that triggers the mesh encoding of a single connected
61
+ // component.
62
+ TOPOLOGY_INIT_FACE,
63
+ // A special value used to indicate an invalid symbol.
64
+ TOPOLOGY_INVALID
65
+ };
66
+
67
+ enum EdgebreakerSymbol {
68
+ EDGEBREAKER_SYMBOL_C = 0,
69
+ EDGEBREAKER_SYMBOL_S,
70
+ EDGEBREAKER_SYMBOL_L,
71
+ EDGEBREAKER_SYMBOL_R,
72
+ EDGEBREAKER_SYMBOL_E,
73
+ EDGEBREAKER_SYMBOL_INVALID
74
+ };
75
+
76
+ // Bit-length of symbols in the EdgebreakerTopologyBitPattern stored as a
77
+ // lookup table for faster indexing.
78
+ constexpr int32_t edge_breaker_topology_bit_pattern_length[] = {1, 3, 0, 3,
79
+ 0, 3, 0, 3};
80
+
81
+ // Zero-indexed symbol id for each of topology pattern.
82
+ constexpr EdgebreakerSymbol edge_breaker_topology_to_symbol_id[] = {
83
+ EDGEBREAKER_SYMBOL_C, EDGEBREAKER_SYMBOL_S,
84
+ EDGEBREAKER_SYMBOL_INVALID, EDGEBREAKER_SYMBOL_L,
85
+ EDGEBREAKER_SYMBOL_INVALID, EDGEBREAKER_SYMBOL_R,
86
+ EDGEBREAKER_SYMBOL_INVALID, EDGEBREAKER_SYMBOL_E};
87
+
88
+ // Reverse mapping between symbol id and topology pattern symbol.
89
+ constexpr EdgebreakerTopologyBitPattern edge_breaker_symbol_to_topology_id[] = {
90
+ TOPOLOGY_C, TOPOLOGY_S, TOPOLOGY_L, TOPOLOGY_R, TOPOLOGY_E};
91
+
92
+ // Types of edges used during mesh traversal relative to the tip vertex of a
93
+ // visited triangle.
94
+ enum EdgeFaceName : uint8_t { LEFT_FACE_EDGE = 0, RIGHT_FACE_EDGE = 1 };
95
+
96
+ // Struct used for storing data about a source face that connects to an
97
+ // already traversed face that was either the initial face or a face encoded
98
+ // with either topology S (split) symbol. Such connection can be only caused by
99
+ // topology changes on the traversed surface (if its genus != 0, i.e. when the
100
+ // surface has topological handles or holes).
101
+ // For each occurrence of such event we always encode the split symbol id,
102
+ // source symbol id and source edge id (left, or right). There will be always
103
+ // exactly two occurrences of this event for every topological handle on the
104
+ // traversed mesh and one occurrence for a hole.
105
+ struct TopologySplitEventData {
106
+ uint32_t split_symbol_id;
107
+ uint32_t source_symbol_id;
108
+ // We need to use uint32_t instead of EdgeFaceName because the most recent
109
+ // version of gcc does not allow that when optimizations are turned on.
110
+ uint32_t source_edge : 1;
111
+ };
112
+
113
+ // Hole event is used to store info about the first symbol that reached a
114
+ // vertex of so far unvisited hole. This can happen only on either the initial
115
+ // face or during a regular traversal when TOPOLOGY_S is encountered.
116
+ struct HoleEventData {
117
+ int32_t symbol_id;
118
+ HoleEventData() : symbol_id(0) {}
119
+ explicit HoleEventData(int32_t sym_id) : symbol_id(sym_id) {}
120
+ };
121
+
122
+ // List of supported modes for valence based edgebreaker coding.
123
+ enum EdgebreakerValenceCodingMode {
124
+ EDGEBREAKER_VALENCE_MODE_2_7 = 0, // Use contexts for valences in range 2-7.
125
+ };
126
+
127
+ } // namespace draco
128
+
129
+ #endif // DRACO_COMPRESSION_MESH_MESH_EDGEBREAKER_SHARED_H_
@@ -0,0 +1,201 @@
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_MESH_MESH_EDGEBREAKER_TRAVERSAL_DECODER_H_
16
+ #define DRACO_COMPRESSION_MESH_MESH_EDGEBREAKER_TRAVERSAL_DECODER_H_
17
+
18
+ #include "draco/compression/bit_coders/rans_bit_decoder.h"
19
+ #include "draco/compression/mesh/mesh_edgebreaker_decoder.h"
20
+ #include "draco/compression/mesh/mesh_edgebreaker_decoder_impl_interface.h"
21
+ #include "draco/compression/mesh/mesh_edgebreaker_shared.h"
22
+ #include "draco/draco_features.h"
23
+
24
+ namespace draco {
25
+
26
+ typedef RAnsBitDecoder BinaryDecoder;
27
+
28
+ // Default implementation of the edgebreaker traversal decoder that reads the
29
+ // traversal data directly from a buffer.
30
+ class MeshEdgebreakerTraversalDecoder {
31
+ public:
32
+ MeshEdgebreakerTraversalDecoder()
33
+ : attribute_connectivity_decoders_(nullptr),
34
+ num_attribute_data_(0),
35
+ decoder_impl_(nullptr) {}
36
+ void Init(MeshEdgebreakerDecoderImplInterface *decoder) {
37
+ decoder_impl_ = decoder;
38
+ buffer_.Init(decoder->GetDecoder()->buffer()->data_head(),
39
+ decoder->GetDecoder()->buffer()->remaining_size(),
40
+ decoder->GetDecoder()->buffer()->bitstream_version());
41
+ }
42
+
43
+ // Returns the Draco bitstream version.
44
+ uint16_t BitstreamVersion() const {
45
+ return decoder_impl_->GetDecoder()->bitstream_version();
46
+ }
47
+
48
+ // Used to tell the decoder what is the number of expected decoded vertices.
49
+ // Ignored by default.
50
+ void SetNumEncodedVertices(int /* num_vertices */) {}
51
+
52
+ // Set the number of non-position attribute data for which we need to decode
53
+ // the connectivity.
54
+ void SetNumAttributeData(int num_data) { num_attribute_data_ = num_data; }
55
+
56
+ // Called before the traversal decoding is started.
57
+ // Returns a buffer decoder that points to data that was encoded after the
58
+ // traversal.
59
+ bool Start(DecoderBuffer *out_buffer) {
60
+ // Decode symbols from the main buffer decoder and face configurations from
61
+ // the start_face_buffer decoder.
62
+ if (!DecodeTraversalSymbols()) {
63
+ return false;
64
+ }
65
+
66
+ if (!DecodeStartFaces()) {
67
+ return false;
68
+ }
69
+
70
+ if (!DecodeAttributeSeams()) {
71
+ return false;
72
+ }
73
+ *out_buffer = buffer_;
74
+ return true;
75
+ }
76
+
77
+ // Returns the configuration of a new initial face.
78
+ inline bool DecodeStartFaceConfiguration() {
79
+ uint32_t face_configuration;
80
+ #ifdef DRACO_BACKWARDS_COMPATIBILITY_SUPPORTED
81
+ if (buffer_.bitstream_version() < DRACO_BITSTREAM_VERSION(2, 2)) {
82
+ start_face_buffer_.DecodeLeastSignificantBits32(1, &face_configuration);
83
+
84
+ } else
85
+ #endif
86
+ {
87
+ face_configuration = start_face_decoder_.DecodeNextBit();
88
+ }
89
+ return face_configuration;
90
+ }
91
+
92
+ // Returns the next edgebreaker symbol that was reached during the traversal.
93
+ inline uint32_t DecodeSymbol() {
94
+ uint32_t symbol;
95
+ symbol_buffer_.DecodeLeastSignificantBits32(1, &symbol);
96
+ if (symbol == TOPOLOGY_C) {
97
+ return symbol;
98
+ }
99
+ // Else decode two additional bits.
100
+ uint32_t symbol_suffix;
101
+ symbol_buffer_.DecodeLeastSignificantBits32(2, &symbol_suffix);
102
+ symbol |= (symbol_suffix << 1);
103
+ return symbol;
104
+ }
105
+
106
+ // Called whenever a new active corner is set in the decoder.
107
+ inline void NewActiveCornerReached(CornerIndex /* corner */) {}
108
+
109
+ // Called whenever |source| vertex is about to be merged into the |dest|
110
+ // vertex.
111
+ inline void MergeVertices(VertexIndex /* dest */, VertexIndex /* source */) {}
112
+
113
+ // Returns true if there is an attribute seam for the next processed pair
114
+ // of visited faces.
115
+ // |attribute| is used to mark the id of the non-position attribute (in range
116
+ // of <0, num_attributes - 1>).
117
+ inline bool DecodeAttributeSeam(int attribute) {
118
+ return attribute_connectivity_decoders_[attribute].DecodeNextBit();
119
+ }
120
+
121
+ // Called when the traversal is finished.
122
+ void Done() {
123
+ if (symbol_buffer_.bit_decoder_active()) {
124
+ symbol_buffer_.EndBitDecoding();
125
+ }
126
+ #ifdef DRACO_BACKWARDS_COMPATIBILITY_SUPPORTED
127
+ if (buffer_.bitstream_version() < DRACO_BITSTREAM_VERSION(2, 2)) {
128
+ start_face_buffer_.EndBitDecoding();
129
+
130
+ } else
131
+ #endif
132
+ {
133
+ start_face_decoder_.EndDecoding();
134
+ }
135
+ }
136
+
137
+ protected:
138
+ DecoderBuffer *buffer() { return &buffer_; }
139
+
140
+ bool DecodeTraversalSymbols() {
141
+ uint64_t traversal_size;
142
+ symbol_buffer_ = buffer_;
143
+ if (!symbol_buffer_.StartBitDecoding(true, &traversal_size)) {
144
+ return false;
145
+ }
146
+ buffer_ = symbol_buffer_;
147
+ if (traversal_size > static_cast<uint64_t>(buffer_.remaining_size())) {
148
+ return false;
149
+ }
150
+ buffer_.Advance(traversal_size);
151
+ return true;
152
+ }
153
+
154
+ bool DecodeStartFaces() {
155
+ // Create a decoder that is set to the end of the encoded traversal data.
156
+ #ifdef DRACO_BACKWARDS_COMPATIBILITY_SUPPORTED
157
+ if (buffer_.bitstream_version() < DRACO_BITSTREAM_VERSION(2, 2)) {
158
+ start_face_buffer_ = buffer_;
159
+ uint64_t traversal_size;
160
+ if (!start_face_buffer_.StartBitDecoding(true, &traversal_size)) {
161
+ return false;
162
+ }
163
+ buffer_ = start_face_buffer_;
164
+ if (traversal_size > static_cast<uint64_t>(buffer_.remaining_size())) {
165
+ return false;
166
+ }
167
+ buffer_.Advance(traversal_size);
168
+ return true;
169
+ }
170
+ #endif
171
+ return start_face_decoder_.StartDecoding(&buffer_);
172
+ }
173
+
174
+ bool DecodeAttributeSeams() {
175
+ // Prepare attribute decoding.
176
+ if (num_attribute_data_ > 0) {
177
+ attribute_connectivity_decoders_ = std::unique_ptr<BinaryDecoder[]>(
178
+ new BinaryDecoder[num_attribute_data_]);
179
+ for (int i = 0; i < num_attribute_data_; ++i) {
180
+ if (!attribute_connectivity_decoders_[i].StartDecoding(&buffer_)) {
181
+ return false;
182
+ }
183
+ }
184
+ }
185
+ return true;
186
+ }
187
+
188
+ private:
189
+ // Buffer that contains the encoded data.
190
+ DecoderBuffer buffer_;
191
+ DecoderBuffer symbol_buffer_;
192
+ BinaryDecoder start_face_decoder_;
193
+ DecoderBuffer start_face_buffer_;
194
+ std::unique_ptr<BinaryDecoder[]> attribute_connectivity_decoders_;
195
+ int num_attribute_data_;
196
+ const MeshEdgebreakerDecoderImplInterface *decoder_impl_;
197
+ };
198
+
199
+ } // namespace draco
200
+
201
+ #endif // DRACO_COMPRESSION_MESH_MESH_EDGEBREAKER_TRAVERSAL_DECODER_H_