Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 1 | /* |
Yaowu Xu | 2ab7ff0 | 2016-09-02 12:04:54 -0700 | [diff] [blame] | 2 | * Copyright (c) 2016, Alliance for Open Media. All rights reserved |
Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 3 | * |
Yaowu Xu | 2ab7ff0 | 2016-09-02 12:04:54 -0700 | [diff] [blame] | 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. |
Johann | 123e8a6 | 2017-12-28 14:40:49 -0800 | [diff] [blame] | 10 | */ |
Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 11 | |
| 12 | #include <string> |
| 13 | #include <vector> |
Tom Finegan | 7a07ece | 2017-02-07 17:14:05 -0800 | [diff] [blame] | 14 | #include "third_party/googletest/src/googletest/include/gtest/gtest.h" |
Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 15 | #include "test/codec_factory.h" |
| 16 | #include "test/encode_test_driver.h" |
Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 17 | #include "test/md5_helper.h" |
James Zern | 7839d03 | 2015-02-25 19:09:59 -0800 | [diff] [blame] | 18 | #include "test/util.h" |
Debargha Mukherjee | 2773872 | 2017-10-13 16:27:09 -0700 | [diff] [blame] | 19 | #include "test/yuv_video_source.h" |
Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 20 | |
| 21 | namespace { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 22 | class AVxEncoderThreadTest |
Ravi Chaudhary | 2aaeed8 | 2018-09-27 11:45:55 +0530 | [diff] [blame] | 23 | : public ::libaom_test::CodecTestWith5Params<libaom_test::TestMode, int, |
| 24 | int, int, int>, |
Sebastien Alaiwan | 4322bc1 | 2017-06-05 10:18:28 +0200 | [diff] [blame] | 25 | public ::libaom_test::EncoderTest { |
Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 26 | protected: |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 27 | AVxEncoderThreadTest() |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 28 | : EncoderTest(GET_PARAM(0)), encoder_initialized_(false), |
Ravi Chaudhary | e426b01 | 2018-07-18 17:56:35 +0530 | [diff] [blame] | 29 | encoding_mode_(GET_PARAM(1)), set_cpu_used_(GET_PARAM(2)), |
Ravi Chaudhary | 2aaeed8 | 2018-09-27 11:45:55 +0530 | [diff] [blame] | 30 | tile_cols_(GET_PARAM(3)), tile_rows_(GET_PARAM(4)), |
| 31 | row_mt_(GET_PARAM(5)) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 32 | init_flags_ = AOM_CODEC_USE_PSNR; |
| 33 | aom_codec_dec_cfg_t cfg = aom_codec_dec_cfg_t(); |
Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 34 | cfg.w = 1280; |
| 35 | cfg.h = 720; |
Sebastien Alaiwan | 8a65f9f | 2017-06-23 07:28:44 +0200 | [diff] [blame] | 36 | cfg.allow_lowbitdepth = 1; |
Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 37 | decoder_ = codec_->CreateDecoder(cfg, 0); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 38 | if (decoder_->IsAV1()) { |
| 39 | decoder_->Control(AV1_SET_DECODE_TILE_ROW, -1); |
| 40 | decoder_->Control(AV1_SET_DECODE_TILE_COL, -1); |
Yunqing Wang | 8e5e338 | 2016-05-05 16:42:57 -0700 | [diff] [blame] | 41 | } |
Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 42 | |
Geza Lore | 688f9ed | 2016-05-04 11:25:01 +0100 | [diff] [blame] | 43 | size_enc_.clear(); |
| 44 | md5_dec_.clear(); |
| 45 | md5_enc_.clear(); |
Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 46 | } |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 47 | virtual ~AVxEncoderThreadTest() { delete decoder_; } |
Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 48 | |
| 49 | virtual void SetUp() { |
| 50 | InitializeConfig(); |
| 51 | SetMode(encoding_mode_); |
| 52 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 53 | if (encoding_mode_ != ::libaom_test::kRealTime) { |
Yunqing Wang | 7d447f5 | 2018-09-10 17:22:11 -0700 | [diff] [blame] | 54 | cfg_.g_lag_in_frames = 5; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 55 | cfg_.rc_end_usage = AOM_VBR; |
Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 56 | cfg_.rc_2pass_vbr_minsection_pct = 5; |
hui su | b1a3871 | 2016-03-14 16:32:41 -0700 | [diff] [blame] | 57 | cfg_.rc_2pass_vbr_maxsection_pct = 2000; |
Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 58 | } else { |
| 59 | cfg_.g_lag_in_frames = 0; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 60 | cfg_.rc_end_usage = AOM_CBR; |
Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 61 | cfg_.g_error_resilient = 1; |
| 62 | } |
| 63 | cfg_.rc_max_quantizer = 56; |
| 64 | cfg_.rc_min_quantizer = 0; |
| 65 | } |
| 66 | |
Alex Converse | 587a0b3 | 2015-03-05 11:47:21 -0800 | [diff] [blame] | 67 | virtual void BeginPassHook(unsigned int /*pass*/) { |
| 68 | encoder_initialized_ = false; |
| 69 | } |
| 70 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 71 | virtual void PreEncodeFrameHook(::libaom_test::VideoSource * /*video*/, |
| 72 | ::libaom_test::Encoder *encoder) { |
Alex Converse | 587a0b3 | 2015-03-05 11:47:21 -0800 | [diff] [blame] | 73 | if (!encoder_initialized_) { |
Yunqing Wang | eeb08a9 | 2017-07-07 21:25:18 -0700 | [diff] [blame] | 74 | SetTileSize(encoder); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 75 | encoder->Control(AOME_SET_CPUUSED, set_cpu_used_); |
Ravi Chaudhary | 0ec03a4 | 2018-08-17 18:53:28 +0530 | [diff] [blame] | 76 | encoder->Control(AV1E_SET_ROW_MT, row_mt_); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 77 | if (encoding_mode_ != ::libaom_test::kRealTime) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 78 | encoder->Control(AOME_SET_ENABLEAUTOALTREF, 1); |
| 79 | encoder->Control(AOME_SET_ARNR_MAXFRAMES, 7); |
| 80 | encoder->Control(AOME_SET_ARNR_STRENGTH, 5); |
Yunqing Wang | 8c1e57c | 2016-10-25 15:15:23 -0700 | [diff] [blame] | 81 | encoder->Control(AV1E_SET_FRAME_PARALLEL_DECODING, 0); |
Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 82 | } else { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 83 | encoder->Control(AOME_SET_ENABLEAUTOALTREF, 0); |
| 84 | encoder->Control(AV1E_SET_AQ_MODE, 3); |
Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 85 | } |
Alex Converse | 587a0b3 | 2015-03-05 11:47:21 -0800 | [diff] [blame] | 86 | encoder_initialized_ = true; |
Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 87 | } |
| 88 | } |
| 89 | |
Yunqing Wang | eeb08a9 | 2017-07-07 21:25:18 -0700 | [diff] [blame] | 90 | virtual void SetTileSize(libaom_test::Encoder *encoder) { |
Ravi Chaudhary | e426b01 | 2018-07-18 17:56:35 +0530 | [diff] [blame] | 91 | encoder->Control(AV1E_SET_TILE_COLUMNS, tile_cols_); |
| 92 | encoder->Control(AV1E_SET_TILE_ROWS, tile_rows_); |
Yunqing Wang | eeb08a9 | 2017-07-07 21:25:18 -0700 | [diff] [blame] | 93 | } |
| 94 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 95 | virtual void FramePktHook(const aom_codec_cx_pkt_t *pkt) { |
Geza Lore | 688f9ed | 2016-05-04 11:25:01 +0100 | [diff] [blame] | 96 | size_enc_.push_back(pkt->data.frame.sz); |
| 97 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 98 | ::libaom_test::MD5 md5_enc; |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 99 | md5_enc.Add(reinterpret_cast<uint8_t *>(pkt->data.frame.buf), |
Geza Lore | 688f9ed | 2016-05-04 11:25:01 +0100 | [diff] [blame] | 100 | pkt->data.frame.sz); |
| 101 | md5_enc_.push_back(md5_enc.Get()); |
| 102 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 103 | const aom_codec_err_t res = decoder_->DecodeFrame( |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 104 | reinterpret_cast<uint8_t *>(pkt->data.frame.buf), pkt->data.frame.sz); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 105 | if (res != AOM_CODEC_OK) { |
Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 106 | abort_ = true; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 107 | ASSERT_EQ(AOM_CODEC_OK, res); |
Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 108 | } |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 109 | const aom_image_t *img = decoder_->GetDxData().Next(); |
Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 110 | |
| 111 | if (img) { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 112 | ::libaom_test::MD5 md5_res; |
Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 113 | md5_res.Add(img); |
Geza Lore | 688f9ed | 2016-05-04 11:25:01 +0100 | [diff] [blame] | 114 | md5_dec_.push_back(md5_res.Get()); |
Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 115 | } |
| 116 | } |
| 117 | |
Debargha Mukherjee | 6abddf3 | 2016-06-14 14:50:30 -0700 | [diff] [blame] | 118 | void DoTest() { |
Debargha Mukherjee | 2773872 | 2017-10-13 16:27:09 -0700 | [diff] [blame] | 119 | ::libaom_test::YUVVideoSource video( |
Yunqing Wang | 7d447f5 | 2018-09-10 17:22:11 -0700 | [diff] [blame] | 120 | "niklas_640_480_30.yuv", AOM_IMG_FMT_I420, 640, 480, 30, 1, 15, 21); |
Debargha Mukherjee | 6abddf3 | 2016-06-14 14:50:30 -0700 | [diff] [blame] | 121 | cfg_.rc_target_bitrate = 1000; |
| 122 | |
Ravi Chaudhary | 2aaeed8 | 2018-09-27 11:45:55 +0530 | [diff] [blame] | 123 | if (row_mt_ == 0) { |
| 124 | // Encode using single thread. |
| 125 | cfg_.g_threads = 1; |
| 126 | init_flags_ = AOM_CODEC_USE_PSNR; |
| 127 | ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); |
| 128 | std::vector<size_t> single_thr_size_enc; |
| 129 | std::vector<std::string> single_thr_md5_enc; |
| 130 | std::vector<std::string> single_thr_md5_dec; |
| 131 | single_thr_size_enc = size_enc_; |
| 132 | single_thr_md5_enc = md5_enc_; |
| 133 | single_thr_md5_dec = md5_dec_; |
| 134 | size_enc_.clear(); |
| 135 | md5_enc_.clear(); |
| 136 | md5_dec_.clear(); |
Debargha Mukherjee | 6abddf3 | 2016-06-14 14:50:30 -0700 | [diff] [blame] | 137 | |
Ravi Chaudhary | 2aaeed8 | 2018-09-27 11:45:55 +0530 | [diff] [blame] | 138 | // Encode using multiple threads. |
| 139 | cfg_.g_threads = 4; |
| 140 | ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); |
| 141 | std::vector<size_t> multi_thr_size_enc; |
| 142 | std::vector<std::string> multi_thr_md5_enc; |
| 143 | std::vector<std::string> multi_thr_md5_dec; |
| 144 | multi_thr_size_enc = size_enc_; |
| 145 | multi_thr_md5_enc = md5_enc_; |
| 146 | multi_thr_md5_dec = md5_dec_; |
| 147 | size_enc_.clear(); |
| 148 | md5_enc_.clear(); |
| 149 | md5_dec_.clear(); |
Debargha Mukherjee | 6abddf3 | 2016-06-14 14:50:30 -0700 | [diff] [blame] | 150 | |
Ravi Chaudhary | 2aaeed8 | 2018-09-27 11:45:55 +0530 | [diff] [blame] | 151 | // Check that the vectors are equal. |
| 152 | ASSERT_EQ(single_thr_size_enc, multi_thr_size_enc); |
| 153 | ASSERT_EQ(single_thr_md5_enc, multi_thr_md5_enc); |
| 154 | ASSERT_EQ(single_thr_md5_dec, multi_thr_md5_dec); |
| 155 | } else if (row_mt_ == 1) { |
| 156 | // Encode using multiple threads row-mt enabled. |
| 157 | cfg_.g_threads = 2; |
| 158 | ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); |
| 159 | std::vector<size_t> multi_thr2_row_mt_size_enc; |
| 160 | std::vector<std::string> multi_thr2_row_mt_md5_enc; |
| 161 | std::vector<std::string> multi_thr2_row_mt_md5_dec; |
| 162 | multi_thr2_row_mt_size_enc = size_enc_; |
| 163 | multi_thr2_row_mt_md5_enc = md5_enc_; |
| 164 | multi_thr2_row_mt_md5_dec = md5_dec_; |
| 165 | size_enc_.clear(); |
| 166 | md5_enc_.clear(); |
| 167 | md5_dec_.clear(); |
Ravi Chaudhary | 0ec03a4 | 2018-08-17 18:53:28 +0530 | [diff] [blame] | 168 | |
Ravi Chaudhary | 2aaeed8 | 2018-09-27 11:45:55 +0530 | [diff] [blame] | 169 | // Disable threads=3 test for now to reduce the time so that the nightly |
| 170 | // test would not time out. |
| 171 | // cfg_.g_threads = 3; |
| 172 | // ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); |
| 173 | // std::vector<size_t> multi_thr3_row_mt_size_enc; |
| 174 | // std::vector<std::string> multi_thr3_row_mt_md5_enc; |
| 175 | // std::vector<std::string> multi_thr3_row_mt_md5_dec; |
| 176 | // multi_thr3_row_mt_size_enc = size_enc_; |
| 177 | // multi_thr3_row_mt_md5_enc = md5_enc_; |
| 178 | // multi_thr3_row_mt_md5_dec = md5_dec_; |
| 179 | // size_enc_.clear(); |
| 180 | // md5_enc_.clear(); |
| 181 | // md5_dec_.clear(); |
| 182 | // Check that the vectors are equal. |
| 183 | // ASSERT_EQ(multi_thr3_row_mt_size_enc, multi_thr2_row_mt_size_enc); |
| 184 | // ASSERT_EQ(multi_thr3_row_mt_md5_enc, multi_thr2_row_mt_md5_enc); |
| 185 | // ASSERT_EQ(multi_thr3_row_mt_md5_dec, multi_thr2_row_mt_md5_dec); |
Ravi Chaudhary | 0ec03a4 | 2018-08-17 18:53:28 +0530 | [diff] [blame] | 186 | |
Ravi Chaudhary | 2aaeed8 | 2018-09-27 11:45:55 +0530 | [diff] [blame] | 187 | cfg_.g_threads = 4; |
| 188 | ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); |
| 189 | std::vector<size_t> multi_thr4_row_mt_size_enc; |
| 190 | std::vector<std::string> multi_thr4_row_mt_md5_enc; |
| 191 | std::vector<std::string> multi_thr4_row_mt_md5_dec; |
| 192 | multi_thr4_row_mt_size_enc = size_enc_; |
| 193 | multi_thr4_row_mt_md5_enc = md5_enc_; |
| 194 | multi_thr4_row_mt_md5_dec = md5_dec_; |
| 195 | size_enc_.clear(); |
| 196 | md5_enc_.clear(); |
| 197 | md5_dec_.clear(); |
Ravi Chaudhary | 0ec03a4 | 2018-08-17 18:53:28 +0530 | [diff] [blame] | 198 | |
Ravi Chaudhary | 2aaeed8 | 2018-09-27 11:45:55 +0530 | [diff] [blame] | 199 | // Check that the vectors are equal. |
| 200 | ASSERT_EQ(multi_thr4_row_mt_size_enc, multi_thr2_row_mt_size_enc); |
| 201 | ASSERT_EQ(multi_thr4_row_mt_md5_enc, multi_thr2_row_mt_md5_enc); |
| 202 | ASSERT_EQ(multi_thr4_row_mt_md5_dec, multi_thr2_row_mt_md5_dec); |
| 203 | } |
Debargha Mukherjee | 6abddf3 | 2016-06-14 14:50:30 -0700 | [diff] [blame] | 204 | } |
| 205 | |
Alex Converse | 587a0b3 | 2015-03-05 11:47:21 -0800 | [diff] [blame] | 206 | bool encoder_initialized_; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 207 | ::libaom_test::TestMode encoding_mode_; |
Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 208 | int set_cpu_used_; |
Ravi Chaudhary | e426b01 | 2018-07-18 17:56:35 +0530 | [diff] [blame] | 209 | int tile_cols_; |
| 210 | int tile_rows_; |
Ravi Chaudhary | 0ec03a4 | 2018-08-17 18:53:28 +0530 | [diff] [blame] | 211 | int row_mt_; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 212 | ::libaom_test::Decoder *decoder_; |
Geza Lore | 688f9ed | 2016-05-04 11:25:01 +0100 | [diff] [blame] | 213 | std::vector<size_t> size_enc_; |
| 214 | std::vector<std::string> md5_enc_; |
| 215 | std::vector<std::string> md5_dec_; |
Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 216 | }; |
| 217 | |
Yunqing Wang | eeb08a9 | 2017-07-07 21:25:18 -0700 | [diff] [blame] | 218 | TEST_P(AVxEncoderThreadTest, EncoderResultTest) { |
Yunqing Wang | eeb08a9 | 2017-07-07 21:25:18 -0700 | [diff] [blame] | 219 | cfg_.large_scale_tile = 0; |
Yunqing Wang | 8ae64a9 | 2018-01-12 12:26:44 -0800 | [diff] [blame] | 220 | decoder_->Control(AV1_SET_TILE_MODE, 0); |
Yunqing Wang | eeb08a9 | 2017-07-07 21:25:18 -0700 | [diff] [blame] | 221 | DoTest(); |
| 222 | } |
Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 223 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 224 | class AVxEncoderThreadTestLarge : public AVxEncoderThreadTest {}; |
Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 225 | |
Yunqing Wang | eeb08a9 | 2017-07-07 21:25:18 -0700 | [diff] [blame] | 226 | TEST_P(AVxEncoderThreadTestLarge, EncoderResultTest) { |
Yunqing Wang | eeb08a9 | 2017-07-07 21:25:18 -0700 | [diff] [blame] | 227 | cfg_.large_scale_tile = 0; |
Yunqing Wang | 8ae64a9 | 2018-01-12 12:26:44 -0800 | [diff] [blame] | 228 | decoder_->Control(AV1_SET_TILE_MODE, 0); |
Yunqing Wang | eeb08a9 | 2017-07-07 21:25:18 -0700 | [diff] [blame] | 229 | DoTest(); |
| 230 | } |
Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 231 | |
Yunqing Wang | 840b2be | 2016-12-13 15:15:28 -0800 | [diff] [blame] | 232 | // For AV1, only test speed 0 to 3. |
Yunqing Wang | b18fd06 | 2018-09-04 15:55:45 -0700 | [diff] [blame] | 233 | // Here test cpu_used 2 and 3 |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 234 | AV1_INSTANTIATE_TEST_CASE(AVxEncoderThreadTest, |
Yunqing Wang | 7d447f5 | 2018-09-10 17:22:11 -0700 | [diff] [blame] | 235 | ::testing::Values(::libaom_test::kTwoPassGood), |
| 236 | ::testing::Range(2, 4), ::testing::Values(0, 2), |
Ravi Chaudhary | 2aaeed8 | 2018-09-27 11:45:55 +0530 | [diff] [blame] | 237 | ::testing::Values(0, 1), ::testing::Values(0, 1)); |
Jingning Han | 41be09a | 2015-08-19 14:13:18 -0700 | [diff] [blame] | 238 | |
Yunqing Wang | b18fd06 | 2018-09-04 15:55:45 -0700 | [diff] [blame] | 239 | // Test cpu_used 0 and 1. |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 240 | AV1_INSTANTIATE_TEST_CASE(AVxEncoderThreadTestLarge, |
| 241 | ::testing::Values(::libaom_test::kTwoPassGood, |
| 242 | ::libaom_test::kOnePassGood), |
Yunqing Wang | b18fd06 | 2018-09-04 15:55:45 -0700 | [diff] [blame] | 243 | ::testing::Range(0, 2), ::testing::Values(0, 1, 2, 6), |
Ravi Chaudhary | 2aaeed8 | 2018-09-27 11:45:55 +0530 | [diff] [blame] | 244 | ::testing::Values(0, 1, 2, 6), |
| 245 | ::testing::Values(0, 1)); |
Yunqing Wang | eeb08a9 | 2017-07-07 21:25:18 -0700 | [diff] [blame] | 246 | |
Yunqing Wang | eeb08a9 | 2017-07-07 21:25:18 -0700 | [diff] [blame] | 247 | class AVxEncoderThreadLSTest : public AVxEncoderThreadTest { |
| 248 | virtual void SetTileSize(libaom_test::Encoder *encoder) { |
Ravi Chaudhary | e426b01 | 2018-07-18 17:56:35 +0530 | [diff] [blame] | 249 | encoder->Control(AV1E_SET_TILE_COLUMNS, tile_cols_); |
| 250 | encoder->Control(AV1E_SET_TILE_ROWS, tile_rows_); |
Yunqing Wang | eeb08a9 | 2017-07-07 21:25:18 -0700 | [diff] [blame] | 251 | } |
| 252 | }; |
| 253 | |
Yunqing Wang | ce8f481 | 2018-06-25 15:17:44 -0700 | [diff] [blame] | 254 | TEST_P(AVxEncoderThreadLSTest, EncoderResultTest) { |
Yunqing Wang | eeb08a9 | 2017-07-07 21:25:18 -0700 | [diff] [blame] | 255 | cfg_.large_scale_tile = 1; |
Yunqing Wang | 8ae64a9 | 2018-01-12 12:26:44 -0800 | [diff] [blame] | 256 | decoder_->Control(AV1_SET_TILE_MODE, 1); |
Yunqing Wang | ce8f481 | 2018-06-25 15:17:44 -0700 | [diff] [blame] | 257 | decoder_->Control(AV1D_EXT_TILE_DEBUG, 1); |
Yunqing Wang | eeb08a9 | 2017-07-07 21:25:18 -0700 | [diff] [blame] | 258 | DoTest(); |
| 259 | } |
| 260 | |
| 261 | class AVxEncoderThreadLSTestLarge : public AVxEncoderThreadLSTest {}; |
| 262 | |
Yunqing Wang | ce8f481 | 2018-06-25 15:17:44 -0700 | [diff] [blame] | 263 | TEST_P(AVxEncoderThreadLSTestLarge, EncoderResultTest) { |
Yunqing Wang | eeb08a9 | 2017-07-07 21:25:18 -0700 | [diff] [blame] | 264 | cfg_.large_scale_tile = 1; |
Yunqing Wang | 8ae64a9 | 2018-01-12 12:26:44 -0800 | [diff] [blame] | 265 | decoder_->Control(AV1_SET_TILE_MODE, 1); |
Yunqing Wang | ce8f481 | 2018-06-25 15:17:44 -0700 | [diff] [blame] | 266 | decoder_->Control(AV1D_EXT_TILE_DEBUG, 1); |
Yunqing Wang | eeb08a9 | 2017-07-07 21:25:18 -0700 | [diff] [blame] | 267 | DoTest(); |
| 268 | } |
| 269 | |
Yunqing Wang | eeb08a9 | 2017-07-07 21:25:18 -0700 | [diff] [blame] | 270 | AV1_INSTANTIATE_TEST_CASE(AVxEncoderThreadLSTestLarge, |
| 271 | ::testing::Values(::libaom_test::kTwoPassGood, |
| 272 | ::libaom_test::kOnePassGood), |
Yunqing Wang | b18fd06 | 2018-09-04 15:55:45 -0700 | [diff] [blame] | 273 | ::testing::Range(0, 4), ::testing::Values(0, 6), |
Ravi Chaudhary | 2aaeed8 | 2018-09-27 11:45:55 +0530 | [diff] [blame] | 274 | ::testing::Values(0, 6), ::testing::Values(0, 1)); |
Yunqing Wang | 7c2c2be | 2014-12-16 11:10:20 -0800 | [diff] [blame] | 275 | } // namespace |