Skip to content

Commit

Permalink
media/gpu/vaapi/VP9Encoder: Ease max QP limitation for Software BRC.
Browse files Browse the repository at this point in the history
Bug: 1060775
Test: appr.tc/?vsbr=500&vsc=vp9 on rammus
Test: video_encode_accelerator_tests --codec=vp9 on rammus
Change-Id: I45ef96aec373b05383680c54245fc0d0000b7579
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2359816
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Miguel Casas <mcasas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799484}
  • Loading branch information
Hirokazu Honda authored and Commit Bot committed Aug 19, 2020
1 parent d7b52b6 commit 7589c16
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions media/gpu/vaapi/vp9_encoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ constexpr int kCPBWindowSizeMs = 500;
// Quantization parameter. They are vp9 ac/dc indices and their ranges are
// 0-255. Based on WebRTC's defaults.
constexpr int kMinQP = 4;
// TODO(crbug.com/1060775): Relax this max quantization parameter upper bound
// so that our encoder and bitrate controller can select a higher value in the
// case a requested bitrate is small.
constexpr int kMaxQP = 112;
// The upper limitation of the quantization parameter for the software rate
// controller. This is larger than |kMaxQP| because a driver might ignore the
// specified maximum quantization parameter when the driver determines the
// value, but it doesn't ignore the quantization parameter by the software rate
// controller.
constexpr int kMaxQPForSoftwareRateCtrl = 224;

// This stands for 31 as a real ac value (see rfc 8.6.1 table
// ac_qlookup[3][256]). Note: This needs to be revisited once we have 10&12 bit
// encoder support.
Expand Down Expand Up @@ -220,6 +224,8 @@ bool VP9Encoder::Initialize(const VideoEncodeAccelerator::Config& config,
temporal_layers_ =
std::make_unique<VP9TemporalLayers>(num_temporal_layers);
}
current_params_.scaling_settings.max_qp = kMaxQPForSoftwareRateCtrl;

// |rate_ctrl_| might be injected for tests.
if (!rate_ctrl_) {
rate_ctrl_ = VP9RateControl::Create(CreateRateControlConfig(
Expand Down

0 comments on commit 7589c16

Please sign in to comment.