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.
- bin/draco_decoder.exe +0 -0
- bin/draco_encoder.exe +0 -0
- dracox/__init__.py +252 -0
- dracox/dracox_ext.cp39-win_amd64.pyd +0 -0
- dracox-0.0.1.dist-info/METADATA +14 -0
- dracox-0.0.1.dist-info/RECORD +214 -0
- dracox-0.0.1.dist-info/WHEEL +5 -0
- include/draco/animation/keyframe_animation.h +107 -0
- include/draco/animation/keyframe_animation_decoder.h +34 -0
- include/draco/animation/keyframe_animation_encoder.h +39 -0
- include/draco/attributes/attribute_octahedron_transform.h +81 -0
- include/draco/attributes/attribute_quantization_transform.h +102 -0
- include/draco/attributes/attribute_transform.h +76 -0
- include/draco/attributes/attribute_transform_data.h +71 -0
- include/draco/attributes/attribute_transform_type.h +30 -0
- include/draco/attributes/geometry_attribute.h +541 -0
- include/draco/attributes/geometry_indices.h +54 -0
- include/draco/attributes/point_attribute.h +196 -0
- include/draco/compression/attributes/attributes_decoder.h +97 -0
- include/draco/compression/attributes/attributes_decoder_interface.h +62 -0
- include/draco/compression/attributes/attributes_encoder.h +154 -0
- include/draco/compression/attributes/kd_tree_attributes_decoder.h +50 -0
- include/draco/compression/attributes/kd_tree_attributes_encoder.h +51 -0
- include/draco/compression/attributes/kd_tree_attributes_shared.h +28 -0
- include/draco/compression/attributes/linear_sequencer.h +51 -0
- include/draco/compression/attributes/mesh_attribute_indices_encoding_data.h +58 -0
- include/draco/compression/attributes/normal_compression_utils.h +372 -0
- include/draco/compression/attributes/point_d_vector.h +288 -0
- include/draco/compression/attributes/points_sequencer.h +63 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_constrained_multi_parallelogram_decoder.h +236 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_constrained_multi_parallelogram_encoder.h +413 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_constrained_multi_parallelogram_shared.h +34 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_data.h +72 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_decoder.h +46 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_encoder.h +46 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_decoder.h +176 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_encoder.h +180 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_predictor_area.h +117 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_predictor_base.h +96 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_multi_parallelogram_decoder.h +128 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_multi_parallelogram_encoder.h +133 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_parallelogram_encoder.h +111 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_parallelogram_shared.h +78 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_decoder.h +372 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_encoder.h +318 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_portable_decoder.h +143 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_portable_encoder.h +136 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_portable_predictor.h +282 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_decoder.h +90 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_decoder_factory.h +194 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_decoder_interface.h +53 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_decoding_transform.h +65 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_delta_decoder.h +65 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_delta_encoder.h +69 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_encoder.h +90 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_encoder_factory.h +134 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_encoder_interface.h +55 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_encoding_transform.h +77 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_factory.h +85 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_interface.h +60 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_canonicalized_decoding_transform.h +118 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_canonicalized_encoding_transform.h +116 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_canonicalized_transform_base.h +102 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_decoding_transform.h +115 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_encoding_transform.h +105 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_transform_base.h +90 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_wrap_decoding_transform.h +88 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_wrap_encoding_transform.h +81 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_wrap_transform_base.h +120 -0
- include/draco/compression/attributes/sequential_attribute_decoder.h +86 -0
- include/draco/compression/attributes/sequential_attribute_decoders_controller.h +61 -0
- include/draco/compression/attributes/sequential_attribute_encoder.h +134 -0
- include/draco/compression/attributes/sequential_attribute_encoders_controller.h +115 -0
- include/draco/compression/attributes/sequential_integer_attribute_decoder.h +76 -0
- include/draco/compression/attributes/sequential_integer_attribute_encoder.h +67 -0
- include/draco/compression/attributes/sequential_normal_attribute_decoder.h +83 -0
- include/draco/compression/attributes/sequential_normal_attribute_encoder.h +82 -0
- include/draco/compression/attributes/sequential_quantization_attribute_decoder.h +52 -0
- include/draco/compression/attributes/sequential_quantization_attribute_encoder.h +52 -0
- include/draco/compression/bit_coders/adaptive_rans_bit_coding_shared.h +43 -0
- include/draco/compression/bit_coders/adaptive_rans_bit_decoder.h +54 -0
- include/draco/compression/bit_coders/adaptive_rans_bit_encoder.h +61 -0
- include/draco/compression/bit_coders/direct_bit_decoder.h +89 -0
- include/draco/compression/bit_coders/direct_bit_encoder.h +89 -0
- include/draco/compression/bit_coders/folded_integer_bit_decoder.h +77 -0
- include/draco/compression/bit_coders/folded_integer_bit_encoder.h +82 -0
- include/draco/compression/bit_coders/rans_bit_decoder.h +55 -0
- include/draco/compression/bit_coders/rans_bit_encoder.h +57 -0
- include/draco/compression/bit_coders/symbol_bit_decoder.h +36 -0
- include/draco/compression/bit_coders/symbol_bit_encoder.h +36 -0
- include/draco/compression/config/compression_shared.h +155 -0
- include/draco/compression/config/decoder_options.h +34 -0
- include/draco/compression/config/draco_options.h +249 -0
- include/draco/compression/config/encoder_options.h +101 -0
- include/draco/compression/config/encoding_features.h +39 -0
- include/draco/compression/decode.h +80 -0
- include/draco/compression/draco_compression_options.h +141 -0
- include/draco/compression/encode.h +139 -0
- include/draco/compression/encode_base.h +131 -0
- include/draco/compression/entropy/ans.h +526 -0
- include/draco/compression/entropy/rans_symbol_coding.h +53 -0
- include/draco/compression/entropy/rans_symbol_decoder.h +171 -0
- include/draco/compression/entropy/rans_symbol_encoder.h +290 -0
- include/draco/compression/entropy/shannon_entropy.h +110 -0
- include/draco/compression/entropy/symbol_decoding.h +29 -0
- include/draco/compression/entropy/symbol_encoding.h +47 -0
- include/draco/compression/expert_encode.h +160 -0
- include/draco/compression/mesh/mesh_decoder.h +68 -0
- include/draco/compression/mesh/mesh_edgebreaker_decoder.h +54 -0
- include/draco/compression/mesh/mesh_edgebreaker_decoder_impl.h +228 -0
- include/draco/compression/mesh/mesh_edgebreaker_decoder_impl_interface.h +47 -0
- include/draco/compression/mesh/mesh_edgebreaker_encoder.h +73 -0
- include/draco/compression/mesh/mesh_edgebreaker_encoder_impl.h +209 -0
- include/draco/compression/mesh/mesh_edgebreaker_encoder_impl_interface.h +57 -0
- include/draco/compression/mesh/mesh_edgebreaker_shared.h +129 -0
- include/draco/compression/mesh/mesh_edgebreaker_traversal_decoder.h +201 -0
- include/draco/compression/mesh/mesh_edgebreaker_traversal_encoder.h +139 -0
- include/draco/compression/mesh/mesh_edgebreaker_traversal_predictive_decoder.h +134 -0
- include/draco/compression/mesh/mesh_edgebreaker_traversal_predictive_encoder.h +172 -0
- include/draco/compression/mesh/mesh_edgebreaker_traversal_valence_decoder.h +219 -0
- include/draco/compression/mesh/mesh_edgebreaker_traversal_valence_encoder.h +226 -0
- include/draco/compression/mesh/mesh_encoder.h +84 -0
- include/draco/compression/mesh/mesh_sequential_decoder.h +39 -0
- include/draco/compression/mesh/mesh_sequential_encoder.h +56 -0
- include/draco/compression/mesh/traverser/depth_first_traverser.h +172 -0
- include/draco/compression/mesh/traverser/max_prediction_degree_traverser.h +226 -0
- include/draco/compression/mesh/traverser/mesh_attribute_indices_encoding_observer.h +76 -0
- include/draco/compression/mesh/traverser/mesh_traversal_sequencer.h +113 -0
- include/draco/compression/mesh/traverser/traverser_base.h +87 -0
- include/draco/compression/point_cloud/algorithms/dynamic_integer_points_kd_tree_decoder.h +369 -0
- include/draco/compression/point_cloud/algorithms/dynamic_integer_points_kd_tree_encoder.h +372 -0
- include/draco/compression/point_cloud/algorithms/float_points_tree_decoder.h +141 -0
- include/draco/compression/point_cloud/algorithms/float_points_tree_encoder.h +126 -0
- include/draco/compression/point_cloud/algorithms/point_cloud_compression_method.h +34 -0
- include/draco/compression/point_cloud/algorithms/point_cloud_types.h +76 -0
- include/draco/compression/point_cloud/algorithms/quantize_points_3.h +84 -0
- include/draco/compression/point_cloud/algorithms/queuing_policy.h +75 -0
- include/draco/compression/point_cloud/point_cloud_decoder.h +118 -0
- include/draco/compression/point_cloud/point_cloud_encoder.h +158 -0
- include/draco/compression/point_cloud/point_cloud_kd_tree_decoder.h +31 -0
- include/draco/compression/point_cloud/point_cloud_kd_tree_encoder.h +45 -0
- include/draco/compression/point_cloud/point_cloud_sequential_decoder.h +33 -0
- include/draco/compression/point_cloud/point_cloud_sequential_encoder.h +43 -0
- include/draco/core/bit_utils.h +127 -0
- include/draco/core/bounding_box.h +77 -0
- include/draco/core/constants.h +6 -0
- include/draco/core/cycle_timer.h +51 -0
- include/draco/core/data_buffer.h +82 -0
- include/draco/core/decoder_buffer.h +216 -0
- include/draco/core/divide.h +42 -0
- include/draco/core/draco_index_type.h +184 -0
- include/draco/core/draco_index_type_vector.h +90 -0
- include/draco/core/draco_types.h +52 -0
- include/draco/core/draco_version.h +25 -0
- include/draco/core/encoder_buffer.h +152 -0
- include/draco/core/hash_utils.h +64 -0
- include/draco/core/macros.h +124 -0
- include/draco/core/math_utils.h +79 -0
- include/draco/core/options.h +151 -0
- include/draco/core/quantization_utils.h +82 -0
- include/draco/core/status.h +83 -0
- include/draco/core/status_or.h +81 -0
- include/draco/core/varint_decoding.h +81 -0
- include/draco/core/varint_encoding.h +61 -0
- include/draco/core/vector_d.h +355 -0
- include/draco/draco_features.h +25 -0
- include/draco/io/file_reader_factory.h +34 -0
- include/draco/io/file_reader_interface.h +32 -0
- include/draco/io/file_utils.h +86 -0
- include/draco/io/file_writer_factory.h +34 -0
- include/draco/io/file_writer_interface.h +26 -0
- include/draco/io/file_writer_utils.h +38 -0
- include/draco/io/mesh_io.h +107 -0
- include/draco/io/obj_decoder.h +147 -0
- include/draco/io/obj_encoder.h +107 -0
- include/draco/io/parser_utils.h +66 -0
- include/draco/io/ply_decoder.h +69 -0
- include/draco/io/ply_encoder.h +54 -0
- include/draco/io/ply_property_reader.h +96 -0
- include/draco/io/ply_property_writer.h +94 -0
- include/draco/io/ply_reader.h +155 -0
- include/draco/io/point_cloud_io.h +89 -0
- include/draco/io/stdio_file_reader.h +48 -0
- include/draco/io/stdio_file_writer.h +42 -0
- include/draco/io/stl_decoder.h +38 -0
- include/draco/io/stl_encoder.h +52 -0
- include/draco/mesh/corner_table.h +397 -0
- include/draco/mesh/corner_table_iterators.h +309 -0
- include/draco/mesh/mesh.h +378 -0
- include/draco/mesh/mesh_are_equivalent.h +71 -0
- include/draco/mesh/mesh_attribute_corner_table.h +202 -0
- include/draco/mesh/mesh_cleanup.h +61 -0
- include/draco/mesh/mesh_features.h +93 -0
- include/draco/mesh/mesh_indices.h +37 -0
- include/draco/mesh/mesh_misc_functions.h +105 -0
- include/draco/mesh/mesh_stripifier.h +258 -0
- include/draco/mesh/triangle_soup_mesh_builder.h +134 -0
- include/draco/mesh/valence_cache.h +142 -0
- include/draco/metadata/geometry_metadata.h +142 -0
- include/draco/metadata/metadata.h +209 -0
- include/draco/metadata/metadata_decoder.h +42 -0
- include/draco/metadata/metadata_encoder.h +41 -0
- include/draco/metadata/property_attribute.h +107 -0
- include/draco/metadata/property_table.h +222 -0
- include/draco/metadata/structural_metadata.h +78 -0
- include/draco/metadata/structural_metadata_schema.h +118 -0
- include/draco/point_cloud/point_cloud.h +289 -0
- include/draco/point_cloud/point_cloud_builder.h +101 -0
- lib/draco.lib +0 -0
- lib/pkgconfig/draco.pc +6 -0
- share/cmake/draco/draco-config-version.cmake +43 -0
- share/cmake/draco/draco-config.cmake +27 -0
- share/cmake/draco/draco-targets-release.cmake +19 -0
- share/cmake/draco/draco-targets.cmake +107 -0
|
@@ -0,0 +1,369 @@
|
|
|
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
|
+
// See dynamic_integer_points_kd_tree_encoder.h for documentation.
|
|
16
|
+
|
|
17
|
+
#ifndef DRACO_COMPRESSION_POINT_CLOUD_ALGORITHMS_DYNAMIC_INTEGER_POINTS_KD_TREE_DECODER_H_
|
|
18
|
+
#define DRACO_COMPRESSION_POINT_CLOUD_ALGORITHMS_DYNAMIC_INTEGER_POINTS_KD_TREE_DECODER_H_
|
|
19
|
+
|
|
20
|
+
#include <array>
|
|
21
|
+
#include <limits>
|
|
22
|
+
#include <memory>
|
|
23
|
+
#include <stack>
|
|
24
|
+
#include <vector>
|
|
25
|
+
|
|
26
|
+
#include "draco/compression/bit_coders/adaptive_rans_bit_decoder.h"
|
|
27
|
+
#include "draco/compression/bit_coders/direct_bit_decoder.h"
|
|
28
|
+
#include "draco/compression/bit_coders/folded_integer_bit_decoder.h"
|
|
29
|
+
#include "draco/compression/bit_coders/rans_bit_decoder.h"
|
|
30
|
+
#include "draco/compression/point_cloud/algorithms/point_cloud_types.h"
|
|
31
|
+
#include "draco/core/bit_utils.h"
|
|
32
|
+
#include "draco/core/decoder_buffer.h"
|
|
33
|
+
#include "draco/core/math_utils.h"
|
|
34
|
+
|
|
35
|
+
namespace draco {
|
|
36
|
+
|
|
37
|
+
template <int compression_level_t>
|
|
38
|
+
struct DynamicIntegerPointsKdTreeDecoderCompressionPolicy
|
|
39
|
+
: public DynamicIntegerPointsKdTreeDecoderCompressionPolicy<
|
|
40
|
+
compression_level_t - 1> {};
|
|
41
|
+
|
|
42
|
+
template <>
|
|
43
|
+
struct DynamicIntegerPointsKdTreeDecoderCompressionPolicy<0> {
|
|
44
|
+
typedef DirectBitDecoder NumbersDecoder;
|
|
45
|
+
typedef DirectBitDecoder AxisDecoder;
|
|
46
|
+
typedef DirectBitDecoder HalfDecoder;
|
|
47
|
+
typedef DirectBitDecoder RemainingBitsDecoder;
|
|
48
|
+
static constexpr bool select_axis = false;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
template <>
|
|
52
|
+
struct DynamicIntegerPointsKdTreeDecoderCompressionPolicy<2>
|
|
53
|
+
: public DynamicIntegerPointsKdTreeDecoderCompressionPolicy<1> {
|
|
54
|
+
typedef RAnsBitDecoder NumbersDecoder;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
template <>
|
|
58
|
+
struct DynamicIntegerPointsKdTreeDecoderCompressionPolicy<4>
|
|
59
|
+
: public DynamicIntegerPointsKdTreeDecoderCompressionPolicy<3> {
|
|
60
|
+
typedef FoldedBit32Decoder<RAnsBitDecoder> NumbersDecoder;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
template <>
|
|
64
|
+
struct DynamicIntegerPointsKdTreeDecoderCompressionPolicy<6>
|
|
65
|
+
: public DynamicIntegerPointsKdTreeDecoderCompressionPolicy<5> {
|
|
66
|
+
static constexpr bool select_axis = true;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// Decodes a point cloud encoded by DynamicIntegerPointsKdTreeEncoder.
|
|
70
|
+
template <int compression_level_t>
|
|
71
|
+
class DynamicIntegerPointsKdTreeDecoder {
|
|
72
|
+
static_assert(compression_level_t >= 0, "Compression level must in [0..6].");
|
|
73
|
+
static_assert(compression_level_t <= 6, "Compression level must in [0..6].");
|
|
74
|
+
typedef DynamicIntegerPointsKdTreeDecoderCompressionPolicy<
|
|
75
|
+
compression_level_t>
|
|
76
|
+
Policy;
|
|
77
|
+
|
|
78
|
+
typedef typename Policy::NumbersDecoder NumbersDecoder;
|
|
79
|
+
typedef typename Policy::AxisDecoder AxisDecoder;
|
|
80
|
+
typedef typename Policy::HalfDecoder HalfDecoder;
|
|
81
|
+
typedef typename Policy::RemainingBitsDecoder RemainingBitsDecoder;
|
|
82
|
+
typedef std::vector<uint32_t> VectorUint32;
|
|
83
|
+
|
|
84
|
+
public:
|
|
85
|
+
explicit DynamicIntegerPointsKdTreeDecoder(uint32_t dimension)
|
|
86
|
+
: bit_length_(0),
|
|
87
|
+
num_points_(0),
|
|
88
|
+
num_decoded_points_(0),
|
|
89
|
+
dimension_(dimension),
|
|
90
|
+
p_(dimension, 0),
|
|
91
|
+
axes_(dimension, 0),
|
|
92
|
+
// Init the stack with the maximum depth of the tree.
|
|
93
|
+
// +1 for a second leaf.
|
|
94
|
+
base_stack_(32 * dimension + 1, VectorUint32(dimension, 0)),
|
|
95
|
+
levels_stack_(32 * dimension + 1, VectorUint32(dimension, 0)) {}
|
|
96
|
+
|
|
97
|
+
// Decodes an integer point cloud from |buffer|. Optional |oit_max_points| can
|
|
98
|
+
// be used to tell the decoder the maximum number of points accepted by the
|
|
99
|
+
// iterator.
|
|
100
|
+
template <class OutputIteratorT>
|
|
101
|
+
bool DecodePoints(DecoderBuffer *buffer, OutputIteratorT &oit);
|
|
102
|
+
|
|
103
|
+
template <class OutputIteratorT>
|
|
104
|
+
bool DecodePoints(DecoderBuffer *buffer, OutputIteratorT &oit,
|
|
105
|
+
uint32_t oit_max_points);
|
|
106
|
+
|
|
107
|
+
#ifndef DRACO_OLD_GCC
|
|
108
|
+
template <class OutputIteratorT>
|
|
109
|
+
bool DecodePoints(DecoderBuffer *buffer, OutputIteratorT &&oit);
|
|
110
|
+
template <class OutputIteratorT>
|
|
111
|
+
bool DecodePoints(DecoderBuffer *buffer, OutputIteratorT &&oit,
|
|
112
|
+
uint32_t oit_max_points);
|
|
113
|
+
#endif // DRACO_OLD_GCC
|
|
114
|
+
|
|
115
|
+
const uint32_t dimension() const { return dimension_; }
|
|
116
|
+
|
|
117
|
+
// Returns the number of decoded points. Must be called after DecodePoints().
|
|
118
|
+
uint32_t num_decoded_points() const { return num_decoded_points_; }
|
|
119
|
+
|
|
120
|
+
private:
|
|
121
|
+
uint32_t GetAxis(uint32_t num_remaining_points, const VectorUint32 &levels,
|
|
122
|
+
uint32_t last_axis);
|
|
123
|
+
|
|
124
|
+
template <class OutputIteratorT>
|
|
125
|
+
bool DecodeInternal(uint32_t num_points, OutputIteratorT &oit);
|
|
126
|
+
|
|
127
|
+
void DecodeNumber(int nbits, uint32_t *value) {
|
|
128
|
+
numbers_decoder_.DecodeLeastSignificantBits32(nbits, value);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
struct DecodingStatus {
|
|
132
|
+
DecodingStatus(uint32_t num_remaining_points_, uint32_t last_axis_,
|
|
133
|
+
uint32_t stack_pos_)
|
|
134
|
+
: num_remaining_points(num_remaining_points_),
|
|
135
|
+
last_axis(last_axis_),
|
|
136
|
+
stack_pos(stack_pos_) {}
|
|
137
|
+
|
|
138
|
+
uint32_t num_remaining_points;
|
|
139
|
+
uint32_t last_axis;
|
|
140
|
+
uint32_t stack_pos; // used to get base and levels
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
uint32_t bit_length_;
|
|
144
|
+
uint32_t num_points_;
|
|
145
|
+
uint32_t num_decoded_points_;
|
|
146
|
+
uint32_t dimension_;
|
|
147
|
+
NumbersDecoder numbers_decoder_;
|
|
148
|
+
RemainingBitsDecoder remaining_bits_decoder_;
|
|
149
|
+
AxisDecoder axis_decoder_;
|
|
150
|
+
HalfDecoder half_decoder_;
|
|
151
|
+
VectorUint32 p_;
|
|
152
|
+
VectorUint32 axes_;
|
|
153
|
+
std::vector<VectorUint32> base_stack_;
|
|
154
|
+
std::vector<VectorUint32> levels_stack_;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
// Decodes a point cloud from |buffer|.
|
|
158
|
+
#ifndef DRACO_OLD_GCC
|
|
159
|
+
template <int compression_level_t>
|
|
160
|
+
template <class OutputIteratorT>
|
|
161
|
+
bool DynamicIntegerPointsKdTreeDecoder<compression_level_t>::DecodePoints(
|
|
162
|
+
DecoderBuffer *buffer, OutputIteratorT &&oit) {
|
|
163
|
+
return DecodePoints(buffer, oit, std::numeric_limits<uint32_t>::max());
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
template <int compression_level_t>
|
|
167
|
+
template <class OutputIteratorT>
|
|
168
|
+
bool DynamicIntegerPointsKdTreeDecoder<compression_level_t>::DecodePoints(
|
|
169
|
+
DecoderBuffer *buffer, OutputIteratorT &&oit, uint32_t oit_max_points) {
|
|
170
|
+
OutputIteratorT local = std::forward<OutputIteratorT>(oit);
|
|
171
|
+
return DecodePoints(buffer, local, oit_max_points);
|
|
172
|
+
}
|
|
173
|
+
#endif // DRACO_OLD_GCC
|
|
174
|
+
|
|
175
|
+
template <int compression_level_t>
|
|
176
|
+
template <class OutputIteratorT>
|
|
177
|
+
bool DynamicIntegerPointsKdTreeDecoder<compression_level_t>::DecodePoints(
|
|
178
|
+
DecoderBuffer *buffer, OutputIteratorT &oit) {
|
|
179
|
+
return DecodePoints(buffer, oit, std::numeric_limits<uint32_t>::max());
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
template <int compression_level_t>
|
|
183
|
+
template <class OutputIteratorT>
|
|
184
|
+
bool DynamicIntegerPointsKdTreeDecoder<compression_level_t>::DecodePoints(
|
|
185
|
+
DecoderBuffer *buffer, OutputIteratorT &oit, uint32_t oit_max_points) {
|
|
186
|
+
if (!buffer->Decode(&bit_length_)) {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
if (bit_length_ > 32) {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
if (!buffer->Decode(&num_points_)) {
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
if (num_points_ == 0) {
|
|
196
|
+
return true;
|
|
197
|
+
}
|
|
198
|
+
if (num_points_ > oit_max_points) {
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
num_decoded_points_ = 0;
|
|
202
|
+
|
|
203
|
+
if (!numbers_decoder_.StartDecoding(buffer)) {
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
if (!remaining_bits_decoder_.StartDecoding(buffer)) {
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
if (!axis_decoder_.StartDecoding(buffer)) {
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
if (!half_decoder_.StartDecoding(buffer)) {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (!DecodeInternal(num_points_, oit)) {
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
numbers_decoder_.EndDecoding();
|
|
221
|
+
remaining_bits_decoder_.EndDecoding();
|
|
222
|
+
axis_decoder_.EndDecoding();
|
|
223
|
+
half_decoder_.EndDecoding();
|
|
224
|
+
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
template <int compression_level_t>
|
|
229
|
+
uint32_t DynamicIntegerPointsKdTreeDecoder<compression_level_t>::GetAxis(
|
|
230
|
+
uint32_t num_remaining_points, const VectorUint32 &levels,
|
|
231
|
+
uint32_t last_axis) {
|
|
232
|
+
if (!Policy::select_axis) {
|
|
233
|
+
return DRACO_INCREMENT_MOD(last_axis, dimension_);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
uint32_t best_axis = 0;
|
|
237
|
+
if (num_remaining_points < 64) {
|
|
238
|
+
for (uint32_t axis = 1; axis < dimension_; ++axis) {
|
|
239
|
+
if (levels[best_axis] > levels[axis]) {
|
|
240
|
+
best_axis = axis;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
} else {
|
|
244
|
+
axis_decoder_.DecodeLeastSignificantBits32(4, &best_axis);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
return best_axis;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
template <int compression_level_t>
|
|
251
|
+
template <class OutputIteratorT>
|
|
252
|
+
bool DynamicIntegerPointsKdTreeDecoder<compression_level_t>::DecodeInternal(
|
|
253
|
+
uint32_t num_points, OutputIteratorT &oit) {
|
|
254
|
+
typedef DecodingStatus Status;
|
|
255
|
+
base_stack_[0] = VectorUint32(dimension_, 0);
|
|
256
|
+
levels_stack_[0] = VectorUint32(dimension_, 0);
|
|
257
|
+
DecodingStatus init_status(num_points, 0, 0);
|
|
258
|
+
std::stack<Status> status_stack;
|
|
259
|
+
status_stack.push(init_status);
|
|
260
|
+
|
|
261
|
+
// TODO(b/199760123): Use preallocated vector instead of stack.
|
|
262
|
+
while (!status_stack.empty()) {
|
|
263
|
+
const DecodingStatus status = status_stack.top();
|
|
264
|
+
status_stack.pop();
|
|
265
|
+
|
|
266
|
+
const uint32_t num_remaining_points = status.num_remaining_points;
|
|
267
|
+
const uint32_t last_axis = status.last_axis;
|
|
268
|
+
const uint32_t stack_pos = status.stack_pos;
|
|
269
|
+
const VectorUint32 &old_base = base_stack_[stack_pos];
|
|
270
|
+
const VectorUint32 &levels = levels_stack_[stack_pos];
|
|
271
|
+
|
|
272
|
+
if (num_remaining_points > num_points) {
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
const uint32_t axis = GetAxis(num_remaining_points, levels, last_axis);
|
|
277
|
+
if (axis >= dimension_) {
|
|
278
|
+
return false;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
const uint32_t level = levels[axis];
|
|
282
|
+
|
|
283
|
+
// All axes have been fully subdivided, just output points.
|
|
284
|
+
if ((bit_length_ - level) == 0) {
|
|
285
|
+
for (uint32_t i = 0; i < num_remaining_points; i++) {
|
|
286
|
+
*oit = old_base;
|
|
287
|
+
++oit;
|
|
288
|
+
++num_decoded_points_;
|
|
289
|
+
}
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
DRACO_DCHECK_EQ(true, num_remaining_points != 0);
|
|
294
|
+
|
|
295
|
+
// Fast decoding of remaining bits if number of points is 1 or 2.
|
|
296
|
+
if (num_remaining_points <= 2) {
|
|
297
|
+
// TODO(b/199760123): |axes_| not necessary, remove would change
|
|
298
|
+
// bitstream!
|
|
299
|
+
axes_[0] = axis;
|
|
300
|
+
for (uint32_t i = 1; i < dimension_; i++) {
|
|
301
|
+
axes_[i] = DRACO_INCREMENT_MOD(axes_[i - 1], dimension_);
|
|
302
|
+
}
|
|
303
|
+
for (uint32_t i = 0; i < num_remaining_points; ++i) {
|
|
304
|
+
for (uint32_t j = 0; j < dimension_; j++) {
|
|
305
|
+
p_[axes_[j]] = 0;
|
|
306
|
+
const uint32_t num_remaining_bits = bit_length_ - levels[axes_[j]];
|
|
307
|
+
if (num_remaining_bits) {
|
|
308
|
+
if (!remaining_bits_decoder_.DecodeLeastSignificantBits32(
|
|
309
|
+
num_remaining_bits, &p_[axes_[j]])) {
|
|
310
|
+
return false;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
p_[axes_[j]] = old_base[axes_[j]] | p_[axes_[j]];
|
|
314
|
+
}
|
|
315
|
+
*oit = p_;
|
|
316
|
+
++oit;
|
|
317
|
+
++num_decoded_points_;
|
|
318
|
+
}
|
|
319
|
+
continue;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (num_decoded_points_ > num_points_) {
|
|
323
|
+
return false;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
const int num_remaining_bits = bit_length_ - level;
|
|
327
|
+
const uint32_t modifier = 1 << (num_remaining_bits - 1);
|
|
328
|
+
base_stack_[stack_pos + 1] = old_base; // copy
|
|
329
|
+
base_stack_[stack_pos + 1][axis] += modifier; // new base
|
|
330
|
+
|
|
331
|
+
const int incoming_bits = MostSignificantBit(num_remaining_points);
|
|
332
|
+
|
|
333
|
+
uint32_t number = 0;
|
|
334
|
+
DecodeNumber(incoming_bits, &number);
|
|
335
|
+
|
|
336
|
+
uint32_t first_half = num_remaining_points / 2;
|
|
337
|
+
if (first_half < number) {
|
|
338
|
+
// Invalid |number|.
|
|
339
|
+
return false;
|
|
340
|
+
}
|
|
341
|
+
first_half -= number;
|
|
342
|
+
uint32_t second_half = num_remaining_points - first_half;
|
|
343
|
+
|
|
344
|
+
if (first_half != second_half) {
|
|
345
|
+
if (!half_decoder_.DecodeNextBit()) {
|
|
346
|
+
std::swap(first_half, second_half);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
levels_stack_[stack_pos][axis] += 1;
|
|
351
|
+
levels_stack_[stack_pos + 1] = levels_stack_[stack_pos]; // copy
|
|
352
|
+
if (first_half) {
|
|
353
|
+
status_stack.push(DecodingStatus(first_half, axis, stack_pos));
|
|
354
|
+
}
|
|
355
|
+
if (second_half) {
|
|
356
|
+
status_stack.push(DecodingStatus(second_half, axis, stack_pos + 1));
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
return true;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
extern template class DynamicIntegerPointsKdTreeDecoder<0>;
|
|
363
|
+
extern template class DynamicIntegerPointsKdTreeDecoder<2>;
|
|
364
|
+
extern template class DynamicIntegerPointsKdTreeDecoder<4>;
|
|
365
|
+
extern template class DynamicIntegerPointsKdTreeDecoder<6>;
|
|
366
|
+
|
|
367
|
+
} // namespace draco
|
|
368
|
+
|
|
369
|
+
#endif // DRACO_COMPRESSION_POINT_CLOUD_ALGORITHMS_DYNAMIC_INTEGER_POINTS_KD_TREE_DECODER_H_
|