GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
sequential_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_ATTRIBUTE_DECODER_H_
16#define DRACO_COMPRESSION_ATTRIBUTES_SEQUENTIAL_ATTRIBUTE_DECODER_H_
17
21
22namespace draco {
23
24// A base class for decoding attribute values encoded by the
25// SequentialAttributeEncoder.
27 public:
29 virtual ~SequentialAttributeDecoder() = default;
30
31 virtual bool Init(PointCloudDecoder *decoder, int attribute_id);
32
33 // Initialization for a specific attribute. This can be used mostly for
34 // standalone decoding of an attribute without an PointCloudDecoder.
36
37 // Performs lossless decoding of the portable attribute data.
38 virtual bool DecodePortableAttribute(const std::vector<PointIndex> &point_ids,
39 DecoderBuffer *in_buffer);
40
41 // Decodes any data needed to revert portable transform of the decoded
42 // attribute.
44 const std::vector<PointIndex> &point_ids, DecoderBuffer *in_buffer);
45
46 // Reverts transformation performed by encoder in
47 // SequentialAttributeEncoder::TransformAttributeToPortableFormat() method.
49 const std::vector<PointIndex> &point_ids);
50
52
53 const PointAttribute *attribute() const { return attribute_; }
54 PointAttribute *attribute() { return attribute_; }
55 int attribute_id() const { return attribute_id_; }
56 PointCloudDecoder *decoder() const { return decoder_; }
57
58 protected:
59 // Should be used to initialize newly created prediction scheme.
60 // Returns false when the initialization failed (in which case the scheme
61 // cannot be used).
63
64 // The actual implementation of the attribute decoding. Should be overridden
65 // for specialized decoders.
66 virtual bool DecodeValues(const std::vector<PointIndex> &point_ids,
67 DecoderBuffer *in_buffer);
68
69 void SetPortableAttribute(std::unique_ptr<PointAttribute> att) {
70 portable_attribute_ = std::move(att);
71 }
72
73 PointAttribute *portable_attribute() { return portable_attribute_.get(); }
74
75 private:
76 PointCloudDecoder *decoder_;
77 PointAttribute *attribute_;
78 int attribute_id_;
79
80 // Storage for decoded portable attribute (after lossless decoding).
81 std::unique_ptr<PointAttribute> portable_attribute_;
82};
83
84} // namespace draco
85
86#endif // DRACO_COMPRESSION_ATTRIBUTES_SEQUENTIAL_ATTRIBUTE_DECODER_H_
Definition decoder_buffer.h:30
Definition point_attribute.h:33
Definition point_cloud_decoder.h:28
Definition prediction_scheme_interface.h:27
void SetPortableAttribute(std::unique_ptr< PointAttribute > att)
Definition sequential_attribute_decoder.h:69
virtual bool DecodeDataNeededByPortableTransform(const std::vector< PointIndex > &point_ids, DecoderBuffer *in_buffer)
Definition sequential_attribute_decoder.cc:49
int attribute_id() const
Definition sequential_attribute_decoder.h:55
virtual bool InitializeStandalone(PointAttribute *attribute)
Definition sequential_attribute_decoder.cc:30
PointAttribute * portable_attribute()
Definition sequential_attribute_decoder.h:73
PointCloudDecoder * decoder() const
Definition sequential_attribute_decoder.h:56
const PointAttribute * GetPortableAttribute()
Definition sequential_attribute_decoder.cc:61
virtual bool Init(PointCloudDecoder *decoder, int attribute_id)
Definition sequential_attribute_decoder.cc:22
virtual bool DecodeValues(const std::vector< PointIndex > &point_ids, DecoderBuffer *in_buffer)
Definition sequential_attribute_decoder.cc:100
virtual bool DecodePortableAttribute(const std::vector< PointIndex > &point_ids, DecoderBuffer *in_buffer)
Definition sequential_attribute_decoder.cc:37
PointAttribute * attribute()
Definition sequential_attribute_decoder.h:54
virtual bool TransformAttributeToOriginalFormat(const std::vector< PointIndex > &point_ids)
Definition sequential_attribute_decoder.cc:55
virtual ~SequentialAttributeDecoder()=default
virtual bool InitPredictionScheme(PredictionSchemeInterface *ps)
Definition sequential_attribute_decoder.cc:75
SequentialAttributeDecoder()
Definition sequential_attribute_decoder.cc:19
const PointAttribute * attribute() const
Definition sequential_attribute_decoder.h:53
Definition attribute_octahedron_transform.cc:21