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"
19 : public ::libvpx_test::EncoderTest,
20 public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
22 AqSegmentTest() : EncoderTest(GET_PARAM(0)) {}
23 virtual ~AqSegmentTest() {}
25 virtual void SetUp() {
27 SetMode(GET_PARAM(1));
28 set_cpu_used_ = GET_PARAM(2);
32 virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
33 ::libvpx_test::Encoder *encoder) {
34 if (video->frame() == 1) {
35 encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
36 encoder->Control(VP9E_SET_AQ_MODE, aq_mode_);
37 encoder->Control(VP8E_SET_MAX_INTRA_BITRATE_PCT, 100);
45 // Validate that this AQ segmentation mode (AQ=1, variance_ap)
46 // encodes and decodes without a mismatch.
47 TEST_P(AqSegmentTest, TestNoMisMatchAQ1) {
48 cfg_.rc_min_quantizer = 8;
49 cfg_.rc_max_quantizer = 56;
50 cfg_.rc_end_usage = VPX_CBR;
51 cfg_.g_lag_in_frames = 0;
52 cfg_.rc_buf_initial_sz = 500;
53 cfg_.rc_buf_optimal_sz = 500;
54 cfg_.rc_buf_sz = 1000;
55 cfg_.rc_target_bitrate = 300;
59 ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
62 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
65 // Validate that this AQ segmentation mode (AQ=2, complexity_aq)
66 // encodes and decodes without a mismatch.
67 TEST_P(AqSegmentTest, TestNoMisMatchAQ2) {
68 cfg_.rc_min_quantizer = 8;
69 cfg_.rc_max_quantizer = 56;
70 cfg_.rc_end_usage = VPX_CBR;
71 cfg_.g_lag_in_frames = 0;
72 cfg_.rc_buf_initial_sz = 500;
73 cfg_.rc_buf_optimal_sz = 500;
74 cfg_.rc_buf_sz = 1000;
75 cfg_.rc_target_bitrate = 300;
79 ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
82 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
85 // Validate that this AQ segmentation mode (AQ=3, cyclic_refresh_aq)
86 // encodes and decodes without a mismatch.
87 TEST_P(AqSegmentTest, TestNoMisMatchAQ3) {
88 cfg_.rc_min_quantizer = 8;
89 cfg_.rc_max_quantizer = 56;
90 cfg_.rc_end_usage = VPX_CBR;
91 cfg_.g_lag_in_frames = 0;
92 cfg_.rc_buf_initial_sz = 500;
93 cfg_.rc_buf_optimal_sz = 500;
94 cfg_.rc_buf_sz = 1000;
95 cfg_.rc_target_bitrate = 300;
99 ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
102 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
105 VP9_INSTANTIATE_TEST_CASE(AqSegmentTest,
106 ::testing::Values(::libvpx_test::kRealTime,
107 ::libvpx_test::kOnePassGood),
108 ::testing::Range(3, 9));