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,139 @@
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_ENCODE_H_
16
+ #define DRACO_COMPRESSION_ENCODE_H_
17
+
18
+ #include "draco/compression/config/compression_shared.h"
19
+ #include "draco/compression/config/encoder_options.h"
20
+ #include "draco/compression/encode_base.h"
21
+ #include "draco/core/encoder_buffer.h"
22
+ #include "draco/core/status.h"
23
+ #include "draco/mesh/mesh.h"
24
+
25
+ namespace draco {
26
+
27
+ // Basic helper class for encoding geometry using the Draco compression library.
28
+ // The class provides various methods that can be used to control several common
29
+ // options used during the encoding, such as the number of quantization bits for
30
+ // a given attribute. All these options are defined per attribute type, i.e.,
31
+ // if there are more attributes of the same type (such as multiple texture
32
+ // coordinate attributes), the same options are going to be used for all of the
33
+ // attributes of this type. If different attributes of the same type need to
34
+ // use different options, use ExpertEncoder in expert_encode.h.
35
+ class Encoder
36
+ : public EncoderBase<EncoderOptionsBase<GeometryAttribute::Type>> {
37
+ public:
38
+ typedef EncoderBase<EncoderOptionsBase<GeometryAttribute::Type>> Base;
39
+
40
+ Encoder();
41
+ virtual ~Encoder() {}
42
+
43
+ // Encodes a point cloud to the provided buffer.
44
+ virtual Status EncodePointCloudToBuffer(const PointCloud &pc,
45
+ EncoderBuffer *out_buffer);
46
+
47
+ // Encodes a mesh to the provided buffer.
48
+ virtual Status EncodeMeshToBuffer(const Mesh &m, EncoderBuffer *out_buffer);
49
+
50
+ // Set encoder options used during the geometry encoding. Note that this call
51
+ // overwrites any modifications to the options done with the functions below,
52
+ // i.e., it resets the encoder.
53
+ void Reset(const EncoderOptionsBase<GeometryAttribute::Type> &options);
54
+ void Reset();
55
+
56
+ // Sets the desired encoding and decoding speed for the given options.
57
+ //
58
+ // 0 = slowest speed, but the best compression.
59
+ // 10 = fastest, but the worst compression.
60
+ // -1 = undefined.
61
+ //
62
+ // Note that both speed options affect the encoder choice of used methods and
63
+ // algorithms. For example, a requirement for fast decoding may prevent the
64
+ // encoder from using the best compression methods even if the encoding speed
65
+ // is set to 0. In general, the faster of the two options limits the choice of
66
+ // features that can be used by the encoder. Additionally, setting
67
+ // |decoding_speed| to be faster than the |encoding_speed| may allow the
68
+ // encoder to choose the optimal method out of the available features for the
69
+ // given |decoding_speed|.
70
+ void SetSpeedOptions(int encoding_speed, int decoding_speed);
71
+
72
+ // Sets the quantization compression options for a named attribute. The
73
+ // attribute values will be quantized in a box defined by the maximum extent
74
+ // of the attribute values. I.e., the actual precision of this option depends
75
+ // on the scale of the attribute values.
76
+ void SetAttributeQuantization(GeometryAttribute::Type type,
77
+ int quantization_bits);
78
+
79
+ // Sets the explicit quantization compression for a named attribute. The
80
+ // attribute values will be quantized in a coordinate system defined by the
81
+ // provided origin and range (the input values should be within interval:
82
+ // <origin, origin + range>).
83
+ void SetAttributeExplicitQuantization(GeometryAttribute::Type type,
84
+ int quantization_bits, int num_dims,
85
+ const float *origin, float range);
86
+
87
+ // Sets the desired prediction method for a given attribute. By default,
88
+ // prediction scheme is selected automatically by the encoder using other
89
+ // provided options (such as speed) and input geometry type (mesh, point
90
+ // cloud). This function should be called only when a specific prediction is
91
+ // preferred (e.g., when it is known that the encoder would select a less
92
+ // optimal prediction for the given input data).
93
+ //
94
+ // |prediction_scheme_method| should be one of the entries defined in
95
+ // compression/config/compression_shared.h :
96
+ //
97
+ // PREDICTION_NONE - use no prediction.
98
+ // PREDICTION_DIFFERENCE - delta coding
99
+ // MESH_PREDICTION_PARALLELOGRAM - parallelogram prediction for meshes.
100
+ // MESH_PREDICTION_CONSTRAINED_PARALLELOGRAM
101
+ // - better and more costly version of the parallelogram prediction.
102
+ // MESH_PREDICTION_TEX_COORDS_PORTABLE
103
+ // - specialized predictor for tex coordinates.
104
+ // MESH_PREDICTION_GEOMETRIC_NORMAL
105
+ // - specialized predictor for normal coordinates.
106
+ //
107
+ // Note that in case the desired prediction cannot be used, the default
108
+ // prediction will be automatically used instead.
109
+ Status SetAttributePredictionScheme(GeometryAttribute::Type type,
110
+ int prediction_scheme_method);
111
+
112
+ // Sets the desired encoding method for a given geometry. By default, encoding
113
+ // method is selected based on the properties of the input geometry and based
114
+ // on the other options selected in the used EncoderOptions (such as desired
115
+ // encoding and decoding speed). This function should be called only when a
116
+ // specific method is required.
117
+ //
118
+ // |encoding_method| can be one of the values defined in
119
+ // compression/config/compression_shared.h based on the type of the input
120
+ // geometry that is going to be encoded. For point clouds, allowed entries are
121
+ // POINT_CLOUD_SEQUENTIAL_ENCODING
122
+ // POINT_CLOUD_KD_TREE_ENCODING
123
+ //
124
+ // For meshes the input can be
125
+ // MESH_SEQUENTIAL_ENCODING
126
+ // MESH_EDGEBREAKER_ENCODING
127
+ //
128
+ // If the selected method cannot be used for the given input, the subsequent
129
+ // call of EncodePointCloudToBuffer or EncodeMeshToBuffer is going to fail.
130
+ void SetEncodingMethod(int encoding_method);
131
+
132
+ // Creates encoder options for the expert encoder used during the actual
133
+ // encoding.
134
+ EncoderOptions CreateExpertEncoderOptions(const PointCloud &pc) const;
135
+ };
136
+
137
+ } // namespace draco
138
+
139
+ #endif // DRACO_COMPRESSION_ENCODE_H_
@@ -0,0 +1,131 @@
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_ENCODE_BASE_H_
16
+ #define DRACO_COMPRESSION_ENCODE_BASE_H_
17
+
18
+ #include "draco/attributes/geometry_attribute.h"
19
+ #include "draco/compression/config/compression_shared.h"
20
+ #include "draco/core/status.h"
21
+
22
+ namespace draco {
23
+
24
+ // Base class for our geometry encoder classes. |EncoderOptionsT| specifies
25
+ // options class used by the encoder. Please, see encode.h and expert_encode.h
26
+ // for more details and method descriptions.
27
+ template <class EncoderOptionsT>
28
+ class EncoderBase {
29
+ public:
30
+ typedef EncoderOptionsT OptionsType;
31
+
32
+ EncoderBase()
33
+ : options_(EncoderOptionsT::CreateDefaultOptions()),
34
+ num_encoded_points_(0),
35
+ num_encoded_faces_(0) {}
36
+ virtual ~EncoderBase() {}
37
+
38
+ const EncoderOptionsT &options() const { return options_; }
39
+ EncoderOptionsT &options() { return options_; }
40
+
41
+ // If enabled, it tells the encoder to keep track of the number of encoded
42
+ // points and faces (default = false).
43
+ // Note that this can slow down encoding for certain encoders.
44
+ void SetTrackEncodedProperties(bool flag);
45
+
46
+ // Returns the number of encoded points and faces during the last encoding
47
+ // operation. Returns 0 if SetTrackEncodedProperties() was not set.
48
+ size_t num_encoded_points() const { return num_encoded_points_; }
49
+ size_t num_encoded_faces() const { return num_encoded_faces_; }
50
+
51
+ protected:
52
+ void Reset(const EncoderOptionsT &options) { options_ = options; }
53
+
54
+ void Reset() { options_ = EncoderOptionsT::CreateDefaultOptions(); }
55
+
56
+ void SetSpeedOptions(int encoding_speed, int decoding_speed) {
57
+ options_.SetSpeed(encoding_speed, decoding_speed);
58
+ }
59
+
60
+ void SetEncodingMethod(int encoding_method) {
61
+ options_.SetGlobalInt("encoding_method", encoding_method);
62
+ }
63
+
64
+ void SetEncodingSubmethod(int encoding_submethod) {
65
+ options_.SetGlobalInt("encoding_submethod", encoding_submethod);
66
+ }
67
+
68
+ Status CheckPredictionScheme(GeometryAttribute::Type att_type,
69
+ int prediction_scheme) const {
70
+ // Out of bound checks:
71
+ if (prediction_scheme < PREDICTION_NONE) {
72
+ return Status(Status::DRACO_ERROR,
73
+ "Invalid prediction scheme requested.");
74
+ }
75
+ if (prediction_scheme >= NUM_PREDICTION_SCHEMES) {
76
+ return Status(Status::DRACO_ERROR,
77
+ "Invalid prediction scheme requested.");
78
+ }
79
+ // Deprecated prediction schemes:
80
+ if (prediction_scheme == MESH_PREDICTION_TEX_COORDS_DEPRECATED) {
81
+ return Status(Status::DRACO_ERROR,
82
+ "MESH_PREDICTION_TEX_COORDS_DEPRECATED is deprecated.");
83
+ }
84
+ if (prediction_scheme == MESH_PREDICTION_MULTI_PARALLELOGRAM) {
85
+ return Status(Status::DRACO_ERROR,
86
+ "MESH_PREDICTION_MULTI_PARALLELOGRAM is deprecated.");
87
+ }
88
+ // Attribute specific checks:
89
+ if (prediction_scheme == MESH_PREDICTION_TEX_COORDS_PORTABLE) {
90
+ if (att_type != GeometryAttribute::TEX_COORD) {
91
+ return Status(Status::DRACO_ERROR,
92
+ "Invalid prediction scheme for attribute type.");
93
+ }
94
+ }
95
+ if (prediction_scheme == MESH_PREDICTION_GEOMETRIC_NORMAL) {
96
+ if (att_type != GeometryAttribute::NORMAL) {
97
+ return Status(Status::DRACO_ERROR,
98
+ "Invalid prediction scheme for attribute type.");
99
+ }
100
+ }
101
+ // TODO(b/199760123): Try to enable more prediction schemes for normals.
102
+ if (att_type == GeometryAttribute::NORMAL) {
103
+ if (!(prediction_scheme == PREDICTION_DIFFERENCE ||
104
+ prediction_scheme == MESH_PREDICTION_GEOMETRIC_NORMAL)) {
105
+ return Status(Status::DRACO_ERROR,
106
+ "Invalid prediction scheme for attribute type.");
107
+ }
108
+ }
109
+ return OkStatus();
110
+ }
111
+
112
+ protected:
113
+ void set_num_encoded_points(size_t num) { num_encoded_points_ = num; }
114
+ void set_num_encoded_faces(size_t num) { num_encoded_faces_ = num; }
115
+
116
+ private:
117
+ EncoderOptionsT options_;
118
+
119
+ size_t num_encoded_points_;
120
+ size_t num_encoded_faces_;
121
+ };
122
+
123
+ template <class EncoderOptionsT>
124
+ void EncoderBase<EncoderOptionsT>::SetTrackEncodedProperties(bool flag) {
125
+ options_.SetGlobalBool("store_number_of_encoded_points", flag);
126
+ options_.SetGlobalBool("store_number_of_encoded_faces", flag);
127
+ }
128
+
129
+ } // namespace draco
130
+
131
+ #endif // DRACO_COMPRESSION_ENCODE_BASE_H_