Differential D9642 Diff 31697 extern/draco/draco/src/draco/compression/attributes/sequential_attribute_encoder.cc
Changeset View
Changeset View
Standalone View
Standalone View
extern/draco/draco/src/draco/compression/attributes/sequential_attribute_encoder.cc
- This file was moved from extern/draco/dracoenc/src/draco/compression/attributes/sequential_attribute_encoder.cc.
| Show All 40 Lines | bool SequentialAttributeEncoder::TransformAttributeToPortableFormat( | ||||
| const std::vector<PointIndex> &point_ids) { | const std::vector<PointIndex> &point_ids) { | ||||
| // Default implementation doesn't transform the input data. | // Default implementation doesn't transform the input data. | ||||
| return true; | return true; | ||||
| } | } | ||||
| bool SequentialAttributeEncoder::EncodePortableAttribute( | bool SequentialAttributeEncoder::EncodePortableAttribute( | ||||
| const std::vector<PointIndex> &point_ids, EncoderBuffer *out_buffer) { | const std::vector<PointIndex> &point_ids, EncoderBuffer *out_buffer) { | ||||
| // Lossless encoding of the input values. | // Lossless encoding of the input values. | ||||
| if (!EncodeValues(point_ids, out_buffer)) | if (!EncodeValues(point_ids, out_buffer)) { | ||||
| return false; | return false; | ||||
| } | |||||
| return true; | return true; | ||||
| } | } | ||||
| bool SequentialAttributeEncoder::EncodeDataNeededByPortableTransform( | bool SequentialAttributeEncoder::EncodeDataNeededByPortableTransform( | ||||
| EncoderBuffer *out_buffer) { | EncoderBuffer *out_buffer) { | ||||
| // Default implementation doesn't transform the input data. | // Default implementation doesn't transform the input data. | ||||
| return true; | return true; | ||||
| } | } | ||||
| Show All 16 Lines | void SequentialAttributeEncoder::MarkParentAttribute() { | ||||
| is_parent_encoder_ = true; | is_parent_encoder_ = true; | ||||
| } | } | ||||
| bool SequentialAttributeEncoder::InitPredictionScheme( | bool SequentialAttributeEncoder::InitPredictionScheme( | ||||
| PredictionSchemeInterface *ps) { | PredictionSchemeInterface *ps) { | ||||
| for (int i = 0; i < ps->GetNumParentAttributes(); ++i) { | for (int i = 0; i < ps->GetNumParentAttributes(); ++i) { | ||||
| const int att_id = encoder_->point_cloud()->GetNamedAttributeId( | const int att_id = encoder_->point_cloud()->GetNamedAttributeId( | ||||
| ps->GetParentAttributeType(i)); | ps->GetParentAttributeType(i)); | ||||
| if (att_id == -1) | if (att_id == -1) { | ||||
| return false; // Requested attribute does not exist. | return false; // Requested attribute does not exist. | ||||
| } | |||||
| parent_attributes_.push_back(att_id); | parent_attributes_.push_back(att_id); | ||||
| encoder_->MarkParentAttribute(att_id); | encoder_->MarkParentAttribute(att_id); | ||||
| } | } | ||||
| return true; | return true; | ||||
| } | } | ||||
| bool SequentialAttributeEncoder::SetPredictionSchemeParentAttributes( | bool SequentialAttributeEncoder::SetPredictionSchemeParentAttributes( | ||||
| PredictionSchemeInterface *ps) { | PredictionSchemeInterface *ps) { | ||||
| for (int i = 0; i < ps->GetNumParentAttributes(); ++i) { | for (int i = 0; i < ps->GetNumParentAttributes(); ++i) { | ||||
| const int att_id = encoder_->point_cloud()->GetNamedAttributeId( | const int att_id = encoder_->point_cloud()->GetNamedAttributeId( | ||||
| ps->GetParentAttributeType(i)); | ps->GetParentAttributeType(i)); | ||||
| if (att_id == -1) | if (att_id == -1) { | ||||
| return false; // Requested attribute does not exist. | return false; // Requested attribute does not exist. | ||||
| if (!ps->SetParentAttribute(encoder_->GetPortableAttribute(att_id))) | } | ||||
| if (!ps->SetParentAttribute(encoder_->GetPortableAttribute(att_id))) { | |||||
| return false; | return false; | ||||
| } | } | ||||
| } | |||||
| return true; | return true; | ||||
| } | } | ||||
| } // namespace draco | } // namespace draco | ||||