Change isColorValid with isDataSpaceValid

This commit is contained in:
Daniele Sparano 2023-08-17 17:19:15 +01:00 committed by microkatz
parent 1fe9c3303e
commit f14732873f
3 changed files with 10 additions and 10 deletions

View File

@ -288,10 +288,10 @@ public final class ColorInfo implements Bundleable {
/** /**
* Returns whether this instance is valid. * Returns whether this instance is valid.
* *
* <p>This instance is valid if at least one between bitdepths and color info are valid. * <p>This instance is valid if at least one between bitdepths and DataSpace info are valid.
*/ */
public boolean isValid() { public boolean isValid() {
return isBitdepthValid() || isColorValid(); return isBitdepthValid() || isDataSpaceValid();
} }
/** /**
@ -304,11 +304,11 @@ public final class ColorInfo implements Bundleable {
} }
/** /**
* Returns whether this instance is color valid. * Returns whether this instance has valid DataSpace members.
* *
* <p>This instance is valid if no color members are {@link Format#NO_VALUE}. * <p>This instance is valid if no DataSpace members are {@link Format#NO_VALUE}.
*/ */
public boolean isColorValid() { public boolean isDataSpaceValid() {
return colorSpace != Format.NO_VALUE return colorSpace != Format.NO_VALUE
&& colorRange != Format.NO_VALUE && colorRange != Format.NO_VALUE
&& colorTransfer != Format.NO_VALUE; && colorTransfer != Format.NO_VALUE;
@ -325,11 +325,11 @@ public final class ColorInfo implements Bundleable {
} }
String bitdepthsString = isBitdepthValid() ? lumaBitdepth + "/" + chromaBitdepth : "NA"; String bitdepthsString = isBitdepthValid() ? lumaBitdepth + "/" + chromaBitdepth : "NA";
String colorString = isColorValid() ? Util.formatInvariant("%s/%s/%s", String dataspaceString = isDataSpaceValid() ? Util.formatInvariant("%s/%s/%s",
colorSpaceToString(colorSpace), colorSpaceToString(colorSpace),
colorRangeToString(colorRange), colorRangeToString(colorRange),
colorTransferToString(colorTransfer)) : "NA"; colorTransferToString(colorTransfer)) : "NA";
return bitdepthsString + "/" + colorString; return bitdepthsString + "/" + dataspaceString;
} }
@Override @Override

View File

@ -253,9 +253,9 @@ public final class DefaultVideoFrameProcessor implements VideoFrameProcessor {
throws VideoFrameProcessingException { throws VideoFrameProcessingException {
// TODO(b/261188041) Add tests to verify the Listener is invoked on the given Executor. // TODO(b/261188041) Add tests to verify the Listener is invoked on the given Executor.
checkArgument(inputColorInfo.isColorValid()); checkArgument(inputColorInfo.isDataSpaceValid());
checkArgument(inputColorInfo.colorTransfer != C.COLOR_TRANSFER_LINEAR); checkArgument(inputColorInfo.colorTransfer != C.COLOR_TRANSFER_LINEAR);
checkArgument(outputColorInfo.isColorValid()); checkArgument(outputColorInfo.isDataSpaceValid());
checkArgument(outputColorInfo.colorTransfer != C.COLOR_TRANSFER_LINEAR); checkArgument(outputColorInfo.colorTransfer != C.COLOR_TRANSFER_LINEAR);
if (ColorInfo.isTransferHdr(inputColorInfo) || ColorInfo.isTransferHdr(outputColorInfo)) { if (ColorInfo.isTransferHdr(inputColorInfo) || ColorInfo.isTransferHdr(outputColorInfo)) {
checkArgument(enableColorTransfers); checkArgument(enableColorTransfers);

View File

@ -97,7 +97,7 @@ import org.checkerframework.dataflow.qual.Pure;
finalFramePresentationTimeUs = C.TIME_UNSET; finalFramePresentationTimeUs = C.TIME_UNSET;
ColorInfo decoderInputColor; ColorInfo decoderInputColor;
if (firstInputFormat.colorInfo == null || !firstInputFormat.colorInfo.isColorValid()) { if (firstInputFormat.colorInfo == null || !firstInputFormat.colorInfo.isDataSpaceValid()) {
Log.d(TAG, "colorInfo is null or invalid. Defaulting to SDR_BT709_LIMITED."); Log.d(TAG, "colorInfo is null or invalid. Defaulting to SDR_BT709_LIMITED.");
decoderInputColor = ColorInfo.SDR_BT709_LIMITED; decoderInputColor = ColorInfo.SDR_BT709_LIMITED;
} else { } else {