Differential D9642 Diff 31697 extern/draco/draco/src/draco/compression/attributes/prediction_schemes/prediction_scheme_decoder_factory.h
Changeset View
Changeset View
Standalone View
Standalone View
extern/draco/draco/src/draco/compression/attributes/prediction_schemes/prediction_scheme_decoder_factory.h
- This file was moved from extern/draco/dracoenc/src/draco/compression/attributes/prediction_schemes/prediction_scheme_decoder_factory.h.
| Show All 12 Lines | |||||
| // limitations under the License. | // limitations under the License. | ||||
| // | // | ||||
| // Functions for creating prediction schemes for decoders using the provided | // Functions for creating prediction schemes for decoders using the provided | ||||
| // prediction method id. | // prediction method id. | ||||
| #ifndef DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_DECODER_FACTORY_H_ | #ifndef DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_DECODER_FACTORY_H_ | ||||
| #define DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_DECODER_FACTORY_H_ | #define DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_DECODER_FACTORY_H_ | ||||
| #include "draco/draco_features.h" | |||||
| #include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_constrained_multi_parallelogram_decoder.h" | #include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_constrained_multi_parallelogram_decoder.h" | ||||
| #include "draco/draco_features.h" | |||||
| #ifdef DRACO_NORMAL_ENCODING_SUPPORTED | #ifdef DRACO_NORMAL_ENCODING_SUPPORTED | ||||
| #include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_decoder.h" | #include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_decoder.h" | ||||
| #endif | #endif | ||||
| #include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_multi_parallelogram_decoder.h" | #include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_multi_parallelogram_decoder.h" | ||||
| #include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_parallelogram_decoder.h" | #include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_parallelogram_decoder.h" | ||||
| #include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_decoder.h" | #include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_decoder.h" | ||||
| #include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_portable_decoder.h" | #include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_portable_decoder.h" | ||||
| #include "draco/compression/attributes/prediction_schemes/prediction_scheme_decoder.h" | #include "draco/compression/attributes/prediction_schemes/prediction_scheme_decoder.h" | ||||
| ▲ Show 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | |||||
| // Creates a prediction scheme for a given decoder and given prediction method. | // Creates a prediction scheme for a given decoder and given prediction method. | ||||
| // The prediction schemes are automatically initialized with decoder specific | // The prediction schemes are automatically initialized with decoder specific | ||||
| // data if needed. | // data if needed. | ||||
| template <typename DataTypeT, class TransformT> | template <typename DataTypeT, class TransformT> | ||||
| std::unique_ptr<PredictionSchemeDecoder<DataTypeT, TransformT>> | std::unique_ptr<PredictionSchemeDecoder<DataTypeT, TransformT>> | ||||
| CreatePredictionSchemeForDecoder(PredictionSchemeMethod method, int att_id, | CreatePredictionSchemeForDecoder(PredictionSchemeMethod method, int att_id, | ||||
| const PointCloudDecoder *decoder, | const PointCloudDecoder *decoder, | ||||
| const TransformT &transform) { | const TransformT &transform) { | ||||
| if (method == PREDICTION_NONE) | if (method == PREDICTION_NONE) { | ||||
| return nullptr; | return nullptr; | ||||
| } | |||||
| const PointAttribute *const att = decoder->point_cloud()->attribute(att_id); | const PointAttribute *const att = decoder->point_cloud()->attribute(att_id); | ||||
| if (decoder->GetGeometryType() == TRIANGULAR_MESH) { | if (decoder->GetGeometryType() == TRIANGULAR_MESH) { | ||||
| // Cast the decoder to mesh decoder. This is not necessarily safe if there | // Cast the decoder to mesh decoder. This is not necessarily safe if there | ||||
| // is some other decoder decides to use TRIANGULAR_MESH as the return type, | // is some other decoder 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 MeshDecoder *const mesh_decoder = | const MeshDecoder *const mesh_decoder = | ||||
| static_cast<const MeshDecoder *>(decoder); | static_cast<const MeshDecoder *>(decoder); | ||||
| auto ret = CreateMeshPredictionScheme< | auto ret = CreateMeshPredictionScheme< | ||||
| MeshDecoder, PredictionSchemeDecoder<DataTypeT, TransformT>, | MeshDecoder, PredictionSchemeDecoder<DataTypeT, TransformT>, | ||||
| MeshPredictionSchemeDecoderFactory<DataTypeT>>( | MeshPredictionSchemeDecoderFactory<DataTypeT>>( | ||||
| mesh_decoder, method, att_id, transform, decoder->bitstream_version()); | mesh_decoder, method, att_id, transform, decoder->bitstream_version()); | ||||
| if (ret) | if (ret) { | ||||
| return ret; | return ret; | ||||
| } | |||||
| // Otherwise try to create another prediction scheme. | // Otherwise try to create another prediction scheme. | ||||
| } | } | ||||
| // Create delta decoder. | // Create delta decoder. | ||||
| return std::unique_ptr<PredictionSchemeDecoder<DataTypeT, TransformT>>( | return std::unique_ptr<PredictionSchemeDecoder<DataTypeT, TransformT>>( | ||||
| new PredictionSchemeDeltaDecoder<DataTypeT, TransformT>(att, transform)); | new PredictionSchemeDeltaDecoder<DataTypeT, TransformT>(att, transform)); | ||||
| } | } | ||||
| // Create a prediction scheme using a default transform constructor. | // Create a prediction scheme using a default transform constructor. | ||||
| Show All 11 Lines | |||||