Effect: remove duplicate inputColorInfo checks
We currently check certain properties about inputColorInfo twice: once in checkColors in the DVFP and once when creating the samplers in the defaultshaderprogam. The inputcolorinfo shouldn't change between these two components so removing the checks in the shader program to have one source of truth for inputColorInfo checks, which will make the code simpler when it comes to adding to color-related features (like the ones related to removing de-gamma-ing) PiperOrigin-RevId: 626400960
This commit is contained in:
parent
09f2cda43c
commit
0bc5ac24b0
@ -346,7 +346,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
checkArgument(
|
checkArgument(
|
||||||
outputColorTransfer == C.COLOR_TRANSFER_HLG
|
outputColorTransfer == C.COLOR_TRANSFER_HLG
|
||||||
|| outputColorTransfer == C.COLOR_TRANSFER_ST2084);
|
|| outputColorTransfer == C.COLOR_TRANSFER_ST2084);
|
||||||
checkArgument(enableColorTransfers);
|
|
||||||
glProgram.setIntUniform("uOutputColorTransfer", outputColorTransfer);
|
glProgram.setIntUniform("uOutputColorTransfer", outputColorTransfer);
|
||||||
} else if (enableColorTransfers) {
|
} else if (enableColorTransfers) {
|
||||||
checkArgument(
|
checkArgument(
|
||||||
@ -375,8 +374,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
&& outputColorInfo.colorSpace == C.COLOR_SPACE_BT2020;
|
&& outputColorInfo.colorSpace == C.COLOR_SPACE_BT2020;
|
||||||
@C.ColorTransfer int outputColorTransfer = outputColorInfo.colorTransfer;
|
@C.ColorTransfer int outputColorTransfer = outputColorInfo.colorTransfer;
|
||||||
if (isInputTransferHdr) {
|
if (isInputTransferHdr) {
|
||||||
checkArgument(inputColorInfo.colorSpace == C.COLOR_SPACE_BT2020);
|
|
||||||
checkArgument(enableColorTransfers);
|
|
||||||
// TODO(b/239735341): Add a setBooleanUniform method to GlProgram.
|
// TODO(b/239735341): Add a setBooleanUniform method to GlProgram.
|
||||||
checkArgument(outputColorTransfer != Format.NO_VALUE);
|
checkArgument(outputColorTransfer != Format.NO_VALUE);
|
||||||
if (outputColorTransfer == C.COLOR_TRANSFER_SDR) {
|
if (outputColorTransfer == C.COLOR_TRANSFER_SDR) {
|
||||||
@ -386,7 +383,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
}
|
}
|
||||||
glProgram.setIntUniform("uOutputColorTransfer", outputColorTransfer);
|
glProgram.setIntUniform("uOutputColorTransfer", outputColorTransfer);
|
||||||
} else if (isExpandingColorGamut) {
|
} else if (isExpandingColorGamut) {
|
||||||
checkArgument(enableColorTransfers);
|
|
||||||
glProgram.setIntUniform("uOutputColorTransfer", outputColorTransfer);
|
glProgram.setIntUniform("uOutputColorTransfer", outputColorTransfer);
|
||||||
} else {
|
} else {
|
||||||
glProgram.setIntUniform("uEnableColorTransfer", enableColorTransfers ? GL_TRUE : GL_FALSE);
|
glProgram.setIntUniform("uEnableColorTransfer", enableColorTransfers ? GL_TRUE : GL_FALSE);
|
||||||
|
@ -889,6 +889,9 @@ public final class DefaultVideoFrameProcessor implements VideoFrameProcessor {
|
|||||||
private static void checkColors(
|
private static void checkColors(
|
||||||
ColorInfo inputColorInfo, ColorInfo outputColorInfo, boolean enableColorTransfers)
|
ColorInfo inputColorInfo, ColorInfo outputColorInfo, boolean enableColorTransfers)
|
||||||
throws VideoFrameProcessingException {
|
throws VideoFrameProcessingException {
|
||||||
|
if (ColorInfo.isTransferHdr(inputColorInfo)) {
|
||||||
|
checkArgument(inputColorInfo.colorSpace == C.COLOR_SPACE_BT2020);
|
||||||
|
}
|
||||||
if ((ColorInfo.isTransferHdr(inputColorInfo) || ColorInfo.isTransferHdr(outputColorInfo))) {
|
if ((ColorInfo.isTransferHdr(inputColorInfo) || ColorInfo.isTransferHdr(outputColorInfo))) {
|
||||||
checkArgument(enableColorTransfers);
|
checkArgument(enableColorTransfers);
|
||||||
long glVersion;
|
long glVersion;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user