cdef(highbd): Remove unnecessary loop code.
[aom.git] / test / borders_test.cc
blobbf9cc8b1aec45ef6369841f45551a04342a38d88
1 /*
2 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
4 * This source code is subject to the terms of the BSD 2 Clause License and
5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6 * was not distributed with this source code in the LICENSE file, you can
7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8 * Media Patent License 1.0 was not distributed with this source code in the
9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
12 #include <climits>
13 #include <vector>
14 #include "third_party/googletest/src/googletest/include/gtest/gtest.h"
15 #include "test/codec_factory.h"
16 #include "test/encode_test_driver.h"
17 #include "test/i420_video_source.h"
18 #include "test/util.h"
20 namespace {
22 class BordersTestLarge
23 : public ::libaom_test::CodecTestWithParam<libaom_test::TestMode>,
24 public ::libaom_test::EncoderTest {
25 protected:
26 BordersTestLarge() : EncoderTest(GET_PARAM(0)) {}
27 virtual ~BordersTestLarge() {}
29 virtual void SetUp() { InitializeConfig(GET_PARAM(1)); }
31 virtual void PreEncodeFrameHook(::libaom_test::VideoSource *video,
32 ::libaom_test::Encoder *encoder) {
33 if (video->frame() == 0) {
34 encoder->Control(AOME_SET_CPUUSED, 1);
35 encoder->Control(AOME_SET_ENABLEAUTOALTREF, 1);
36 encoder->Control(AOME_SET_ARNR_MAXFRAMES, 7);
37 encoder->Control(AOME_SET_ARNR_STRENGTH, 5);
41 virtual void FramePktHook(const aom_codec_cx_pkt_t *pkt) {
42 if (pkt->data.frame.flags & AOM_FRAME_IS_KEY) {
47 TEST_P(BordersTestLarge, TestEncodeHighBitrate) {
48 // Validate that this non multiple of 64 wide clip encodes and decodes
49 // without a mismatch when passing in a very low max q. This pushes
50 // the encoder to producing lots of big partitions which will likely
51 // extend into the border and test the border condition.
52 cfg_.g_lag_in_frames = 25;
53 cfg_.rc_2pass_vbr_minsection_pct = 5;
54 cfg_.rc_2pass_vbr_maxsection_pct = 2000;
55 cfg_.rc_target_bitrate = 2000;
56 cfg_.rc_max_quantizer = 10;
58 ::libaom_test::I420VideoSource video("hantro_odd.yuv", 208, 144, 30, 1, 0,
59 10);
61 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
63 TEST_P(BordersTestLarge, TestLowBitrate) {
64 // Validate that this clip encodes and decodes without a mismatch
65 // when passing in a very high min q. This pushes the encoder to producing
66 // lots of small partitions which might will test the other condition.
68 cfg_.g_lag_in_frames = 25;
69 cfg_.rc_2pass_vbr_minsection_pct = 5;
70 cfg_.rc_2pass_vbr_maxsection_pct = 2000;
71 cfg_.rc_target_bitrate = 200;
72 cfg_.rc_min_quantizer = 40;
74 ::libaom_test::I420VideoSource video("hantro_odd.yuv", 208, 144, 30, 1, 0,
75 10);
77 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
80 AV1_INSTANTIATE_TEST_SUITE(BordersTestLarge,
81 ::testing::Values(::libaom_test::kTwoPassGood));
82 } // namespace