mirror of
https://github.com/Alex313031/thorium.git
synced 2025-01-10 03:47:44 -03:00
Update vaapi_wrapper.cc
This commit is contained in:
parent
6991c13744
commit
6c9c8d3b84
1 changed files with 21 additions and 7 deletions
|
@ -42,6 +42,7 @@
|
|||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
#include "media/base/media_switches.h"
|
||||
#include "media/base/video_codecs.h"
|
||||
#include "media/base/video_frame.h"
|
||||
#include "media/base/video_types.h"
|
||||
#include "media/gpu/macros.h"
|
||||
|
@ -481,6 +482,17 @@ bool IsVAProfileSupported(VAProfile va_profile) {
|
|||
}) != profiles.end();
|
||||
}
|
||||
|
||||
bool IsImplementedVbr(VideoCodecProfile codec_profile) {
|
||||
switch (codec_profile) {
|
||||
case H264PROFILE_BASELINE:
|
||||
case H264PROFILE_MAIN:
|
||||
case H264PROFILE_HIGH:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsBlockedDriver(VaapiWrapper::CodecMode mode, VAProfile va_profile) {
|
||||
if (!IsModeEncoding(mode)) {
|
||||
return va_profile == VAProfileAV1Profile0 &&
|
||||
|
@ -1524,12 +1536,7 @@ std::vector<SVCScalabilityMode> VaapiWrapper::GetSupportedScalabilityModes(
|
|||
}
|
||||
|
||||
if (media_profile >= H264PROFILE_MIN && media_profile <= H264PROFILE_MAX) {
|
||||
// TODO(b/199487660): Enable H.264 temporal layer encoding on AMD once their
|
||||
// drivers support them.
|
||||
VAImplementation implementation = VaapiWrapper::GetImplementationType();
|
||||
if (base::FeatureList::IsEnabled(kVaapiH264TemporalLayerHWEncoding) &&
|
||||
(implementation == VAImplementation::kIntelI965 ||
|
||||
implementation == VAImplementation::kIntelIHD)) {
|
||||
if (base::FeatureList::IsEnabled(kVaapiH264TemporalLayerHWEncoding)) {
|
||||
scalability_modes.push_back(SVCScalabilityMode::kL1T2);
|
||||
scalability_modes.push_back(SVCScalabilityMode::kL1T3);
|
||||
}
|
||||
|
@ -1561,8 +1568,15 @@ VaapiWrapper::GetSupportedEncodeProfiles() {
|
|||
constexpr int kMaxEncoderFramerate = 30;
|
||||
profile.max_framerate_numerator = kMaxEncoderFramerate;
|
||||
profile.max_framerate_denominator = 1;
|
||||
// TODO(b/193680666): remove hard-coding when VBR is supported
|
||||
profile.rate_control_modes = media::VideoEncodeAccelerator::kConstantMode;
|
||||
// This code assumes that the resolutions are the same between CBR and VBR.
|
||||
// This is checked in a test in vaapi_unittest.cc: VbrAndCbrResolutionsMatch
|
||||
if (IsImplementedVbr(media_profile) &&
|
||||
VASupportedProfiles::Get().IsProfileSupported(kEncodeVariableBitrate,
|
||||
va_profile)) {
|
||||
profile.rate_control_modes |=
|
||||
media::VideoEncodeAccelerator::kVariableMode;
|
||||
}
|
||||
profile.scalability_modes =
|
||||
GetSupportedScalabilityModes(media_profile, va_profile);
|
||||
profiles.push_back(profile);
|
||||
|
|
Loading…
Reference in a new issue