Backed out 3 changesets (bug 1790375) for causing wd failures on fetch_error.py....
[gecko.git] / third_party / aom / test / borders_test.cc
blob893237ef3031b5bdc412c21ac55788fe358a2163
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() {
30 InitializeConfig();
31 SetMode(GET_PARAM(1));
34 virtual void PreEncodeFrameHook(::libaom_test::VideoSource *video,
35 ::libaom_test::Encoder *encoder) {
36 if (video->frame() == 1) {
37 encoder->Control(AOME_SET_CPUUSED, 1);
38 encoder->Control(AOME_SET_ENABLEAUTOALTREF, 1);
39 encoder->Control(AOME_SET_ARNR_MAXFRAMES, 7);
40 encoder->Control(AOME_SET_ARNR_STRENGTH, 5);
44 virtual void FramePktHook(const aom_codec_cx_pkt_t *pkt) {
45 if (pkt->data.frame.flags & AOM_FRAME_IS_KEY) {
50 TEST_P(BordersTestLarge, TestEncodeHighBitrate) {
51 // Validate that this non multiple of 64 wide clip encodes and decodes
52 // without a mismatch when passing in a very low max q. This pushes
53 // the encoder to producing lots of big partitions which will likely
54 // extend into the border and test the border condition.
55 cfg_.g_lag_in_frames = 25;
56 cfg_.rc_2pass_vbr_minsection_pct = 5;
57 cfg_.rc_2pass_vbr_maxsection_pct = 2000;
58 cfg_.rc_target_bitrate = 2000;
59 cfg_.rc_max_quantizer = 10;
61 ::libaom_test::I420VideoSource video("hantro_odd.yuv", 208, 144, 30, 1, 0,
62 10);
64 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
66 TEST_P(BordersTestLarge, TestLowBitrate) {
67 // Validate that this clip encodes and decodes without a mismatch
68 // when passing in a very high min q. This pushes the encoder to producing
69 // lots of small partitions which might will test the other condition.
71 cfg_.g_lag_in_frames = 25;
72 cfg_.rc_2pass_vbr_minsection_pct = 5;
73 cfg_.rc_2pass_vbr_maxsection_pct = 2000;
74 cfg_.rc_target_bitrate = 200;
75 cfg_.rc_min_quantizer = 40;
77 ::libaom_test::I420VideoSource video("hantro_odd.yuv", 208, 144, 30, 1, 0,
78 10);
80 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
83 AV1_INSTANTIATE_TEST_CASE(BordersTestLarge,
84 ::testing::Values(::libaom_test::kTwoPassGood));
85 } // namespace