Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Unified Diff: webrtc/modules/video_coding/utility/quality_scaler_unittest.cc

Issue 1672173002: Add initial bitrate and frame resolution parameters to quality scaler. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Address comments - 3 Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/video_coding/utility/quality_scaler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/video_coding/utility/quality_scaler_unittest.cc
diff --git a/webrtc/modules/video_coding/utility/quality_scaler_unittest.cc b/webrtc/modules/video_coding/utility/quality_scaler_unittest.cc
index bad73a748c678e32a7ef18ce481af9ca2c3d84e6..a5e3219f7059e283fe429fe4ea445009502c5323 100644
--- a/webrtc/modules/video_coding/utility/quality_scaler_unittest.cc
+++ b/webrtc/modules/video_coding/utility/quality_scaler_unittest.cc
@@ -16,13 +16,17 @@ namespace webrtc {
namespace {
static const int kNumSeconds = 10;
static const int kWidth = 1920;
+static const int kWidthVga = 640;
static const int kHalfWidth = kWidth / 2;
static const int kHeight = 1080;
+static const int kHeightVga = 480;
static const int kFramerate = 30;
static const int kLowQp = 15;
static const int kNormalQp = 30;
static const int kHighQp = 40;
static const int kMaxQp = 56;
+static const int kDisabledBadQpThreshold = kMaxQp + 1;
+static const int kLowInitialBitrateKbps = 300;
} // namespace
class QualityScalerTest : public ::testing::Test {
@@ -46,7 +50,8 @@ class QualityScalerTest : public ::testing::Test {
QualityScalerTest() {
input_frame_.CreateEmptyFrame(kWidth, kHeight, kWidth, kHalfWidth,
kHalfWidth);
- qs_.Init(kMaxQp / QualityScaler::kDefaultLowQpDenominator, kHighQp, false);
+ qs_.Init(kMaxQp / QualityScaler::kDefaultLowQpDenominator, kHighQp, false,
+ 0, 0, 0);
qs_.ReportFramerate(kFramerate);
qs_.OnEncodeFrame(input_frame_);
}
@@ -296,9 +301,8 @@ void QualityScalerTest::VerifyQualityAdaptation(
int seconds,
bool expect_spatial_resize,
bool expect_framerate_reduction) {
- const int kDisabledBadQpThreshold = kMaxQp + 1;
qs_.Init(kMaxQp / QualityScaler::kDefaultLowQpDenominator,
- kDisabledBadQpThreshold, true);
+ kDisabledBadQpThreshold, true, 0, 0, 0);
qs_.OnEncodeFrame(input_frame_);
int init_width = qs_.GetScaledResolution().width;
int init_height = qs_.GetScaledResolution().height;
@@ -364,6 +368,17 @@ TEST_F(QualityScalerTest, DoesNotDownscaleBelow2xDefaultMinDimensionsHeight) {
1000, 2 * QualityScaler::kDefaultMinDownscaleDimension - 1);
}
+TEST_F(QualityScalerTest, DownscaleToVgaOnLowInitialBitrate) {
+ qs_.Init(kMaxQp / QualityScaler::kDefaultLowQpDenominator,
+ kDisabledBadQpThreshold, true,
+ kLowInitialBitrateKbps, kWidth, kHeight);
+ qs_.OnEncodeFrame(input_frame_);
+ int init_width = qs_.GetScaledResolution().width;
+ int init_height = qs_.GetScaledResolution().height;
+ EXPECT_LE(init_width, kWidthVga);
+ EXPECT_LE(init_height, kHeightVga);
+}
+
void QualityScalerTest::DownscaleEndsAt(int input_width,
int input_height,
int end_width,
« no previous file with comments | « webrtc/modules/video_coding/utility/quality_scaler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698