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

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

Issue 1364253002: Implement a high-QP threshold for Android H.264. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: feedback Created 5 years, 3 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 d1710b6dd7e83b5f2f26ef0daf8f746ecc8df60c..2ce1107472e9821740533c04bbea707ae971e008 100644
--- a/webrtc/modules/video_coding/utility/quality_scaler_unittest.cc
+++ b/webrtc/modules/video_coding/utility/quality_scaler_unittest.cc
@@ -21,6 +21,7 @@ static const int kHeight = 1080;
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;
} // namespace
@@ -33,13 +34,18 @@ class QualityScalerTest : public ::testing::Test {
int height;
};
protected:
- enum ScaleDirection { kScaleDown, kScaleUp };
+ enum ScaleDirection {
+ kKeepScaleAtHighQp,
+ kScaleDown,
+ kScaleDownAboveHighQp,
+ kScaleUp
+ };
enum BadQualityMetric { kDropFrame, kReportLowQP };
QualityScalerTest() {
input_frame_.CreateEmptyFrame(
kWidth, kHeight, kWidth, kHalfWidth, kHalfWidth);
- qs_.Init(kMaxQp / QualityScaler::kDefaultLowQpDenominator, false);
+ qs_.Init(kMaxQp / QualityScaler::kDefaultLowQpDenominator, kHighQp, false);
qs_.ReportFramerate(kFramerate);
qs_.OnEncodeFrame(input_frame_);
}
@@ -55,6 +61,12 @@ class QualityScalerTest : public ::testing::Test {
case kScaleDown:
qs_.ReportDroppedFrame();
break;
+ case kKeepScaleAtHighQp:
+ qs_.ReportQP(kHighQp);
+ break;
+ case kScaleDownAboveHighQp:
+ qs_.ReportQP(kHighQp + 1);
+ break;
}
qs_.OnEncodeFrame(input_frame_);
if (qs_.GetScaledResolution().width != initial_width)
@@ -117,6 +129,22 @@ TEST_F(QualityScalerTest, DownscalesAfterContinuousFramedrop) {
EXPECT_LT(res.height, input_frame_.height());
}
+TEST_F(QualityScalerTest, KeepsScaleAtHighQp) {
+ EXPECT_FALSE(TriggerScale(kKeepScaleAtHighQp))
+ << "Downscale at high threshold which should keep scale.";
+ QualityScaler::Resolution res = qs_.GetScaledResolution();
+ EXPECT_EQ(res.width, input_frame_.width());
+ EXPECT_EQ(res.height, input_frame_.height());
+}
+
+TEST_F(QualityScalerTest, DownscalesAboveHighQp) {
+ EXPECT_TRUE(TriggerScale(kScaleDownAboveHighQp))
+ << "No downscale within " << kNumSeconds << " seconds.";
+ QualityScaler::Resolution res = qs_.GetScaledResolution();
+ EXPECT_LT(res.width, input_frame_.width());
+ EXPECT_LT(res.height, input_frame_.height());
+}
+
TEST_F(QualityScalerTest, DownscalesAfterTwoThirdsFramedrop) {
for (int i = 0; i < kFramerate * kNumSeconds / 3; ++i) {
qs_.ReportQP(kNormalQp);
@@ -262,7 +290,9 @@ QualityScalerTest::Resolution QualityScalerTest::TriggerResolutionChange(
void QualityScalerTest::VerifyQualityAdaptation(
int initial_framerate, int seconds, bool expect_spatial_resize,
bool expect_framerate_reduction) {
- qs_.Init(kMaxQp / QualityScaler::kDefaultLowQpDenominator, true);
+ const int kDisabledBadQpThreshold = kMaxQp + 1;
+ qs_.Init(kMaxQp / QualityScaler::kDefaultLowQpDenominator,
+ kDisabledBadQpThreshold, true);
qs_.OnEncodeFrame(input_frame_);
int init_width = qs_.GetScaledResolution().width;
int init_height = qs_.GetScaledResolution().height;
« 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