GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
sequential_integer_attribute_encoder.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_ENCODER_H_
16#define DRACO_COMPRESSION_ATTRIBUTES_SEQUENTIAL_INTEGER_ATTRIBUTE_ENCODER_H_
17
20
21namespace draco {
22
23// Attribute encoder designed for lossless encoding of integer attributes. The
24// attribute values can be pre-processed by a prediction scheme and compressed
25// with a built-in entropy coder.
27 public:
29 uint8_t GetUniqueId() const override {
31 }
32
33 bool Init(PointCloudEncoder *encoder, int attribute_id) override;
35 const std::vector<PointIndex> &point_ids) override;
36
37 protected:
38 bool EncodeValues(const std::vector<PointIndex> &point_ids,
39 EncoderBuffer *out_buffer) override;
40
41 // Returns a prediction scheme that should be used for encoding of the
42 // integer values.
43 virtual std::unique_ptr<PredictionSchemeTypedEncoderInterface<int32_t>>
45
46 // Prepares the integer values that are going to be encoded.
47 virtual bool PrepareValues(const std::vector<PointIndex> &point_ids,
48 int num_points);
49
50 void PreparePortableAttribute(int num_entries, int num_components,
51 int num_points);
52
54 return reinterpret_cast<int32_t *>(
55 portable_attribute()->GetAddress(AttributeValueIndex(0)));
56 }
57
58 private:
59 // Optional prediction scheme can be used to modify the integer values in
60 // order to make them easier to compress.
61 std::unique_ptr<PredictionSchemeTypedEncoderInterface<int32_t>>
62 prediction_scheme_;
63};
64
65} // namespace draco
66
67#endif // DRACO_COMPRESSION_ATTRIBUTES_SEQUENTIAL_INTEGER_ATTRIBUTE_ENCODER_H_
Definition encoder_buffer.h:29
const uint8_t * GetAddress(AttributeValueIndex att_index) const
Definition geometry_attribute.h:122
Definition point_cloud_encoder.h:29
PointCloudEncoder * encoder() const
Definition sequential_attribute_encoder.h:83
PointAttribute * portable_attribute()
Definition sequential_attribute_encoder.h:111
int attribute_id() const
Definition sequential_attribute_encoder.h:82
SequentialAttributeEncoder()
Definition sequential_attribute_encoder.cc:19
void PreparePortableAttribute(int num_entries, int num_components, int num_points)
Definition sequential_integer_attribute_encoder.cc:222
SequentialIntegerAttributeEncoder()
Definition sequential_integer_attribute_encoder.cc:24
uint8_t GetUniqueId() const override
Definition sequential_integer_attribute_encoder.h:29
virtual bool PrepareValues(const std::vector< PointIndex > &point_ids, int num_points)
Definition sequential_integer_attribute_encoder.cc:202
int32_t * GetPortableAttributeData()
Definition sequential_integer_attribute_encoder.h:53
bool Init(PointCloudEncoder *encoder, int attribute_id) override
Definition sequential_integer_attribute_encoder.cc:26
virtual std::unique_ptr< PredictionSchemeTypedEncoderInterface< int32_t > > CreateIntPredictionScheme(PredictionSchemeMethod method)
Definition sequential_integer_attribute_encoder.cc:98
bool EncodeValues(const std::vector< PointIndex > &point_ids, EncoderBuffer *out_buffer) override
Definition sequential_integer_attribute_encoder.cc:105
bool TransformAttributeToPortableFormat(const std::vector< PointIndex > &point_ids) override
Definition sequential_integer_attribute_encoder.cc:59
Definition attribute_octahedron_transform.cc:21
@ SEQUENTIAL_ATTRIBUTE_ENCODER_INTEGER
Definition compression_shared.h:74
PredictionSchemeMethod
Definition compression_shared.h:80