Update colr
box values to be overridden by bitstream boxes
#minor-release PiperOrigin-RevId: 523983688
This commit is contained in:
parent
c71e4bf1ff
commit
596a7c7033
@ -1208,15 +1208,9 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
pixelWidthHeightRatio = hevcConfig.pixelWidthHeightRatio;
|
pixelWidthHeightRatio = hevcConfig.pixelWidthHeightRatio;
|
||||||
}
|
}
|
||||||
codecs = hevcConfig.codecs;
|
codecs = hevcConfig.codecs;
|
||||||
// Modify these values only if they have not already been set. If 'Atom.TYPE_colr' atom is
|
|
||||||
// present, these values may be overridden.
|
|
||||||
if (colorSpace == Format.NO_VALUE
|
|
||||||
&& colorRange == Format.NO_VALUE
|
|
||||||
&& colorTransfer == Format.NO_VALUE) {
|
|
||||||
colorSpace = hevcConfig.colorSpace;
|
colorSpace = hevcConfig.colorSpace;
|
||||||
colorRange = hevcConfig.colorRange;
|
colorRange = hevcConfig.colorRange;
|
||||||
colorTransfer = hevcConfig.colorTransfer;
|
colorTransfer = hevcConfig.colorTransfer;
|
||||||
}
|
|
||||||
} else if (childAtomType == Atom.TYPE_dvcC || childAtomType == Atom.TYPE_dvvC) {
|
} else if (childAtomType == Atom.TYPE_dvcC || childAtomType == Atom.TYPE_dvvC) {
|
||||||
@Nullable DolbyVisionConfig dolbyVisionConfig = DolbyVisionConfig.parse(parent);
|
@Nullable DolbyVisionConfig dolbyVisionConfig = DolbyVisionConfig.parse(parent);
|
||||||
if (dolbyVisionConfig != null) {
|
if (dolbyVisionConfig != null) {
|
||||||
@ -1232,16 +1226,10 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
boolean fullRangeFlag = (parent.readUnsignedByte() & 1) != 0;
|
boolean fullRangeFlag = (parent.readUnsignedByte() & 1) != 0;
|
||||||
int colorPrimaries = parent.readUnsignedByte();
|
int colorPrimaries = parent.readUnsignedByte();
|
||||||
int transferCharacteristics = parent.readUnsignedByte();
|
int transferCharacteristics = parent.readUnsignedByte();
|
||||||
// Modify these values only if they have not already been set. If 'Atom.TYPE_colr' atom is
|
|
||||||
// present, these values may be overridden.
|
|
||||||
if (colorSpace == Format.NO_VALUE
|
|
||||||
&& colorRange == Format.NO_VALUE
|
|
||||||
&& colorTransfer == Format.NO_VALUE) {
|
|
||||||
colorSpace = ColorInfo.isoColorPrimariesToColorSpace(colorPrimaries);
|
colorSpace = ColorInfo.isoColorPrimariesToColorSpace(colorPrimaries);
|
||||||
colorRange = fullRangeFlag ? C.COLOR_RANGE_FULL : C.COLOR_RANGE_LIMITED;
|
colorRange = fullRangeFlag ? C.COLOR_RANGE_FULL : C.COLOR_RANGE_LIMITED;
|
||||||
colorTransfer =
|
colorTransfer =
|
||||||
ColorInfo.isoTransferCharacteristicsToColorTransfer(transferCharacteristics);
|
ColorInfo.isoTransferCharacteristicsToColorTransfer(transferCharacteristics);
|
||||||
}
|
|
||||||
} else if (childAtomType == Atom.TYPE_av1C) {
|
} else if (childAtomType == Atom.TYPE_av1C) {
|
||||||
ExtractorUtil.checkContainerInput(mimeType == null, /* message= */ null);
|
ExtractorUtil.checkContainerInput(mimeType == null, /* message= */ null);
|
||||||
mimeType = MimeTypes.VIDEO_AV1;
|
mimeType = MimeTypes.VIDEO_AV1;
|
||||||
@ -1321,6 +1309,12 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (childAtomType == Atom.TYPE_colr) {
|
} else if (childAtomType == Atom.TYPE_colr) {
|
||||||
|
// Only modify these values if they have not been previously established by the bitstream.
|
||||||
|
// If 'Atom.TYPE_hvcC' atom or 'Atom.TYPE_vpcC' is available, they will take precedence and
|
||||||
|
// overwrite any existing values.
|
||||||
|
if (colorSpace == Format.NO_VALUE
|
||||||
|
&& colorRange == Format.NO_VALUE
|
||||||
|
&& colorTransfer == Format.NO_VALUE) {
|
||||||
int colorType = parent.readInt();
|
int colorType = parent.readInt();
|
||||||
if (colorType == TYPE_nclx || colorType == TYPE_nclc) {
|
if (colorType == TYPE_nclx || colorType == TYPE_nclc) {
|
||||||
// For more info on syntax, see Section 8.5.2.2 in ISO/IEC 14496-12:2012(E) and
|
// For more info on syntax, see Section 8.5.2.2 in ISO/IEC 14496-12:2012(E) and
|
||||||
@ -1343,6 +1337,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
Log.w(TAG, "Unsupported color type: " + Atom.getAtomTypeString(colorType));
|
Log.w(TAG, "Unsupported color type: " + Atom.getAtomTypeString(colorType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
childPosition += childAtomSize;
|
childPosition += childAtomSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user