mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Fix color info conversion in vpccBox method
The color space should be used to determine the color primaries and matrix coefficients, not the video range. PiperOrigin-RevId: 688489212 (cherry picked from commit 31ece8cbd2047024af243d18205cc6ce03924e31)
This commit is contained in:
parent
ca010231a8
commit
761cf4a001
@ -1530,8 +1530,11 @@ import org.checkerframework.checker.nullness.qual.PolyNull;
|
|||||||
ByteBuffer contents = ByteBuffer.allocate(MAX_FIXED_LEAF_BOX_SIZE);
|
ByteBuffer contents = ByteBuffer.allocate(MAX_FIXED_LEAF_BOX_SIZE);
|
||||||
|
|
||||||
contents.putInt(versionAndFlags);
|
contents.putInt(versionAndFlags);
|
||||||
// Default value of videoRange is 0.
|
// Default value of videoRange is limited range (value 0).
|
||||||
int videoRange = format.colorInfo != null ? format.colorInfo.colorRange : 0;
|
int videoRange =
|
||||||
|
format.colorInfo != null && format.colorInfo.colorRange != Format.NO_VALUE
|
||||||
|
? format.colorInfo.colorRange
|
||||||
|
: 0;
|
||||||
ByteBuffer codecPrivateContent = parseVp9CodecPrivateFromCsd(csd0, videoRange);
|
ByteBuffer codecPrivateContent = parseVp9CodecPrivateFromCsd(csd0, videoRange);
|
||||||
contents.put(codecPrivateContent);
|
contents.put(codecPrivateContent);
|
||||||
|
|
||||||
@ -1542,10 +1545,16 @@ import org.checkerframework.checker.nullness.qual.PolyNull;
|
|||||||
int matrixCoefficients = 1;
|
int matrixCoefficients = 1;
|
||||||
|
|
||||||
if (format.colorInfo != null) {
|
if (format.colorInfo != null) {
|
||||||
colourPrimaries = MEDIAFORMAT_STANDARD_TO_PRIMARIES_AND_MATRIX.get(videoRange).get(0);
|
ColorInfo colorInfo = format.colorInfo;
|
||||||
transferCharacteristics =
|
if (colorInfo.colorSpace != Format.NO_VALUE) {
|
||||||
MEDIAFORMAT_TRANSFER_TO_MP4_TRANSFER.get(format.colorInfo.colorTransfer);
|
colourPrimaries =
|
||||||
matrixCoefficients = MEDIAFORMAT_STANDARD_TO_PRIMARIES_AND_MATRIX.get(videoRange).get(1);
|
MEDIAFORMAT_STANDARD_TO_PRIMARIES_AND_MATRIX.get(colorInfo.colorSpace).get(0);
|
||||||
|
matrixCoefficients =
|
||||||
|
MEDIAFORMAT_STANDARD_TO_PRIMARIES_AND_MATRIX.get(colorInfo.colorSpace).get(1);
|
||||||
|
}
|
||||||
|
if (colorInfo.colorTransfer != Format.NO_VALUE) {
|
||||||
|
transferCharacteristics = MEDIAFORMAT_TRANSFER_TO_MP4_TRANSFER.get(colorInfo.colorTransfer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
contents.put((byte) colourPrimaries);
|
contents.put((byte) colourPrimaries);
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
vp09 (141 bytes):
|
vp09 (141 bytes):
|
||||||
Data = length 133, hash 86CBFAF0
|
Data = length 133, hash 4A5066E0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user