Remove QualityScaler kDefaultLowQpDenominator.

This denominator doesn't make any semantic sense, it's better to use
real thresholds for when things look "good" or "bad" rather than
fractions of a max QP.

BUG=webrtc:5678
R=danilchap@webrtc.org

Review URL: https://codereview.webrtc.org/1855393005 .

Cr-Commit-Position: refs/heads/master@{#12363}
This commit is contained in:
Peter Boström
2016-04-14 17:04:03 +02:00
parent 926dfcdf5e
commit 00b62b0849
4 changed files with 11 additions and 17 deletions

View File

@ -600,11 +600,11 @@ int VP8EncoderImpl::InitEncode(const VideoCodec* inst,
rps_.Init();
// Disable both high-QP limits and framedropping. Both are handled by libvpx
// internally.
const int kLowQpThreshold = 18;
const int kDisabledBadQpThreshold = 64;
// TODO(glaznev/sprang): consider passing codec initial bitrate to quality
// scaler to avoid starting with HD for low initial bitrates.
quality_scaler_.Init(codec_.qpMax / QualityScaler::kDefaultLowQpDenominator,
kDisabledBadQpThreshold, false, 0, 0, 0,
quality_scaler_.Init(kLowQpThreshold, kDisabledBadQpThreshold, false, 0, 0, 0,
codec_.maxFramerate);
// Only apply scaling to improve for single-layer streams. The scaling metrics

View File

@ -25,8 +25,6 @@ static const int kHdBitrateThresholdKbps = 500;
static const int kMinDownscaleDimension = 140;
} // namespace
const int QualityScaler::kDefaultLowQpDenominator = 3;
QualityScaler::QualityScaler()
: low_qp_threshold_(-1), framerate_down_(false) {}

View File

@ -17,7 +17,6 @@
namespace webrtc {
class QualityScaler {
public:
static const int kDefaultLowQpDenominator;
struct Resolution {
int width;
int height;

View File

@ -23,9 +23,9 @@ static const int kHeightVga = 480;
static const int kFramerate = 30;
static const int kLowQp = 15;
static const int kNormalQp = 30;
static const int kLowQpThreshold = 18;
static const int kHighQp = 40;
static const int kMaxQp = 56;
static const int kDisabledBadQpThreshold = kMaxQp + 1;
static const int kDisabledBadQpThreshold = 64;
static const int kLowInitialBitrateKbps = 300;
// These values need to be in sync with corresponding constants
// in quality_scaler.cc
@ -56,8 +56,7 @@ class QualityScalerTest : public ::testing::Test {
QualityScalerTest() {
input_frame_.CreateEmptyFrame(kWidth, kHeight, kWidth, kHalfWidth,
kHalfWidth);
qs_.Init(kMaxQp / QualityScaler::kDefaultLowQpDenominator, kHighQp, false,
0, 0, 0, kFramerate);
qs_.Init(kLowQpThreshold, kHighQp, false, 0, 0, 0, kFramerate);
qs_.OnEncodeFrame(input_frame_);
}
@ -308,8 +307,8 @@ void QualityScalerTest::VerifyQualityAdaptation(
int seconds_upscale,
bool expect_spatial_resize,
bool expect_framerate_reduction) {
qs_.Init(kMaxQp / QualityScaler::kDefaultLowQpDenominator,
kDisabledBadQpThreshold, true, 0, 0, 0, initial_framerate);
qs_.Init(kLowQpThreshold, kDisabledBadQpThreshold, true, 0, 0, 0,
initial_framerate);
qs_.OnEncodeFrame(input_frame_);
int init_width = qs_.GetScaledResolution().width;
int init_height = qs_.GetScaledResolution().height;
@ -381,8 +380,7 @@ TEST_F(QualityScalerTest, DoesNotDownscaleBelow2xDefaultMinDimensionsHeight) {
}
TEST_F(QualityScalerTest, DownscaleToVgaOnLowInitialBitrate) {
qs_.Init(kMaxQp / QualityScaler::kDefaultLowQpDenominator,
kDisabledBadQpThreshold, true,
qs_.Init(kLowQpThreshold, kDisabledBadQpThreshold, true,
kLowInitialBitrateKbps, kWidth, kHeight, kFramerate);
qs_.OnEncodeFrame(input_frame_);
int init_width = qs_.GetScaledResolution().width;
@ -393,8 +391,7 @@ TEST_F(QualityScalerTest, DownscaleToVgaOnLowInitialBitrate) {
TEST_F(QualityScalerTest, DownscaleAfterMeasuredSecondsThenSlowerBackUp) {
QualityScalerTest::Resolution initial_res;
qs_.Init(kMaxQp / QualityScaler::kDefaultLowQpDenominator, kHighQp, false, 0,
kWidth, kHeight, kFramerate);
qs_.Init(kLowQpThreshold, kHighQp, false, 0, kWidth, kHeight, kFramerate);
qs_.OnEncodeFrame(input_frame_);
initial_res.width = qs_.GetScaledResolution().width;
initial_res.height = qs_.GetScaledResolution().height;
@ -433,8 +430,8 @@ TEST_F(QualityScalerTest, DownscaleAfterMeasuredSecondsThenSlowerBackUp) {
TEST_F(QualityScalerTest, UpscaleQuicklyInitiallyAfterMeasuredSeconds) {
QualityScalerTest::Resolution initial_res;
qs_.Init(kMaxQp / QualityScaler::kDefaultLowQpDenominator, kHighQp, false,
kLowInitialBitrateKbps, kWidth, kHeight, kFramerate);
qs_.Init(kLowQpThreshold, kHighQp, false, kLowInitialBitrateKbps, kWidth,
kHeight, kFramerate);
qs_.OnEncodeFrame(input_frame_);
initial_res.width = qs_.GetScaledResolution().width;
initial_res.height = qs_.GetScaledResolution().height;