diff options
author | 2023-05-02 00:03:08 +0000 | |
---|---|---|
committer | 2023-05-02 00:08:26 +0000 | |
commit | 792b150a708a61faedaaa5983fbc5c5185984f50 (patch) | |
tree | d45dba99bbb180dd1ceae9da7c336859249fe7cc /libs/shaders/shaders.cpp | |
parent | 8a186104276cdf57d552c54dbad488e14f0d3d16 (diff) |
Don't overdim SDR content in an HLG screenshot.
Aligning HLG and PQ to 1.0 == 203 nits made SDR assets in screenshots
too dim, since both the colorspace and the color transform applied
dimming. Removing dimming application from the color transform is a
larger change, so just compensate when configuring the screenshot in
SurfaceFlinger instead.
Bug: 280347733
Test: HwAccelerationTest
Test: Navigate in and out of recents
Change-Id: Idfdb74c0c3b977717b870b2bb9a469be37d27dc9
Diffstat (limited to 'libs/shaders/shaders.cpp')
-rw-r--r-- | libs/shaders/shaders.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libs/shaders/shaders.cpp b/libs/shaders/shaders.cpp index b8f2be111e..c85517a976 100644 --- a/libs/shaders/shaders.cpp +++ b/libs/shaders/shaders.cpp @@ -103,10 +103,14 @@ static void generateLuminanceNormalizationForOOTF(ui::Dataspace inputDataspace, // tonemapping downstream. // BT. 2100-2 operates on normalized luminances, so renormalize to the input to // correctly adjust gamma. + // Note that following BT. 2408 for HLG OETF actually maps 0.75 == ~264.96 nits, + // rather than 203 nits, because 203 nits == OOTF(invOETF(0.75)), so even though + // we originally scaled by 203 nits we need to re-normalize to 264.96 nits when + // converting to the correct brightness range. shader.append(R"( float3 NormalizeLuminance(float3 xyz) { float ootfGain = pow(xyz.y / 1000.0, -0.2 / 1.2); - return xyz * ootfGain / 203.0; + return xyz * ootfGain / 264.96; } )"); break; |