Fix HDR effect pipeline

NPE in toneMap_hlgFrame_matchesGoldenFile and toneMap_pqFrame_matchesGoldenFile was created because a uEnableColorTransfer uniform was being created on the HDR path, when HDR shader files don't have this uniform. (they don't support disable color transfers right now)

Fix: only create the uniform when input is SDR.

manually tested on failing tests

PiperOrigin-RevId: 522002603
This commit is contained in:
tofunmi 2023-04-05 11:14:04 +01:00 committed by Marc Baechinger
parent 219967c5a3
commit 5d6ffaaf55

View File

@ -334,7 +334,6 @@ import java.util.List;
ColorInfo outputColorInfo, ColorInfo outputColorInfo,
boolean enableColorTransfers) boolean enableColorTransfers)
throws VideoFrameProcessingException { throws VideoFrameProcessingException {
glProgram.setIntUniform("uEnableColorTransfer", enableColorTransfers ? GL_TRUE : GL_FALSE);
boolean isInputTransferHdr = ColorInfo.isTransferHdr(inputColorInfo); boolean isInputTransferHdr = ColorInfo.isTransferHdr(inputColorInfo);
@C.ColorTransfer int outputColorTransfer = outputColorInfo.colorTransfer; @C.ColorTransfer int outputColorTransfer = outputColorInfo.colorTransfer;
if (isInputTransferHdr) { if (isInputTransferHdr) {
@ -362,6 +361,7 @@ import java.util.List;
outputColorTransfer != Format.NO_VALUE && outputColorTransfer != C.COLOR_TRANSFER_SDR); outputColorTransfer != Format.NO_VALUE && outputColorTransfer != C.COLOR_TRANSFER_SDR);
glProgram.setIntUniform("uOutputColorTransfer", outputColorTransfer); glProgram.setIntUniform("uOutputColorTransfer", outputColorTransfer);
} else { } else {
glProgram.setIntUniform("uEnableColorTransfer", enableColorTransfers ? GL_TRUE : GL_FALSE);
checkArgument( checkArgument(
outputColorInfo.colorSpace != C.COLOR_SPACE_BT2020, outputColorInfo.colorSpace != C.COLOR_SPACE_BT2020,
"Converting from SDR to HDR is not supported."); "Converting from SDR to HDR is not supported.");