2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
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.
10 #include "third_party/googletest/src/include/gtest/gtest.h"
11 #include "test/codec_factory.h"
12 #include "test/encode_test_driver.h"
13 #include "test/i420_video_source.h"
14 #include "test/util.h"
18 class AltRefAqSegmentTest
19 : public ::libvpx_test::EncoderTest,
20 public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
22 AltRefAqSegmentTest() : EncoderTest(GET_PARAM(0)) {}
23 virtual ~AltRefAqSegmentTest() {}
25 virtual void SetUp() {
27 SetMode(GET_PARAM(1));
28 set_cpu_used_ = GET_PARAM(2);
33 virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
34 ::libvpx_test::Encoder *encoder) {
35 if (video->frame() == 0) {
36 encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
37 encoder->Control(VP9E_SET_ALT_REF_AQ, alt_ref_aq_mode_);
38 encoder->Control(VP9E_SET_AQ_MODE, aq_mode_);
39 encoder->Control(VP8E_SET_MAX_INTRA_BITRATE_PCT, 100);
48 // Validate that this ALT_REF_AQ/AQ segmentation mode
49 // (ALT_REF_AQ=0, AQ=0/no_aq)
50 // encodes and decodes without a mismatch.
51 TEST_P(AltRefAqSegmentTest, TestNoMisMatchAltRefAQ0) {
52 cfg_.rc_min_quantizer = 8;
53 cfg_.rc_max_quantizer = 56;
54 cfg_.rc_end_usage = VPX_VBR;
55 cfg_.rc_buf_initial_sz = 500;
56 cfg_.rc_buf_optimal_sz = 500;
57 cfg_.rc_buf_sz = 1000;
58 cfg_.rc_target_bitrate = 300;
63 ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
66 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
69 // Validate that this ALT_REF_AQ/AQ segmentation mode
70 // (ALT_REF_AQ=0, AQ=1/variance_aq)
71 // encodes and decodes without a mismatch.
72 TEST_P(AltRefAqSegmentTest, TestNoMisMatchAltRefAQ1) {
73 cfg_.rc_min_quantizer = 8;
74 cfg_.rc_max_quantizer = 56;
75 cfg_.rc_end_usage = VPX_VBR;
76 cfg_.rc_buf_initial_sz = 500;
77 cfg_.rc_buf_optimal_sz = 500;
78 cfg_.rc_buf_sz = 1000;
79 cfg_.rc_target_bitrate = 300;
84 ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
87 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
90 // Validate that this ALT_REF_AQ/AQ segmentation mode
91 // (ALT_REF_AQ=0, AQ=2/complexity_aq)
92 // encodes and decodes without a mismatch.
93 TEST_P(AltRefAqSegmentTest, TestNoMisMatchAltRefAQ2) {
94 cfg_.rc_min_quantizer = 8;
95 cfg_.rc_max_quantizer = 56;
96 cfg_.rc_end_usage = VPX_VBR;
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;
103 alt_ref_aq_mode_ = 1;
105 ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
108 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
111 // Validate that this ALT_REF_AQ/AQ segmentation mode
112 // (ALT_REF_AQ=0, AQ=3/cyclicrefresh_aq)
113 // encodes and decodes without a mismatch.
114 TEST_P(AltRefAqSegmentTest, TestNoMisMatchAltRefAQ3) {
115 cfg_.rc_min_quantizer = 8;
116 cfg_.rc_max_quantizer = 56;
117 cfg_.rc_end_usage = VPX_VBR;
118 cfg_.rc_buf_initial_sz = 500;
119 cfg_.rc_buf_optimal_sz = 500;
120 cfg_.rc_buf_sz = 1000;
121 cfg_.rc_target_bitrate = 300;
124 alt_ref_aq_mode_ = 1;
126 ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
129 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
132 // Validate that this ALT_REF_AQ/AQ segmentation mode
133 // (ALT_REF_AQ=0, AQ=4/equator360_aq)
134 // encodes and decodes without a mismatch.
135 TEST_P(AltRefAqSegmentTest, TestNoMisMatchAltRefAQ4) {
136 cfg_.rc_min_quantizer = 8;
137 cfg_.rc_max_quantizer = 56;
138 cfg_.rc_end_usage = VPX_VBR;
139 cfg_.rc_buf_initial_sz = 500;
140 cfg_.rc_buf_optimal_sz = 500;
141 cfg_.rc_buf_sz = 1000;
142 cfg_.rc_target_bitrate = 300;
145 alt_ref_aq_mode_ = 1;
147 ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
150 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
153 VP9_INSTANTIATE_TEST_SUITE(AltRefAqSegmentTest,
154 ::testing::Values(::libvpx_test::kOnePassGood,
155 ::libvpx_test::kTwoPassGood),
156 ::testing::Range(2, 5));