Differential D9642 Diff 31697 extern/draco/draco/src/draco/compression/attributes/prediction_schemes/prediction_scheme_wrap_decoding_transform.h
Changeset View
Changeset View
Standalone View
Standalone View
extern/draco/draco/src/draco/compression/attributes/prediction_schemes/prediction_scheme_wrap_decoding_transform.h
- This file was moved from extern/draco/dracoenc/src/draco/compression/attributes/prediction_schemes/prediction_scheme_wrap_decoding_transform.h.
| Show All 33 Lines | public: | ||||
| // Computes the original value from the input predicted value and the decoded | // Computes the original value from the input predicted value and the decoded | ||||
| // corrections. Values out of the bounds of the input values are unwrapped. | // corrections. Values out of the bounds of the input values are unwrapped. | ||||
| inline void ComputeOriginalValue(const DataTypeT *predicted_vals, | inline void ComputeOriginalValue(const DataTypeT *predicted_vals, | ||||
| const CorrTypeT *corr_vals, | const CorrTypeT *corr_vals, | ||||
| DataTypeT *out_original_vals) const { | DataTypeT *out_original_vals) const { | ||||
| predicted_vals = this->ClampPredictedValue(predicted_vals); | predicted_vals = this->ClampPredictedValue(predicted_vals); | ||||
| for (int i = 0; i < this->num_components(); ++i) { | for (int i = 0; i < this->num_components(); ++i) { | ||||
| out_original_vals[i] = predicted_vals[i] + corr_vals[i]; | out_original_vals[i] = predicted_vals[i] + corr_vals[i]; | ||||
| if (out_original_vals[i] > this->max_value()) | if (out_original_vals[i] > this->max_value()) { | ||||
| out_original_vals[i] -= this->max_dif(); | out_original_vals[i] -= this->max_dif(); | ||||
| else if (out_original_vals[i] < this->min_value()) | } else if (out_original_vals[i] < this->min_value()) { | ||||
| out_original_vals[i] += this->max_dif(); | out_original_vals[i] += this->max_dif(); | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| bool DecodeTransformData(DecoderBuffer *buffer) { | bool DecodeTransformData(DecoderBuffer *buffer) { | ||||
| DataTypeT min_value, max_value; | DataTypeT min_value, max_value; | ||||
| if (!buffer->Decode(&min_value)) | if (!buffer->Decode(&min_value)) { | ||||
| return false; | return false; | ||||
| if (!buffer->Decode(&max_value)) | } | ||||
| if (!buffer->Decode(&max_value)) { | |||||
| return false; | return false; | ||||
| if (min_value > max_value) | } | ||||
| if (min_value > max_value) { | |||||
| return false; | return false; | ||||
| } | |||||
| this->set_min_value(min_value); | this->set_min_value(min_value); | ||||
| this->set_max_value(max_value); | this->set_max_value(max_value); | ||||
| if (!this->InitCorrectionBounds()) | if (!this->InitCorrectionBounds()) { | ||||
| return false; | return false; | ||||
| } | |||||
| return true; | return true; | ||||
| } | } | ||||
| }; | }; | ||||
| } // namespace draco | } // namespace draco | ||||
| #endif // DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_WRAP_DECODING_TRANSFORM_H_ | #endif // DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_WRAP_DECODING_TRANSFORM_H_ | ||||