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
Updated golden file tests and readded constructor
  • Loading branch information
microkatz committed Oct 17, 2023
commit 716240776ee63fd21278e59c4efdf36d42250a8a
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.Arrays;
import org.checkerframework.dataflow.qual.Pure;

// copybara:exo-only import com.google.android.exoplayer2.Bundleable;
// copybara:exo-only import com.google.android.exoplayer2.C;
// copybara:exo-only import com.google.android.exoplayer2.Format;
Expand Down Expand Up @@ -256,6 +257,24 @@ public static boolean isTransferHdr(@Nullable ColorInfo colorInfo) {
// Lazily initialized hashcode.
private int hashCode;

/**
* Constructs the ColorInfo.
*
* @param colorSpace The color space of the video.
* @param colorRange The color range of the video.
* @param colorTransfer The color transfer characteristics of the video.
* @param hdrStaticInfo HdrStaticInfo as defined in CTA-861.3, or null if none specified.
* @deprecated Use {@link Builder}.
*/
@Deprecated
public ColorInfo(
@C.ColorSpace int colorSpace,
@C.ColorRange int colorRange,
@C.ColorTransfer int colorTransfer,
@Nullable byte[] hdrStaticInfo) {
this(colorSpace, colorRange, colorTransfer, hdrStaticInfo, Format.NO_VALUE, Format.NO_VALUE);
}

/**
* Constructs the ColorInfo.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,10 @@ private static MediaCodecInfo buildAacCodecInfo() {
}

private static ColorInfo buildColorInfo(@C.ColorSpace int colorSpace) {
return new ColorInfo.Builder().setColorSpace(
colorSpace).setColorRange(C.COLOR_RANGE_FULL).setColorTransfer(C.COLOR_TRANSFER_HLG).build();
return new ColorInfo.Builder()
.setColorSpace(colorSpace)
.setColorRange(C.COLOR_RANGE_FULL)
.setColorTransfer(C.COLOR_TRANSFER_HLG)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,12 @@ public void generatePayloadFormat_withH264MediaDescription_succeeds() {
.setHeight(544)
.setWidth(960)
.setCodecs("avc1.64001F")
.setColorInfo(new ColorInfo.Builder()
.setColorRange(1)
.setLumaBitdepth(8)
.setChromaBitdepth(8)
.build())
.setColorInfo(
new ColorInfo.Builder()
.setColorRange(1)
.setLumaBitdepth(8)
.setChromaBitdepth(8)
.build())
.setInitializationData(
ImmutableList.of(
new byte[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ track 0:
height = 120
pixelWidthHeightRatio = 0.5
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
lumaBitdepth = 8
chromaBitdepth = 8
metadata = entries=[TSSE: description=null: values=[Lavf58.42.100], Mp4Timestamp: creation time=0, modification time=0, timescale=1000]
initializationData:
data = length 32, hash 1F3D6E87
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ track 0:
height = 120
pixelWidthHeightRatio = 0.5
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
lumaBitdepth = 8
chromaBitdepth = 8
metadata = entries=[TSSE: description=null: values=[Lavf58.42.100], Mp4Timestamp: creation time=0, modification time=0, timescale=1000]
initializationData:
data = length 32, hash 1F3D6E87
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ track 0:
height = 120
pixelWidthHeightRatio = 0.5
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
lumaBitdepth = 8
chromaBitdepth = 8
metadata = entries=[TSSE: description=null: values=[Lavf58.42.100], Mp4Timestamp: creation time=0, modification time=0, timescale=1000]
initializationData:
data = length 32, hash 1F3D6E87
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ track 0:
height = 120
pixelWidthHeightRatio = 0.5
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
lumaBitdepth = 8
chromaBitdepth = 8
metadata = entries=[TSSE: description=null: values=[Lavf58.42.100], Mp4Timestamp: creation time=0, modification time=0, timescale=1000]
initializationData:
data = length 32, hash 1F3D6E87
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ track 0:
height = 720
frameRate = 29.970028
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
lumaBitdepth = 8
chromaBitdepth = 8
metadata = entries=[TSSE: description=null: values=[Lavf56.1.0], xyz: latitude=40.68, longitude=-74.5, Mp4Timestamp: creation time=3547558895, modification time=3547558895, timescale=1000]
initializationData:
data = length 29, hash 4746B5D9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ track 0:
height = 720
frameRate = 29.970028
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
lumaBitdepth = 8
chromaBitdepth = 8
metadata = entries=[TSSE: description=null: values=[Lavf56.1.0], xyz: latitude=40.68, longitude=-74.5, Mp4Timestamp: creation time=3547558895, modification time=3547558895, timescale=1000]
initializationData:
data = length 29, hash 4746B5D9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ track 0:
height = 720
frameRate = 29.970028
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
lumaBitdepth = 8
chromaBitdepth = 8
metadata = entries=[TSSE: description=null: values=[Lavf56.1.0], xyz: latitude=40.68, longitude=-74.5, Mp4Timestamp: creation time=3547558895, modification time=3547558895, timescale=1000]
initializationData:
data = length 29, hash 4746B5D9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ track 0:
height = 720
frameRate = 29.970028
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
lumaBitdepth = 8
chromaBitdepth = 8
metadata = entries=[TSSE: description=null: values=[Lavf56.1.0], xyz: latitude=40.68, longitude=-74.5, Mp4Timestamp: creation time=3547558895, modification time=3547558895, timescale=1000]
initializationData:
data = length 29, hash 4746B5D9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ track 0:
height = 720
frameRate = 29.970028
colorInfo:
colorSpace = -1
colorRange = -1
colorTransfer = -1
hdrStaticInfo = length 0, hash 0
lumaBitdepth = 8
chromaBitdepth = 8
metadata = entries=[TSSE: description=null: values=[Lavf56.1.0], xyz: latitude=40.68, longitude=-74.5, Mp4Timestamp: creation time=3547558895, modification time=3547558895, timescale=1000]
initializationData:
data = length 29, hash 4746B5D9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ track 0:
colorSpace = 1
colorRange = 2
colorTransfer = 3
lumaBitdepth = 8
chromaBitdepth = 8
metadata = entries=[Mp4Timestamp: creation time=3718109610, modification time=3718109610, timescale=1000]
initializationData:
data = length 29, hash 4746B5D9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ track 0:
colorSpace = 1
colorRange = 2
colorTransfer = 3
lumaBitdepth = 8
chromaBitdepth = 8
metadata = entries=[Mp4Timestamp: creation time=3718109610, modification time=3718109610, timescale=1000]
initializationData:
data = length 29, hash 4746B5D9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ track 0:
colorSpace = 1
colorRange = 2
colorTransfer = 3
lumaBitdepth = 8
chromaBitdepth = 8
metadata = entries=[Mp4Timestamp: creation time=3718109610, modification time=3718109610, timescale=1000]
initializationData:
data = length 29, hash 4746B5D9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ track 0:
colorSpace = 1
colorRange = 2
colorTransfer = 3
lumaBitdepth = 8
chromaBitdepth = 8
metadata = entries=[Mp4Timestamp: creation time=3718109610, modification time=3718109610, timescale=1000]
initializationData:
data = length 29, hash 4746B5D9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ track 0:
colorSpace = 1
colorRange = 2
colorTransfer = 3
lumaBitdepth = 8
chromaBitdepth = 8
metadata = entries=[Mp4Timestamp: creation time=3718109610, modification time=3718109610, timescale=1000]
initializationData:
data = length 29, hash 4746B5D9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ track 0:
colorInfo:
colorSpace = 2
colorRange = 1
lumaBitdepth = 8
chromaBitdepth = 8
metadata = entries=[mdta: key=major_brand, value=mp42, mdta: key=minor_version, value=0, mdta: key=compatible_brands, value=isommp42, mdta: key=com.android.capture.fps, value=240.0, mdta: key=com.android.version, value=10, mdta: key=encoder, value=Lavf58.29.100, Mp4Timestamp: creation time=0, modification time=0, timescale=1000]
initializationData:
data = length 22, hash 4CF81805
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ track 0:
colorInfo:
colorSpace = 2
colorRange = 1
lumaBitdepth = 8
chromaBitdepth = 8
metadata = entries=[mdta: key=major_brand, value=mp42, mdta: key=minor_version, value=0, mdta: key=compatible_brands, value=isommp42, mdta: key=com.android.capture.fps, value=240.0, mdta: key=com.android.version, value=10, mdta: key=encoder, value=Lavf58.29.100, Mp4Timestamp: creation time=0, modification time=0, timescale=1000]
initializationData:
data = length 22, hash 4CF81805
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ track 0:
colorInfo:
colorSpace = 2
colorRange = 1
lumaBitdepth = 8
chromaBitdepth = 8
metadata = entries=[mdta: key=major_brand, value=mp42, mdta: key=minor_version, value=0, mdta: key=compatible_brands, value=isommp42, mdta: key=com.android.capture.fps, value=240.0, mdta: key=com.android.version, value=10, mdta: key=encoder, value=Lavf58.29.100, Mp4Timestamp: creation time=0, modification time=0, timescale=1000]
initializationData:
data = length 22, hash 4CF81805
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ track 0:
colorInfo:
colorSpace = 2
colorRange = 1
lumaBitdepth = 8
chromaBitdepth = 8
metadata = entries=[mdta: key=major_brand, value=mp42, mdta: key=minor_version, value=0, mdta: key=compatible_brands, value=isommp42, mdta: key=com.android.capture.fps, value=240.0, mdta: key=com.android.version, value=10, mdta: key=encoder, value=Lavf58.29.100, Mp4Timestamp: creation time=0, modification time=0, timescale=1000]
initializationData:
data = length 22, hash 4CF81805
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ track 0:
colorInfo:
colorSpace = 2
colorRange = 1
lumaBitdepth = 8
chromaBitdepth = 8
metadata = entries=[mdta: key=major_brand, value=mp42, mdta: key=minor_version, value=0, mdta: key=compatible_brands, value=isommp42, mdta: key=com.android.capture.fps, value=240.0, mdta: key=com.android.version, value=10, mdta: key=encoder, value=Lavf58.29.100, Mp4Timestamp: creation time=0, modification time=0, timescale=1000]
initializationData:
data = length 22, hash 4CF81805
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ track 0:
codecs = avc1.64001F
width = 1080
height = 720
colorInfo:
lumaBitdepth = 8
chromaBitdepth = 8
initializationData:
data = length 29, hash 4746B5D9
data = length 10, hash 7A0D0F2B
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ track 0:
codecs = avc1.64001F
width = 1080
height = 720
colorInfo:
lumaBitdepth = 8
chromaBitdepth = 8
initializationData:
data = length 29, hash 4746B5D9
data = length 10, hash 7A0D0F2B
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ track 0:
codecs = avc1.64001F
width = 1080
height = 720
colorInfo:
lumaBitdepth = 8
chromaBitdepth = 8
initializationData:
data = length 29, hash 4746B5D9
data = length 10, hash 7A0D0F2B
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ track 0:
codecs = avc1.64001F
width = 1080
height = 720
colorInfo:
lumaBitdepth = 8
chromaBitdepth = 8
initializationData:
data = length 29, hash 4746B5D9
data = length 10, hash 7A0D0F2B
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ track 0:
codecs = avc1.64001F
width = 1080
height = 720
colorInfo:
lumaBitdepth = 8
chromaBitdepth = 8
initializationData:
data = length 29, hash 4746B5D9
data = length 10, hash 7A0D0F2B
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ track 0:
codecs = avc1.64001F
width = 1080
height = 720
colorInfo:
lumaBitdepth = 8
chromaBitdepth = 8
initializationData:
data = length 29, hash 4746B5D9
data = length 10, hash 7A0D0F2B
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ track 0:
codecs = avc1.64001F
width = 1080
height = 720
colorInfo:
lumaBitdepth = 8
chromaBitdepth = 8
initializationData:
data = length 29, hash 4746B5D9
data = length 10, hash 7A0D0F2B
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ track 0:
codecs = avc1.64001F
width = 1080
height = 720
colorInfo:
lumaBitdepth = 8
chromaBitdepth = 8
initializationData:
data = length 29, hash 4746B5D9
data = length 10, hash 7A0D0F2B
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ track 0:
codecs = avc1.64001F
width = 1080
height = 720
colorInfo:
lumaBitdepth = 8
chromaBitdepth = 8
initializationData:
data = length 29, hash 4746B5D9
data = length 10, hash 7A0D0F2B
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ track 0:
codecs = avc1.64001F
width = 1080
height = 720
colorInfo:
lumaBitdepth = 8
chromaBitdepth = 8
initializationData:
data = length 29, hash 4746B5D9
data = length 10, hash 7A0D0F2B
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ track 0:
codecs = avc1.64001F
width = 1080
height = 720
colorInfo:
lumaBitdepth = 8
chromaBitdepth = 8
initializationData:
data = length 29, hash 4746B5D9
data = length 10, hash 7A0D0F2B
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ track 0:
codecs = avc1.64001F
width = 1080
height = 720
colorInfo:
lumaBitdepth = 8
chromaBitdepth = 8
initializationData:
data = length 29, hash 4746B5D9
data = length 10, hash 7A0D0F2B
Expand Down
Loading