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:
@ -600,11 +600,11 @@ int VP8EncoderImpl::InitEncode(const VideoCodec* inst,
|
|||||||
rps_.Init();
|
rps_.Init();
|
||||||
// Disable both high-QP limits and framedropping. Both are handled by libvpx
|
// Disable both high-QP limits and framedropping. Both are handled by libvpx
|
||||||
// internally.
|
// internally.
|
||||||
|
const int kLowQpThreshold = 18;
|
||||||
const int kDisabledBadQpThreshold = 64;
|
const int kDisabledBadQpThreshold = 64;
|
||||||
// TODO(glaznev/sprang): consider passing codec initial bitrate to quality
|
// TODO(glaznev/sprang): consider passing codec initial bitrate to quality
|
||||||
// scaler to avoid starting with HD for low initial bitrates.
|
// scaler to avoid starting with HD for low initial bitrates.
|
||||||
quality_scaler_.Init(codec_.qpMax / QualityScaler::kDefaultLowQpDenominator,
|
quality_scaler_.Init(kLowQpThreshold, kDisabledBadQpThreshold, false, 0, 0, 0,
|
||||||
kDisabledBadQpThreshold, false, 0, 0, 0,
|
|
||||||
codec_.maxFramerate);
|
codec_.maxFramerate);
|
||||||
|
|
||||||
// Only apply scaling to improve for single-layer streams. The scaling metrics
|
// Only apply scaling to improve for single-layer streams. The scaling metrics
|
||||||
|
@ -25,8 +25,6 @@ static const int kHdBitrateThresholdKbps = 500;
|
|||||||
static const int kMinDownscaleDimension = 140;
|
static const int kMinDownscaleDimension = 140;
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
const int QualityScaler::kDefaultLowQpDenominator = 3;
|
|
||||||
|
|
||||||
QualityScaler::QualityScaler()
|
QualityScaler::QualityScaler()
|
||||||
: low_qp_threshold_(-1), framerate_down_(false) {}
|
: low_qp_threshold_(-1), framerate_down_(false) {}
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
class QualityScaler {
|
class QualityScaler {
|
||||||
public:
|
public:
|
||||||
static const int kDefaultLowQpDenominator;
|
|
||||||
struct Resolution {
|
struct Resolution {
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
|
@ -23,9 +23,9 @@ static const int kHeightVga = 480;
|
|||||||
static const int kFramerate = 30;
|
static const int kFramerate = 30;
|
||||||
static const int kLowQp = 15;
|
static const int kLowQp = 15;
|
||||||
static const int kNormalQp = 30;
|
static const int kNormalQp = 30;
|
||||||
|
static const int kLowQpThreshold = 18;
|
||||||
static const int kHighQp = 40;
|
static const int kHighQp = 40;
|
||||||
static const int kMaxQp = 56;
|
static const int kDisabledBadQpThreshold = 64;
|
||||||
static const int kDisabledBadQpThreshold = kMaxQp + 1;
|
|
||||||
static const int kLowInitialBitrateKbps = 300;
|
static const int kLowInitialBitrateKbps = 300;
|
||||||
// These values need to be in sync with corresponding constants
|
// These values need to be in sync with corresponding constants
|
||||||
// in quality_scaler.cc
|
// in quality_scaler.cc
|
||||||
@ -56,8 +56,7 @@ class QualityScalerTest : public ::testing::Test {
|
|||||||
QualityScalerTest() {
|
QualityScalerTest() {
|
||||||
input_frame_.CreateEmptyFrame(kWidth, kHeight, kWidth, kHalfWidth,
|
input_frame_.CreateEmptyFrame(kWidth, kHeight, kWidth, kHalfWidth,
|
||||||
kHalfWidth);
|
kHalfWidth);
|
||||||
qs_.Init(kMaxQp / QualityScaler::kDefaultLowQpDenominator, kHighQp, false,
|
qs_.Init(kLowQpThreshold, kHighQp, false, 0, 0, 0, kFramerate);
|
||||||
0, 0, 0, kFramerate);
|
|
||||||
qs_.OnEncodeFrame(input_frame_);
|
qs_.OnEncodeFrame(input_frame_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -308,8 +307,8 @@ void QualityScalerTest::VerifyQualityAdaptation(
|
|||||||
int seconds_upscale,
|
int seconds_upscale,
|
||||||
bool expect_spatial_resize,
|
bool expect_spatial_resize,
|
||||||
bool expect_framerate_reduction) {
|
bool expect_framerate_reduction) {
|
||||||
qs_.Init(kMaxQp / QualityScaler::kDefaultLowQpDenominator,
|
qs_.Init(kLowQpThreshold, kDisabledBadQpThreshold, true, 0, 0, 0,
|
||||||
kDisabledBadQpThreshold, true, 0, 0, 0, initial_framerate);
|
initial_framerate);
|
||||||
qs_.OnEncodeFrame(input_frame_);
|
qs_.OnEncodeFrame(input_frame_);
|
||||||
int init_width = qs_.GetScaledResolution().width;
|
int init_width = qs_.GetScaledResolution().width;
|
||||||
int init_height = qs_.GetScaledResolution().height;
|
int init_height = qs_.GetScaledResolution().height;
|
||||||
@ -381,8 +380,7 @@ TEST_F(QualityScalerTest, DoesNotDownscaleBelow2xDefaultMinDimensionsHeight) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(QualityScalerTest, DownscaleToVgaOnLowInitialBitrate) {
|
TEST_F(QualityScalerTest, DownscaleToVgaOnLowInitialBitrate) {
|
||||||
qs_.Init(kMaxQp / QualityScaler::kDefaultLowQpDenominator,
|
qs_.Init(kLowQpThreshold, kDisabledBadQpThreshold, true,
|
||||||
kDisabledBadQpThreshold, true,
|
|
||||||
kLowInitialBitrateKbps, kWidth, kHeight, kFramerate);
|
kLowInitialBitrateKbps, kWidth, kHeight, kFramerate);
|
||||||
qs_.OnEncodeFrame(input_frame_);
|
qs_.OnEncodeFrame(input_frame_);
|
||||||
int init_width = qs_.GetScaledResolution().width;
|
int init_width = qs_.GetScaledResolution().width;
|
||||||
@ -393,8 +391,7 @@ TEST_F(QualityScalerTest, DownscaleToVgaOnLowInitialBitrate) {
|
|||||||
|
|
||||||
TEST_F(QualityScalerTest, DownscaleAfterMeasuredSecondsThenSlowerBackUp) {
|
TEST_F(QualityScalerTest, DownscaleAfterMeasuredSecondsThenSlowerBackUp) {
|
||||||
QualityScalerTest::Resolution initial_res;
|
QualityScalerTest::Resolution initial_res;
|
||||||
qs_.Init(kMaxQp / QualityScaler::kDefaultLowQpDenominator, kHighQp, false, 0,
|
qs_.Init(kLowQpThreshold, kHighQp, false, 0, kWidth, kHeight, kFramerate);
|
||||||
kWidth, kHeight, kFramerate);
|
|
||||||
qs_.OnEncodeFrame(input_frame_);
|
qs_.OnEncodeFrame(input_frame_);
|
||||||
initial_res.width = qs_.GetScaledResolution().width;
|
initial_res.width = qs_.GetScaledResolution().width;
|
||||||
initial_res.height = qs_.GetScaledResolution().height;
|
initial_res.height = qs_.GetScaledResolution().height;
|
||||||
@ -433,8 +430,8 @@ TEST_F(QualityScalerTest, DownscaleAfterMeasuredSecondsThenSlowerBackUp) {
|
|||||||
|
|
||||||
TEST_F(QualityScalerTest, UpscaleQuicklyInitiallyAfterMeasuredSeconds) {
|
TEST_F(QualityScalerTest, UpscaleQuicklyInitiallyAfterMeasuredSeconds) {
|
||||||
QualityScalerTest::Resolution initial_res;
|
QualityScalerTest::Resolution initial_res;
|
||||||
qs_.Init(kMaxQp / QualityScaler::kDefaultLowQpDenominator, kHighQp, false,
|
qs_.Init(kLowQpThreshold, kHighQp, false, kLowInitialBitrateKbps, kWidth,
|
||||||
kLowInitialBitrateKbps, kWidth, kHeight, kFramerate);
|
kHeight, kFramerate);
|
||||||
qs_.OnEncodeFrame(input_frame_);
|
qs_.OnEncodeFrame(input_frame_);
|
||||||
initial_res.width = qs_.GetScaledResolution().width;
|
initial_res.width = qs_.GetScaledResolution().width;
|
||||||
initial_res.height = qs_.GetScaledResolution().height;
|
initial_res.height = qs_.GetScaledResolution().height;
|
||||||
|
Reference in New Issue
Block a user