Add ssse3 aom_smooth_h_predictor_4xh
[aom.git] / test / active_map_test.cc
bloba2b0546edb4210d04b65355b0022990c595118c1
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 ActiveMapTest
23 : public ::libaom_test::CodecTestWith2Params<libaom_test::TestMode, int>,
24 public ::libaom_test::EncoderTest {
25 protected:
26 static const int kWidth = 208;
27 static const int kHeight = 144;
29 ActiveMapTest() : EncoderTest(GET_PARAM(0)) {}
30 virtual ~ActiveMapTest() {}
32 virtual void SetUp() {
33 InitializeConfig();
34 SetMode(GET_PARAM(1));
35 cpu_used_ = GET_PARAM(2);
38 virtual void PreEncodeFrameHook(::libaom_test::VideoSource *video,
39 ::libaom_test::Encoder *encoder) {
40 if (video->frame() == 1) {
41 encoder->Control(AOME_SET_CPUUSED, cpu_used_);
42 } else if (video->frame() == 3) {
43 aom_active_map_t map = aom_active_map_t();
44 /* clang-format off */
45 uint8_t active_map[9 * 13] = {
46 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0,
47 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0,
48 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0,
49 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0,
50 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1,
51 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1,
52 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1,
53 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1,
54 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0,
56 /* clang-format on */
57 map.cols = (kWidth + 15) / 16;
58 map.rows = (kHeight + 15) / 16;
59 ASSERT_EQ(map.cols, 13u);
60 ASSERT_EQ(map.rows, 9u);
61 map.active_map = active_map;
62 encoder->Control(AOME_SET_ACTIVEMAP, &map);
63 } else if (video->frame() == 15) {
64 aom_active_map_t map = aom_active_map_t();
65 map.cols = (kWidth + 15) / 16;
66 map.rows = (kHeight + 15) / 16;
67 map.active_map = NULL;
68 encoder->Control(AOME_SET_ACTIVEMAP, &map);
72 void DoTest() {
73 // Validate that this non multiple of 64 wide clip encodes
74 cfg_.g_lag_in_frames = 0;
75 cfg_.rc_target_bitrate = 400;
76 cfg_.rc_resize_mode = 0;
77 cfg_.g_pass = AOM_RC_ONE_PASS;
78 cfg_.rc_end_usage = AOM_CBR;
79 cfg_.kf_max_dist = 90000;
80 ::libaom_test::I420VideoSource video("hantro_odd.yuv", kWidth, kHeight, 30,
81 1, 0, 20);
83 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
86 int cpu_used_;
89 TEST_P(ActiveMapTest, Test) { DoTest(); }
91 class ActiveMapTestLarge : public ActiveMapTest {};
93 TEST_P(ActiveMapTestLarge, Test) { DoTest(); }
95 AV1_INSTANTIATE_TEST_CASE(ActiveMapTestLarge,
96 ::testing::Values(::libaom_test::kRealTime),
97 ::testing::Range(0, 5));
99 AV1_INSTANTIATE_TEST_CASE(ActiveMapTest,
100 ::testing::Values(::libaom_test::kRealTime),
101 ::testing::Range(5, 9));
103 } // namespace