Commit b328078c authored by Ohji Nakagami's avatar Ohji Nakagami Committed by David Flynn
Browse files

m42538/recolour: extend reflectance clipping to 16-bit range

This commit fixes an issue with source sequences that contain 16-bit
reflectance data, which may be clipped to 8-bit ranges during attribute
transfer (recolouring) following geometry quantisation.
parent c79fe4b7
...@@ -233,14 +233,15 @@ inline bool PCCTransfertReflectances(const PCCPointSet3 &source, const int32_t s ...@@ -233,14 +233,15 @@ inline bool PCCTransfertReflectances(const PCCPointSet3 &source, const int32_t s
} }
} }
const double oneMinusW = 1.0 - w; const double oneMinusW = 1.0 - w;
// todo(df): clipping range should be based on the input data type
const double maxValue = std::numeric_limits<uint16_t>::max();
const double reflectance0 = const double reflectance0 =
PCCClip(round(w * centroid1 + oneMinusW * centroid2), 0.0, 255.0); PCCClip(round(w * centroid1 + oneMinusW * centroid2), 0.0, maxValue);
const double rSource = 1.0 / double(pointCountSource); const double rSource = 1.0 / double(pointCountSource);
const double rTarget = 1.0 / double(pointCountTarget); const double rTarget = 1.0 / double(pointCountTarget);
double minError = std::numeric_limits<double>::max(); double minError = std::numeric_limits<double>::max();
double bestReflectance = reflectance0; double bestReflectance = reflectance0;
double reflectance; double reflectance;
const double maxValue = std::numeric_limits<uint16_t>::max();
for (int32_t s = -searchRange; s <= searchRange; ++s) { for (int32_t s = -searchRange; s <= searchRange; ++s) {
reflectance = PCCClip(reflectance0 + s, 0.0, maxValue); reflectance = PCCClip(reflectance0 + s, 0.0, maxValue);
const double d = reflectance - reflectance1; const double d = reflectance - reflectance1;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment