Push HLG OOTF down to libtonemap.
Usage of current display brightness may be vendor-configured when the
display brightness is very low, so keep the OOTF in libtonemap as part
of the reference implementation.
Concretely, this means that:
* The BT2100 recommended OOTF for HLG->output format is moved from
ScaleLuminance in libshaders to be the first part of the tonemapping
operator in libtonemap
* The inverse OOTF for input format->HLG is moved from
NormalizeLuminance in libshaders to the end of the tonemapping operator
in libtonemp
* Current display brightness is only taken into account in the default
tonemapping for Android T. The historic tonemapper does not take into
account current display brightness, as it treats the "nominal peak
brightness" of the display as 1000 nits instead of the current
brightness.
Also add a default lower-bound for using the current display brightness,
because not having a bound looks really terrible on existing shipping
devices
Bug: 208933319
Test: builds
Test: HLG test video looks okay
Test: HDR10 test video didn't break
Change-Id: I4f489c68f635a8ecc4d497b98c32e91c297d0765
diff --git a/libs/renderengine/tests/RenderEngineTest.cpp b/libs/renderengine/tests/RenderEngineTest.cpp
index ec1bd47..38ae2fd 100644
--- a/libs/renderengine/tests/RenderEngineTest.cpp
+++ b/libs/renderengine/tests/RenderEngineTest.cpp
@@ -2619,8 +2619,7 @@
[](vec3 color) { return EOTF_HLG(color); },
[](vec3 color, float currentLuminaceNits) {
static constexpr float kMaxHLGLuminance = 1000.f;
- static const float kHLGGamma = 1.2 + 0.42 * std::log10(currentLuminaceNits / 1000);
- return color * kMaxHLGLuminance * std::pow(color.y, kHLGGamma - 1);
+ return color * kMaxHLGLuminance;
});
}