Commit ae2eee3e authored by Sunny Sachanandani's avatar Sunny Sachanandani Committed by Commit Bot

Check if DXVA decoder supports VP9 profile 2

Bug: 937108
Change-Id: If1a8979c5493204d40efcd262c8cb60650c95696
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1632288
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarFrank Liberato <liberato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#664005}
parent 73253b45
...@@ -1437,8 +1437,9 @@ DXVAVideoDecodeAccelerator::GetSupportedProfiles( ...@@ -1437,8 +1437,9 @@ DXVAVideoDecodeAccelerator::GetSupportedProfiles(
// 1920 x 1088. We use 1088 to account for 16x16 macroblocks. // 1920 x 1088. We use 1088 to account for 16x16 macroblocks.
ResolutionPair max_h264_resolutions(gfx::Size(1920, 1088), gfx::Size()); ResolutionPair max_h264_resolutions(gfx::Size(1920, 1088), gfx::Size());
// VPX has no default resolutions since it may not even be supported. // VP9 has no default resolutions since it may not even be supported.
ResolutionPair max_vpx_resolutions; ResolutionPair max_vp9_profile0_resolutions;
ResolutionPair max_vp9_profile2_resolutions;
if (base::win::GetVersion() > base::win::Version::WIN7) { if (base::win::GetVersion() > base::win::Version::WIN7) {
// To detect if a driver supports the desired resolutions, we try and create // To detect if a driver supports the desired resolutions, we try and create
...@@ -1458,57 +1459,68 @@ DXVAVideoDecodeAccelerator::GetSupportedProfiles( ...@@ -1458,57 +1459,68 @@ DXVAVideoDecodeAccelerator::GetSupportedProfiles(
{gfx::Size(2560, 1440), gfx::Size(3840, 2160), {gfx::Size(2560, 1440), gfx::Size(3840, 2160),
gfx::Size(4096, 2160), gfx::Size(4096, 2304)}); gfx::Size(4096, 2160), gfx::Size(4096, 2304)});
// Despite the name this is the GUID for VP9.
if (preferences.enable_accelerated_vpx_decode && if (preferences.enable_accelerated_vpx_decode &&
!workarounds.disable_accelerated_vpx_decode) { !workarounds.disable_accelerated_vpx_decode) {
max_vpx_resolutions = GetMaxResolutionsForGUIDs( max_vp9_profile0_resolutions = GetMaxResolutionsForGUIDs(
max_vpx_resolutions.first, video_device.Get(), max_vp9_profile0_resolutions.first, video_device.Get(),
{D3D11_DECODER_PROFILE_VP9_VLD_PROFILE0}, {D3D11_DECODER_PROFILE_VP9_VLD_PROFILE0},
{gfx::Size(4096, 2160), gfx::Size(4096, 2304), {gfx::Size(4096, 2160), gfx::Size(4096, 2304),
gfx::Size(7680, 4320), gfx::Size(8192, 4320), gfx::Size(7680, 4320), gfx::Size(8192, 4320),
gfx::Size(8192, 8192)}); gfx::Size(8192, 8192)});
max_vp9_profile2_resolutions = GetMaxResolutionsForGUIDs(
max_vp9_profile2_resolutions.first, video_device.Get(),
{D3D11_DECODER_PROFILE_VP9_VLD_10BIT_PROFILE2},
{gfx::Size(4096, 2160), gfx::Size(4096, 2304),
gfx::Size(7680, 4320), gfx::Size(8192, 4320),
gfx::Size(8192, 8192)});
} }
} }
} }
} }
for (const auto& supported_profile : kSupportedProfiles) { for (const auto& supported_profile : kSupportedProfiles) {
const bool kIsVPX = supported_profile >= VP9PROFILE_MIN && const bool is_h264 = supported_profile >= H264PROFILE_MIN &&
supported_profile <= H264PROFILE_MAX;
const bool is_vp9 = supported_profile >= VP9PROFILE_MIN &&
supported_profile <= VP9PROFILE_MAX; supported_profile <= VP9PROFILE_MAX;
DCHECK(is_h264 || is_vp9);
ResolutionPair max_resolutions;
if (is_h264) {
max_resolutions = max_h264_resolutions;
} else if (supported_profile == VP9PROFILE_PROFILE0) {
max_resolutions = max_vp9_profile0_resolutions;
} else if (supported_profile == VP9PROFILE_PROFILE2) {
max_resolutions = max_vp9_profile2_resolutions;
}
// Skip adding VPX profiles if it's not supported or disabled. // Skip adding VP9 profiles if it's not supported or disabled.
if (kIsVPX && max_vpx_resolutions.first.IsEmpty()) if (is_vp9 && max_resolutions.first.IsEmpty())
continue; continue;
const bool kIsH264 = supported_profile >= H264PROFILE_MIN &&
supported_profile <= H264PROFILE_MAX;
DCHECK(kIsH264 || kIsVPX);
// Windows Media Foundation H.264 decoding does not support decoding videos // Windows Media Foundation H.264 decoding does not support decoding videos
// with any dimension smaller than 48 pixels: // with any dimension smaller than 48 pixels:
// http://msdn.microsoft.com/en-us/library/windows/desktop/dd797815 // http://msdn.microsoft.com/en-us/library/windows/desktop/dd797815
// //
// TODO(dalecurtis): These values are too low. We should only be using // TODO(dalecurtis): These values are too low. We should only be using
// hardware decode for videos above ~360p, see http://crbug.com/684792. // hardware decode for videos above ~360p, see http://crbug.com/684792.
const gfx::Size kMinResolution = const gfx::Size min_resolution =
kIsH264 ? gfx::Size(48, 48) : gfx::Size(16, 16); is_h264 ? gfx::Size(48, 48) : gfx::Size(16, 16);
{ {
SupportedProfile profile; SupportedProfile profile;
profile.profile = supported_profile; profile.profile = supported_profile;
profile.min_resolution = kMinResolution; profile.min_resolution = min_resolution;
profile.max_resolution = profile.max_resolution = max_resolutions.first;
kIsH264 ? max_h264_resolutions.first : max_vpx_resolutions.first;
profiles.push_back(profile); profiles.push_back(profile);
} }
const gfx::Size kPortraitMax = const gfx::Size portrait_max_resolution = max_resolutions.second;
kIsH264 ? max_h264_resolutions.second : max_vpx_resolutions.second; if (!portrait_max_resolution.IsEmpty()) {
if (!kPortraitMax.IsEmpty()) {
SupportedProfile profile; SupportedProfile profile;
profile.profile = supported_profile; profile.profile = supported_profile;
profile.min_resolution = kMinResolution; profile.min_resolution = min_resolution;
profile.max_resolution = kPortraitMax; profile.max_resolution = portrait_max_resolution;
profiles.push_back(profile); profiles.push_back(profile);
} }
} }
......
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