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

Side by Side Diff: webrtc/modules/video_coding/utility/quality_scaler_unittest.cc

Issue 2310853002: Refactor QualityScaler and MovingAverage (Closed)
Patch Set: fix build error Created 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 25 matching lines...) Expand all
36 protected: 36 protected:
37 enum ScaleDirection { 37 enum ScaleDirection {
38 kKeepScaleAtHighQp, 38 kKeepScaleAtHighQp,
39 kScaleDown, 39 kScaleDown,
40 kScaleDownAboveHighQp, 40 kScaleDownAboveHighQp,
41 kScaleUp 41 kScaleUp
42 }; 42 };
43 43
44 QualityScalerTest() { 44 QualityScalerTest() {
45 input_frame_ = I420Buffer::Create(kWidth, kHeight); 45 input_frame_ = I420Buffer::Create(kWidth, kHeight);
46 qs_.Init(kLowQpThreshold, kHighQp, 0, 0, 0, kFramerate); 46 qs_.Init(kLowQpThreshold, kHighQp, 0, kWidth, kHeight, kFramerate);
47 qs_.OnEncodeFrame(input_frame_->width(), input_frame_->height()); 47 qs_.OnEncodeFrame(input_frame_->width(), input_frame_->height());
48 } 48 }
49 49
50 bool TriggerScale(ScaleDirection scale_direction) { 50 bool TriggerScale(ScaleDirection scale_direction) {
51 qs_.OnEncodeFrame(input_frame_->width(), input_frame_->height()); 51 qs_.OnEncodeFrame(input_frame_->width(), input_frame_->height());
52 int initial_width = qs_.GetScaledResolution().width; 52 int initial_width = qs_.GetScaledResolution().width;
53 for (int i = 0; i < kFramerate * kNumSeconds; ++i) { 53 for (int i = 0; i < kFramerate * kNumSeconds; ++i) {
54 switch (scale_direction) { 54 switch (scale_direction) {
55 case kScaleUp: 55 case kScaleUp:
56 qs_.ReportQP(kLowQp); 56 qs_.ReportQP(kLowQp);
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 377
378 TEST_F(QualityScalerTest, DownscalesFrom1280x720To320x180) { 378 TEST_F(QualityScalerTest, DownscalesFrom1280x720To320x180) {
379 DownscaleEndsAt(1280, 720, 320, 180); 379 DownscaleEndsAt(1280, 720, 320, 180);
380 } 380 }
381 381
382 TEST_F(QualityScalerTest, DoesntDownscaleInitialQvga) { 382 TEST_F(QualityScalerTest, DoesntDownscaleInitialQvga) {
383 DownscaleEndsAt(320, 180, 320, 180); 383 DownscaleEndsAt(320, 180, 320, 180);
384 } 384 }
385 385
386 } // namespace webrtc 386 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/utility/quality_scaler.cc ('k') | webrtc/modules/video_coding/utility/video_coding_utility.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698