Merge pull request #2023 from DolbyLaboratories:dlb/dovi-format/dev

PiperOrigin-RevId: 716226613
This commit is contained in:
Copybara-Service 2025-01-16 07:26:46 -08:00
commit fda8b8a35d
23 changed files with 55 additions and 39 deletions

View File

@ -317,15 +317,24 @@ public final class MediaCodecInfo {
int profile = codecProfileAndLevel.first; int profile = codecProfileAndLevel.first;
int level = codecProfileAndLevel.second; int level = codecProfileAndLevel.second;
if (MimeTypes.VIDEO_DOLBY_VISION.equals(format.sampleMimeType)) { if (MimeTypes.VIDEO_DOLBY_VISION.equals(format.sampleMimeType)) {
// If this codec is H264 or H265, we only support the Dolby Vision base layer and need to map // If this codec is H.264, H.265 or AV1, we only support the Dolby Vision base layer and need
// the Dolby Vision profile to the corresponding base layer profile. Also assume all levels of // to map the Dolby Vision profile to the corresponding base layer profile. Also assume all
// this base layer profile are supported. // levels of this base layer profile are supported.
if (MimeTypes.VIDEO_H264.equals(mimeType)) { switch (mimeType) {
case MimeTypes.VIDEO_H264:
profile = CodecProfileLevel.AVCProfileHigh; profile = CodecProfileLevel.AVCProfileHigh;
level = 0; level = 0;
} else if (MimeTypes.VIDEO_H265.equals(mimeType)) { break;
case MimeTypes.VIDEO_H265:
profile = CodecProfileLevel.HEVCProfileMain10; profile = CodecProfileLevel.HEVCProfileMain10;
level = 0; level = 0;
break;
case MimeTypes.VIDEO_AV1:
profile = CodecProfileLevel.AV1ProfileMain10;
level = 0;
break;
default:
break;
} }
} }

View File

@ -1155,11 +1155,11 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
String sampleMimeType = checkNotNull(format.sampleMimeType); String sampleMimeType = checkNotNull(format.sampleMimeType);
if (MimeTypes.VIDEO_DOLBY_VISION.equals(sampleMimeType)) { if (MimeTypes.VIDEO_DOLBY_VISION.equals(sampleMimeType)) {
// Dolby vision can be a wrapper around H264 or H265. We assume it's wrapping H265 by default // Dolby vision can be a wrapper around H.264, H.265 or AV1. We assume it's wrapping H.265 by
// because it's the common case, and because some devices may fail to allocate the codec when // default because it's the common case, and because some devices may fail to allocate the
// the larger buffer size required for H264 is requested. We size buffers for H264 only if the // codec when the larger buffer size required for H.264/AV1 is requested. We size buffers
// format contains sufficient information for us to determine unambiguously that it's a H264 // for H.264/AV1 only if the format contains sufficient information for us to determine
// profile. // unambiguously that it's a H.264/AV1 based profile.
sampleMimeType = MimeTypes.VIDEO_H265; sampleMimeType = MimeTypes.VIDEO_H265;
@Nullable @Nullable
Pair<Integer, Integer> codecProfileAndLevel = MediaCodecUtil.getCodecProfileAndLevel(format); Pair<Integer, Integer> codecProfileAndLevel = MediaCodecUtil.getCodecProfileAndLevel(format);
@ -1169,6 +1169,8 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|| profile == CodecProfileLevel.DolbyVisionProfileDvavPer || profile == CodecProfileLevel.DolbyVisionProfileDvavPer
|| profile == CodecProfileLevel.DolbyVisionProfileDvavPen) { || profile == CodecProfileLevel.DolbyVisionProfileDvavPen) {
sampleMimeType = MimeTypes.VIDEO_H264; sampleMimeType = MimeTypes.VIDEO_H264;
} else if (profile == CodecProfileLevel.DolbyVisionProfileDvav110) {
sampleMimeType = MimeTypes.VIDEO_AV1;
} }
} }
} }

View File

@ -38,16 +38,21 @@ public final class DolbyVisionConfig {
int dvProfile = (profileData >> 1); int dvProfile = (profileData >> 1);
int dvLevel = ((profileData & 0x1) << 5) | ((data.readUnsignedByte() >> 3) & 0x1F); int dvLevel = ((profileData & 0x1) << 5) | ((data.readUnsignedByte() >> 3) & 0x1F);
String codecsPrefix; String codecsPrefix;
if (dvProfile == 4 || dvProfile == 5 || dvProfile == 7) { if (dvProfile == 4 || dvProfile == 5 || dvProfile == 7 || dvProfile == 8) {
codecsPrefix = "dvhe"; codecsPrefix = "dvhe";
} else if (dvProfile == 8) {
codecsPrefix = "hev1";
} else if (dvProfile == 9) { } else if (dvProfile == 9) {
codecsPrefix = "avc3"; codecsPrefix = "dvav";
} else if (dvProfile == 10) {
codecsPrefix = "dav1";
} else { } else {
return null; return null;
} }
String codecs = codecsPrefix + ".0" + dvProfile + (dvLevel < 10 ? ".0" : ".") + dvLevel; String codecs =
codecsPrefix
+ (dvProfile < 10 ? ".0" : ".")
+ dvProfile
+ (dvLevel < 10 ? ".0" : ".")
+ dvLevel;
return new DolbyVisionConfig(dvProfile, dvLevel, codecs); return new DolbyVisionConfig(dvProfile, dvLevel, codecs);
} }

View File

@ -14,7 +14,7 @@ track 0:
id = 1 id = 1
containerMimeType = video/mp4 containerMimeType = video/mp4
sampleMimeType = video/dolby-vision sampleMimeType = video/dolby-vision
codecs = hev1.08.04 codecs = dvhe.08.04
maxInputSize = 196379 maxInputSize = 196379
maxNumReorderSamples = 2 maxNumReorderSamples = 2
width = 1920 width = 1920

View File

@ -14,7 +14,7 @@ track 0:
id = 1 id = 1
containerMimeType = video/mp4 containerMimeType = video/mp4
sampleMimeType = video/dolby-vision sampleMimeType = video/dolby-vision
codecs = hev1.08.04 codecs = dvhe.08.04
maxInputSize = 196379 maxInputSize = 196379
maxNumReorderSamples = 2 maxNumReorderSamples = 2
width = 1920 width = 1920

View File

@ -14,7 +14,7 @@ track 0:
id = 1 id = 1
containerMimeType = video/mp4 containerMimeType = video/mp4
sampleMimeType = video/dolby-vision sampleMimeType = video/dolby-vision
codecs = hev1.08.04 codecs = dvhe.08.04
maxInputSize = 196379 maxInputSize = 196379
maxNumReorderSamples = 2 maxNumReorderSamples = 2
width = 1920 width = 1920

View File

@ -14,7 +14,7 @@ track 0:
id = 1 id = 1
containerMimeType = video/mp4 containerMimeType = video/mp4
sampleMimeType = video/dolby-vision sampleMimeType = video/dolby-vision
codecs = hev1.08.04 codecs = dvhe.08.04
maxInputSize = 196379 maxInputSize = 196379
maxNumReorderSamples = 2 maxNumReorderSamples = 2
width = 1920 width = 1920

View File

@ -14,7 +14,7 @@ track 0:
id = 1 id = 1
containerMimeType = video/mp4 containerMimeType = video/mp4
sampleMimeType = video/dolby-vision sampleMimeType = video/dolby-vision
codecs = hev1.08.04 codecs = dvhe.08.04
maxInputSize = 196379 maxInputSize = 196379
maxNumReorderSamples = 2 maxNumReorderSamples = 2
width = 1920 width = 1920

View File

@ -14,7 +14,7 @@ track 0:
id = 1 id = 1
containerMimeType = video/mp4 containerMimeType = video/mp4
sampleMimeType = video/dolby-vision sampleMimeType = video/dolby-vision
codecs = hev1.08.04 codecs = dvhe.08.04
maxInputSize = 196379 maxInputSize = 196379
maxNumReorderSamples = 2 maxNumReorderSamples = 2
width = 1920 width = 1920

View File

@ -14,7 +14,7 @@ track 0:
id = 1 id = 1
containerMimeType = video/mp4 containerMimeType = video/mp4
sampleMimeType = video/dolby-vision sampleMimeType = video/dolby-vision
codecs = hev1.08.04 codecs = dvhe.08.04
maxInputSize = 196379 maxInputSize = 196379
maxNumReorderSamples = 2 maxNumReorderSamples = 2
width = 1920 width = 1920

View File

@ -14,7 +14,7 @@ track 0:
id = 1 id = 1
containerMimeType = video/mp4 containerMimeType = video/mp4
sampleMimeType = video/dolby-vision sampleMimeType = video/dolby-vision
codecs = hev1.08.04 codecs = dvhe.08.04
maxInputSize = 196379 maxInputSize = 196379
maxNumReorderSamples = 2 maxNumReorderSamples = 2
width = 1920 width = 1920

View File

@ -14,7 +14,7 @@ track 0:
id = 1 id = 1
containerMimeType = video/mp4 containerMimeType = video/mp4
sampleMimeType = video/dolby-vision sampleMimeType = video/dolby-vision
codecs = hev1.08.04 codecs = dvhe.08.04
maxInputSize = 196379 maxInputSize = 196379
maxNumReorderSamples = 2 maxNumReorderSamples = 2
width = 1920 width = 1920

View File

@ -14,7 +14,7 @@ track 0:
id = 1 id = 1
containerMimeType = video/mp4 containerMimeType = video/mp4
sampleMimeType = video/dolby-vision sampleMimeType = video/dolby-vision
codecs = hev1.08.04 codecs = dvhe.08.04
maxInputSize = 196379 maxInputSize = 196379
maxNumReorderSamples = 2 maxNumReorderSamples = 2
width = 1920 width = 1920

View File

@ -14,7 +14,7 @@ track 0:
id = 1 id = 1
containerMimeType = video/mp4 containerMimeType = video/mp4
sampleMimeType = video/dolby-vision sampleMimeType = video/dolby-vision
codecs = hev1.08.04 codecs = dvhe.08.04
maxInputSize = 40550 maxInputSize = 40550
maxNumReorderSamples = 2 maxNumReorderSamples = 2
width = 1920 width = 1920

View File

@ -14,7 +14,7 @@ track 0:
id = 1 id = 1
containerMimeType = video/mp4 containerMimeType = video/mp4
sampleMimeType = video/dolby-vision sampleMimeType = video/dolby-vision
codecs = hev1.08.04 codecs = dvhe.08.04
maxInputSize = 40550 maxInputSize = 40550
maxNumReorderSamples = 2 maxNumReorderSamples = 2
width = 1920 width = 1920

View File

@ -14,7 +14,7 @@ track 0:
id = 1 id = 1
containerMimeType = video/mp4 containerMimeType = video/mp4
sampleMimeType = video/dolby-vision sampleMimeType = video/dolby-vision
codecs = hev1.08.04 codecs = dvhe.08.04
maxInputSize = 40550 maxInputSize = 40550
maxNumReorderSamples = 2 maxNumReorderSamples = 2
width = 1920 width = 1920

View File

@ -14,7 +14,7 @@ track 0:
id = 1 id = 1
containerMimeType = video/mp4 containerMimeType = video/mp4
sampleMimeType = video/dolby-vision sampleMimeType = video/dolby-vision
codecs = hev1.08.04 codecs = dvhe.08.04
maxInputSize = 40550 maxInputSize = 40550
maxNumReorderSamples = 2 maxNumReorderSamples = 2
width = 1920 width = 1920

View File

@ -14,7 +14,7 @@ track 0:
id = 1 id = 1
containerMimeType = video/mp4 containerMimeType = video/mp4
sampleMimeType = video/dolby-vision sampleMimeType = video/dolby-vision
codecs = hev1.08.04 codecs = dvhe.08.04
maxInputSize = 40550 maxInputSize = 40550
maxNumReorderSamples = 2 maxNumReorderSamples = 2
width = 1920 width = 1920

View File

@ -14,7 +14,7 @@ track 0:
id = 1 id = 1
containerMimeType = video/mp4 containerMimeType = video/mp4
sampleMimeType = video/dolby-vision sampleMimeType = video/dolby-vision
codecs = hev1.08.04 codecs = dvhe.08.04
maxInputSize = 40550 maxInputSize = 40550
maxNumReorderSamples = 2 maxNumReorderSamples = 2
width = 1920 width = 1920

View File

@ -14,7 +14,7 @@ track 0:
id = 1 id = 1
containerMimeType = video/mp4 containerMimeType = video/mp4
sampleMimeType = video/dolby-vision sampleMimeType = video/dolby-vision
codecs = hev1.08.04 codecs = dvhe.08.04
maxInputSize = 40550 maxInputSize = 40550
maxNumReorderSamples = 2 maxNumReorderSamples = 2
width = 1920 width = 1920

View File

@ -14,7 +14,7 @@ track 0:
id = 1 id = 1
containerMimeType = video/mp4 containerMimeType = video/mp4
sampleMimeType = video/dolby-vision sampleMimeType = video/dolby-vision
codecs = hev1.08.04 codecs = dvhe.08.04
maxInputSize = 40550 maxInputSize = 40550
maxNumReorderSamples = 2 maxNumReorderSamples = 2
width = 1920 width = 1920

View File

@ -14,7 +14,7 @@ track 0:
id = 1 id = 1
containerMimeType = video/mp4 containerMimeType = video/mp4
sampleMimeType = video/dolby-vision sampleMimeType = video/dolby-vision
codecs = hev1.08.04 codecs = dvhe.08.04
maxInputSize = 40550 maxInputSize = 40550
maxNumReorderSamples = 2 maxNumReorderSamples = 2
width = 1920 width = 1920

View File

@ -14,7 +14,7 @@ track 0:
id = 1 id = 1
containerMimeType = video/mp4 containerMimeType = video/mp4
sampleMimeType = video/dolby-vision sampleMimeType = video/dolby-vision
codecs = hev1.08.04 codecs = dvhe.08.04
maxInputSize = 40550 maxInputSize = 40550
maxNumReorderSamples = 2 maxNumReorderSamples = 2
width = 1920 width = 1920