Loading services/surfaceflinger/RenderEngine/ProgramCache.cpp +12 −12 Original line number Diff line number Diff line Loading @@ -251,7 +251,7 @@ void ProgramCache::generateOOTF(Formatter& fs, const Key& needs) { const float maxMasteringLumi = 1000.0; const float maxContentLumi = 1000.0; const float maxInLumi = min(maxMasteringLumi, maxContentLumi); const float maxOutLumi = displayMaxLuminance; float maxOutLumi = displayMaxLuminance; // Calculate Y value in XYZ color space. float colorY = CalculateY(color); Loading @@ -269,18 +269,18 @@ void ProgramCache::generateOOTF(Formatter& fs, const Key& needs) { // three control points const float x0 = 10.0; const float y0 = 17.0; const float x1 = maxOutLumi * 0.75; const float y1 = x1; const float x2 = x1 + (maxInLumi - x1) / 2.0; const float y2 = y1 + (maxOutLumi - y1) * 0.75; float x1 = maxOutLumi * 0.75; float y1 = x1; float x2 = x1 + (maxInLumi - x1) / 2.0; float y2 = y1 + (maxOutLumi - y1) * 0.75; // horizontal distances between the last three control points const float h12 = x2 - x1; const float h23 = maxInLumi - x2; float h12 = x2 - x1; float h23 = maxInLumi - x2; // tangents at the last three control points const float m1 = (y2 - y1) / h12; const float m3 = (maxOutLumi - y2) / h23; const float m2 = (m1 + m3) / 2.0; float m1 = (y2 - y1) / h12; float m3 = (maxOutLumi - y2) / h23; float m2 = (m1 + m3) / 2.0; if (nits < x0) { // scale [0.0, x0] to [0.0, y0] linearly Loading @@ -288,7 +288,7 @@ void ProgramCache::generateOOTF(Formatter& fs, const Key& needs) { nits *= slope; } else if (nits < x1) { // scale [x0, x1] to [y0, y1] linearly const float slope = (y1 - y0) / (x1 - x0); float slope = (y1 - y0) / (x1 - x0); nits = y0 + (nits - x0) * slope; } else if (nits < x2) { // scale [x1, x2] to [y1, y2] using Hermite interp Loading Loading @@ -448,7 +448,7 @@ String8 ProgramCache::generateFragmentShader(const Key& needs) { if (needs.hasTransformMatrix() || (needs.getInputTF() != needs.getOutputTF())) { // Currently, only the OOTF of BT2020 PQ needs display maximum luminance. if (needs.getInputTF() == Key::INPUT_TF_ST2084) { fs << "uniform float displayMaxLuminance"; fs << "uniform float displayMaxLuminance;"; } if (needs.hasInputTransformMatrix()) { Loading Loading
services/surfaceflinger/RenderEngine/ProgramCache.cpp +12 −12 Original line number Diff line number Diff line Loading @@ -251,7 +251,7 @@ void ProgramCache::generateOOTF(Formatter& fs, const Key& needs) { const float maxMasteringLumi = 1000.0; const float maxContentLumi = 1000.0; const float maxInLumi = min(maxMasteringLumi, maxContentLumi); const float maxOutLumi = displayMaxLuminance; float maxOutLumi = displayMaxLuminance; // Calculate Y value in XYZ color space. float colorY = CalculateY(color); Loading @@ -269,18 +269,18 @@ void ProgramCache::generateOOTF(Formatter& fs, const Key& needs) { // three control points const float x0 = 10.0; const float y0 = 17.0; const float x1 = maxOutLumi * 0.75; const float y1 = x1; const float x2 = x1 + (maxInLumi - x1) / 2.0; const float y2 = y1 + (maxOutLumi - y1) * 0.75; float x1 = maxOutLumi * 0.75; float y1 = x1; float x2 = x1 + (maxInLumi - x1) / 2.0; float y2 = y1 + (maxOutLumi - y1) * 0.75; // horizontal distances between the last three control points const float h12 = x2 - x1; const float h23 = maxInLumi - x2; float h12 = x2 - x1; float h23 = maxInLumi - x2; // tangents at the last three control points const float m1 = (y2 - y1) / h12; const float m3 = (maxOutLumi - y2) / h23; const float m2 = (m1 + m3) / 2.0; float m1 = (y2 - y1) / h12; float m3 = (maxOutLumi - y2) / h23; float m2 = (m1 + m3) / 2.0; if (nits < x0) { // scale [0.0, x0] to [0.0, y0] linearly Loading @@ -288,7 +288,7 @@ void ProgramCache::generateOOTF(Formatter& fs, const Key& needs) { nits *= slope; } else if (nits < x1) { // scale [x0, x1] to [y0, y1] linearly const float slope = (y1 - y0) / (x1 - x0); float slope = (y1 - y0) / (x1 - x0); nits = y0 + (nits - x0) * slope; } else if (nits < x2) { // scale [x1, x2] to [y1, y2] using Hermite interp Loading Loading @@ -448,7 +448,7 @@ String8 ProgramCache::generateFragmentShader(const Key& needs) { if (needs.hasTransformMatrix() || (needs.getInputTF() != needs.getOutputTF())) { // Currently, only the OOTF of BT2020 PQ needs display maximum luminance. if (needs.getInputTF() == Key::INPUT_TF_ST2084) { fs << "uniform float displayMaxLuminance"; fs << "uniform float displayMaxLuminance;"; } if (needs.hasInputTransformMatrix()) { Loading