1 // Copyright 2016 The Draco Authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //      http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 #ifndef DRACO_COMPRESSION_ATTRIBUTES_KD_TREE_ATTRIBUTES_DECODER_H_
16 #define DRACO_COMPRESSION_ATTRIBUTES_KD_TREE_ATTRIBUTES_DECODER_H_
17 
18 #include "draco/attributes/attribute_quantization_transform.h"
19 #include "draco/compression/attributes/attributes_decoder.h"
20 
21 namespace draco {
22 
23 // Decodes attributes encoded with the KdTreeAttributesEncoder.
24 class KdTreeAttributesDecoder : public AttributesDecoder {
25  public:
26   KdTreeAttributesDecoder();
27 
28  protected:
29   bool DecodePortableAttributes(DecoderBuffer *in_buffer) override;
30   bool DecodeDataNeededByPortableTransforms(DecoderBuffer *in_buffer) override;
31   bool TransformAttributesToOriginalFormat() override;
32 
33  private:
34   template <typename SignedDataTypeT>
35   bool TransformAttributeBackToSignedType(PointAttribute *att,
36                                           int num_processed_signed_components);
37 
38   std::vector<AttributeQuantizationTransform>
39       attribute_quantization_transforms_;
40   std::vector<int32_t> min_signed_values_;
41   std::vector<std::unique_ptr<PointAttribute>> quantized_portable_attributes_;
42 };
43 
44 }  // namespace draco
45 
46 #endif  // DRACO_COMPRESSION_ATTRIBUTES_KD_TREE_ATTRIBUTES_DECODER_H_
47