Differential D9642 Diff 31697 extern/draco/draco/src/draco/compression/attributes/prediction_schemes/prediction_scheme_encoder_factory.h
Changeset View
Changeset View
Standalone View
Standalone View
extern/draco/draco/src/draco/compression/attributes/prediction_schemes/prediction_scheme_encoder_factory.h
- This file was moved from extern/draco/dracoenc/src/draco/compression/attributes/prediction_schemes/prediction_scheme_encoder_factory.h.
| Show First 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | |||||
| std::unique_ptr<PredictionSchemeEncoder<DataTypeT, TransformT>> | std::unique_ptr<PredictionSchemeEncoder<DataTypeT, TransformT>> | ||||
| CreatePredictionSchemeForEncoder(PredictionSchemeMethod method, int att_id, | CreatePredictionSchemeForEncoder(PredictionSchemeMethod method, int att_id, | ||||
| const PointCloudEncoder *encoder, | const PointCloudEncoder *encoder, | ||||
| const TransformT &transform) { | const TransformT &transform) { | ||||
| const PointAttribute *const att = encoder->point_cloud()->attribute(att_id); | const PointAttribute *const att = encoder->point_cloud()->attribute(att_id); | ||||
| if (method == PREDICTION_UNDEFINED) { | if (method == PREDICTION_UNDEFINED) { | ||||
| method = SelectPredictionMethod(att_id, encoder); | method = SelectPredictionMethod(att_id, encoder); | ||||
| } | } | ||||
| if (method == PREDICTION_NONE) | if (method == PREDICTION_NONE) { | ||||
| return nullptr; // No prediction is used. | return nullptr; // No prediction is used. | ||||
| } | |||||
| if (encoder->GetGeometryType() == TRIANGULAR_MESH) { | if (encoder->GetGeometryType() == TRIANGULAR_MESH) { | ||||
| // Cast the encoder to mesh encoder. This is not necessarily safe if there | // Cast the encoder to mesh encoder. This is not necessarily safe if there | ||||
| // is some other encoder decides to use TRIANGULAR_MESH as the return type, | // is some other encoder decides to use TRIANGULAR_MESH as the return type, | ||||
| // but unfortunately there is not nice work around for this without using | // but unfortunately there is not nice work around for this without using | ||||
| // RTTI (double dispatch and similar concepts will not work because of the | // RTTI (double dispatch and similar concepts will not work because of the | ||||
| // template nature of the prediction schemes). | // template nature of the prediction schemes). | ||||
| const MeshEncoder *const mesh_encoder = | const MeshEncoder *const mesh_encoder = | ||||
| static_cast<const MeshEncoder *>(encoder); | static_cast<const MeshEncoder *>(encoder); | ||||
| auto ret = CreateMeshPredictionScheme< | auto ret = CreateMeshPredictionScheme< | ||||
| MeshEncoder, PredictionSchemeEncoder<DataTypeT, TransformT>, | MeshEncoder, PredictionSchemeEncoder<DataTypeT, TransformT>, | ||||
| MeshPredictionSchemeEncoderFactory<DataTypeT>>( | MeshPredictionSchemeEncoderFactory<DataTypeT>>( | ||||
| mesh_encoder, method, att_id, transform, kDracoMeshBitstreamVersion); | mesh_encoder, method, att_id, transform, kDracoMeshBitstreamVersion); | ||||
| if (ret) | if (ret) { | ||||
| return ret; | return ret; | ||||
| } | |||||
| // Otherwise try to create another prediction scheme. | // Otherwise try to create another prediction scheme. | ||||
| } | } | ||||
| // Create delta encoder. | // Create delta encoder. | ||||
| return std::unique_ptr<PredictionSchemeEncoder<DataTypeT, TransformT>>( | return std::unique_ptr<PredictionSchemeEncoder<DataTypeT, TransformT>>( | ||||
| new PredictionSchemeDeltaEncoder<DataTypeT, TransformT>(att, transform)); | new PredictionSchemeDeltaEncoder<DataTypeT, TransformT>(att, transform)); | ||||
| } | } | ||||
| // Create a prediction scheme using a default transform constructor. | // Create a prediction scheme using a default transform constructor. | ||||
| Show All 15 Lines | |||||