diff options
author | Siddharth Kapoor <ksiddharth@google.com> | 2018-12-05 20:29:06 +0800 |
---|---|---|
committer | Siddharth Kapoor <ksiddharth@google.com> | 2018-12-05 20:29:06 +0800 |
commit | ac1f7c9c50b468315dbd4b0e71e03fb736fd98eb (patch) | |
tree | 26f32935f4d9392b831f64020a0f78f00a2970f1 | |
parent | 4c3137a9d3fe39d09aed664c0405bb219591cc90 (diff) | |
download | native-ac1f7c9c50b468315dbd4b0e71e03fb736fd98eb.tar.gz |
[RenderEngine] Clamp input color for BT2020_PQ EOTF
Color input to EOTF for PQ transfer function is out-of-bounds [0.0, 1.0]
Reason being, texture2D returns values which is not in range [0.0, 1.0].
These returned values are passed as gl_FragColor.rgb to EOTF for PQ
transfer function. In EOTF, colors outside the range [0.0, 1.0] are
rendered as black resulting in artifacts while video playback.
Clamp the input color to the range [0.0, 1.0]
Bug: 118794307
Test: Youtube HDR video plays fine, also screenshots taken while playback
does not have any artifacts.
Change-Id: I266f5a009c4c58924510283295757abae811a41e
-rw-r--r-- | services/surfaceflinger/RenderEngine/ProgramCache.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/services/surfaceflinger/RenderEngine/ProgramCache.cpp b/services/surfaceflinger/RenderEngine/ProgramCache.cpp index 9dc6858566..46402d5164 100644 --- a/services/surfaceflinger/RenderEngine/ProgramCache.cpp +++ b/services/surfaceflinger/RenderEngine/ProgramCache.cpp @@ -220,7 +220,7 @@ void ProgramCache::generateEOTF(Formatter& fs, const Key& needs) { const highp float c2 = (2413.0 / 4096.0) * 32.0; const highp float c3 = (2392.0 / 4096.0) * 32.0; - highp vec3 tmp = pow(color, 1.0 / vec3(m2)); + highp vec3 tmp = pow(clamp(color, 0.0, 1.0), 1.0 / vec3(m2)); tmp = max(tmp - c1, 0.0) / (c2 - c3 * tmp); return pow(tmp, 1.0 / vec3(m1)); } |