Commit f87a7ae3 authored by Yuchen Liu's avatar Yuchen Liu Committed by Commit Bot

Support DV profile 8 and 9

This patch adds new enum DOLBYVISION_PROFILE8 and DOLBYVISION_PROFILE9,
and updates all the other related codes.

Bug: internal b/134099245
Test: DV stream, Netflix, Vudu
Change-Id: Ic238eefedde39387924356ef105fac8dc89075d8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1637983Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarSergey Volk <servolk@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Commit-Queue: Yuchen Liu <yucliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#665988}
parent 6d57c056
......@@ -50,11 +50,13 @@ VideoCodec ToCastVideoCodec(const ::media::VideoCodec video_codec,
case ::media::kCodecHEVC:
return kCodecHEVC;
case ::media::kCodecDolbyVision:
if (codec_profile == ::media::DOLBYVISION_PROFILE0) {
if (codec_profile == ::media::DOLBYVISION_PROFILE0 ||
codec_profile == ::media::DOLBYVISION_PROFILE9) {
return kCodecDolbyVisionH264;
} else if (codec_profile == ::media::DOLBYVISION_PROFILE4 ||
codec_profile == ::media::DOLBYVISION_PROFILE5 ||
codec_profile == ::media::DOLBYVISION_PROFILE7) {
codec_profile == ::media::DOLBYVISION_PROFILE7 ||
codec_profile == ::media::DOLBYVISION_PROFILE8) {
return kCodecDolbyVisionHEVC;
}
LOG(ERROR) << "Unsupported video codec profile " << codec_profile;
......
......@@ -42,12 +42,12 @@ CHECK_PROFILE_ENUM(HEVCPROFILE_MAIN);
CHECK_PROFILE_ENUM(HEVCPROFILE_MAIN10);
CHECK_PROFILE_ENUM(HEVCPROFILE_MAIN_STILL_PICTURE);
CHECK_PROFILE_ENUM(HEVCPROFILE_MAX);
CHECK_PROFILE_ENUM(DOLBYVISION_MIN);
CHECK_PROFILE_ENUM(DOLBYVISION_PROFILE0);
CHECK_PROFILE_ENUM(DOLBYVISION_PROFILE4);
CHECK_PROFILE_ENUM(DOLBYVISION_PROFILE5);
CHECK_PROFILE_ENUM(DOLBYVISION_PROFILE7);
CHECK_PROFILE_ENUM(DOLBYVISION_MAX);
CHECK_PROFILE_ENUM(DOLBYVISION_PROFILE8);
CHECK_PROFILE_ENUM(DOLBYVISION_PROFILE9);
CHECK_PROFILE_ENUM(THEORAPROFILE_MIN);
CHECK_PROFILE_ENUM(THEORAPROFILE_ANY);
CHECK_PROFILE_ENUM(THEORAPROFILE_MAX);
......@@ -96,6 +96,8 @@ bool EnumTraits<arc::mojom::VideoCodecProfile, media::VideoCodecProfile>::
case arc::mojom::VideoCodecProfile::DOLBYVISION_PROFILE4:
case arc::mojom::VideoCodecProfile::DOLBYVISION_PROFILE5:
case arc::mojom::VideoCodecProfile::DOLBYVISION_PROFILE7:
case arc::mojom::VideoCodecProfile::DOLBYVISION_PROFILE8:
case arc::mojom::VideoCodecProfile::DOLBYVISION_PROFILE9:
case arc::mojom::VideoCodecProfile::THEORAPROFILE_ANY:
case arc::mojom::VideoCodecProfile::AV1PROFILE_PROFILE_MAIN:
case arc::mojom::VideoCodecProfile::AV1PROFILE_PROFILE_HIGH:
......
......@@ -41,12 +41,10 @@ enum VideoCodecProfile {
HEVCPROFILE_MAIN10 = 17,
HEVCPROFILE_MAIN_STILL_PICTURE = 18,
HEVCPROFILE_MAX = HEVCPROFILE_MAIN_STILL_PICTURE,
DOLBYVISION_MIN = 19,
DOLBYVISION_PROFILE0 = DOLBYVISION_MIN,
DOLBYVISION_PROFILE0 = 19,
DOLBYVISION_PROFILE4 = 20,
DOLBYVISION_PROFILE5 = 21,
DOLBYVISION_PROFILE7 = 22,
DOLBYVISION_MAX = DOLBYVISION_PROFILE7,
THEORAPROFILE_MIN = 23,
THEORAPROFILE_ANY = THEORAPROFILE_MIN,
THEORAPROFILE_MAX = THEORAPROFILE_ANY,
......@@ -55,7 +53,9 @@ enum VideoCodecProfile {
AV1PROFILE_PROFILE_HIGH = 25,
AV1PROFILE_PROFILE_PRO = 26,
AV1PROFILE_MAX = AV1PROFILE_PROFILE_PRO,
VIDEO_CODEC_PROFILE_MAX = AV1PROFILE_PROFILE_PRO,
DOLBYVISION_PROFILE8 = 27,
DOLBYVISION_PROFILE9 = 28,
VIDEO_CODEC_PROFILE_MAX = DOLBYVISION_PROFILE9,
};
[Extensible]
......
......@@ -407,7 +407,7 @@ std::unique_ptr<base::ListValue> getDisplayInfo() {
return display_info;
}
std::string GetProfileName(gpu::VideoCodecProfile profile) {
const char* GetProfileName(gpu::VideoCodecProfile profile) {
switch (profile) {
case gpu::VIDEO_CODEC_PROFILE_UNKNOWN:
return "unknown";
......@@ -457,6 +457,10 @@ std::string GetProfileName(gpu::VideoCodecProfile profile) {
return "dolby vision profile 5";
case gpu::DOLBYVISION_PROFILE7:
return "dolby vision profile 7";
case gpu::DOLBYVISION_PROFILE8:
return "dolby vision profile 8";
case gpu::DOLBYVISION_PROFILE9:
return "dolby vision profile 9";
case gpu::THEORAPROFILE_ANY:
return "theora";
case gpu::AV1PROFILE_PROFILE_MAIN:
......@@ -476,8 +480,8 @@ std::unique_ptr<base::ListValue> GetVideoAcceleratorsInfo() {
for (const auto& profile :
gpu_info.video_decode_accelerator_capabilities.supported_profiles) {
std::string codec_string = base::StringPrintf(
"Decode %s", GetProfileName(profile.profile).c_str());
std::string codec_string =
base::StringPrintf("Decode %s", GetProfileName(profile.profile));
std::string resolution_string = base::StringPrintf(
"up to %s pixels %s", profile.max_resolution.ToString().c_str(),
profile.encrypted_only ? "(encrypted)" : "");
......@@ -486,8 +490,8 @@ std::unique_ptr<base::ListValue> GetVideoAcceleratorsInfo() {
for (const auto& profile :
gpu_info.video_encode_accelerator_supported_profiles) {
std::string codec_string = base::StringPrintf(
"Encode %s", GetProfileName(profile.profile).c_str());
std::string codec_string =
base::StringPrintf("Encode %s", GetProfileName(profile.profile));
std::string resolution_string = base::StringPrintf(
"up to %s pixels and/or %.3f fps",
profile.max_resolution.ToString().c_str(),
......
......@@ -80,7 +80,9 @@ enum VideoCodecProfile {
AV1PROFILE_PROFILE_MAIN,
AV1PROFILE_PROFILE_HIGH,
AV1PROFILE_PROFILE_PRO,
VIDEO_CODEC_PROFILE_MAX = AV1PROFILE_PROFILE_PRO,
DOLBYVISION_PROFILE8,
DOLBYVISION_PROFILE9,
VIDEO_CODEC_PROFILE_MAX = DOLBYVISION_PROFILE9,
};
// Specification of a decoding profile supported by a hardware decoder.
......
......@@ -52,6 +52,8 @@ enum VideoCodecProfile {
AV1PROFILE_PROFILE_MAIN,
AV1PROFILE_PROFILE_HIGH,
AV1PROFILE_PROFILE_PRO,
DOLBYVISION_PROFILE8,
DOLBYVISION_PROFILE9,
};
// gpu::VideoDecodeAcceleratorSupportedProfile
......
......@@ -79,6 +79,10 @@ EnumTraits<gpu::mojom::VideoCodecProfile, gpu::VideoCodecProfile>::ToMojom(
return gpu::mojom::VideoCodecProfile::DOLBYVISION_PROFILE5;
case gpu::VideoCodecProfile::DOLBYVISION_PROFILE7:
return gpu::mojom::VideoCodecProfile::DOLBYVISION_PROFILE7;
case gpu::VideoCodecProfile::DOLBYVISION_PROFILE8:
return gpu::mojom::VideoCodecProfile::DOLBYVISION_PROFILE8;
case gpu::VideoCodecProfile::DOLBYVISION_PROFILE9:
return gpu::mojom::VideoCodecProfile::DOLBYVISION_PROFILE9;
case gpu::VideoCodecProfile::THEORAPROFILE_ANY:
return gpu::mojom::VideoCodecProfile::THEORAPROFILE_ANY;
case gpu::VideoCodecProfile::AV1PROFILE_PROFILE_MAIN:
......@@ -169,6 +173,12 @@ bool EnumTraits<gpu::mojom::VideoCodecProfile, gpu::VideoCodecProfile>::
case gpu::mojom::VideoCodecProfile::DOLBYVISION_PROFILE7:
*out = gpu::VideoCodecProfile::DOLBYVISION_PROFILE7;
return true;
case gpu::mojom::VideoCodecProfile::DOLBYVISION_PROFILE8:
*out = gpu::VideoCodecProfile::DOLBYVISION_PROFILE8;
return true;
case gpu::mojom::VideoCodecProfile::DOLBYVISION_PROFILE9:
*out = gpu::VideoCodecProfile::DOLBYVISION_PROFILE9;
return true;
case gpu::mojom::VideoCodecProfile::THEORAPROFILE_ANY:
*out = gpu::VideoCodecProfile::THEORAPROFILE_ANY;
return true;
......
......@@ -103,13 +103,14 @@ EmeCodec ToVideoEmeCodec(VideoCodec codec, VideoCodecProfile profile) {
case kCodecHEVC:
return EME_CODEC_HEVC;
case kCodecDolbyVision:
// Only profiles 0, 4, 5 and 7 are valid. Profile 0 is encoded based on
// AVC while profile 4, 5 and 7 are based on HEVC.
if (profile == DOLBYVISION_PROFILE0) {
// Only profiles 0, 4, 5, 7, 8, 9 are valid. Profile 0 and 9 are encoded
// based on AVC while profile 4, 5, 7 and 8 are based on HEVC.
if (profile == DOLBYVISION_PROFILE0 || profile == DOLBYVISION_PROFILE9) {
return EME_CODEC_DOLBY_VISION_AVC;
} else if (profile == DOLBYVISION_PROFILE4 ||
profile == DOLBYVISION_PROFILE5 ||
profile == DOLBYVISION_PROFILE7) {
profile == DOLBYVISION_PROFILE7 ||
profile == DOLBYVISION_PROFILE8) {
return EME_CODEC_DOLBY_VISION_HEVC;
} else {
return EME_CODEC_NONE;
......
......@@ -160,7 +160,7 @@ static VideoCodecProfile MinProfile(VideoCodec codec) {
case kCodecHEVC:
return HEVCPROFILE_MIN;
case kCodecDolbyVision:
return DOLBYVISION_MIN;
return DOLBYVISION_PROFILE0;
case kCodecAV1:
return AV1PROFILE_MIN;
}
......
......@@ -92,6 +92,10 @@ std::string GetProfileName(VideoCodecProfile profile) {
return "dolby vision profile 5";
case DOLBYVISION_PROFILE7:
return "dolby vision profile 7";
case DOLBYVISION_PROFILE8:
return "dolby vision profile 8";
case DOLBYVISION_PROFILE9:
return "dolby vision profile 9";
case THEORAPROFILE_ANY:
return "theora";
case AV1PROFILE_PROFILE_MAIN:
......@@ -756,26 +760,31 @@ bool ParseDolbyVisionCodecId(const std::string& codec_id,
// Profile string should be two digits.
unsigned profile_id = 0;
if (elem[1].size() != 2 || !base::StringToUint(elem[1], &profile_id) ||
profile_id > 7) {
profile_id > 9) {
DVLOG(4) << __func__ << ": invalid format or profile_id=" << elem[1];
return false;
}
// Only profiles 0, 4, 5 and 7 are valid. Profile 0 is encoded based on AVC
// while profile 4, 5 and 7 are based on HEVC.
// Only profiles 0, 4, 5, 7, 8 and 9 are valid. Profile 0 and 9 are encoded
// based on AVC while profile 4, 5, 7 and 8 are based on HEVC.
switch (profile_id) {
case 0:
case 9:
if (!IsDolbyVisionAVCCodecId(codec_id)) {
DVLOG(4) << __func__
<< ": codec id is mismatched with profile_id=" << profile_id;
return false;
}
*profile = DOLBYVISION_PROFILE0;
if (profile_id == 0)
*profile = DOLBYVISION_PROFILE0;
else if (profile_id == 9)
*profile = DOLBYVISION_PROFILE9;
break;
#if BUILDFLAG(ENABLE_HEVC_DEMUXING)
case 4:
case 5:
case 7:
case 8:
if (!IsDolbyVisionHEVCCodecId(codec_id)) {
DVLOG(4) << __func__
<< ": codec id is mismatched with profile_id=" << profile_id;
......@@ -787,6 +796,8 @@ bool ParseDolbyVisionCodecId(const std::string& codec_id,
*profile = DOLBYVISION_PROFILE5;
else if (profile_id == 7)
*profile = DOLBYVISION_PROFILE7;
else if (profile_id == 8)
*profile = DOLBYVISION_PROFILE8;
break;
#endif
default:
......
......@@ -79,12 +79,10 @@ enum VideoCodecProfile {
HEVCPROFILE_MAIN10 = 17,
HEVCPROFILE_MAIN_STILL_PICTURE = 18,
HEVCPROFILE_MAX = HEVCPROFILE_MAIN_STILL_PICTURE,
DOLBYVISION_MIN = 19,
DOLBYVISION_PROFILE0 = DOLBYVISION_MIN,
DOLBYVISION_PROFILE0 = 19,
DOLBYVISION_PROFILE4 = 20,
DOLBYVISION_PROFILE5 = 21,
DOLBYVISION_PROFILE7 = 22,
DOLBYVISION_MAX = DOLBYVISION_PROFILE7,
THEORAPROFILE_MIN = 23,
THEORAPROFILE_ANY = THEORAPROFILE_MIN,
THEORAPROFILE_MAX = THEORAPROFILE_ANY,
......@@ -93,7 +91,9 @@ enum VideoCodecProfile {
AV1PROFILE_PROFILE_HIGH = 25,
AV1PROFILE_PROFILE_PRO = 26,
AV1PROFILE_MAX = AV1PROFILE_PROFILE_PRO,
VIDEO_CODEC_PROFILE_MAX = AV1PROFILE_PROFILE_PRO,
DOLBYVISION_PROFILE8 = 27,
DOLBYVISION_PROFILE9 = 28,
VIDEO_CODEC_PROFILE_MAX = DOLBYVISION_PROFILE9,
};
struct CodecProfileLevel {
......
......@@ -46,6 +46,8 @@ VideoCodec VideoCodecProfileToVideoCodec(VideoCodecProfile profile) {
case DOLBYVISION_PROFILE4:
case DOLBYVISION_PROFILE5:
case DOLBYVISION_PROFILE7:
case DOLBYVISION_PROFILE8:
case DOLBYVISION_PROFILE9:
return kCodecDolbyVision;
case THEORAPROFILE_ANY:
return kCodecTheora;
......
......@@ -65,6 +65,12 @@ bool DolbyVisionConfiguration::ParseInternal(BufferReader* reader,
case 7:
codec_profile = DOLBYVISION_PROFILE7;
break;
case 8:
codec_profile = DOLBYVISION_PROFILE8;
break;
case 9:
codec_profile = DOLBYVISION_PROFILE9;
break;
default:
DVLOG(2) << "Deprecated or invalid Dolby Vision profile:"
<< static_cast<int>(dv_profile);
......
......@@ -189,6 +189,8 @@ message VideoDecoderConfig {
AV1PROFILE_PROFILE_MAIN = 24;
AV1PROFILE_PROFILE_HIGH = 25;
AV1PROFILE_PROFILE_PRO = 26;
DOLBYVISION_PROFILE8 = 27;
DOLBYVISION_PROFILE9 = 28;
};
// Proto version of media::VideoPixelFormat.
......
......@@ -284,6 +284,8 @@ base::Optional<VideoCodecProfile> ToMediaVideoCodecProfile(
CASE_RETURN_OTHER(DOLBYVISION_PROFILE4);
CASE_RETURN_OTHER(DOLBYVISION_PROFILE5);
CASE_RETURN_OTHER(DOLBYVISION_PROFILE7);
CASE_RETURN_OTHER(DOLBYVISION_PROFILE8);
CASE_RETURN_OTHER(DOLBYVISION_PROFILE9);
CASE_RETURN_OTHER(THEORAPROFILE_ANY);
CASE_RETURN_OTHER(AV1PROFILE_PROFILE_MAIN);
CASE_RETURN_OTHER(AV1PROFILE_PROFILE_HIGH);
......@@ -321,6 +323,8 @@ ToProtoVideoDecoderConfigProfile(VideoCodecProfile value) {
CASE_RETURN_OTHER(DOLBYVISION_PROFILE4);
CASE_RETURN_OTHER(DOLBYVISION_PROFILE5);
CASE_RETURN_OTHER(DOLBYVISION_PROFILE7);
CASE_RETURN_OTHER(DOLBYVISION_PROFILE8);
CASE_RETURN_OTHER(DOLBYVISION_PROFILE9);
CASE_RETURN_OTHER(THEORAPROFILE_ANY);
CASE_RETURN_OTHER(AV1PROFILE_PROFILE_MAIN);
CASE_RETURN_OTHER(AV1PROFILE_PROFILE_HIGH);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment