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

Side by Side Diff: source/libvpx/test/aq_segment_test.cc

Issue 232133009: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « source/libvpx/test/android/scrape_gtest_log.py ('k') | source/libvpx/test/borders_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10 #include <climits>
11 #include <vector>
12 #include "third_party/googletest/src/include/gtest/gtest.h"
13 #include "test/codec_factory.h"
14 #include "test/encode_test_driver.h"
15 #include "test/i420_video_source.h"
16 #include "test/util.h"
17
18 namespace {
19
20 class AqSegmentTest : public ::libvpx_test::EncoderTest,
21 public ::libvpx_test::CodecTestWith2Params<
22 libvpx_test::TestMode, int> {
23 protected:
24 AqSegmentTest() : EncoderTest(GET_PARAM(0)) {}
25
26 virtual void SetUp() {
27 InitializeConfig();
28 SetMode(GET_PARAM(1));
29 set_cpu_used_ = GET_PARAM(2);
30 aq_mode_ = 0;
31 }
32
33 virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
34 ::libvpx_test::Encoder *encoder) {
35 if (video->frame() == 1) {
36 encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
37 encoder->Control(VP9E_SET_AQ_MODE, aq_mode_);
38 encoder->Control(VP8E_SET_MAX_INTRA_BITRATE_PCT, 100);
39 }
40 }
41
42 virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
43 if (pkt->data.frame.flags & VPX_FRAME_IS_KEY) {
44 }
45 }
46 int set_cpu_used_;
47 int aq_mode_;
48 };
49
50 // Validate that this AQ segmentation mode (AQ=1, variance_ap)
51 // encodes and decodes without a mismatch.
52 TEST_P(AqSegmentTest, TestNoMisMatchAQ1) {
53 cfg_.rc_min_quantizer = 8;
54 cfg_.rc_max_quantizer = 56;
55 cfg_.rc_end_usage = VPX_CBR;
56 cfg_.g_lag_in_frames = 0;
57 cfg_.rc_buf_initial_sz = 500;
58 cfg_.rc_buf_optimal_sz = 500;
59 cfg_.rc_buf_sz = 1000;
60 cfg_.rc_target_bitrate = 300;
61
62 aq_mode_ = 1;
63
64 ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
65 30, 1, 0, 100);
66
67 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
68 }
69
70 // Validate that this AQ segmentation mode (AQ=2, complexity_aq)
71 // encodes and decodes without a mismatch.
72 TEST_P(AqSegmentTest, TestNoMisMatchAQ2) {
73 cfg_.rc_min_quantizer = 8;
74 cfg_.rc_max_quantizer = 56;
75 cfg_.rc_end_usage = VPX_CBR;
76 cfg_.g_lag_in_frames = 0;
77 cfg_.rc_buf_initial_sz = 500;
78 cfg_.rc_buf_optimal_sz = 500;
79 cfg_.rc_buf_sz = 1000;
80 cfg_.rc_target_bitrate = 300;
81
82 aq_mode_ = 2;
83
84 ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
85 30, 1, 0, 100);
86
87 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
88 }
89
90 // Validate that this AQ segmentation mode (AQ=3, cyclic_refresh_aq)
91 // encodes and decodes without a mismatch.
92 TEST_P(AqSegmentTest, TestNoMisMatchAQ3) {
93 cfg_.rc_min_quantizer = 8;
94 cfg_.rc_max_quantizer = 56;
95 cfg_.rc_end_usage = VPX_CBR;
96 cfg_.g_lag_in_frames = 0;
97 cfg_.rc_buf_initial_sz = 500;
98 cfg_.rc_buf_optimal_sz = 500;
99 cfg_.rc_buf_sz = 1000;
100 cfg_.rc_target_bitrate = 300;
101
102 aq_mode_ = 3;
103
104 ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
105 30, 1, 0, 100);
106
107 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
108 }
109
110 using std::tr1::make_tuple;
111
112 #define VP9_FACTORY \
113 static_cast<const libvpx_test::CodecFactory*> (&libvpx_test::kVP9)
114
115 VP9_INSTANTIATE_TEST_CASE(AqSegmentTest,
116 ::testing::Values(::libvpx_test::kRealTime,
117 ::libvpx_test::kOnePassGood),
118 ::testing::Range(3, 9));
119 } // namespace
OLDNEW
« no previous file with comments | « source/libvpx/test/android/scrape_gtest_log.py ('k') | source/libvpx/test/borders_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698