avg_test.cc 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737
  1. /*
  2. * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
  3. *
  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.
  9. */
  10. #include <limits.h>
  11. #include <stdio.h>
  12. #include <string.h>
  13. #include <tuple>
  14. #include "third_party/googletest/src/include/gtest/gtest.h"
  15. #include "./vp9_rtcd.h"
  16. #include "./vpx_config.h"
  17. #include "./vpx_dsp_rtcd.h"
  18. #include "test/acm_random.h"
  19. #include "test/clear_system_state.h"
  20. #include "test/register_state_check.h"
  21. #include "test/util.h"
  22. #include "vpx/vpx_codec.h"
  23. #include "vpx_mem/vpx_mem.h"
  24. #include "vpx_ports/vpx_timer.h"
  25. using libvpx_test::ACMRandom;
  26. namespace {
  27. template <typename Pixel>
  28. class AverageTestBase : public ::testing::Test {
  29. public:
  30. AverageTestBase(int width, int height)
  31. : width_(width), height_(height), source_data_(NULL), source_stride_(0),
  32. bit_depth_(8) {}
  33. virtual void TearDown() {
  34. vpx_free(source_data_);
  35. source_data_ = NULL;
  36. libvpx_test::ClearSystemState();
  37. }
  38. protected:
  39. // Handle blocks up to 4 blocks 64x64 with stride up to 128
  40. static const int kDataAlignment = 16;
  41. static const int kDataBlockSize = 64 * 128;
  42. virtual void SetUp() {
  43. source_data_ = reinterpret_cast<Pixel *>(
  44. vpx_memalign(kDataAlignment, kDataBlockSize * sizeof(source_data_[0])));
  45. ASSERT_TRUE(source_data_ != NULL);
  46. source_stride_ = (width_ + 31) & ~31;
  47. bit_depth_ = 8;
  48. rnd_.Reset(ACMRandom::DeterministicSeed());
  49. }
  50. // Sum Pixels
  51. static unsigned int ReferenceAverage8x8(const Pixel *source, int pitch) {
  52. unsigned int average = 0;
  53. for (int h = 0; h < 8; ++h) {
  54. for (int w = 0; w < 8; ++w) average += source[h * pitch + w];
  55. }
  56. return ((average + 32) >> 6);
  57. }
  58. static unsigned int ReferenceAverage4x4(const Pixel *source, int pitch) {
  59. unsigned int average = 0;
  60. for (int h = 0; h < 4; ++h) {
  61. for (int w = 0; w < 4; ++w) average += source[h * pitch + w];
  62. }
  63. return ((average + 8) >> 4);
  64. }
  65. void FillConstant(Pixel fill_constant) {
  66. for (int i = 0; i < width_ * height_; ++i) {
  67. source_data_[i] = fill_constant;
  68. }
  69. }
  70. void FillRandom() {
  71. for (int i = 0; i < width_ * height_; ++i) {
  72. source_data_[i] = rnd_.Rand16() & ((1 << bit_depth_) - 1);
  73. }
  74. }
  75. int width_, height_;
  76. Pixel *source_data_;
  77. int source_stride_;
  78. int bit_depth_;
  79. ACMRandom rnd_;
  80. };
  81. typedef unsigned int (*AverageFunction)(const uint8_t *s, int pitch);
  82. typedef std::tuple<int, int, int, int, AverageFunction> AvgFunc;
  83. class AverageTest : public AverageTestBase<uint8_t>,
  84. public ::testing::WithParamInterface<AvgFunc> {
  85. public:
  86. AverageTest() : AverageTestBase(GET_PARAM(0), GET_PARAM(1)) {}
  87. protected:
  88. void CheckAverages() {
  89. const int block_size = GET_PARAM(3);
  90. unsigned int expected = 0;
  91. if (block_size == 8) {
  92. expected =
  93. ReferenceAverage8x8(source_data_ + GET_PARAM(2), source_stride_);
  94. } else if (block_size == 4) {
  95. expected =
  96. ReferenceAverage4x4(source_data_ + GET_PARAM(2), source_stride_);
  97. }
  98. ASM_REGISTER_STATE_CHECK(
  99. GET_PARAM(4)(source_data_ + GET_PARAM(2), source_stride_));
  100. unsigned int actual =
  101. GET_PARAM(4)(source_data_ + GET_PARAM(2), source_stride_);
  102. EXPECT_EQ(expected, actual);
  103. }
  104. };
  105. #if CONFIG_VP9_HIGHBITDEPTH
  106. class AverageTestHBD : public AverageTestBase<uint16_t>,
  107. public ::testing::WithParamInterface<AvgFunc> {
  108. public:
  109. AverageTestHBD() : AverageTestBase(GET_PARAM(0), GET_PARAM(1)) {}
  110. protected:
  111. void CheckAverages() {
  112. const int block_size = GET_PARAM(3);
  113. unsigned int expected = 0;
  114. if (block_size == 8) {
  115. expected =
  116. ReferenceAverage8x8(source_data_ + GET_PARAM(2), source_stride_);
  117. } else if (block_size == 4) {
  118. expected =
  119. ReferenceAverage4x4(source_data_ + GET_PARAM(2), source_stride_);
  120. }
  121. ASM_REGISTER_STATE_CHECK(GET_PARAM(4)(
  122. CONVERT_TO_BYTEPTR(source_data_ + GET_PARAM(2)), source_stride_));
  123. unsigned int actual = GET_PARAM(4)(
  124. CONVERT_TO_BYTEPTR(source_data_ + GET_PARAM(2)), source_stride_);
  125. EXPECT_EQ(expected, actual);
  126. }
  127. };
  128. #endif // CONFIG_VP9_HIGHBITDEPTH
  129. typedef void (*IntProRowFunc)(int16_t hbuf[16], uint8_t const *ref,
  130. const int ref_stride, const int height);
  131. typedef std::tuple<int, IntProRowFunc, IntProRowFunc> IntProRowParam;
  132. class IntProRowTest : public AverageTestBase<uint8_t>,
  133. public ::testing::WithParamInterface<IntProRowParam> {
  134. public:
  135. IntProRowTest()
  136. : AverageTestBase(16, GET_PARAM(0)), hbuf_asm_(NULL), hbuf_c_(NULL) {
  137. asm_func_ = GET_PARAM(1);
  138. c_func_ = GET_PARAM(2);
  139. }
  140. protected:
  141. virtual void SetUp() {
  142. source_data_ = reinterpret_cast<uint8_t *>(
  143. vpx_memalign(kDataAlignment, kDataBlockSize * sizeof(source_data_[0])));
  144. ASSERT_TRUE(source_data_ != NULL);
  145. hbuf_asm_ = reinterpret_cast<int16_t *>(
  146. vpx_memalign(kDataAlignment, sizeof(*hbuf_asm_) * 16));
  147. hbuf_c_ = reinterpret_cast<int16_t *>(
  148. vpx_memalign(kDataAlignment, sizeof(*hbuf_c_) * 16));
  149. }
  150. virtual void TearDown() {
  151. vpx_free(source_data_);
  152. source_data_ = NULL;
  153. vpx_free(hbuf_c_);
  154. hbuf_c_ = NULL;
  155. vpx_free(hbuf_asm_);
  156. hbuf_asm_ = NULL;
  157. }
  158. void RunComparison() {
  159. ASM_REGISTER_STATE_CHECK(c_func_(hbuf_c_, source_data_, 0, height_));
  160. ASM_REGISTER_STATE_CHECK(asm_func_(hbuf_asm_, source_data_, 0, height_));
  161. EXPECT_EQ(0, memcmp(hbuf_c_, hbuf_asm_, sizeof(*hbuf_c_) * 16))
  162. << "Output mismatch";
  163. }
  164. private:
  165. IntProRowFunc asm_func_;
  166. IntProRowFunc c_func_;
  167. int16_t *hbuf_asm_;
  168. int16_t *hbuf_c_;
  169. };
  170. typedef int16_t (*IntProColFunc)(uint8_t const *ref, const int width);
  171. typedef std::tuple<int, IntProColFunc, IntProColFunc> IntProColParam;
  172. class IntProColTest : public AverageTestBase<uint8_t>,
  173. public ::testing::WithParamInterface<IntProColParam> {
  174. public:
  175. IntProColTest() : AverageTestBase(GET_PARAM(0), 1), sum_asm_(0), sum_c_(0) {
  176. asm_func_ = GET_PARAM(1);
  177. c_func_ = GET_PARAM(2);
  178. }
  179. protected:
  180. void RunComparison() {
  181. ASM_REGISTER_STATE_CHECK(sum_c_ = c_func_(source_data_, width_));
  182. ASM_REGISTER_STATE_CHECK(sum_asm_ = asm_func_(source_data_, width_));
  183. EXPECT_EQ(sum_c_, sum_asm_) << "Output mismatch";
  184. }
  185. private:
  186. IntProColFunc asm_func_;
  187. IntProColFunc c_func_;
  188. int16_t sum_asm_;
  189. int16_t sum_c_;
  190. };
  191. typedef int (*SatdFunc)(const tran_low_t *coeffs, int length);
  192. typedef std::tuple<int, SatdFunc> SatdTestParam;
  193. class SatdTest : public ::testing::Test,
  194. public ::testing::WithParamInterface<SatdTestParam> {
  195. protected:
  196. virtual void SetUp() {
  197. satd_size_ = GET_PARAM(0);
  198. satd_func_ = GET_PARAM(1);
  199. rnd_.Reset(ACMRandom::DeterministicSeed());
  200. src_ = reinterpret_cast<tran_low_t *>(
  201. vpx_memalign(16, sizeof(*src_) * satd_size_));
  202. ASSERT_TRUE(src_ != NULL);
  203. }
  204. virtual void TearDown() {
  205. libvpx_test::ClearSystemState();
  206. vpx_free(src_);
  207. }
  208. void FillConstant(const tran_low_t val) {
  209. for (int i = 0; i < satd_size_; ++i) src_[i] = val;
  210. }
  211. virtual void FillRandom() = 0;
  212. void Check(const int expected) {
  213. int total;
  214. ASM_REGISTER_STATE_CHECK(total = satd_func_(src_, satd_size_));
  215. EXPECT_EQ(expected, total);
  216. }
  217. tran_low_t *GetCoeff() const { return src_; }
  218. int satd_size_;
  219. ACMRandom rnd_;
  220. tran_low_t *src_;
  221. private:
  222. SatdFunc satd_func_;
  223. };
  224. class SatdLowbdTest : public SatdTest {
  225. protected:
  226. virtual void FillRandom() {
  227. for (int i = 0; i < satd_size_; ++i) {
  228. const int16_t tmp = rnd_.Rand16Signed();
  229. src_[i] = (tran_low_t)tmp;
  230. }
  231. }
  232. };
  233. typedef int64_t (*BlockErrorFunc)(const tran_low_t *coeff,
  234. const tran_low_t *dqcoeff, int block_size);
  235. typedef std::tuple<int, BlockErrorFunc> BlockErrorTestFPParam;
  236. class BlockErrorTestFP
  237. : public ::testing::Test,
  238. public ::testing::WithParamInterface<BlockErrorTestFPParam> {
  239. protected:
  240. virtual void SetUp() {
  241. txfm_size_ = GET_PARAM(0);
  242. block_error_func_ = GET_PARAM(1);
  243. rnd_.Reset(ACMRandom::DeterministicSeed());
  244. coeff_ = reinterpret_cast<tran_low_t *>(
  245. vpx_memalign(16, sizeof(*coeff_) * txfm_size_));
  246. dqcoeff_ = reinterpret_cast<tran_low_t *>(
  247. vpx_memalign(16, sizeof(*dqcoeff_) * txfm_size_));
  248. ASSERT_TRUE(coeff_ != NULL);
  249. ASSERT_TRUE(dqcoeff_ != NULL);
  250. }
  251. virtual void TearDown() {
  252. libvpx_test::ClearSystemState();
  253. vpx_free(coeff_);
  254. vpx_free(dqcoeff_);
  255. }
  256. void FillConstant(const tran_low_t coeff_val, const tran_low_t dqcoeff_val) {
  257. for (int i = 0; i < txfm_size_; ++i) coeff_[i] = coeff_val;
  258. for (int i = 0; i < txfm_size_; ++i) dqcoeff_[i] = dqcoeff_val;
  259. }
  260. void FillRandom() {
  261. // Just two fixed seeds
  262. rnd_.Reset(0xb0b9);
  263. for (int i = 0; i < txfm_size_; ++i) coeff_[i] = rnd_.Rand16() >> 1;
  264. rnd_.Reset(0xb0c8);
  265. for (int i = 0; i < txfm_size_; ++i) dqcoeff_[i] = rnd_.Rand16() >> 1;
  266. }
  267. void Check(const int64_t expected) {
  268. int64_t total;
  269. ASM_REGISTER_STATE_CHECK(
  270. total = block_error_func_(coeff_, dqcoeff_, txfm_size_));
  271. EXPECT_EQ(expected, total);
  272. }
  273. tran_low_t *GetCoeff() const { return coeff_; }
  274. tran_low_t *GetDQCoeff() const { return dqcoeff_; }
  275. int txfm_size_;
  276. private:
  277. tran_low_t *coeff_;
  278. tran_low_t *dqcoeff_;
  279. BlockErrorFunc block_error_func_;
  280. ACMRandom rnd_;
  281. };
  282. TEST_P(AverageTest, MinValue) {
  283. FillConstant(0);
  284. CheckAverages();
  285. }
  286. TEST_P(AverageTest, MaxValue) {
  287. FillConstant(255);
  288. CheckAverages();
  289. }
  290. TEST_P(AverageTest, Random) {
  291. // The reference frame, but not the source frame, may be unaligned for
  292. // certain types of searches.
  293. for (int i = 0; i < 1000; i++) {
  294. FillRandom();
  295. CheckAverages();
  296. }
  297. }
  298. #if CONFIG_VP9_HIGHBITDEPTH
  299. TEST_P(AverageTestHBD, MinValue) {
  300. FillConstant(0);
  301. CheckAverages();
  302. }
  303. TEST_P(AverageTestHBD, MaxValue) {
  304. FillConstant((1 << VPX_BITS_12) - 1);
  305. CheckAverages();
  306. }
  307. TEST_P(AverageTestHBD, Random) {
  308. bit_depth_ = VPX_BITS_12;
  309. // The reference frame, but not the source frame, may be unaligned for
  310. // certain types of searches.
  311. for (int i = 0; i < 1000; i++) {
  312. FillRandom();
  313. CheckAverages();
  314. }
  315. }
  316. #endif // CONFIG_VP9_HIGHBITDEPTH
  317. TEST_P(IntProRowTest, MinValue) {
  318. FillConstant(0);
  319. RunComparison();
  320. }
  321. TEST_P(IntProRowTest, MaxValue) {
  322. FillConstant(255);
  323. RunComparison();
  324. }
  325. TEST_P(IntProRowTest, Random) {
  326. FillRandom();
  327. RunComparison();
  328. }
  329. TEST_P(IntProColTest, MinValue) {
  330. FillConstant(0);
  331. RunComparison();
  332. }
  333. TEST_P(IntProColTest, MaxValue) {
  334. FillConstant(255);
  335. RunComparison();
  336. }
  337. TEST_P(IntProColTest, Random) {
  338. FillRandom();
  339. RunComparison();
  340. }
  341. TEST_P(SatdLowbdTest, MinValue) {
  342. const int kMin = -32640;
  343. const int expected = -kMin * satd_size_;
  344. FillConstant(kMin);
  345. Check(expected);
  346. }
  347. TEST_P(SatdLowbdTest, MaxValue) {
  348. const int kMax = 32640;
  349. const int expected = kMax * satd_size_;
  350. FillConstant(kMax);
  351. Check(expected);
  352. }
  353. TEST_P(SatdLowbdTest, Random) {
  354. int expected;
  355. switch (satd_size_) {
  356. case 16: expected = 263252; break;
  357. case 64: expected = 1105420; break;
  358. case 256: expected = 4252250; break;
  359. case 1024: expected = 16876840; break;
  360. default:
  361. FAIL() << "Invalid satd size (" << satd_size_
  362. << ") valid: 16/64/256/1024";
  363. }
  364. FillRandom();
  365. Check(expected);
  366. }
  367. TEST_P(SatdLowbdTest, DISABLED_Speed) {
  368. const int kCountSpeedTestBlock = 20000;
  369. vpx_usec_timer timer;
  370. const int blocksize = GET_PARAM(0);
  371. FillRandom();
  372. tran_low_t *coeff = GetCoeff();
  373. vpx_usec_timer_start(&timer);
  374. for (int i = 0; i < kCountSpeedTestBlock; ++i) {
  375. GET_PARAM(1)(coeff, blocksize);
  376. }
  377. vpx_usec_timer_mark(&timer);
  378. const int elapsed_time = static_cast<int>(vpx_usec_timer_elapsed(&timer));
  379. printf("blocksize: %4d time: %4d us\n", blocksize, elapsed_time);
  380. }
  381. #if CONFIG_VP9_HIGHBITDEPTH
  382. class SatdHighbdTest : public SatdTest {
  383. protected:
  384. virtual void FillRandom() {
  385. for (int i = 0; i < satd_size_; ++i) {
  386. src_[i] = rnd_.Rand20Signed();
  387. }
  388. }
  389. };
  390. TEST_P(SatdHighbdTest, MinValue) {
  391. const int kMin = -524280;
  392. const int expected = -kMin * satd_size_;
  393. FillConstant(kMin);
  394. Check(expected);
  395. }
  396. TEST_P(SatdHighbdTest, MaxValue) {
  397. const int kMax = 524280;
  398. const int expected = kMax * satd_size_;
  399. FillConstant(kMax);
  400. Check(expected);
  401. }
  402. TEST_P(SatdHighbdTest, Random) {
  403. int expected;
  404. switch (satd_size_) {
  405. case 16: expected = 5249712; break;
  406. case 64: expected = 18362120; break;
  407. case 256: expected = 66100520; break;
  408. case 1024: expected = 266094734; break;
  409. default:
  410. FAIL() << "Invalid satd size (" << satd_size_
  411. << ") valid: 16/64/256/1024";
  412. }
  413. FillRandom();
  414. Check(expected);
  415. }
  416. TEST_P(SatdHighbdTest, DISABLED_Speed) {
  417. const int kCountSpeedTestBlock = 20000;
  418. vpx_usec_timer timer;
  419. const int blocksize = GET_PARAM(0);
  420. FillRandom();
  421. tran_low_t *coeff = GetCoeff();
  422. vpx_usec_timer_start(&timer);
  423. for (int i = 0; i < kCountSpeedTestBlock; ++i) {
  424. GET_PARAM(1)(coeff, blocksize);
  425. }
  426. vpx_usec_timer_mark(&timer);
  427. const int elapsed_time = static_cast<int>(vpx_usec_timer_elapsed(&timer));
  428. printf("blocksize: %4d time: %4d us\n", blocksize, elapsed_time);
  429. }
  430. #endif // CONFIG_VP9_HIGHBITDEPTH
  431. TEST_P(BlockErrorTestFP, MinValue) {
  432. const int64_t kMin = -32640;
  433. const int64_t expected = kMin * kMin * txfm_size_;
  434. FillConstant(kMin, 0);
  435. Check(expected);
  436. }
  437. TEST_P(BlockErrorTestFP, MaxValue) {
  438. const int64_t kMax = 32640;
  439. const int64_t expected = kMax * kMax * txfm_size_;
  440. FillConstant(kMax, 0);
  441. Check(expected);
  442. }
  443. TEST_P(BlockErrorTestFP, Random) {
  444. int64_t expected;
  445. switch (txfm_size_) {
  446. case 16: expected = 2051681432; break;
  447. case 64: expected = 11075114379; break;
  448. case 256: expected = 44386271116; break;
  449. case 1024: expected = 184774996089; break;
  450. default:
  451. FAIL() << "Invalid satd size (" << txfm_size_
  452. << ") valid: 16/64/256/1024";
  453. }
  454. FillRandom();
  455. Check(expected);
  456. }
  457. TEST_P(BlockErrorTestFP, DISABLED_Speed) {
  458. const int kCountSpeedTestBlock = 20000;
  459. vpx_usec_timer timer;
  460. const int blocksize = GET_PARAM(0);
  461. FillRandom();
  462. tran_low_t *coeff = GetCoeff();
  463. tran_low_t *dqcoeff = GetDQCoeff();
  464. vpx_usec_timer_start(&timer);
  465. for (int i = 0; i < kCountSpeedTestBlock; ++i) {
  466. GET_PARAM(1)(coeff, dqcoeff, blocksize);
  467. }
  468. vpx_usec_timer_mark(&timer);
  469. const int elapsed_time = static_cast<int>(vpx_usec_timer_elapsed(&timer));
  470. printf("blocksize: %4d time: %4d us\n", blocksize, elapsed_time);
  471. }
  472. using std::make_tuple;
  473. INSTANTIATE_TEST_CASE_P(
  474. C, AverageTest,
  475. ::testing::Values(make_tuple(16, 16, 1, 8, &vpx_avg_8x8_c),
  476. make_tuple(16, 16, 1, 4, &vpx_avg_4x4_c)));
  477. #if CONFIG_VP9_HIGHBITDEPTH
  478. INSTANTIATE_TEST_CASE_P(
  479. C, AverageTestHBD,
  480. ::testing::Values(make_tuple(16, 16, 1, 8, &vpx_highbd_avg_8x8_c),
  481. make_tuple(16, 16, 1, 4, &vpx_highbd_avg_4x4_c)));
  482. #if HAVE_SSE2
  483. INSTANTIATE_TEST_CASE_P(
  484. SSE2, AverageTestHBD,
  485. ::testing::Values(make_tuple(16, 16, 1, 8, &vpx_highbd_avg_8x8_sse2),
  486. make_tuple(16, 16, 1, 4, &vpx_highbd_avg_4x4_sse2)));
  487. #endif // HAVE_SSE2
  488. INSTANTIATE_TEST_CASE_P(C, SatdHighbdTest,
  489. ::testing::Values(make_tuple(16, &vpx_satd_c),
  490. make_tuple(64, &vpx_satd_c),
  491. make_tuple(256, &vpx_satd_c),
  492. make_tuple(1024, &vpx_satd_c)));
  493. #endif // CONFIG_VP9_HIGHBITDEPTH
  494. INSTANTIATE_TEST_CASE_P(C, SatdLowbdTest,
  495. ::testing::Values(make_tuple(16, &vpx_satd_c),
  496. make_tuple(64, &vpx_satd_c),
  497. make_tuple(256, &vpx_satd_c),
  498. make_tuple(1024, &vpx_satd_c)));
  499. INSTANTIATE_TEST_CASE_P(
  500. C, BlockErrorTestFP,
  501. ::testing::Values(make_tuple(16, &vp9_block_error_fp_c),
  502. make_tuple(64, &vp9_block_error_fp_c),
  503. make_tuple(256, &vp9_block_error_fp_c),
  504. make_tuple(1024, &vp9_block_error_fp_c)));
  505. #if HAVE_SSE2
  506. INSTANTIATE_TEST_CASE_P(
  507. SSE2, AverageTest,
  508. ::testing::Values(make_tuple(16, 16, 0, 8, &vpx_avg_8x8_sse2),
  509. make_tuple(16, 16, 5, 8, &vpx_avg_8x8_sse2),
  510. make_tuple(32, 32, 15, 8, &vpx_avg_8x8_sse2),
  511. make_tuple(16, 16, 0, 4, &vpx_avg_4x4_sse2),
  512. make_tuple(16, 16, 5, 4, &vpx_avg_4x4_sse2),
  513. make_tuple(32, 32, 15, 4, &vpx_avg_4x4_sse2)));
  514. INSTANTIATE_TEST_CASE_P(
  515. SSE2, IntProRowTest,
  516. ::testing::Values(make_tuple(16, &vpx_int_pro_row_sse2, &vpx_int_pro_row_c),
  517. make_tuple(32, &vpx_int_pro_row_sse2, &vpx_int_pro_row_c),
  518. make_tuple(64, &vpx_int_pro_row_sse2,
  519. &vpx_int_pro_row_c)));
  520. INSTANTIATE_TEST_CASE_P(
  521. SSE2, IntProColTest,
  522. ::testing::Values(make_tuple(16, &vpx_int_pro_col_sse2, &vpx_int_pro_col_c),
  523. make_tuple(32, &vpx_int_pro_col_sse2, &vpx_int_pro_col_c),
  524. make_tuple(64, &vpx_int_pro_col_sse2,
  525. &vpx_int_pro_col_c)));
  526. INSTANTIATE_TEST_CASE_P(SSE2, SatdLowbdTest,
  527. ::testing::Values(make_tuple(16, &vpx_satd_sse2),
  528. make_tuple(64, &vpx_satd_sse2),
  529. make_tuple(256, &vpx_satd_sse2),
  530. make_tuple(1024, &vpx_satd_sse2)));
  531. INSTANTIATE_TEST_CASE_P(
  532. SSE2, BlockErrorTestFP,
  533. ::testing::Values(make_tuple(16, &vp9_block_error_fp_sse2),
  534. make_tuple(64, &vp9_block_error_fp_sse2),
  535. make_tuple(256, &vp9_block_error_fp_sse2),
  536. make_tuple(1024, &vp9_block_error_fp_sse2)));
  537. #endif // HAVE_SSE2
  538. #if HAVE_AVX2
  539. INSTANTIATE_TEST_CASE_P(AVX2, SatdLowbdTest,
  540. ::testing::Values(make_tuple(16, &vpx_satd_avx2),
  541. make_tuple(64, &vpx_satd_avx2),
  542. make_tuple(256, &vpx_satd_avx2),
  543. make_tuple(1024, &vpx_satd_avx2)));
  544. #if CONFIG_VP9_HIGHBITDEPTH
  545. INSTANTIATE_TEST_CASE_P(
  546. AVX2, SatdHighbdTest,
  547. ::testing::Values(make_tuple(16, &vpx_highbd_satd_avx2),
  548. make_tuple(64, &vpx_highbd_satd_avx2),
  549. make_tuple(256, &vpx_highbd_satd_avx2),
  550. make_tuple(1024, &vpx_highbd_satd_avx2)));
  551. #endif // CONFIG_VP9_HIGHBITDEPTH
  552. INSTANTIATE_TEST_CASE_P(
  553. AVX2, BlockErrorTestFP,
  554. ::testing::Values(make_tuple(16, &vp9_block_error_fp_avx2),
  555. make_tuple(64, &vp9_block_error_fp_avx2),
  556. make_tuple(256, &vp9_block_error_fp_avx2),
  557. make_tuple(1024, &vp9_block_error_fp_avx2)));
  558. #endif
  559. #if HAVE_NEON
  560. INSTANTIATE_TEST_CASE_P(
  561. NEON, AverageTest,
  562. ::testing::Values(make_tuple(16, 16, 0, 8, &vpx_avg_8x8_neon),
  563. make_tuple(16, 16, 5, 8, &vpx_avg_8x8_neon),
  564. make_tuple(32, 32, 15, 8, &vpx_avg_8x8_neon),
  565. make_tuple(16, 16, 0, 4, &vpx_avg_4x4_neon),
  566. make_tuple(16, 16, 5, 4, &vpx_avg_4x4_neon),
  567. make_tuple(32, 32, 15, 4, &vpx_avg_4x4_neon)));
  568. INSTANTIATE_TEST_CASE_P(
  569. NEON, IntProRowTest,
  570. ::testing::Values(make_tuple(16, &vpx_int_pro_row_neon, &vpx_int_pro_row_c),
  571. make_tuple(32, &vpx_int_pro_row_neon, &vpx_int_pro_row_c),
  572. make_tuple(64, &vpx_int_pro_row_neon,
  573. &vpx_int_pro_row_c)));
  574. INSTANTIATE_TEST_CASE_P(
  575. NEON, IntProColTest,
  576. ::testing::Values(make_tuple(16, &vpx_int_pro_col_neon, &vpx_int_pro_col_c),
  577. make_tuple(32, &vpx_int_pro_col_neon, &vpx_int_pro_col_c),
  578. make_tuple(64, &vpx_int_pro_col_neon,
  579. &vpx_int_pro_col_c)));
  580. INSTANTIATE_TEST_CASE_P(NEON, SatdLowbdTest,
  581. ::testing::Values(make_tuple(16, &vpx_satd_neon),
  582. make_tuple(64, &vpx_satd_neon),
  583. make_tuple(256, &vpx_satd_neon),
  584. make_tuple(1024, &vpx_satd_neon)));
  585. // TODO(jianj): Remove the highbitdepth flag once the SIMD functions are
  586. // in place.
  587. #if !CONFIG_VP9_HIGHBITDEPTH
  588. INSTANTIATE_TEST_CASE_P(
  589. NEON, BlockErrorTestFP,
  590. ::testing::Values(make_tuple(16, &vp9_block_error_fp_neon),
  591. make_tuple(64, &vp9_block_error_fp_neon),
  592. make_tuple(256, &vp9_block_error_fp_neon),
  593. make_tuple(1024, &vp9_block_error_fp_neon)));
  594. #endif // !CONFIG_VP9_HIGHBITDEPTH
  595. #endif // HAVE_NEON
  596. #if HAVE_MSA
  597. INSTANTIATE_TEST_CASE_P(
  598. MSA, AverageTest,
  599. ::testing::Values(make_tuple(16, 16, 0, 8, &vpx_avg_8x8_msa),
  600. make_tuple(16, 16, 5, 8, &vpx_avg_8x8_msa),
  601. make_tuple(32, 32, 15, 8, &vpx_avg_8x8_msa),
  602. make_tuple(16, 16, 0, 4, &vpx_avg_4x4_msa),
  603. make_tuple(16, 16, 5, 4, &vpx_avg_4x4_msa),
  604. make_tuple(32, 32, 15, 4, &vpx_avg_4x4_msa)));
  605. INSTANTIATE_TEST_CASE_P(
  606. MSA, IntProRowTest,
  607. ::testing::Values(make_tuple(16, &vpx_int_pro_row_msa, &vpx_int_pro_row_c),
  608. make_tuple(32, &vpx_int_pro_row_msa, &vpx_int_pro_row_c),
  609. make_tuple(64, &vpx_int_pro_row_msa,
  610. &vpx_int_pro_row_c)));
  611. INSTANTIATE_TEST_CASE_P(
  612. MSA, IntProColTest,
  613. ::testing::Values(make_tuple(16, &vpx_int_pro_col_msa, &vpx_int_pro_col_c),
  614. make_tuple(32, &vpx_int_pro_col_msa, &vpx_int_pro_col_c),
  615. make_tuple(64, &vpx_int_pro_col_msa,
  616. &vpx_int_pro_col_c)));
  617. // TODO(jingning): Remove the highbitdepth flag once the SIMD functions are
  618. // in place.
  619. #if !CONFIG_VP9_HIGHBITDEPTH
  620. INSTANTIATE_TEST_CASE_P(MSA, SatdLowbdTest,
  621. ::testing::Values(make_tuple(16, &vpx_satd_msa),
  622. make_tuple(64, &vpx_satd_msa),
  623. make_tuple(256, &vpx_satd_msa),
  624. make_tuple(1024, &vpx_satd_msa)));
  625. #endif // !CONFIG_VP9_HIGHBITDEPTH
  626. #endif // HAVE_MSA
  627. } // namespace