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,249 @@
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_CONFIG_DRACO_OPTIONS_H_
16
+ #define DRACO_COMPRESSION_CONFIG_DRACO_OPTIONS_H_
17
+
18
+ #include <map>
19
+ #include <memory>
20
+
21
+ #include "draco/core/options.h"
22
+
23
+ namespace draco {
24
+
25
+ // Base option class used to control encoding and decoding. The geometry coding
26
+ // can be controlled through the following options:
27
+ // 1. Global options - Options specific to overall geometry or options common
28
+ // for all attributes
29
+ // 2. Per attribute options - Options specific to a given attribute.
30
+ // Each attribute is identified by the template
31
+ // argument AttributeKeyT that can be for example
32
+ // the attribute type or the attribute id.
33
+ //
34
+ // Example:
35
+ //
36
+ // DracoOptions<AttributeKey> options;
37
+ //
38
+ // // Set an option common for all attributes.
39
+ // options.SetGlobalInt("some_option_name", 2);
40
+ //
41
+ // // Geometry with two attributes.
42
+ // AttributeKey att_key0 = in_key0;
43
+ // AttributeKey att_key1 = in_key1;
44
+ //
45
+ // options.SetAttributeInt(att_key0, "some_option_name", 3);
46
+ //
47
+ // options.GetAttributeInt(att_key0, "some_option_name"); // Returns 3
48
+ // options.GetAttributeInt(att_key1, "some_option_name"); // Returns 2
49
+ // options.GetGlobalInt("some_option_name"); // Returns 2
50
+ //
51
+ template <typename AttributeKeyT>
52
+ class DracoOptions {
53
+ public:
54
+ typedef AttributeKeyT AttributeKey;
55
+
56
+ // Get an option for a specific attribute key. If the option is not found in
57
+ // an attribute specific storage, the implementation will return a global
58
+ // option of the given name (if available). If the option is not found, the
59
+ // provided default value |default_val| is returned instead.
60
+ int GetAttributeInt(const AttributeKey &att_key, const std::string &name,
61
+ int default_val) const;
62
+
63
+ // Sets an option for a specific attribute key.
64
+ void SetAttributeInt(const AttributeKey &att_key, const std::string &name,
65
+ int val);
66
+
67
+ float GetAttributeFloat(const AttributeKey &att_key, const std::string &name,
68
+ float default_val) const;
69
+ void SetAttributeFloat(const AttributeKey &att_key, const std::string &name,
70
+ float val);
71
+ bool GetAttributeBool(const AttributeKey &att_key, const std::string &name,
72
+ bool default_val) const;
73
+ void SetAttributeBool(const AttributeKey &att_key, const std::string &name,
74
+ bool val);
75
+ template <typename DataTypeT>
76
+ bool GetAttributeVector(const AttributeKey &att_key, const std::string &name,
77
+ int num_dims, DataTypeT *val) const;
78
+ template <typename DataTypeT>
79
+ void SetAttributeVector(const AttributeKey &att_key, const std::string &name,
80
+ int num_dims, const DataTypeT *val);
81
+
82
+ bool IsAttributeOptionSet(const AttributeKey &att_key,
83
+ const std::string &name) const;
84
+
85
+ // Gets/sets a global option that is not specific to any attribute.
86
+ int GetGlobalInt(const std::string &name, int default_val) const {
87
+ return global_options_.GetInt(name, default_val);
88
+ }
89
+ void SetGlobalInt(const std::string &name, int val) {
90
+ global_options_.SetInt(name, val);
91
+ }
92
+ float GetGlobalFloat(const std::string &name, float default_val) const {
93
+ return global_options_.GetFloat(name, default_val);
94
+ }
95
+ void SetGlobalFloat(const std::string &name, float val) {
96
+ global_options_.SetFloat(name, val);
97
+ }
98
+ bool GetGlobalBool(const std::string &name, bool default_val) const {
99
+ return global_options_.GetBool(name, default_val);
100
+ }
101
+ void SetGlobalBool(const std::string &name, bool val) {
102
+ global_options_.SetBool(name, val);
103
+ }
104
+ template <typename DataTypeT>
105
+ bool GetGlobalVector(const std::string &name, int num_dims,
106
+ DataTypeT *val) const {
107
+ return global_options_.GetVector(name, num_dims, val);
108
+ }
109
+ template <typename DataTypeT>
110
+ void SetGlobalVector(const std::string &name, int num_dims,
111
+ const DataTypeT *val) {
112
+ global_options_.SetVector(name, val, num_dims);
113
+ }
114
+ bool IsGlobalOptionSet(const std::string &name) const {
115
+ return global_options_.IsOptionSet(name);
116
+ }
117
+
118
+ // Sets or replaces attribute options with the provided |options|.
119
+ void SetAttributeOptions(const AttributeKey &att_key, const Options &options);
120
+ void SetGlobalOptions(const Options &options) { global_options_ = options; }
121
+
122
+ // Returns |Options| instance for the specified options class if it exists.
123
+ const Options *FindAttributeOptions(const AttributeKeyT &att_key) const;
124
+ const Options &GetGlobalOptions() const { return global_options_; }
125
+
126
+ private:
127
+ Options *GetAttributeOptions(const AttributeKeyT &att_key);
128
+
129
+ Options global_options_;
130
+
131
+ // Storage for options related to geometry attributes.
132
+ std::map<AttributeKey, Options> attribute_options_;
133
+ };
134
+
135
+ template <typename AttributeKeyT>
136
+ const Options *DracoOptions<AttributeKeyT>::FindAttributeOptions(
137
+ const AttributeKeyT &att_key) const {
138
+ auto it = attribute_options_.find(att_key);
139
+ if (it == attribute_options_.end()) {
140
+ return nullptr;
141
+ }
142
+ return &it->second;
143
+ }
144
+
145
+ template <typename AttributeKeyT>
146
+ Options *DracoOptions<AttributeKeyT>::GetAttributeOptions(
147
+ const AttributeKeyT &att_key) {
148
+ auto it = attribute_options_.find(att_key);
149
+ if (it != attribute_options_.end()) {
150
+ return &it->second;
151
+ }
152
+ Options new_options;
153
+ it = attribute_options_.insert(std::make_pair(att_key, new_options)).first;
154
+ return &it->second;
155
+ }
156
+
157
+ template <typename AttributeKeyT>
158
+ int DracoOptions<AttributeKeyT>::GetAttributeInt(const AttributeKeyT &att_key,
159
+ const std::string &name,
160
+ int default_val) const {
161
+ const Options *const att_options = FindAttributeOptions(att_key);
162
+ if (att_options && att_options->IsOptionSet(name)) {
163
+ return att_options->GetInt(name, default_val);
164
+ }
165
+ return global_options_.GetInt(name, default_val);
166
+ }
167
+
168
+ template <typename AttributeKeyT>
169
+ void DracoOptions<AttributeKeyT>::SetAttributeInt(const AttributeKeyT &att_key,
170
+ const std::string &name,
171
+ int val) {
172
+ GetAttributeOptions(att_key)->SetInt(name, val);
173
+ }
174
+
175
+ template <typename AttributeKeyT>
176
+ float DracoOptions<AttributeKeyT>::GetAttributeFloat(
177
+ const AttributeKeyT &att_key, const std::string &name,
178
+ float default_val) const {
179
+ const Options *const att_options = FindAttributeOptions(att_key);
180
+ if (att_options && att_options->IsOptionSet(name)) {
181
+ return att_options->GetFloat(name, default_val);
182
+ }
183
+ return global_options_.GetFloat(name, default_val);
184
+ }
185
+
186
+ template <typename AttributeKeyT>
187
+ void DracoOptions<AttributeKeyT>::SetAttributeFloat(
188
+ const AttributeKeyT &att_key, const std::string &name, float val) {
189
+ GetAttributeOptions(att_key)->SetFloat(name, val);
190
+ }
191
+
192
+ template <typename AttributeKeyT>
193
+ bool DracoOptions<AttributeKeyT>::GetAttributeBool(const AttributeKeyT &att_key,
194
+ const std::string &name,
195
+ bool default_val) const {
196
+ const Options *const att_options = FindAttributeOptions(att_key);
197
+ if (att_options && att_options->IsOptionSet(name)) {
198
+ return att_options->GetBool(name, default_val);
199
+ }
200
+ return global_options_.GetBool(name, default_val);
201
+ }
202
+
203
+ template <typename AttributeKeyT>
204
+ void DracoOptions<AttributeKeyT>::SetAttributeBool(const AttributeKeyT &att_key,
205
+ const std::string &name,
206
+ bool val) {
207
+ GetAttributeOptions(att_key)->SetBool(name, val);
208
+ }
209
+
210
+ template <typename AttributeKeyT>
211
+ template <typename DataTypeT>
212
+ bool DracoOptions<AttributeKeyT>::GetAttributeVector(
213
+ const AttributeKey &att_key, const std::string &name, int num_dims,
214
+ DataTypeT *val) const {
215
+ const Options *const att_options = FindAttributeOptions(att_key);
216
+ if (att_options && att_options->IsOptionSet(name)) {
217
+ return att_options->GetVector(name, num_dims, val);
218
+ }
219
+ return global_options_.GetVector(name, num_dims, val);
220
+ }
221
+
222
+ template <typename AttributeKeyT>
223
+ template <typename DataTypeT>
224
+ void DracoOptions<AttributeKeyT>::SetAttributeVector(
225
+ const AttributeKey &att_key, const std::string &name, int num_dims,
226
+ const DataTypeT *val) {
227
+ GetAttributeOptions(att_key)->SetVector(name, val, num_dims);
228
+ }
229
+
230
+ template <typename AttributeKeyT>
231
+ bool DracoOptions<AttributeKeyT>::IsAttributeOptionSet(
232
+ const AttributeKey &att_key, const std::string &name) const {
233
+ const Options *const att_options = FindAttributeOptions(att_key);
234
+ if (att_options) {
235
+ return att_options->IsOptionSet(name);
236
+ }
237
+ return global_options_.IsOptionSet(name);
238
+ }
239
+
240
+ template <typename AttributeKeyT>
241
+ void DracoOptions<AttributeKeyT>::SetAttributeOptions(
242
+ const AttributeKey &att_key, const Options &options) {
243
+ Options *att_options = GetAttributeOptions(att_key);
244
+ *att_options = options;
245
+ }
246
+
247
+ } // namespace draco
248
+
249
+ #endif // DRACO_COMPRESSION_CONFIG_DRACO_OPTIONS_H_
@@ -0,0 +1,101 @@
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_CONFIG_ENCODER_OPTIONS_H_
16
+ #define DRACO_COMPRESSION_CONFIG_ENCODER_OPTIONS_H_
17
+
18
+ #include "draco/attributes/geometry_attribute.h"
19
+ #include "draco/compression/config/draco_options.h"
20
+ #include "draco/compression/config/encoding_features.h"
21
+ #include "draco/draco_features.h"
22
+
23
+ namespace draco {
24
+
25
+ // EncoderOptions allow users to specify so called feature options that are used
26
+ // to inform the encoder which encoding features can be used (i.e. which
27
+ // features are going to be available to the decoder).
28
+ template <typename AttributeKeyT>
29
+ class EncoderOptionsBase : public DracoOptions<AttributeKeyT> {
30
+ public:
31
+ static EncoderOptionsBase CreateDefaultOptions() {
32
+ EncoderOptionsBase options;
33
+ #ifdef DRACO_STANDARD_EDGEBREAKER_SUPPORTED
34
+ options.SetSupportedFeature(features::kEdgebreaker, true);
35
+ #endif
36
+ #ifdef DRACO_PREDICTIVE_EDGEBREAKER_SUPPORTED
37
+ options.SetSupportedFeature(features::kPredictiveEdgebreaker, true);
38
+ #endif
39
+ return options;
40
+ }
41
+ static EncoderOptionsBase CreateEmptyOptions() {
42
+ return EncoderOptionsBase();
43
+ }
44
+
45
+ // Returns speed options with default value of 5.
46
+ int GetEncodingSpeed() const {
47
+ return this->GetGlobalInt("encoding_speed", 5);
48
+ }
49
+ int GetDecodingSpeed() const {
50
+ return this->GetGlobalInt("decoding_speed", 5);
51
+ }
52
+
53
+ // Returns the maximum speed for both encoding/decoding.
54
+ int GetSpeed() const {
55
+ const int encoding_speed = this->GetGlobalInt("encoding_speed", -1);
56
+ const int decoding_speed = this->GetGlobalInt("decoding_speed", -1);
57
+ const int max_speed = std::max(encoding_speed, decoding_speed);
58
+ if (max_speed == -1) {
59
+ return 5; // Default value.
60
+ }
61
+ return max_speed;
62
+ }
63
+
64
+ void SetSpeed(int encoding_speed, int decoding_speed) {
65
+ this->SetGlobalInt("encoding_speed", encoding_speed);
66
+ this->SetGlobalInt("decoding_speed", decoding_speed);
67
+ }
68
+ bool IsSpeedSet() const {
69
+ return this->IsGlobalOptionSet("encoding_speed") ||
70
+ this->IsGlobalOptionSet("decoding_speed");
71
+ }
72
+
73
+ // Sets a given feature as supported or unsupported by the target decoder.
74
+ // Encoder will always use only supported features when encoding the input
75
+ // geometry.
76
+ void SetSupportedFeature(const std::string &name, bool supported) {
77
+ feature_options_.SetBool(name, supported);
78
+ }
79
+ bool IsFeatureSupported(const std::string &name) const {
80
+ return feature_options_.GetBool(name);
81
+ }
82
+
83
+ void SetFeatureOptions(const Options &options) { feature_options_ = options; }
84
+ const Options &GetFeaturelOptions() const { return feature_options_; }
85
+
86
+ private:
87
+ // Use helper methods to construct the encoder options.
88
+ // See CreateDefaultOptions();
89
+ EncoderOptionsBase() {}
90
+
91
+ // List of supported/unsupported features that can be used by the encoder.
92
+ Options feature_options_;
93
+ };
94
+
95
+ // Encoder options where attributes are identified by their attribute id.
96
+ // Used to set options that are specific to a given geometry.
97
+ typedef EncoderOptionsBase<int32_t> EncoderOptions;
98
+
99
+ } // namespace draco
100
+
101
+ #endif // DRACO_COMPRESSION_CONFIG_ENCODER_OPTIONS_H_
@@ -0,0 +1,39 @@
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
+ // File provides helpful macros that define features available for encoding
16
+ // the input of the input geometry. These macros can be used as an input in
17
+ // the EncoderOptions::SetSupportedFeature() method instead of the text.
18
+ // The most recent set of features supported
19
+ // by the default implementation is:
20
+ //
21
+ // kEdgebreaker
22
+ // - edgebreaker method for encoding meshes.
23
+ // kPredictiveEdgebreaker
24
+ // - advanced version of the edgebreaker method (slower but better
25
+ // compression).
26
+ //
27
+ #ifndef DRACO_COMPRESSION_CONFIG_ENCODING_FEATURES_H_
28
+ #define DRACO_COMPRESSION_CONFIG_ENCODING_FEATURES_H_
29
+
30
+ namespace draco {
31
+ namespace features {
32
+
33
+ constexpr const char *kEdgebreaker = "standard_edgebreaker";
34
+ constexpr const char *kPredictiveEdgebreaker = "predictive_edgebreaker";
35
+
36
+ } // namespace features
37
+ } // namespace draco
38
+
39
+ #endif // DRACO_COMPRESSION_CONFIG_ENCODING_FEATURES_H_
@@ -0,0 +1,80 @@
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_DECODE_H_
16
+ #define DRACO_COMPRESSION_DECODE_H_
17
+
18
+ #include "draco/compression/config/compression_shared.h"
19
+ #include "draco/compression/config/decoder_options.h"
20
+ #include "draco/core/decoder_buffer.h"
21
+ #include "draco/core/status_or.h"
22
+ #include "draco/draco_features.h"
23
+ #include "draco/mesh/mesh.h"
24
+
25
+ namespace draco {
26
+
27
+ // Class responsible for decoding of meshes and point clouds that were
28
+ // compressed by a Draco encoder.
29
+ class Decoder {
30
+ public:
31
+ // Returns the geometry type encoded in the input |in_buffer|.
32
+ // The return value is one of POINT_CLOUD, MESH or INVALID_GEOMETRY in case
33
+ // the input data is invalid.
34
+ // The decoded geometry type can be used to choose an appropriate decoding
35
+ // function for a given geometry type (see below).
36
+ static StatusOr<EncodedGeometryType> GetEncodedGeometryType(
37
+ DecoderBuffer *in_buffer);
38
+
39
+ // Decodes point cloud from the provided buffer. The buffer must be filled
40
+ // with data that was encoded with either the EncodePointCloudToBuffer or
41
+ // EncodeMeshToBuffer methods in encode.h. In case the input buffer contains
42
+ // mesh, the returned instance can be down-casted to Mesh.
43
+ StatusOr<std::unique_ptr<PointCloud>> DecodePointCloudFromBuffer(
44
+ DecoderBuffer *in_buffer);
45
+
46
+ // Decodes a triangular mesh from the provided buffer. The mesh must be filled
47
+ // with data that was encoded using the EncodeMeshToBuffer method in encode.h.
48
+ // The function will return nullptr in case the input is invalid or if it was
49
+ // encoded with the EncodePointCloudToBuffer method.
50
+ StatusOr<std::unique_ptr<Mesh>> DecodeMeshFromBuffer(
51
+ DecoderBuffer *in_buffer);
52
+
53
+ // Decodes the buffer into a provided geometry. If the geometry is
54
+ // incompatible with the encoded data. For example, when |out_geometry| is
55
+ // draco::Mesh while the data contains a point cloud, the function will return
56
+ // an error status.
57
+ Status DecodeBufferToGeometry(DecoderBuffer *in_buffer,
58
+ PointCloud *out_geometry);
59
+ Status DecodeBufferToGeometry(DecoderBuffer *in_buffer, Mesh *out_geometry);
60
+
61
+ // When set, the decoder is going to skip attribute transform for a given
62
+ // attribute type. For example for quantized attributes, the decoder would
63
+ // skip the dequantization step and the returned geometry would contain an
64
+ // attribute with quantized values. The attribute would also contain an
65
+ // instance of AttributeTransform class that is used to describe the skipped
66
+ // transform, including all parameters that are needed to perform the
67
+ // transform manually.
68
+ void SetSkipAttributeTransform(GeometryAttribute::Type att_type);
69
+
70
+ // Returns the options instance used by the decoder that can be used by users
71
+ // to control the decoding process.
72
+ DecoderOptions *options() { return &options_; }
73
+
74
+ private:
75
+ DecoderOptions options_;
76
+ };
77
+
78
+ } // namespace draco
79
+
80
+ #endif // DRACO_COMPRESSION_DECODE_H_
@@ -0,0 +1,141 @@
1
+ // Copyright 2019 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_DRACO_COMPRESSION_OPTIONS_H_
16
+ #define DRACO_COMPRESSION_DRACO_COMPRESSION_OPTIONS_H_
17
+
18
+ #include "draco/draco_features.h"
19
+
20
+ #ifdef DRACO_TRANSCODER_SUPPORTED
21
+ #include "draco/core/status.h"
22
+
23
+ namespace draco {
24
+
25
+ // Quantization options for positions. Currently there are two modes for
26
+ // quantizing positions:
27
+ //
28
+ // 1. Quantization bits:
29
+ // - User defined number of quantization bits that is evenly distributed
30
+ // to cover the compressed geometry.
31
+ // 2. Grid:
32
+ // - Positions are snapped to a global grid defined by grid spacing.
33
+ // - This method is primarily intended to be used when the location of
34
+ // quantized vertices needs to be consistent between multiple
35
+ // geometries.
36
+ class SpatialQuantizationOptions {
37
+ public:
38
+ explicit SpatialQuantizationOptions(int quantization_bits);
39
+
40
+ // Sets quantization bits that are going to be used for the compressed
41
+ // geometry. If the geometry is a scene, the same number of quantization bits
42
+ // is going to be applied to each mesh of the scene. Quantized values are
43
+ // going to be distributed within the bounds of individual meshes.
44
+ void SetQuantizationBits(int quantization_bits);
45
+
46
+ // If this returns true, quantization_bits() should be used to get the
47
+ // desired number of quantization bits for compression. Otherwise the grid
48
+ // mode is selected and spacing() should be used to get the desired grid
49
+ // spacing.
50
+ bool AreQuantizationBitsDefined() const;
51
+ const int quantization_bits() const { return quantization_bits_; }
52
+
53
+ // Defines quantization grid used for the compressed geometry. All vertices
54
+ // are going to be snapped to the nearest grid vertex that corresponds to an
55
+ // integer quantized position. |spacing| defines the distance between two grid
56
+ // vertices. E.g. a grid with |spacing| = 10 would have grid vertices at
57
+ // locations {10 * i, 10 * j, 10 * k} where i, j, k are integer numbers.
58
+ SpatialQuantizationOptions &SetGrid(float spacing);
59
+
60
+ const float spacing() const { return spacing_; }
61
+
62
+ bool operator==(const SpatialQuantizationOptions &other) const;
63
+
64
+ private:
65
+ enum Mode { LOCAL_QUANTIZATION_BITS, GLOBAL_GRID };
66
+ Mode mode_ = LOCAL_QUANTIZATION_BITS;
67
+ int quantization_bits_; // Default quantization bits for positions.
68
+ float spacing_ = 0.f;
69
+ };
70
+
71
+ // TODO(fgalligan): Add support for unified_position_quantization.
72
+ // Struct to hold Draco compression options.
73
+ struct DracoCompressionOptions {
74
+ int compression_level = 7; // compression level [0-10], most=10, least=0.
75
+ SpatialQuantizationOptions quantization_position{11};
76
+ int quantization_bits_normal = 8;
77
+ int quantization_bits_tex_coord = 10;
78
+ int quantization_bits_color = 8;
79
+ int quantization_bits_generic = 8;
80
+ int quantization_bits_tangent = 8;
81
+ int quantization_bits_weight = 8;
82
+ bool find_non_degenerate_texture_quantization = false;
83
+
84
+ bool operator==(const DracoCompressionOptions &other) const {
85
+ return compression_level == other.compression_level &&
86
+ quantization_position == other.quantization_position &&
87
+ quantization_bits_normal == other.quantization_bits_normal &&
88
+ quantization_bits_tex_coord == other.quantization_bits_tex_coord &&
89
+ quantization_bits_color == other.quantization_bits_color &&
90
+ quantization_bits_generic == other.quantization_bits_generic &&
91
+ quantization_bits_tangent == other.quantization_bits_tangent &&
92
+ quantization_bits_weight == other.quantization_bits_weight &&
93
+ find_non_degenerate_texture_quantization ==
94
+ other.find_non_degenerate_texture_quantization;
95
+ }
96
+
97
+ bool operator!=(const DracoCompressionOptions &other) const {
98
+ return !(*this == other);
99
+ }
100
+
101
+ Status Check() const {
102
+ DRACO_RETURN_IF_ERROR(
103
+ Validate("Compression level", compression_level, 0, 10));
104
+ if (quantization_position.AreQuantizationBitsDefined()) {
105
+ DRACO_RETURN_IF_ERROR(Validate("Position quantization",
106
+ quantization_position.quantization_bits(),
107
+ 0, 30));
108
+ } else {
109
+ if (quantization_position.spacing() <= 0.f) {
110
+ return ErrorStatus("Position quantization spacing is invalid.");
111
+ }
112
+ }
113
+ DRACO_RETURN_IF_ERROR(
114
+ Validate("Normals quantization", quantization_bits_normal, 0, 30));
115
+ DRACO_RETURN_IF_ERROR(
116
+ Validate("Tex coord quantization", quantization_bits_tex_coord, 0, 30));
117
+ DRACO_RETURN_IF_ERROR(
118
+ Validate("Color quantization", quantization_bits_color, 0, 30));
119
+ DRACO_RETURN_IF_ERROR(
120
+ Validate("Generic quantization", quantization_bits_generic, 0, 30));
121
+ DRACO_RETURN_IF_ERROR(
122
+ Validate("Tangent quantization", quantization_bits_tangent, 0, 30));
123
+ DRACO_RETURN_IF_ERROR(
124
+ Validate("Weights quantization", quantization_bits_weight, 0, 30));
125
+ return OkStatus();
126
+ }
127
+
128
+ static Status Validate(const std::string &name, int value, int min, int max) {
129
+ if (value < min || value > max) {
130
+ const std::string range =
131
+ "[" + std::to_string(min) + "-" + std::to_string(max) + "].";
132
+ return Status(Status::DRACO_ERROR, name + " is out of range " + range);
133
+ }
134
+ return OkStatus();
135
+ }
136
+ };
137
+
138
+ } // namespace draco
139
+
140
+ #endif // DRACO_TRANSCODER_SUPPORTED
141
+ #endif // DRACO_COMPRESSION_DRACO_COMPRESSION_OPTIONS_H_