[RenderEngine] Convert BT2020 to SRGB by default.
Previously, we convert BT2020 color space to Display P3 by default. However,
converting it to SRGB makes HDR look visually better under saturated mode. This
patch makes sure we only convert BT2020 to Display P3 when Display P3 is
specified as output data space, and convert BT2020 to SRGB by default.
BUG: 72180957
Test: Build, flash, install customized Youtube app, watch HDR video.
Change-Id: I1ce6568b93fee620ff438b209bf6bb48e1006e83
diff --git a/services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp b/services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp
index aca6c7b..90404fa 100644
--- a/services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp
+++ b/services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp
@@ -147,6 +147,7 @@
mSrgbToXyz = srgb.getRGBtoXYZ();
mDisplayP3ToXyz = displayP3.getRGBtoXYZ();
mBt2020ToXyz = bt2020.getRGBtoXYZ();
+ mXyzToSrgb = mat4(srgb.getXYZtoRGB());
mXyzToDisplayP3 = mat4(displayP3.getXYZtoRGB());
mXyzToBt2020 = mat4(bt2020.getXYZtoRGB());
}
@@ -347,14 +348,17 @@
break;
}
- // The supported output color spaces are Display P3 and BT2020.
+ // The supported output color spaces are BT2020, Display P3 and standard RGB.
switch (outputStandard) {
case Dataspace::STANDARD_BT2020:
wideColorState.setOutputTransformMatrix(mXyzToBt2020);
break;
- default:
+ case Dataspace::STANDARD_DCI_P3:
wideColorState.setOutputTransformMatrix(mXyzToDisplayP3);
break;
+ default:
+ wideColorState.setOutputTransformMatrix(mXyzToSrgb);
+ break;
}
} else if (inputStandard != outputStandard) {
// At this point, the input data space and output data space could be both