GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
sequential_integer_attribute_decoder.h
Go to the documentation of this file.
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_SEQUENTIAL_INTEGER_ATTRIBUTE_DECODER_H_
16#define DRACO_COMPRESSION_ATTRIBUTES_SEQUENTIAL_INTEGER_ATTRIBUTE_DECODER_H_
17
21
22namespace draco {
23
24// Decoder for attributes encoded with the SequentialIntegerAttributeEncoder.
26 public:
28 bool Init(PointCloudDecoder *decoder, int attribute_id) override;
29
31 const std::vector<PointIndex> &point_ids) override;
32
33 protected:
34 bool DecodeValues(const std::vector<PointIndex> &point_ids,
35 DecoderBuffer *in_buffer) override;
36 virtual bool DecodeIntegerValues(const std::vector<PointIndex> &point_ids,
37 DecoderBuffer *in_buffer);
38
39 // Returns a prediction scheme that should be used for decoding of the
40 // integer values.
41 virtual std::unique_ptr<PredictionSchemeTypedDecoderInterface<int32_t>>
43 PredictionSchemeTransformType transform_type);
44
45 // Returns the number of integer attribute components. In general, this
46 // can be different from the number of components of the input attribute.
47 virtual int32_t GetNumValueComponents() const {
48 return attribute()->num_components();
49 }
50
51 // Called after all integer values are decoded. The implementation should
52 // use this method to store the values into the attribute.
53 virtual bool StoreValues(uint32_t num_values);
54
55 void PreparePortableAttribute(int num_entries, int num_components);
56
58 if (portable_attribute()->size() == 0) {
59 return nullptr;
60 }
61 return reinterpret_cast<int32_t *>(
62 portable_attribute()->GetAddress(AttributeValueIndex(0)));
63 }
64
65 private:
66 // Stores decoded values into the attribute with a data type AttributeTypeT.
67 template <typename AttributeTypeT>
68 void StoreTypedValues(uint32_t num_values);
69
70 std::unique_ptr<PredictionSchemeTypedDecoderInterface<int32_t>>
71 prediction_scheme_;
72};
73
74} // namespace draco
75
76#endif // DRACO_COMPRESSION_ATTRIBUTES_SEQUENTIAL_INTEGER_ATTRIBUTE_DECODER_H_
Definition decoder_buffer.h:30
uint8_t num_components() const
Definition geometry_attribute.h:263
const uint8_t * GetAddress(AttributeValueIndex att_index) const
Definition geometry_attribute.h:122
Definition point_cloud_decoder.h:28
int attribute_id() const
Definition sequential_attribute_decoder.h:55
PointAttribute * portable_attribute()
Definition sequential_attribute_decoder.h:73
PointCloudDecoder * decoder() const
Definition sequential_attribute_decoder.h:56
SequentialAttributeDecoder()
Definition sequential_attribute_decoder.cc:19
const PointAttribute * attribute() const
Definition sequential_attribute_decoder.h:53
virtual std::unique_ptr< PredictionSchemeTypedDecoderInterface< int32_t > > CreateIntPredictionScheme(PredictionSchemeMethod method, PredictionSchemeTransformType transform_type)
Definition sequential_integer_attribute_decoder.cc:90
bool Init(PointCloudDecoder *decoder, int attribute_id) override
Definition sequential_integer_attribute_decoder.cc:25
int32_t * GetPortableAttributeData()
Definition sequential_integer_attribute_decoder.h:57
virtual int32_t GetNumValueComponents() const
Definition sequential_integer_attribute_decoder.h:47
bool DecodeValues(const std::vector< PointIndex > &point_ids, DecoderBuffer *in_buffer) override
Definition sequential_integer_attribute_decoder.cc:44
bool TransformAttributeToOriginalFormat(const std::vector< PointIndex > &point_ids) override
Definition sequential_integer_attribute_decoder.cc:33
virtual bool DecodeIntegerValues(const std::vector< PointIndex > &point_ids, DecoderBuffer *in_buffer)
Definition sequential_integer_attribute_decoder.cc:101
SequentialIntegerAttributeDecoder()
Definition sequential_integer_attribute_decoder.cc:23
void PreparePortableAttribute(int num_entries, int num_components)
Definition sequential_integer_attribute_decoder.cc:230
virtual bool StoreValues(uint32_t num_values)
Definition sequential_integer_attribute_decoder.cc:183
n< br > font size
Definition meshpage.php:3536
Definition attribute_octahedron_transform.cc:21
PredictionSchemeTransformType
Definition compression_shared.h:96
PredictionSchemeMethod
Definition compression_shared.h:80