Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add luma & chroma bit depths to Format #491

Merged
merged 15 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change isColorValid with isDataSpaceValid
  • Loading branch information
dsparano authored and microkatz committed Oct 17, 2023
commit f14732873f51607e5b99977d666e5630b1d79a4b
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,10 @@ public Builder buildUpon() {
/**
* 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() {
return isBitdepthValid() || isColorValid();
return isBitdepthValid() || isDataSpaceValid();
}

/**
Expand All @@ -304,11 +304,11 @@ public boolean isBitdepthValid() {
}

/**
* 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
&& colorRange != Format.NO_VALUE
&& colorTransfer != Format.NO_VALUE;
Expand All @@ -325,11 +325,11 @@ public String toLogString() {
}

String bitdepthsString = isBitdepthValid() ? lumaBitdepth + "/" + chromaBitdepth : "NA";
String colorString = isColorValid() ? Util.formatInvariant("%s/%s/%s",
String dataspaceString = isDataSpaceValid() ? Util.formatInvariant("%s/%s/%s",
colorSpaceToString(colorSpace),
colorRangeToString(colorRange),
colorTransferToString(colorTransfer)) : "NA";
return bitdepthsString + "/" + colorString;
return bitdepthsString + "/" + dataspaceString;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,9 @@ public DefaultVideoFrameProcessor create(
throws VideoFrameProcessingException {
// 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(outputColorInfo.isColorValid());
checkArgument(outputColorInfo.isDataSpaceValid());
checkArgument(outputColorInfo.colorTransfer != C.COLOR_TRANSFER_LINEAR);
if (ColorInfo.isTransferHdr(inputColorInfo) || ColorInfo.isTransferHdr(outputColorInfo)) {
checkArgument(enableColorTransfers);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public VideoSampleExporter(
finalFramePresentationTimeUs = C.TIME_UNSET;

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.");
decoderInputColor = ColorInfo.SDR_BT709_LIMITED;
} else {
Expand Down