mirror of
https://github.com/androidx/media.git
synced 2025-05-11 17:49:52 +08:00
HDR: Fix debug surface by setting correct output color.
Set the correct output color on the debug SurfaceViewWrapper, so that SDR contents can have an output transfer of either GAMMA_2_2 (Gamma 2.2) or SDR (SMPTE 170M). This fixes an issue where in-app tone-mapping would output gamma 2.2, and the SDR value incorrectly hardcoded here would lead to an error in the OpenGL, which does not support SMPTE 170M. PiperOrigin-RevId: 506684602
This commit is contained in:
parent
47b59f98e1
commit
f2cfb14be4
@ -367,7 +367,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
if (debugSurfaceView != null && !Util.areEqual(this.debugSurfaceView, debugSurfaceView)) {
|
||||
debugSurfaceViewWrapper =
|
||||
new SurfaceViewWrapper(
|
||||
eglDisplay, eglContext, ColorInfo.isTransferHdr(outputColorInfo), debugSurfaceView);
|
||||
eglDisplay, eglContext, debugSurfaceView, outputColorInfo.colorTransfer);
|
||||
}
|
||||
this.debugSurfaceView = debugSurfaceView;
|
||||
}
|
||||
@ -467,11 +467,17 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
private int height;
|
||||
|
||||
public SurfaceViewWrapper(
|
||||
EGLDisplay eglDisplay, EGLContext eglContext, boolean useHdr, SurfaceView surfaceView) {
|
||||
EGLDisplay eglDisplay,
|
||||
EGLContext eglContext,
|
||||
SurfaceView surfaceView,
|
||||
@C.ColorTransfer int outputColorTransfer) {
|
||||
this.eglDisplay = eglDisplay;
|
||||
this.eglContext = eglContext;
|
||||
// Screen output supports only BT.2020 PQ (ST2084) for HDR.
|
||||
this.outputColorTransfer = useHdr ? C.COLOR_TRANSFER_ST2084 : C.COLOR_TRANSFER_SDR;
|
||||
this.outputColorTransfer =
|
||||
outputColorTransfer == C.COLOR_TRANSFER_HLG
|
||||
? C.COLOR_TRANSFER_ST2084
|
||||
: outputColorTransfer;
|
||||
surfaceView.getHolder().addCallback(this);
|
||||
surface = surfaceView.getHolder().getSurface();
|
||||
width = surfaceView.getWidth();
|
||||
|
Loading…
x
Reference in New Issue
Block a user