Differential D9642 Diff 31357 extern/draco/draco/src/draco/compression/attributes/attributes_decoder.h
Changeset View
Changeset View
Standalone View
Standalone View
extern/draco/draco/src/draco/compression/attributes/attributes_decoder.h
- This file was moved from extern/draco/dracoenc/src/draco/compression/attributes/attributes_decoder.h.
| Show All 11 Lines | |||||
| // See the License for the specific language governing permissions and | // See the License for the specific language governing permissions and | ||||
| // limitations under the License. | // limitations under the License. | ||||
| // | // | ||||
| #ifndef DRACO_COMPRESSION_ATTRIBUTES_ATTRIBUTES_DECODER_H_ | #ifndef DRACO_COMPRESSION_ATTRIBUTES_ATTRIBUTES_DECODER_H_ | ||||
| #define DRACO_COMPRESSION_ATTRIBUTES_ATTRIBUTES_DECODER_H_ | #define DRACO_COMPRESSION_ATTRIBUTES_ATTRIBUTES_DECODER_H_ | ||||
| #include <vector> | #include <vector> | ||||
| #include "draco/draco_features.h" | |||||
| #include "draco/compression/attributes/attributes_decoder_interface.h" | #include "draco/compression/attributes/attributes_decoder_interface.h" | ||||
| #include "draco/compression/point_cloud/point_cloud_decoder.h" | #include "draco/compression/point_cloud/point_cloud_decoder.h" | ||||
| #include "draco/core/decoder_buffer.h" | #include "draco/core/decoder_buffer.h" | ||||
| #include "draco/draco_features.h" | |||||
| #include "draco/point_cloud/point_cloud.h" | #include "draco/point_cloud/point_cloud.h" | ||||
| namespace draco { | namespace draco { | ||||
| // Base class for decoding one or more attributes that were encoded with a | // Base class for decoding one or more attributes that were encoded with a | ||||
| // matching AttributesEncoder. It is a basic implementation of | // matching AttributesEncoder. It is a basic implementation of | ||||
| // AttributesDecoderInterface that provides functionality that is shared between | // AttributesDecoderInterface that provides functionality that is shared between | ||||
| // all AttributesDecoders. | // all AttributesDecoders. | ||||
| Show All 16 Lines | int32_t GetNumAttributes() const override { | ||||
| return static_cast<int32_t>(point_attribute_ids_.size()); | return static_cast<int32_t>(point_attribute_ids_.size()); | ||||
| } | } | ||||
| PointCloudDecoder *GetDecoder() const override { | PointCloudDecoder *GetDecoder() const override { | ||||
| return point_cloud_decoder_; | return point_cloud_decoder_; | ||||
| } | } | ||||
| // Decodes attribute data from the source buffer. | // Decodes attribute data from the source buffer. | ||||
| bool DecodeAttributes(DecoderBuffer *in_buffer) override { | bool DecodeAttributes(DecoderBuffer *in_buffer) override { | ||||
| if (!DecodePortableAttributes(in_buffer)) | if (!DecodePortableAttributes(in_buffer)) { | ||||
| return false; | return false; | ||||
| if (!DecodeDataNeededByPortableTransforms(in_buffer)) | } | ||||
| if (!DecodeDataNeededByPortableTransforms(in_buffer)) { | |||||
| return false; | return false; | ||||
| if (!TransformAttributesToOriginalFormat()) | } | ||||
| if (!TransformAttributesToOriginalFormat()) { | |||||
| return false; | return false; | ||||
| } | |||||
| return true; | return true; | ||||
| } | } | ||||
| protected: | protected: | ||||
| int32_t GetLocalIdForPointAttribute(int32_t point_attribute_id) const { | int32_t GetLocalIdForPointAttribute(int32_t point_attribute_id) const { | ||||
| const int id_map_size = | const int id_map_size = | ||||
| static_cast<int>(point_attribute_to_local_id_map_.size()); | static_cast<int>(point_attribute_to_local_id_map_.size()); | ||||
| if (point_attribute_id >= id_map_size) | if (point_attribute_id >= id_map_size) { | ||||
| return -1; | return -1; | ||||
| } | |||||
| return point_attribute_to_local_id_map_[point_attribute_id]; | return point_attribute_to_local_id_map_[point_attribute_id]; | ||||
| } | } | ||||
| virtual bool DecodePortableAttributes(DecoderBuffer *in_buffer) = 0; | virtual bool DecodePortableAttributes(DecoderBuffer *in_buffer) = 0; | ||||
| virtual bool DecodeDataNeededByPortableTransforms(DecoderBuffer *in_buffer) { | virtual bool DecodeDataNeededByPortableTransforms(DecoderBuffer *in_buffer) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| virtual bool TransformAttributesToOriginalFormat() { return true; } | virtual bool TransformAttributesToOriginalFormat() { return true; } | ||||
| Show All 15 Lines | |||||