Resume toLogString() in ColorInfo; revert DebugTextViewHelper
This commit is contained in:
parent
c72ec74e11
commit
1fe9c3303e
@ -288,10 +288,27 @@ public final class ColorInfo implements Bundleable {
|
|||||||
/**
|
/**
|
||||||
* Returns whether this instance is valid.
|
* Returns whether this instance is valid.
|
||||||
*
|
*
|
||||||
* <p>This instance is valid if no color members are {@link Format#NO_VALUE}, while bit depths may
|
* <p>This instance is valid if at least one between bitdepths and color info are valid.
|
||||||
* be unset.
|
|
||||||
*/
|
*/
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
|
return isBitdepthValid() || isColorValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether this instance has valid bitdepths.
|
||||||
|
*
|
||||||
|
* <p>This instance has valid bitdepths if none of them is {@link Format#NO_VALUE}.
|
||||||
|
*/
|
||||||
|
public boolean isBitdepthValid() {
|
||||||
|
return lumaBitdepth != Format.NO_VALUE && chromaBitdepth != Format.NO_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether this instance is color valid.
|
||||||
|
*
|
||||||
|
* <p>This instance is valid if no color members are {@link Format#NO_VALUE}.
|
||||||
|
*/
|
||||||
|
public boolean isColorValid() {
|
||||||
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;
|
||||||
@ -302,29 +319,17 @@ public final class ColorInfo implements Bundleable {
|
|||||||
*
|
*
|
||||||
* @see Format#toLogString(Format)
|
* @see Format#toLogString(Format)
|
||||||
*/
|
*/
|
||||||
public String toColorString() {
|
public String toLogString() {
|
||||||
if (!isValid()) {
|
if (!isValid()) {
|
||||||
return "NA";
|
return "NA";
|
||||||
}
|
}
|
||||||
|
|
||||||
return Util.formatInvariant(
|
String bitdepthsString = isBitdepthValid() ? lumaBitdepth + "/" + chromaBitdepth : "NA";
|
||||||
"%s/%s/%s",
|
String colorString = isColorValid() ? Util.formatInvariant("%s/%s/%s",
|
||||||
colorSpaceToString(colorSpace),
|
colorSpaceToString(colorSpace),
|
||||||
colorRangeToString(colorRange),
|
colorRangeToString(colorRange),
|
||||||
colorTransferToString(colorTransfer));
|
colorTransferToString(colorTransfer)) : "NA";
|
||||||
}
|
return bitdepthsString + "/" + colorString;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether this instance has valid bitdepths.
|
|
||||||
*
|
|
||||||
* <p>This instance has valid bitdepths if none of them is {@link Format#NO_VALUE}.
|
|
||||||
*/
|
|
||||||
public boolean isBppValid() {
|
|
||||||
return lumaBitdepth != Format.NO_VALUE && chromaBitdepth != Format.NO_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toBppString() {
|
|
||||||
return isBppValid() ? lumaBitdepth + "," + chromaBitdepth : "NA";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -347,9 +352,9 @@ public final class ColorInfo implements Bundleable {
|
|||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ColorInfo("
|
return "ColorInfo("
|
||||||
+ lumaBitdepth
|
+ lumaBitdepthToString(lumaBitdepth)
|
||||||
+ ", "
|
+ ", "
|
||||||
+ chromaBitdepth
|
+ chromaBitdepthToString(chromaBitdepth)
|
||||||
+ ", "
|
+ ", "
|
||||||
+ colorSpaceToString(colorSpace)
|
+ colorSpaceToString(colorSpace)
|
||||||
+ ", "
|
+ ", "
|
||||||
@ -361,6 +366,14 @@ public final class ColorInfo implements Bundleable {
|
|||||||
+ ")";
|
+ ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String lumaBitdepthToString(int val) {
|
||||||
|
return val != Format.NO_VALUE ? val + "bit Luma" : "NA";
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String chromaBitdepthToString(int val) {
|
||||||
|
return val != Format.NO_VALUE ? val + "bit Chroma" : "NA";
|
||||||
|
}
|
||||||
|
|
||||||
private static String colorSpaceToString(@C.ColorSpace int colorSpace) {
|
private static String colorSpaceToString(@C.ColorSpace int colorSpace) {
|
||||||
// LINT.IfChange(color_space)
|
// LINT.IfChange(color_space)
|
||||||
switch (colorSpace) {
|
switch (colorSpace) {
|
||||||
|
@ -1260,7 +1260,7 @@ public final class Format implements Bundleable {
|
|||||||
builder.append(", res=").append(format.width).append("x").append(format.height);
|
builder.append(", res=").append(format.width).append("x").append(format.height);
|
||||||
}
|
}
|
||||||
if (format.colorInfo != null && format.colorInfo.isValid()) {
|
if (format.colorInfo != null && format.colorInfo.isValid()) {
|
||||||
builder.append(", color=").append(format.colorInfo.toColorString());
|
builder.append(", color=").append(format.colorInfo.toLogString());
|
||||||
}
|
}
|
||||||
if (format.frameRate != NO_VALUE) {
|
if (format.frameRate != NO_VALUE) {
|
||||||
builder.append(", fps=").append(format.frameRate);
|
builder.append(", fps=").append(format.frameRate);
|
||||||
|
@ -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.isValid());
|
checkArgument(inputColorInfo.isColorValid());
|
||||||
checkArgument(inputColorInfo.colorTransfer != C.COLOR_TRANSFER_LINEAR);
|
checkArgument(inputColorInfo.colorTransfer != C.COLOR_TRANSFER_LINEAR);
|
||||||
checkArgument(outputColorInfo.isValid());
|
checkArgument(outputColorInfo.isColorValid());
|
||||||
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);
|
||||||
|
@ -189,10 +189,7 @@ public class DebugTextViewHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String getColorInfoString(@Nullable ColorInfo colorInfo) {
|
private static String getColorInfoString(@Nullable ColorInfo colorInfo) {
|
||||||
return colorInfo != null
|
return colorInfo != null && colorInfo.isValid() ? " colr:" + colorInfo.toLogString() : "";
|
||||||
? (colorInfo.isBppValid() ? " b:" + colorInfo.toBppString() : "")
|
|
||||||
+ (colorInfo.isValid() ? " colr:" + colorInfo.toColorString() : "")
|
|
||||||
: "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getPixelAspectRatioString(float pixelAspectRatio) {
|
private static String getPixelAspectRatioString(float pixelAspectRatio) {
|
||||||
|
@ -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.isValid()) {
|
if (firstInputFormat.colorInfo == null || !firstInputFormat.colorInfo.isColorValid()) {
|
||||||
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 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user