diff options
| author | 2023-08-04 20:51:31 +0000 | |
|---|---|---|
| committer | 2023-08-04 20:51:31 +0000 | |
| commit | 30054976b5e4a2b1eb9b27fee6cd394538bc9206 (patch) | |
| tree | a9aa56c6502626a9dd637c3b8df8f81fa7af018b /libs/ultrahdr/gainmapmath.cpp | |
| parent | 10d3ca60da03d21dd52d0635319147f334ab2b37 (diff) | |
| parent | eca8194f745da58ad96eaabeb21b16da8c39dc31 (diff) | |
Merge changes Ic50dd34b,Ib8f5fbef,I058200ca into main
* changes:
ultrahdr: update jpegencoderhelper to accept uncompressed struct fields
ultrahdr: correct offset used during look ups
ultrahdr: minor fixes in encoder and decoder fuzzer
Diffstat (limited to 'libs/ultrahdr/gainmapmath.cpp')
| -rw-r--r-- | libs/ultrahdr/gainmapmath.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libs/ultrahdr/gainmapmath.cpp b/libs/ultrahdr/gainmapmath.cpp index e1c5085b14..ae9c4ca338 100644 --- a/libs/ultrahdr/gainmapmath.cpp +++ b/libs/ultrahdr/gainmapmath.cpp @@ -168,7 +168,7 @@ Color srgbInvOetf(Color e_gamma) { // See IEC 61966-2-1, Equations F.5 and F.6. float srgbInvOetfLUT(float e_gamma) { - uint32_t value = static_cast<uint32_t>(e_gamma * kSrgbInvOETFNumEntries); + uint32_t value = static_cast<uint32_t>(e_gamma * (kSrgbInvOETFNumEntries - 1) + 0.5); //TODO() : Remove once conversion modules have appropriate clamping in place value = CLIP3(value, 0, kSrgbInvOETFNumEntries - 1); return kSrgbInvOETF[value]; @@ -288,7 +288,7 @@ Color hlgOetf(Color e) { } float hlgOetfLUT(float e) { - uint32_t value = static_cast<uint32_t>(e * kHlgOETFNumEntries); + uint32_t value = static_cast<uint32_t>(e * (kHlgOETFNumEntries - 1) + 0.5); //TODO() : Remove once conversion modules have appropriate clamping in place value = CLIP3(value, 0, kHlgOETFNumEntries - 1); @@ -315,7 +315,7 @@ Color hlgInvOetf(Color e_gamma) { } float hlgInvOetfLUT(float e_gamma) { - uint32_t value = static_cast<uint32_t>(e_gamma * kHlgInvOETFNumEntries); + uint32_t value = static_cast<uint32_t>(e_gamma * (kHlgInvOETFNumEntries - 1) + 0.5); //TODO() : Remove once conversion modules have appropriate clamping in place value = CLIP3(value, 0, kHlgInvOETFNumEntries - 1); @@ -344,7 +344,7 @@ Color pqOetf(Color e) { } float pqOetfLUT(float e) { - uint32_t value = static_cast<uint32_t>(e * kPqOETFNumEntries); + uint32_t value = static_cast<uint32_t>(e * (kPqOETFNumEntries - 1) + 0.5); //TODO() : Remove once conversion modules have appropriate clamping in place value = CLIP3(value, 0, kPqOETFNumEntries - 1); @@ -376,7 +376,7 @@ Color pqInvOetf(Color e_gamma) { } float pqInvOetfLUT(float e_gamma) { - uint32_t value = static_cast<uint32_t>(e_gamma * kPqInvOETFNumEntries); + uint32_t value = static_cast<uint32_t>(e_gamma * (kPqInvOETFNumEntries - 1) + 0.5); //TODO() : Remove once conversion modules have appropriate clamping in place value = CLIP3(value, 0, kPqInvOETFNumEntries - 1); |