sad_test.cc 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109
  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 <string.h>
  11. #include <limits.h>
  12. #include "third_party/googletest/src/include/gtest/gtest.h"
  13. #include "./vpx_config.h"
  14. #include "./vpx_dsp_rtcd.h"
  15. #include "test/acm_random.h"
  16. #include "test/bench.h"
  17. #include "test/clear_system_state.h"
  18. #include "test/register_state_check.h"
  19. #include "test/util.h"
  20. #include "vpx/vpx_codec.h"
  21. #include "vpx_mem/vpx_mem.h"
  22. #include "vpx_ports/mem.h"
  23. #include "vpx_ports/msvc.h"
  24. #include "vpx_ports/vpx_timer.h"
  25. template <typename Function>
  26. struct TestParams {
  27. TestParams(int w, int h, Function f, int bd = -1)
  28. : width(w), height(h), bit_depth(bd), func(f) {}
  29. int width, height, bit_depth;
  30. Function func;
  31. };
  32. typedef unsigned int (*SadMxNFunc)(const uint8_t *src_ptr, int src_stride,
  33. const uint8_t *ref_ptr, int ref_stride);
  34. typedef TestParams<SadMxNFunc> SadMxNParam;
  35. typedef unsigned int (*SadMxNAvgFunc)(const uint8_t *src_ptr, int src_stride,
  36. const uint8_t *ref_ptr, int ref_stride,
  37. const uint8_t *second_pred);
  38. typedef TestParams<SadMxNAvgFunc> SadMxNAvgParam;
  39. typedef void (*SadMxNx4Func)(const uint8_t *src_ptr, int src_stride,
  40. const uint8_t *const ref_ptr[], int ref_stride,
  41. unsigned int *sad_array);
  42. typedef TestParams<SadMxNx4Func> SadMxNx4Param;
  43. using libvpx_test::ACMRandom;
  44. namespace {
  45. template <typename ParamType>
  46. class SADTestBase : public ::testing::TestWithParam<ParamType> {
  47. public:
  48. explicit SADTestBase(const ParamType &params) : params_(params) {}
  49. virtual void SetUp() {
  50. source_data8_ = reinterpret_cast<uint8_t *>(
  51. vpx_memalign(kDataAlignment, kDataBlockSize));
  52. reference_data8_ = reinterpret_cast<uint8_t *>(
  53. vpx_memalign(kDataAlignment, kDataBufferSize));
  54. second_pred8_ =
  55. reinterpret_cast<uint8_t *>(vpx_memalign(kDataAlignment, 64 * 64));
  56. source_data16_ = reinterpret_cast<uint16_t *>(
  57. vpx_memalign(kDataAlignment, kDataBlockSize * sizeof(uint16_t)));
  58. reference_data16_ = reinterpret_cast<uint16_t *>(
  59. vpx_memalign(kDataAlignment, kDataBufferSize * sizeof(uint16_t)));
  60. second_pred16_ = reinterpret_cast<uint16_t *>(
  61. vpx_memalign(kDataAlignment, 64 * 64 * sizeof(uint16_t)));
  62. if (params_.bit_depth == -1) {
  63. use_high_bit_depth_ = false;
  64. bit_depth_ = VPX_BITS_8;
  65. source_data_ = source_data8_;
  66. reference_data_ = reference_data8_;
  67. second_pred_ = second_pred8_;
  68. #if CONFIG_VP9_HIGHBITDEPTH
  69. } else {
  70. use_high_bit_depth_ = true;
  71. bit_depth_ = static_cast<vpx_bit_depth_t>(params_.bit_depth);
  72. source_data_ = CONVERT_TO_BYTEPTR(source_data16_);
  73. reference_data_ = CONVERT_TO_BYTEPTR(reference_data16_);
  74. second_pred_ = CONVERT_TO_BYTEPTR(second_pred16_);
  75. #endif // CONFIG_VP9_HIGHBITDEPTH
  76. }
  77. mask_ = (1 << bit_depth_) - 1;
  78. source_stride_ = (params_.width + 63) & ~63;
  79. reference_stride_ = params_.width * 2;
  80. rnd_.Reset(ACMRandom::DeterministicSeed());
  81. }
  82. virtual void TearDown() {
  83. vpx_free(source_data8_);
  84. source_data8_ = NULL;
  85. vpx_free(reference_data8_);
  86. reference_data8_ = NULL;
  87. vpx_free(second_pred8_);
  88. second_pred8_ = NULL;
  89. vpx_free(source_data16_);
  90. source_data16_ = NULL;
  91. vpx_free(reference_data16_);
  92. reference_data16_ = NULL;
  93. vpx_free(second_pred16_);
  94. second_pred16_ = NULL;
  95. libvpx_test::ClearSystemState();
  96. }
  97. protected:
  98. // Handle blocks up to 4 blocks 64x64 with stride up to 128
  99. static const int kDataAlignment = 32;
  100. static const int kDataBlockSize = 64 * 128;
  101. static const int kDataBufferSize = 4 * kDataBlockSize;
  102. uint8_t *GetReference(int block_idx) const {
  103. #if CONFIG_VP9_HIGHBITDEPTH
  104. if (use_high_bit_depth_) {
  105. return CONVERT_TO_BYTEPTR(CONVERT_TO_SHORTPTR(reference_data_) +
  106. block_idx * kDataBlockSize);
  107. }
  108. #endif // CONFIG_VP9_HIGHBITDEPTH
  109. return reference_data_ + block_idx * kDataBlockSize;
  110. }
  111. // Sum of Absolute Differences. Given two blocks, calculate the absolute
  112. // difference between two pixels in the same relative location; accumulate.
  113. uint32_t ReferenceSAD(int block_idx) const {
  114. uint32_t sad = 0;
  115. const uint8_t *const reference8 = GetReference(block_idx);
  116. const uint8_t *const source8 = source_data_;
  117. #if CONFIG_VP9_HIGHBITDEPTH
  118. const uint16_t *const reference16 =
  119. CONVERT_TO_SHORTPTR(GetReference(block_idx));
  120. const uint16_t *const source16 = CONVERT_TO_SHORTPTR(source_data_);
  121. #endif // CONFIG_VP9_HIGHBITDEPTH
  122. for (int h = 0; h < params_.height; ++h) {
  123. for (int w = 0; w < params_.width; ++w) {
  124. if (!use_high_bit_depth_) {
  125. sad += abs(source8[h * source_stride_ + w] -
  126. reference8[h * reference_stride_ + w]);
  127. #if CONFIG_VP9_HIGHBITDEPTH
  128. } else {
  129. sad += abs(source16[h * source_stride_ + w] -
  130. reference16[h * reference_stride_ + w]);
  131. #endif // CONFIG_VP9_HIGHBITDEPTH
  132. }
  133. }
  134. }
  135. return sad;
  136. }
  137. // Sum of Absolute Differences Average. Given two blocks, and a prediction
  138. // calculate the absolute difference between one pixel and average of the
  139. // corresponding and predicted pixels; accumulate.
  140. unsigned int ReferenceSADavg(int block_idx) const {
  141. unsigned int sad = 0;
  142. const uint8_t *const reference8 = GetReference(block_idx);
  143. const uint8_t *const source8 = source_data_;
  144. const uint8_t *const second_pred8 = second_pred_;
  145. #if CONFIG_VP9_HIGHBITDEPTH
  146. const uint16_t *const reference16 =
  147. CONVERT_TO_SHORTPTR(GetReference(block_idx));
  148. const uint16_t *const source16 = CONVERT_TO_SHORTPTR(source_data_);
  149. const uint16_t *const second_pred16 = CONVERT_TO_SHORTPTR(second_pred_);
  150. #endif // CONFIG_VP9_HIGHBITDEPTH
  151. for (int h = 0; h < params_.height; ++h) {
  152. for (int w = 0; w < params_.width; ++w) {
  153. if (!use_high_bit_depth_) {
  154. const int tmp = second_pred8[h * params_.width + w] +
  155. reference8[h * reference_stride_ + w];
  156. const uint8_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);
  157. sad += abs(source8[h * source_stride_ + w] - comp_pred);
  158. #if CONFIG_VP9_HIGHBITDEPTH
  159. } else {
  160. const int tmp = second_pred16[h * params_.width + w] +
  161. reference16[h * reference_stride_ + w];
  162. const uint16_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);
  163. sad += abs(source16[h * source_stride_ + w] - comp_pred);
  164. #endif // CONFIG_VP9_HIGHBITDEPTH
  165. }
  166. }
  167. }
  168. return sad;
  169. }
  170. void FillConstant(uint8_t *data, int stride, uint16_t fill_constant) const {
  171. uint8_t *data8 = data;
  172. #if CONFIG_VP9_HIGHBITDEPTH
  173. uint16_t *data16 = CONVERT_TO_SHORTPTR(data);
  174. #endif // CONFIG_VP9_HIGHBITDEPTH
  175. for (int h = 0; h < params_.height; ++h) {
  176. for (int w = 0; w < params_.width; ++w) {
  177. if (!use_high_bit_depth_) {
  178. data8[h * stride + w] = static_cast<uint8_t>(fill_constant);
  179. #if CONFIG_VP9_HIGHBITDEPTH
  180. } else {
  181. data16[h * stride + w] = fill_constant;
  182. #endif // CONFIG_VP9_HIGHBITDEPTH
  183. }
  184. }
  185. }
  186. }
  187. void FillRandom(uint8_t *data, int stride) {
  188. uint8_t *data8 = data;
  189. #if CONFIG_VP9_HIGHBITDEPTH
  190. uint16_t *data16 = CONVERT_TO_SHORTPTR(data);
  191. #endif // CONFIG_VP9_HIGHBITDEPTH
  192. for (int h = 0; h < params_.height; ++h) {
  193. for (int w = 0; w < params_.width; ++w) {
  194. if (!use_high_bit_depth_) {
  195. data8[h * stride + w] = rnd_.Rand8();
  196. #if CONFIG_VP9_HIGHBITDEPTH
  197. } else {
  198. data16[h * stride + w] = rnd_.Rand16() & mask_;
  199. #endif // CONFIG_VP9_HIGHBITDEPTH
  200. }
  201. }
  202. }
  203. }
  204. uint32_t mask_;
  205. vpx_bit_depth_t bit_depth_;
  206. int source_stride_;
  207. int reference_stride_;
  208. bool use_high_bit_depth_;
  209. uint8_t *source_data_;
  210. uint8_t *reference_data_;
  211. uint8_t *second_pred_;
  212. uint8_t *source_data8_;
  213. uint8_t *reference_data8_;
  214. uint8_t *second_pred8_;
  215. uint16_t *source_data16_;
  216. uint16_t *reference_data16_;
  217. uint16_t *second_pred16_;
  218. ACMRandom rnd_;
  219. ParamType params_;
  220. };
  221. class SADx4Test : public SADTestBase<SadMxNx4Param> {
  222. public:
  223. SADx4Test() : SADTestBase(GetParam()) {}
  224. protected:
  225. void SADs(unsigned int *results) const {
  226. const uint8_t *references[] = { GetReference(0), GetReference(1),
  227. GetReference(2), GetReference(3) };
  228. ASM_REGISTER_STATE_CHECK(params_.func(
  229. source_data_, source_stride_, references, reference_stride_, results));
  230. }
  231. void CheckSADs() const {
  232. uint32_t reference_sad, exp_sad[4];
  233. SADs(exp_sad);
  234. for (int block = 0; block < 4; ++block) {
  235. reference_sad = ReferenceSAD(block);
  236. EXPECT_EQ(reference_sad, exp_sad[block]) << "block " << block;
  237. }
  238. }
  239. };
  240. class SADTest : public AbstractBench, public SADTestBase<SadMxNParam> {
  241. public:
  242. SADTest() : SADTestBase(GetParam()) {}
  243. protected:
  244. unsigned int SAD(int block_idx) const {
  245. unsigned int ret;
  246. const uint8_t *const reference = GetReference(block_idx);
  247. ASM_REGISTER_STATE_CHECK(ret = params_.func(source_data_, source_stride_,
  248. reference, reference_stride_));
  249. return ret;
  250. }
  251. void CheckSAD() const {
  252. const unsigned int reference_sad = ReferenceSAD(0);
  253. const unsigned int exp_sad = SAD(0);
  254. ASSERT_EQ(reference_sad, exp_sad);
  255. }
  256. void Run() {
  257. params_.func(source_data_, source_stride_, reference_data_,
  258. reference_stride_);
  259. }
  260. };
  261. class SADavgTest : public SADTestBase<SadMxNAvgParam> {
  262. public:
  263. SADavgTest() : SADTestBase(GetParam()) {}
  264. protected:
  265. unsigned int SAD_avg(int block_idx) const {
  266. unsigned int ret;
  267. const uint8_t *const reference = GetReference(block_idx);
  268. ASM_REGISTER_STATE_CHECK(ret = params_.func(source_data_, source_stride_,
  269. reference, reference_stride_,
  270. second_pred_));
  271. return ret;
  272. }
  273. void CheckSAD() const {
  274. const unsigned int reference_sad = ReferenceSADavg(0);
  275. const unsigned int exp_sad = SAD_avg(0);
  276. ASSERT_EQ(reference_sad, exp_sad);
  277. }
  278. };
  279. TEST_P(SADTest, MaxRef) {
  280. FillConstant(source_data_, source_stride_, 0);
  281. FillConstant(reference_data_, reference_stride_, mask_);
  282. CheckSAD();
  283. }
  284. TEST_P(SADTest, MaxSrc) {
  285. FillConstant(source_data_, source_stride_, mask_);
  286. FillConstant(reference_data_, reference_stride_, 0);
  287. CheckSAD();
  288. }
  289. TEST_P(SADTest, ShortRef) {
  290. const int tmp_stride = reference_stride_;
  291. reference_stride_ >>= 1;
  292. FillRandom(source_data_, source_stride_);
  293. FillRandom(reference_data_, reference_stride_);
  294. CheckSAD();
  295. reference_stride_ = tmp_stride;
  296. }
  297. TEST_P(SADTest, UnalignedRef) {
  298. // The reference frame, but not the source frame, may be unaligned for
  299. // certain types of searches.
  300. const int tmp_stride = reference_stride_;
  301. reference_stride_ -= 1;
  302. FillRandom(source_data_, source_stride_);
  303. FillRandom(reference_data_, reference_stride_);
  304. CheckSAD();
  305. reference_stride_ = tmp_stride;
  306. }
  307. TEST_P(SADTest, ShortSrc) {
  308. const int tmp_stride = source_stride_;
  309. source_stride_ >>= 1;
  310. FillRandom(source_data_, source_stride_);
  311. FillRandom(reference_data_, reference_stride_);
  312. CheckSAD();
  313. source_stride_ = tmp_stride;
  314. }
  315. TEST_P(SADTest, DISABLED_Speed) {
  316. const int kCountSpeedTestBlock = 50000000 / (params_.width * params_.height);
  317. FillRandom(source_data_, source_stride_);
  318. RunNTimes(kCountSpeedTestBlock);
  319. char title[16];
  320. snprintf(title, sizeof(title), "%dx%d", params_.width, params_.height);
  321. PrintMedian(title);
  322. }
  323. TEST_P(SADavgTest, MaxRef) {
  324. FillConstant(source_data_, source_stride_, 0);
  325. FillConstant(reference_data_, reference_stride_, mask_);
  326. FillConstant(second_pred_, params_.width, 0);
  327. CheckSAD();
  328. }
  329. TEST_P(SADavgTest, MaxSrc) {
  330. FillConstant(source_data_, source_stride_, mask_);
  331. FillConstant(reference_data_, reference_stride_, 0);
  332. FillConstant(second_pred_, params_.width, 0);
  333. CheckSAD();
  334. }
  335. TEST_P(SADavgTest, ShortRef) {
  336. const int tmp_stride = reference_stride_;
  337. reference_stride_ >>= 1;
  338. FillRandom(source_data_, source_stride_);
  339. FillRandom(reference_data_, reference_stride_);
  340. FillRandom(second_pred_, params_.width);
  341. CheckSAD();
  342. reference_stride_ = tmp_stride;
  343. }
  344. TEST_P(SADavgTest, UnalignedRef) {
  345. // The reference frame, but not the source frame, may be unaligned for
  346. // certain types of searches.
  347. const int tmp_stride = reference_stride_;
  348. reference_stride_ -= 1;
  349. FillRandom(source_data_, source_stride_);
  350. FillRandom(reference_data_, reference_stride_);
  351. FillRandom(second_pred_, params_.width);
  352. CheckSAD();
  353. reference_stride_ = tmp_stride;
  354. }
  355. TEST_P(SADavgTest, ShortSrc) {
  356. const int tmp_stride = source_stride_;
  357. source_stride_ >>= 1;
  358. FillRandom(source_data_, source_stride_);
  359. FillRandom(reference_data_, reference_stride_);
  360. FillRandom(second_pred_, params_.width);
  361. CheckSAD();
  362. source_stride_ = tmp_stride;
  363. }
  364. TEST_P(SADx4Test, MaxRef) {
  365. FillConstant(source_data_, source_stride_, 0);
  366. FillConstant(GetReference(0), reference_stride_, mask_);
  367. FillConstant(GetReference(1), reference_stride_, mask_);
  368. FillConstant(GetReference(2), reference_stride_, mask_);
  369. FillConstant(GetReference(3), reference_stride_, mask_);
  370. CheckSADs();
  371. }
  372. TEST_P(SADx4Test, MaxSrc) {
  373. FillConstant(source_data_, source_stride_, mask_);
  374. FillConstant(GetReference(0), reference_stride_, 0);
  375. FillConstant(GetReference(1), reference_stride_, 0);
  376. FillConstant(GetReference(2), reference_stride_, 0);
  377. FillConstant(GetReference(3), reference_stride_, 0);
  378. CheckSADs();
  379. }
  380. TEST_P(SADx4Test, ShortRef) {
  381. int tmp_stride = reference_stride_;
  382. reference_stride_ >>= 1;
  383. FillRandom(source_data_, source_stride_);
  384. FillRandom(GetReference(0), reference_stride_);
  385. FillRandom(GetReference(1), reference_stride_);
  386. FillRandom(GetReference(2), reference_stride_);
  387. FillRandom(GetReference(3), reference_stride_);
  388. CheckSADs();
  389. reference_stride_ = tmp_stride;
  390. }
  391. TEST_P(SADx4Test, UnalignedRef) {
  392. // The reference frame, but not the source frame, may be unaligned for
  393. // certain types of searches.
  394. int tmp_stride = reference_stride_;
  395. reference_stride_ -= 1;
  396. FillRandom(source_data_, source_stride_);
  397. FillRandom(GetReference(0), reference_stride_);
  398. FillRandom(GetReference(1), reference_stride_);
  399. FillRandom(GetReference(2), reference_stride_);
  400. FillRandom(GetReference(3), reference_stride_);
  401. CheckSADs();
  402. reference_stride_ = tmp_stride;
  403. }
  404. TEST_P(SADx4Test, ShortSrc) {
  405. int tmp_stride = source_stride_;
  406. source_stride_ >>= 1;
  407. FillRandom(source_data_, source_stride_);
  408. FillRandom(GetReference(0), reference_stride_);
  409. FillRandom(GetReference(1), reference_stride_);
  410. FillRandom(GetReference(2), reference_stride_);
  411. FillRandom(GetReference(3), reference_stride_);
  412. CheckSADs();
  413. source_stride_ = tmp_stride;
  414. }
  415. TEST_P(SADx4Test, SrcAlignedByWidth) {
  416. uint8_t *tmp_source_data = source_data_;
  417. source_data_ += params_.width;
  418. FillRandom(source_data_, source_stride_);
  419. FillRandom(GetReference(0), reference_stride_);
  420. FillRandom(GetReference(1), reference_stride_);
  421. FillRandom(GetReference(2), reference_stride_);
  422. FillRandom(GetReference(3), reference_stride_);
  423. CheckSADs();
  424. source_data_ = tmp_source_data;
  425. }
  426. TEST_P(SADx4Test, DISABLED_Speed) {
  427. int tmp_stride = reference_stride_;
  428. reference_stride_ -= 1;
  429. FillRandom(source_data_, source_stride_);
  430. FillRandom(GetReference(0), reference_stride_);
  431. FillRandom(GetReference(1), reference_stride_);
  432. FillRandom(GetReference(2), reference_stride_);
  433. FillRandom(GetReference(3), reference_stride_);
  434. const int kCountSpeedTestBlock = 500000000 / (params_.width * params_.height);
  435. uint32_t reference_sad[4], exp_sad[4];
  436. vpx_usec_timer timer;
  437. memset(reference_sad, 0, sizeof(reference_sad));
  438. SADs(exp_sad);
  439. vpx_usec_timer_start(&timer);
  440. for (int i = 0; i < kCountSpeedTestBlock; ++i) {
  441. for (int block = 0; block < 4; ++block) {
  442. reference_sad[block] = ReferenceSAD(block);
  443. }
  444. }
  445. vpx_usec_timer_mark(&timer);
  446. for (int block = 0; block < 4; ++block) {
  447. EXPECT_EQ(reference_sad[block], exp_sad[block]) << "block " << block;
  448. }
  449. const int elapsed_time =
  450. static_cast<int>(vpx_usec_timer_elapsed(&timer) / 1000);
  451. printf("sad%dx%dx4 (%2dbit) time: %5d ms\n", params_.width, params_.height,
  452. bit_depth_, elapsed_time);
  453. reference_stride_ = tmp_stride;
  454. }
  455. //------------------------------------------------------------------------------
  456. // C functions
  457. const SadMxNParam c_tests[] = {
  458. SadMxNParam(64, 64, &vpx_sad64x64_c),
  459. SadMxNParam(64, 32, &vpx_sad64x32_c),
  460. SadMxNParam(32, 64, &vpx_sad32x64_c),
  461. SadMxNParam(32, 32, &vpx_sad32x32_c),
  462. SadMxNParam(32, 16, &vpx_sad32x16_c),
  463. SadMxNParam(16, 32, &vpx_sad16x32_c),
  464. SadMxNParam(16, 16, &vpx_sad16x16_c),
  465. SadMxNParam(16, 8, &vpx_sad16x8_c),
  466. SadMxNParam(8, 16, &vpx_sad8x16_c),
  467. SadMxNParam(8, 8, &vpx_sad8x8_c),
  468. SadMxNParam(8, 4, &vpx_sad8x4_c),
  469. SadMxNParam(4, 8, &vpx_sad4x8_c),
  470. SadMxNParam(4, 4, &vpx_sad4x4_c),
  471. #if CONFIG_VP9_HIGHBITDEPTH
  472. SadMxNParam(64, 64, &vpx_highbd_sad64x64_c, 8),
  473. SadMxNParam(64, 32, &vpx_highbd_sad64x32_c, 8),
  474. SadMxNParam(32, 64, &vpx_highbd_sad32x64_c, 8),
  475. SadMxNParam(32, 32, &vpx_highbd_sad32x32_c, 8),
  476. SadMxNParam(32, 16, &vpx_highbd_sad32x16_c, 8),
  477. SadMxNParam(16, 32, &vpx_highbd_sad16x32_c, 8),
  478. SadMxNParam(16, 16, &vpx_highbd_sad16x16_c, 8),
  479. SadMxNParam(16, 8, &vpx_highbd_sad16x8_c, 8),
  480. SadMxNParam(8, 16, &vpx_highbd_sad8x16_c, 8),
  481. SadMxNParam(8, 8, &vpx_highbd_sad8x8_c, 8),
  482. SadMxNParam(8, 4, &vpx_highbd_sad8x4_c, 8),
  483. SadMxNParam(4, 8, &vpx_highbd_sad4x8_c, 8),
  484. SadMxNParam(4, 4, &vpx_highbd_sad4x4_c, 8),
  485. SadMxNParam(64, 64, &vpx_highbd_sad64x64_c, 10),
  486. SadMxNParam(64, 32, &vpx_highbd_sad64x32_c, 10),
  487. SadMxNParam(32, 64, &vpx_highbd_sad32x64_c, 10),
  488. SadMxNParam(32, 32, &vpx_highbd_sad32x32_c, 10),
  489. SadMxNParam(32, 16, &vpx_highbd_sad32x16_c, 10),
  490. SadMxNParam(16, 32, &vpx_highbd_sad16x32_c, 10),
  491. SadMxNParam(16, 16, &vpx_highbd_sad16x16_c, 10),
  492. SadMxNParam(16, 8, &vpx_highbd_sad16x8_c, 10),
  493. SadMxNParam(8, 16, &vpx_highbd_sad8x16_c, 10),
  494. SadMxNParam(8, 8, &vpx_highbd_sad8x8_c, 10),
  495. SadMxNParam(8, 4, &vpx_highbd_sad8x4_c, 10),
  496. SadMxNParam(4, 8, &vpx_highbd_sad4x8_c, 10),
  497. SadMxNParam(4, 4, &vpx_highbd_sad4x4_c, 10),
  498. SadMxNParam(64, 64, &vpx_highbd_sad64x64_c, 12),
  499. SadMxNParam(64, 32, &vpx_highbd_sad64x32_c, 12),
  500. SadMxNParam(32, 64, &vpx_highbd_sad32x64_c, 12),
  501. SadMxNParam(32, 32, &vpx_highbd_sad32x32_c, 12),
  502. SadMxNParam(32, 16, &vpx_highbd_sad32x16_c, 12),
  503. SadMxNParam(16, 32, &vpx_highbd_sad16x32_c, 12),
  504. SadMxNParam(16, 16, &vpx_highbd_sad16x16_c, 12),
  505. SadMxNParam(16, 8, &vpx_highbd_sad16x8_c, 12),
  506. SadMxNParam(8, 16, &vpx_highbd_sad8x16_c, 12),
  507. SadMxNParam(8, 8, &vpx_highbd_sad8x8_c, 12),
  508. SadMxNParam(8, 4, &vpx_highbd_sad8x4_c, 12),
  509. SadMxNParam(4, 8, &vpx_highbd_sad4x8_c, 12),
  510. SadMxNParam(4, 4, &vpx_highbd_sad4x4_c, 12),
  511. #endif // CONFIG_VP9_HIGHBITDEPTH
  512. };
  513. INSTANTIATE_TEST_CASE_P(C, SADTest, ::testing::ValuesIn(c_tests));
  514. const SadMxNAvgParam avg_c_tests[] = {
  515. SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_c),
  516. SadMxNAvgParam(64, 32, &vpx_sad64x32_avg_c),
  517. SadMxNAvgParam(32, 64, &vpx_sad32x64_avg_c),
  518. SadMxNAvgParam(32, 32, &vpx_sad32x32_avg_c),
  519. SadMxNAvgParam(32, 16, &vpx_sad32x16_avg_c),
  520. SadMxNAvgParam(16, 32, &vpx_sad16x32_avg_c),
  521. SadMxNAvgParam(16, 16, &vpx_sad16x16_avg_c),
  522. SadMxNAvgParam(16, 8, &vpx_sad16x8_avg_c),
  523. SadMxNAvgParam(8, 16, &vpx_sad8x16_avg_c),
  524. SadMxNAvgParam(8, 8, &vpx_sad8x8_avg_c),
  525. SadMxNAvgParam(8, 4, &vpx_sad8x4_avg_c),
  526. SadMxNAvgParam(4, 8, &vpx_sad4x8_avg_c),
  527. SadMxNAvgParam(4, 4, &vpx_sad4x4_avg_c),
  528. #if CONFIG_VP9_HIGHBITDEPTH
  529. SadMxNAvgParam(64, 64, &vpx_highbd_sad64x64_avg_c, 8),
  530. SadMxNAvgParam(64, 32, &vpx_highbd_sad64x32_avg_c, 8),
  531. SadMxNAvgParam(32, 64, &vpx_highbd_sad32x64_avg_c, 8),
  532. SadMxNAvgParam(32, 32, &vpx_highbd_sad32x32_avg_c, 8),
  533. SadMxNAvgParam(32, 16, &vpx_highbd_sad32x16_avg_c, 8),
  534. SadMxNAvgParam(16, 32, &vpx_highbd_sad16x32_avg_c, 8),
  535. SadMxNAvgParam(16, 16, &vpx_highbd_sad16x16_avg_c, 8),
  536. SadMxNAvgParam(16, 8, &vpx_highbd_sad16x8_avg_c, 8),
  537. SadMxNAvgParam(8, 16, &vpx_highbd_sad8x16_avg_c, 8),
  538. SadMxNAvgParam(8, 8, &vpx_highbd_sad8x8_avg_c, 8),
  539. SadMxNAvgParam(8, 4, &vpx_highbd_sad8x4_avg_c, 8),
  540. SadMxNAvgParam(4, 8, &vpx_highbd_sad4x8_avg_c, 8),
  541. SadMxNAvgParam(4, 4, &vpx_highbd_sad4x4_avg_c, 8),
  542. SadMxNAvgParam(64, 64, &vpx_highbd_sad64x64_avg_c, 10),
  543. SadMxNAvgParam(64, 32, &vpx_highbd_sad64x32_avg_c, 10),
  544. SadMxNAvgParam(32, 64, &vpx_highbd_sad32x64_avg_c, 10),
  545. SadMxNAvgParam(32, 32, &vpx_highbd_sad32x32_avg_c, 10),
  546. SadMxNAvgParam(32, 16, &vpx_highbd_sad32x16_avg_c, 10),
  547. SadMxNAvgParam(16, 32, &vpx_highbd_sad16x32_avg_c, 10),
  548. SadMxNAvgParam(16, 16, &vpx_highbd_sad16x16_avg_c, 10),
  549. SadMxNAvgParam(16, 8, &vpx_highbd_sad16x8_avg_c, 10),
  550. SadMxNAvgParam(8, 16, &vpx_highbd_sad8x16_avg_c, 10),
  551. SadMxNAvgParam(8, 8, &vpx_highbd_sad8x8_avg_c, 10),
  552. SadMxNAvgParam(8, 4, &vpx_highbd_sad8x4_avg_c, 10),
  553. SadMxNAvgParam(4, 8, &vpx_highbd_sad4x8_avg_c, 10),
  554. SadMxNAvgParam(4, 4, &vpx_highbd_sad4x4_avg_c, 10),
  555. SadMxNAvgParam(64, 64, &vpx_highbd_sad64x64_avg_c, 12),
  556. SadMxNAvgParam(64, 32, &vpx_highbd_sad64x32_avg_c, 12),
  557. SadMxNAvgParam(32, 64, &vpx_highbd_sad32x64_avg_c, 12),
  558. SadMxNAvgParam(32, 32, &vpx_highbd_sad32x32_avg_c, 12),
  559. SadMxNAvgParam(32, 16, &vpx_highbd_sad32x16_avg_c, 12),
  560. SadMxNAvgParam(16, 32, &vpx_highbd_sad16x32_avg_c, 12),
  561. SadMxNAvgParam(16, 16, &vpx_highbd_sad16x16_avg_c, 12),
  562. SadMxNAvgParam(16, 8, &vpx_highbd_sad16x8_avg_c, 12),
  563. SadMxNAvgParam(8, 16, &vpx_highbd_sad8x16_avg_c, 12),
  564. SadMxNAvgParam(8, 8, &vpx_highbd_sad8x8_avg_c, 12),
  565. SadMxNAvgParam(8, 4, &vpx_highbd_sad8x4_avg_c, 12),
  566. SadMxNAvgParam(4, 8, &vpx_highbd_sad4x8_avg_c, 12),
  567. SadMxNAvgParam(4, 4, &vpx_highbd_sad4x4_avg_c, 12),
  568. #endif // CONFIG_VP9_HIGHBITDEPTH
  569. };
  570. INSTANTIATE_TEST_CASE_P(C, SADavgTest, ::testing::ValuesIn(avg_c_tests));
  571. const SadMxNx4Param x4d_c_tests[] = {
  572. SadMxNx4Param(64, 64, &vpx_sad64x64x4d_c),
  573. SadMxNx4Param(64, 32, &vpx_sad64x32x4d_c),
  574. SadMxNx4Param(32, 64, &vpx_sad32x64x4d_c),
  575. SadMxNx4Param(32, 32, &vpx_sad32x32x4d_c),
  576. SadMxNx4Param(32, 16, &vpx_sad32x16x4d_c),
  577. SadMxNx4Param(16, 32, &vpx_sad16x32x4d_c),
  578. SadMxNx4Param(16, 16, &vpx_sad16x16x4d_c),
  579. SadMxNx4Param(16, 8, &vpx_sad16x8x4d_c),
  580. SadMxNx4Param(8, 16, &vpx_sad8x16x4d_c),
  581. SadMxNx4Param(8, 8, &vpx_sad8x8x4d_c),
  582. SadMxNx4Param(8, 4, &vpx_sad8x4x4d_c),
  583. SadMxNx4Param(4, 8, &vpx_sad4x8x4d_c),
  584. SadMxNx4Param(4, 4, &vpx_sad4x4x4d_c),
  585. #if CONFIG_VP9_HIGHBITDEPTH
  586. SadMxNx4Param(64, 64, &vpx_highbd_sad64x64x4d_c, 8),
  587. SadMxNx4Param(64, 32, &vpx_highbd_sad64x32x4d_c, 8),
  588. SadMxNx4Param(32, 64, &vpx_highbd_sad32x64x4d_c, 8),
  589. SadMxNx4Param(32, 32, &vpx_highbd_sad32x32x4d_c, 8),
  590. SadMxNx4Param(32, 16, &vpx_highbd_sad32x16x4d_c, 8),
  591. SadMxNx4Param(16, 32, &vpx_highbd_sad16x32x4d_c, 8),
  592. SadMxNx4Param(16, 16, &vpx_highbd_sad16x16x4d_c, 8),
  593. SadMxNx4Param(16, 8, &vpx_highbd_sad16x8x4d_c, 8),
  594. SadMxNx4Param(8, 16, &vpx_highbd_sad8x16x4d_c, 8),
  595. SadMxNx4Param(8, 8, &vpx_highbd_sad8x8x4d_c, 8),
  596. SadMxNx4Param(8, 4, &vpx_highbd_sad8x4x4d_c, 8),
  597. SadMxNx4Param(4, 8, &vpx_highbd_sad4x8x4d_c, 8),
  598. SadMxNx4Param(4, 4, &vpx_highbd_sad4x4x4d_c, 8),
  599. SadMxNx4Param(64, 64, &vpx_highbd_sad64x64x4d_c, 10),
  600. SadMxNx4Param(64, 32, &vpx_highbd_sad64x32x4d_c, 10),
  601. SadMxNx4Param(32, 64, &vpx_highbd_sad32x64x4d_c, 10),
  602. SadMxNx4Param(32, 32, &vpx_highbd_sad32x32x4d_c, 10),
  603. SadMxNx4Param(32, 16, &vpx_highbd_sad32x16x4d_c, 10),
  604. SadMxNx4Param(16, 32, &vpx_highbd_sad16x32x4d_c, 10),
  605. SadMxNx4Param(16, 16, &vpx_highbd_sad16x16x4d_c, 10),
  606. SadMxNx4Param(16, 8, &vpx_highbd_sad16x8x4d_c, 10),
  607. SadMxNx4Param(8, 16, &vpx_highbd_sad8x16x4d_c, 10),
  608. SadMxNx4Param(8, 8, &vpx_highbd_sad8x8x4d_c, 10),
  609. SadMxNx4Param(8, 4, &vpx_highbd_sad8x4x4d_c, 10),
  610. SadMxNx4Param(4, 8, &vpx_highbd_sad4x8x4d_c, 10),
  611. SadMxNx4Param(4, 4, &vpx_highbd_sad4x4x4d_c, 10),
  612. SadMxNx4Param(64, 64, &vpx_highbd_sad64x64x4d_c, 12),
  613. SadMxNx4Param(64, 32, &vpx_highbd_sad64x32x4d_c, 12),
  614. SadMxNx4Param(32, 64, &vpx_highbd_sad32x64x4d_c, 12),
  615. SadMxNx4Param(32, 32, &vpx_highbd_sad32x32x4d_c, 12),
  616. SadMxNx4Param(32, 16, &vpx_highbd_sad32x16x4d_c, 12),
  617. SadMxNx4Param(16, 32, &vpx_highbd_sad16x32x4d_c, 12),
  618. SadMxNx4Param(16, 16, &vpx_highbd_sad16x16x4d_c, 12),
  619. SadMxNx4Param(16, 8, &vpx_highbd_sad16x8x4d_c, 12),
  620. SadMxNx4Param(8, 16, &vpx_highbd_sad8x16x4d_c, 12),
  621. SadMxNx4Param(8, 8, &vpx_highbd_sad8x8x4d_c, 12),
  622. SadMxNx4Param(8, 4, &vpx_highbd_sad8x4x4d_c, 12),
  623. SadMxNx4Param(4, 8, &vpx_highbd_sad4x8x4d_c, 12),
  624. SadMxNx4Param(4, 4, &vpx_highbd_sad4x4x4d_c, 12),
  625. #endif // CONFIG_VP9_HIGHBITDEPTH
  626. };
  627. INSTANTIATE_TEST_CASE_P(C, SADx4Test, ::testing::ValuesIn(x4d_c_tests));
  628. //------------------------------------------------------------------------------
  629. // ARM functions
  630. #if HAVE_NEON
  631. const SadMxNParam neon_tests[] = {
  632. SadMxNParam(64, 64, &vpx_sad64x64_neon),
  633. SadMxNParam(64, 32, &vpx_sad64x32_neon),
  634. SadMxNParam(32, 32, &vpx_sad32x32_neon),
  635. SadMxNParam(16, 32, &vpx_sad16x32_neon),
  636. SadMxNParam(16, 16, &vpx_sad16x16_neon),
  637. SadMxNParam(16, 8, &vpx_sad16x8_neon),
  638. SadMxNParam(8, 16, &vpx_sad8x16_neon),
  639. SadMxNParam(8, 8, &vpx_sad8x8_neon),
  640. SadMxNParam(8, 4, &vpx_sad8x4_neon),
  641. SadMxNParam(4, 8, &vpx_sad4x8_neon),
  642. SadMxNParam(4, 4, &vpx_sad4x4_neon),
  643. };
  644. INSTANTIATE_TEST_CASE_P(NEON, SADTest, ::testing::ValuesIn(neon_tests));
  645. const SadMxNAvgParam avg_neon_tests[] = {
  646. SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_neon),
  647. SadMxNAvgParam(64, 32, &vpx_sad64x32_avg_neon),
  648. SadMxNAvgParam(32, 64, &vpx_sad32x64_avg_neon),
  649. SadMxNAvgParam(32, 32, &vpx_sad32x32_avg_neon),
  650. SadMxNAvgParam(32, 16, &vpx_sad32x16_avg_neon),
  651. SadMxNAvgParam(16, 32, &vpx_sad16x32_avg_neon),
  652. SadMxNAvgParam(16, 16, &vpx_sad16x16_avg_neon),
  653. SadMxNAvgParam(16, 8, &vpx_sad16x8_avg_neon),
  654. SadMxNAvgParam(8, 16, &vpx_sad8x16_avg_neon),
  655. SadMxNAvgParam(8, 8, &vpx_sad8x8_avg_neon),
  656. SadMxNAvgParam(8, 4, &vpx_sad8x4_avg_neon),
  657. SadMxNAvgParam(4, 8, &vpx_sad4x8_avg_neon),
  658. SadMxNAvgParam(4, 4, &vpx_sad4x4_avg_neon),
  659. };
  660. INSTANTIATE_TEST_CASE_P(NEON, SADavgTest, ::testing::ValuesIn(avg_neon_tests));
  661. const SadMxNx4Param x4d_neon_tests[] = {
  662. SadMxNx4Param(64, 64, &vpx_sad64x64x4d_neon),
  663. SadMxNx4Param(64, 32, &vpx_sad64x32x4d_neon),
  664. SadMxNx4Param(32, 64, &vpx_sad32x64x4d_neon),
  665. SadMxNx4Param(32, 32, &vpx_sad32x32x4d_neon),
  666. SadMxNx4Param(32, 16, &vpx_sad32x16x4d_neon),
  667. SadMxNx4Param(16, 32, &vpx_sad16x32x4d_neon),
  668. SadMxNx4Param(16, 16, &vpx_sad16x16x4d_neon),
  669. SadMxNx4Param(16, 8, &vpx_sad16x8x4d_neon),
  670. SadMxNx4Param(8, 16, &vpx_sad8x16x4d_neon),
  671. SadMxNx4Param(8, 8, &vpx_sad8x8x4d_neon),
  672. SadMxNx4Param(8, 4, &vpx_sad8x4x4d_neon),
  673. SadMxNx4Param(4, 8, &vpx_sad4x8x4d_neon),
  674. SadMxNx4Param(4, 4, &vpx_sad4x4x4d_neon),
  675. };
  676. INSTANTIATE_TEST_CASE_P(NEON, SADx4Test, ::testing::ValuesIn(x4d_neon_tests));
  677. #endif // HAVE_NEON
  678. //------------------------------------------------------------------------------
  679. // x86 functions
  680. #if HAVE_SSE2
  681. const SadMxNParam sse2_tests[] = {
  682. SadMxNParam(64, 64, &vpx_sad64x64_sse2),
  683. SadMxNParam(64, 32, &vpx_sad64x32_sse2),
  684. SadMxNParam(32, 64, &vpx_sad32x64_sse2),
  685. SadMxNParam(32, 32, &vpx_sad32x32_sse2),
  686. SadMxNParam(32, 16, &vpx_sad32x16_sse2),
  687. SadMxNParam(16, 32, &vpx_sad16x32_sse2),
  688. SadMxNParam(16, 16, &vpx_sad16x16_sse2),
  689. SadMxNParam(16, 8, &vpx_sad16x8_sse2),
  690. SadMxNParam(8, 16, &vpx_sad8x16_sse2),
  691. SadMxNParam(8, 8, &vpx_sad8x8_sse2),
  692. SadMxNParam(8, 4, &vpx_sad8x4_sse2),
  693. SadMxNParam(4, 8, &vpx_sad4x8_sse2),
  694. SadMxNParam(4, 4, &vpx_sad4x4_sse2),
  695. #if CONFIG_VP9_HIGHBITDEPTH
  696. SadMxNParam(64, 64, &vpx_highbd_sad64x64_sse2, 8),
  697. SadMxNParam(64, 32, &vpx_highbd_sad64x32_sse2, 8),
  698. SadMxNParam(32, 64, &vpx_highbd_sad32x64_sse2, 8),
  699. SadMxNParam(32, 32, &vpx_highbd_sad32x32_sse2, 8),
  700. SadMxNParam(32, 16, &vpx_highbd_sad32x16_sse2, 8),
  701. SadMxNParam(16, 32, &vpx_highbd_sad16x32_sse2, 8),
  702. SadMxNParam(16, 16, &vpx_highbd_sad16x16_sse2, 8),
  703. SadMxNParam(16, 8, &vpx_highbd_sad16x8_sse2, 8),
  704. SadMxNParam(8, 16, &vpx_highbd_sad8x16_sse2, 8),
  705. SadMxNParam(8, 8, &vpx_highbd_sad8x8_sse2, 8),
  706. SadMxNParam(8, 4, &vpx_highbd_sad8x4_sse2, 8),
  707. SadMxNParam(64, 64, &vpx_highbd_sad64x64_sse2, 10),
  708. SadMxNParam(64, 32, &vpx_highbd_sad64x32_sse2, 10),
  709. SadMxNParam(32, 64, &vpx_highbd_sad32x64_sse2, 10),
  710. SadMxNParam(32, 32, &vpx_highbd_sad32x32_sse2, 10),
  711. SadMxNParam(32, 16, &vpx_highbd_sad32x16_sse2, 10),
  712. SadMxNParam(16, 32, &vpx_highbd_sad16x32_sse2, 10),
  713. SadMxNParam(16, 16, &vpx_highbd_sad16x16_sse2, 10),
  714. SadMxNParam(16, 8, &vpx_highbd_sad16x8_sse2, 10),
  715. SadMxNParam(8, 16, &vpx_highbd_sad8x16_sse2, 10),
  716. SadMxNParam(8, 8, &vpx_highbd_sad8x8_sse2, 10),
  717. SadMxNParam(8, 4, &vpx_highbd_sad8x4_sse2, 10),
  718. SadMxNParam(64, 64, &vpx_highbd_sad64x64_sse2, 12),
  719. SadMxNParam(64, 32, &vpx_highbd_sad64x32_sse2, 12),
  720. SadMxNParam(32, 64, &vpx_highbd_sad32x64_sse2, 12),
  721. SadMxNParam(32, 32, &vpx_highbd_sad32x32_sse2, 12),
  722. SadMxNParam(32, 16, &vpx_highbd_sad32x16_sse2, 12),
  723. SadMxNParam(16, 32, &vpx_highbd_sad16x32_sse2, 12),
  724. SadMxNParam(16, 16, &vpx_highbd_sad16x16_sse2, 12),
  725. SadMxNParam(16, 8, &vpx_highbd_sad16x8_sse2, 12),
  726. SadMxNParam(8, 16, &vpx_highbd_sad8x16_sse2, 12),
  727. SadMxNParam(8, 8, &vpx_highbd_sad8x8_sse2, 12),
  728. SadMxNParam(8, 4, &vpx_highbd_sad8x4_sse2, 12),
  729. #endif // CONFIG_VP9_HIGHBITDEPTH
  730. };
  731. INSTANTIATE_TEST_CASE_P(SSE2, SADTest, ::testing::ValuesIn(sse2_tests));
  732. const SadMxNAvgParam avg_sse2_tests[] = {
  733. SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_sse2),
  734. SadMxNAvgParam(64, 32, &vpx_sad64x32_avg_sse2),
  735. SadMxNAvgParam(32, 64, &vpx_sad32x64_avg_sse2),
  736. SadMxNAvgParam(32, 32, &vpx_sad32x32_avg_sse2),
  737. SadMxNAvgParam(32, 16, &vpx_sad32x16_avg_sse2),
  738. SadMxNAvgParam(16, 32, &vpx_sad16x32_avg_sse2),
  739. SadMxNAvgParam(16, 16, &vpx_sad16x16_avg_sse2),
  740. SadMxNAvgParam(16, 8, &vpx_sad16x8_avg_sse2),
  741. SadMxNAvgParam(8, 16, &vpx_sad8x16_avg_sse2),
  742. SadMxNAvgParam(8, 8, &vpx_sad8x8_avg_sse2),
  743. SadMxNAvgParam(8, 4, &vpx_sad8x4_avg_sse2),
  744. SadMxNAvgParam(4, 8, &vpx_sad4x8_avg_sse2),
  745. SadMxNAvgParam(4, 4, &vpx_sad4x4_avg_sse2),
  746. #if CONFIG_VP9_HIGHBITDEPTH
  747. SadMxNAvgParam(64, 64, &vpx_highbd_sad64x64_avg_sse2, 8),
  748. SadMxNAvgParam(64, 32, &vpx_highbd_sad64x32_avg_sse2, 8),
  749. SadMxNAvgParam(32, 64, &vpx_highbd_sad32x64_avg_sse2, 8),
  750. SadMxNAvgParam(32, 32, &vpx_highbd_sad32x32_avg_sse2, 8),
  751. SadMxNAvgParam(32, 16, &vpx_highbd_sad32x16_avg_sse2, 8),
  752. SadMxNAvgParam(16, 32, &vpx_highbd_sad16x32_avg_sse2, 8),
  753. SadMxNAvgParam(16, 16, &vpx_highbd_sad16x16_avg_sse2, 8),
  754. SadMxNAvgParam(16, 8, &vpx_highbd_sad16x8_avg_sse2, 8),
  755. SadMxNAvgParam(8, 16, &vpx_highbd_sad8x16_avg_sse2, 8),
  756. SadMxNAvgParam(8, 8, &vpx_highbd_sad8x8_avg_sse2, 8),
  757. SadMxNAvgParam(8, 4, &vpx_highbd_sad8x4_avg_sse2, 8),
  758. SadMxNAvgParam(64, 64, &vpx_highbd_sad64x64_avg_sse2, 10),
  759. SadMxNAvgParam(64, 32, &vpx_highbd_sad64x32_avg_sse2, 10),
  760. SadMxNAvgParam(32, 64, &vpx_highbd_sad32x64_avg_sse2, 10),
  761. SadMxNAvgParam(32, 32, &vpx_highbd_sad32x32_avg_sse2, 10),
  762. SadMxNAvgParam(32, 16, &vpx_highbd_sad32x16_avg_sse2, 10),
  763. SadMxNAvgParam(16, 32, &vpx_highbd_sad16x32_avg_sse2, 10),
  764. SadMxNAvgParam(16, 16, &vpx_highbd_sad16x16_avg_sse2, 10),
  765. SadMxNAvgParam(16, 8, &vpx_highbd_sad16x8_avg_sse2, 10),
  766. SadMxNAvgParam(8, 16, &vpx_highbd_sad8x16_avg_sse2, 10),
  767. SadMxNAvgParam(8, 8, &vpx_highbd_sad8x8_avg_sse2, 10),
  768. SadMxNAvgParam(8, 4, &vpx_highbd_sad8x4_avg_sse2, 10),
  769. SadMxNAvgParam(64, 64, &vpx_highbd_sad64x64_avg_sse2, 12),
  770. SadMxNAvgParam(64, 32, &vpx_highbd_sad64x32_avg_sse2, 12),
  771. SadMxNAvgParam(32, 64, &vpx_highbd_sad32x64_avg_sse2, 12),
  772. SadMxNAvgParam(32, 32, &vpx_highbd_sad32x32_avg_sse2, 12),
  773. SadMxNAvgParam(32, 16, &vpx_highbd_sad32x16_avg_sse2, 12),
  774. SadMxNAvgParam(16, 32, &vpx_highbd_sad16x32_avg_sse2, 12),
  775. SadMxNAvgParam(16, 16, &vpx_highbd_sad16x16_avg_sse2, 12),
  776. SadMxNAvgParam(16, 8, &vpx_highbd_sad16x8_avg_sse2, 12),
  777. SadMxNAvgParam(8, 16, &vpx_highbd_sad8x16_avg_sse2, 12),
  778. SadMxNAvgParam(8, 8, &vpx_highbd_sad8x8_avg_sse2, 12),
  779. SadMxNAvgParam(8, 4, &vpx_highbd_sad8x4_avg_sse2, 12),
  780. #endif // CONFIG_VP9_HIGHBITDEPTH
  781. };
  782. INSTANTIATE_TEST_CASE_P(SSE2, SADavgTest, ::testing::ValuesIn(avg_sse2_tests));
  783. const SadMxNx4Param x4d_sse2_tests[] = {
  784. SadMxNx4Param(64, 64, &vpx_sad64x64x4d_sse2),
  785. SadMxNx4Param(64, 32, &vpx_sad64x32x4d_sse2),
  786. SadMxNx4Param(32, 64, &vpx_sad32x64x4d_sse2),
  787. SadMxNx4Param(32, 32, &vpx_sad32x32x4d_sse2),
  788. SadMxNx4Param(32, 16, &vpx_sad32x16x4d_sse2),
  789. SadMxNx4Param(16, 32, &vpx_sad16x32x4d_sse2),
  790. SadMxNx4Param(16, 16, &vpx_sad16x16x4d_sse2),
  791. SadMxNx4Param(16, 8, &vpx_sad16x8x4d_sse2),
  792. SadMxNx4Param(8, 16, &vpx_sad8x16x4d_sse2),
  793. SadMxNx4Param(8, 8, &vpx_sad8x8x4d_sse2),
  794. SadMxNx4Param(8, 4, &vpx_sad8x4x4d_sse2),
  795. SadMxNx4Param(4, 8, &vpx_sad4x8x4d_sse2),
  796. SadMxNx4Param(4, 4, &vpx_sad4x4x4d_sse2),
  797. #if CONFIG_VP9_HIGHBITDEPTH
  798. SadMxNx4Param(64, 64, &vpx_highbd_sad64x64x4d_sse2, 8),
  799. SadMxNx4Param(64, 32, &vpx_highbd_sad64x32x4d_sse2, 8),
  800. SadMxNx4Param(32, 64, &vpx_highbd_sad32x64x4d_sse2, 8),
  801. SadMxNx4Param(32, 32, &vpx_highbd_sad32x32x4d_sse2, 8),
  802. SadMxNx4Param(32, 16, &vpx_highbd_sad32x16x4d_sse2, 8),
  803. SadMxNx4Param(16, 32, &vpx_highbd_sad16x32x4d_sse2, 8),
  804. SadMxNx4Param(16, 16, &vpx_highbd_sad16x16x4d_sse2, 8),
  805. SadMxNx4Param(16, 8, &vpx_highbd_sad16x8x4d_sse2, 8),
  806. SadMxNx4Param(8, 16, &vpx_highbd_sad8x16x4d_sse2, 8),
  807. SadMxNx4Param(8, 8, &vpx_highbd_sad8x8x4d_sse2, 8),
  808. SadMxNx4Param(8, 4, &vpx_highbd_sad8x4x4d_sse2, 8),
  809. SadMxNx4Param(4, 8, &vpx_highbd_sad4x8x4d_sse2, 8),
  810. SadMxNx4Param(4, 4, &vpx_highbd_sad4x4x4d_sse2, 8),
  811. SadMxNx4Param(64, 64, &vpx_highbd_sad64x64x4d_sse2, 10),
  812. SadMxNx4Param(64, 32, &vpx_highbd_sad64x32x4d_sse2, 10),
  813. SadMxNx4Param(32, 64, &vpx_highbd_sad32x64x4d_sse2, 10),
  814. SadMxNx4Param(32, 32, &vpx_highbd_sad32x32x4d_sse2, 10),
  815. SadMxNx4Param(32, 16, &vpx_highbd_sad32x16x4d_sse2, 10),
  816. SadMxNx4Param(16, 32, &vpx_highbd_sad16x32x4d_sse2, 10),
  817. SadMxNx4Param(16, 16, &vpx_highbd_sad16x16x4d_sse2, 10),
  818. SadMxNx4Param(16, 8, &vpx_highbd_sad16x8x4d_sse2, 10),
  819. SadMxNx4Param(8, 16, &vpx_highbd_sad8x16x4d_sse2, 10),
  820. SadMxNx4Param(8, 8, &vpx_highbd_sad8x8x4d_sse2, 10),
  821. SadMxNx4Param(8, 4, &vpx_highbd_sad8x4x4d_sse2, 10),
  822. SadMxNx4Param(4, 8, &vpx_highbd_sad4x8x4d_sse2, 10),
  823. SadMxNx4Param(4, 4, &vpx_highbd_sad4x4x4d_sse2, 10),
  824. SadMxNx4Param(64, 64, &vpx_highbd_sad64x64x4d_sse2, 12),
  825. SadMxNx4Param(64, 32, &vpx_highbd_sad64x32x4d_sse2, 12),
  826. SadMxNx4Param(32, 64, &vpx_highbd_sad32x64x4d_sse2, 12),
  827. SadMxNx4Param(32, 32, &vpx_highbd_sad32x32x4d_sse2, 12),
  828. SadMxNx4Param(32, 16, &vpx_highbd_sad32x16x4d_sse2, 12),
  829. SadMxNx4Param(16, 32, &vpx_highbd_sad16x32x4d_sse2, 12),
  830. SadMxNx4Param(16, 16, &vpx_highbd_sad16x16x4d_sse2, 12),
  831. SadMxNx4Param(16, 8, &vpx_highbd_sad16x8x4d_sse2, 12),
  832. SadMxNx4Param(8, 16, &vpx_highbd_sad8x16x4d_sse2, 12),
  833. SadMxNx4Param(8, 8, &vpx_highbd_sad8x8x4d_sse2, 12),
  834. SadMxNx4Param(8, 4, &vpx_highbd_sad8x4x4d_sse2, 12),
  835. SadMxNx4Param(4, 8, &vpx_highbd_sad4x8x4d_sse2, 12),
  836. SadMxNx4Param(4, 4, &vpx_highbd_sad4x4x4d_sse2, 12),
  837. #endif // CONFIG_VP9_HIGHBITDEPTH
  838. };
  839. INSTANTIATE_TEST_CASE_P(SSE2, SADx4Test, ::testing::ValuesIn(x4d_sse2_tests));
  840. #endif // HAVE_SSE2
  841. #if HAVE_SSE3
  842. // Only functions are x3, which do not have tests.
  843. #endif // HAVE_SSE3
  844. #if HAVE_SSSE3
  845. // Only functions are x3, which do not have tests.
  846. #endif // HAVE_SSSE3
  847. #if HAVE_SSE4_1
  848. // Only functions are x8, which do not have tests.
  849. #endif // HAVE_SSE4_1
  850. #if HAVE_AVX2
  851. const SadMxNParam avx2_tests[] = {
  852. SadMxNParam(64, 64, &vpx_sad64x64_avx2),
  853. SadMxNParam(64, 32, &vpx_sad64x32_avx2),
  854. SadMxNParam(32, 64, &vpx_sad32x64_avx2),
  855. SadMxNParam(32, 32, &vpx_sad32x32_avx2),
  856. SadMxNParam(32, 16, &vpx_sad32x16_avx2),
  857. };
  858. INSTANTIATE_TEST_CASE_P(AVX2, SADTest, ::testing::ValuesIn(avx2_tests));
  859. const SadMxNAvgParam avg_avx2_tests[] = {
  860. SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_avx2),
  861. SadMxNAvgParam(64, 32, &vpx_sad64x32_avg_avx2),
  862. SadMxNAvgParam(32, 64, &vpx_sad32x64_avg_avx2),
  863. SadMxNAvgParam(32, 32, &vpx_sad32x32_avg_avx2),
  864. SadMxNAvgParam(32, 16, &vpx_sad32x16_avg_avx2),
  865. };
  866. INSTANTIATE_TEST_CASE_P(AVX2, SADavgTest, ::testing::ValuesIn(avg_avx2_tests));
  867. const SadMxNx4Param x4d_avx2_tests[] = {
  868. SadMxNx4Param(64, 64, &vpx_sad64x64x4d_avx2),
  869. SadMxNx4Param(32, 32, &vpx_sad32x32x4d_avx2),
  870. };
  871. INSTANTIATE_TEST_CASE_P(AVX2, SADx4Test, ::testing::ValuesIn(x4d_avx2_tests));
  872. #endif // HAVE_AVX2
  873. #if HAVE_AVX512
  874. const SadMxNx4Param x4d_avx512_tests[] = {
  875. SadMxNx4Param(64, 64, &vpx_sad64x64x4d_avx512),
  876. };
  877. INSTANTIATE_TEST_CASE_P(AVX512, SADx4Test,
  878. ::testing::ValuesIn(x4d_avx512_tests));
  879. #endif // HAVE_AVX512
  880. //------------------------------------------------------------------------------
  881. // MIPS functions
  882. #if HAVE_MSA
  883. const SadMxNParam msa_tests[] = {
  884. SadMxNParam(64, 64, &vpx_sad64x64_msa),
  885. SadMxNParam(64, 32, &vpx_sad64x32_msa),
  886. SadMxNParam(32, 64, &vpx_sad32x64_msa),
  887. SadMxNParam(32, 32, &vpx_sad32x32_msa),
  888. SadMxNParam(32, 16, &vpx_sad32x16_msa),
  889. SadMxNParam(16, 32, &vpx_sad16x32_msa),
  890. SadMxNParam(16, 16, &vpx_sad16x16_msa),
  891. SadMxNParam(16, 8, &vpx_sad16x8_msa),
  892. SadMxNParam(8, 16, &vpx_sad8x16_msa),
  893. SadMxNParam(8, 8, &vpx_sad8x8_msa),
  894. SadMxNParam(8, 4, &vpx_sad8x4_msa),
  895. SadMxNParam(4, 8, &vpx_sad4x8_msa),
  896. SadMxNParam(4, 4, &vpx_sad4x4_msa),
  897. };
  898. INSTANTIATE_TEST_CASE_P(MSA, SADTest, ::testing::ValuesIn(msa_tests));
  899. const SadMxNAvgParam avg_msa_tests[] = {
  900. SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_msa),
  901. SadMxNAvgParam(64, 32, &vpx_sad64x32_avg_msa),
  902. SadMxNAvgParam(32, 64, &vpx_sad32x64_avg_msa),
  903. SadMxNAvgParam(32, 32, &vpx_sad32x32_avg_msa),
  904. SadMxNAvgParam(32, 16, &vpx_sad32x16_avg_msa),
  905. SadMxNAvgParam(16, 32, &vpx_sad16x32_avg_msa),
  906. SadMxNAvgParam(16, 16, &vpx_sad16x16_avg_msa),
  907. SadMxNAvgParam(16, 8, &vpx_sad16x8_avg_msa),
  908. SadMxNAvgParam(8, 16, &vpx_sad8x16_avg_msa),
  909. SadMxNAvgParam(8, 8, &vpx_sad8x8_avg_msa),
  910. SadMxNAvgParam(8, 4, &vpx_sad8x4_avg_msa),
  911. SadMxNAvgParam(4, 8, &vpx_sad4x8_avg_msa),
  912. SadMxNAvgParam(4, 4, &vpx_sad4x4_avg_msa),
  913. };
  914. INSTANTIATE_TEST_CASE_P(MSA, SADavgTest, ::testing::ValuesIn(avg_msa_tests));
  915. const SadMxNx4Param x4d_msa_tests[] = {
  916. SadMxNx4Param(64, 64, &vpx_sad64x64x4d_msa),
  917. SadMxNx4Param(64, 32, &vpx_sad64x32x4d_msa),
  918. SadMxNx4Param(32, 64, &vpx_sad32x64x4d_msa),
  919. SadMxNx4Param(32, 32, &vpx_sad32x32x4d_msa),
  920. SadMxNx4Param(32, 16, &vpx_sad32x16x4d_msa),
  921. SadMxNx4Param(16, 32, &vpx_sad16x32x4d_msa),
  922. SadMxNx4Param(16, 16, &vpx_sad16x16x4d_msa),
  923. SadMxNx4Param(16, 8, &vpx_sad16x8x4d_msa),
  924. SadMxNx4Param(8, 16, &vpx_sad8x16x4d_msa),
  925. SadMxNx4Param(8, 8, &vpx_sad8x8x4d_msa),
  926. SadMxNx4Param(8, 4, &vpx_sad8x4x4d_msa),
  927. SadMxNx4Param(4, 8, &vpx_sad4x8x4d_msa),
  928. SadMxNx4Param(4, 4, &vpx_sad4x4x4d_msa),
  929. };
  930. INSTANTIATE_TEST_CASE_P(MSA, SADx4Test, ::testing::ValuesIn(x4d_msa_tests));
  931. #endif // HAVE_MSA
  932. //------------------------------------------------------------------------------
  933. // VSX functions
  934. #if HAVE_VSX
  935. const SadMxNParam vsx_tests[] = {
  936. SadMxNParam(64, 64, &vpx_sad64x64_vsx),
  937. SadMxNParam(64, 32, &vpx_sad64x32_vsx),
  938. SadMxNParam(32, 64, &vpx_sad32x64_vsx),
  939. SadMxNParam(32, 32, &vpx_sad32x32_vsx),
  940. SadMxNParam(32, 16, &vpx_sad32x16_vsx),
  941. SadMxNParam(16, 32, &vpx_sad16x32_vsx),
  942. SadMxNParam(16, 16, &vpx_sad16x16_vsx),
  943. SadMxNParam(16, 8, &vpx_sad16x8_vsx),
  944. SadMxNParam(8, 16, &vpx_sad8x16_vsx),
  945. SadMxNParam(8, 8, &vpx_sad8x8_vsx),
  946. SadMxNParam(8, 4, &vpx_sad8x4_vsx),
  947. };
  948. INSTANTIATE_TEST_CASE_P(VSX, SADTest, ::testing::ValuesIn(vsx_tests));
  949. const SadMxNAvgParam avg_vsx_tests[] = {
  950. SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_vsx),
  951. SadMxNAvgParam(64, 32, &vpx_sad64x32_avg_vsx),
  952. SadMxNAvgParam(32, 64, &vpx_sad32x64_avg_vsx),
  953. SadMxNAvgParam(32, 32, &vpx_sad32x32_avg_vsx),
  954. SadMxNAvgParam(32, 16, &vpx_sad32x16_avg_vsx),
  955. SadMxNAvgParam(16, 32, &vpx_sad16x32_avg_vsx),
  956. SadMxNAvgParam(16, 16, &vpx_sad16x16_avg_vsx),
  957. SadMxNAvgParam(16, 8, &vpx_sad16x8_avg_vsx),
  958. };
  959. INSTANTIATE_TEST_CASE_P(VSX, SADavgTest, ::testing::ValuesIn(avg_vsx_tests));
  960. const SadMxNx4Param x4d_vsx_tests[] = {
  961. SadMxNx4Param(64, 64, &vpx_sad64x64x4d_vsx),
  962. SadMxNx4Param(64, 32, &vpx_sad64x32x4d_vsx),
  963. SadMxNx4Param(32, 64, &vpx_sad32x64x4d_vsx),
  964. SadMxNx4Param(32, 32, &vpx_sad32x32x4d_vsx),
  965. SadMxNx4Param(32, 16, &vpx_sad32x16x4d_vsx),
  966. SadMxNx4Param(16, 32, &vpx_sad16x32x4d_vsx),
  967. SadMxNx4Param(16, 16, &vpx_sad16x16x4d_vsx),
  968. SadMxNx4Param(16, 8, &vpx_sad16x8x4d_vsx),
  969. };
  970. INSTANTIATE_TEST_CASE_P(VSX, SADx4Test, ::testing::ValuesIn(x4d_vsx_tests));
  971. #endif // HAVE_VSX
  972. //------------------------------------------------------------------------------
  973. // Loongson functions
  974. #if HAVE_MMI
  975. const SadMxNParam mmi_tests[] = {
  976. SadMxNParam(64, 64, &vpx_sad64x64_mmi),
  977. SadMxNParam(64, 32, &vpx_sad64x32_mmi),
  978. SadMxNParam(32, 64, &vpx_sad32x64_mmi),
  979. SadMxNParam(32, 32, &vpx_sad32x32_mmi),
  980. SadMxNParam(32, 16, &vpx_sad32x16_mmi),
  981. SadMxNParam(16, 32, &vpx_sad16x32_mmi),
  982. SadMxNParam(16, 16, &vpx_sad16x16_mmi),
  983. SadMxNParam(16, 8, &vpx_sad16x8_mmi),
  984. SadMxNParam(8, 16, &vpx_sad8x16_mmi),
  985. SadMxNParam(8, 8, &vpx_sad8x8_mmi),
  986. SadMxNParam(8, 4, &vpx_sad8x4_mmi),
  987. SadMxNParam(4, 8, &vpx_sad4x8_mmi),
  988. SadMxNParam(4, 4, &vpx_sad4x4_mmi),
  989. };
  990. INSTANTIATE_TEST_CASE_P(MMI, SADTest, ::testing::ValuesIn(mmi_tests));
  991. const SadMxNAvgParam avg_mmi_tests[] = {
  992. SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_mmi),
  993. SadMxNAvgParam(64, 32, &vpx_sad64x32_avg_mmi),
  994. SadMxNAvgParam(32, 64, &vpx_sad32x64_avg_mmi),
  995. SadMxNAvgParam(32, 32, &vpx_sad32x32_avg_mmi),
  996. SadMxNAvgParam(32, 16, &vpx_sad32x16_avg_mmi),
  997. SadMxNAvgParam(16, 32, &vpx_sad16x32_avg_mmi),
  998. SadMxNAvgParam(16, 16, &vpx_sad16x16_avg_mmi),
  999. SadMxNAvgParam(16, 8, &vpx_sad16x8_avg_mmi),
  1000. SadMxNAvgParam(8, 16, &vpx_sad8x16_avg_mmi),
  1001. SadMxNAvgParam(8, 8, &vpx_sad8x8_avg_mmi),
  1002. SadMxNAvgParam(8, 4, &vpx_sad8x4_avg_mmi),
  1003. SadMxNAvgParam(4, 8, &vpx_sad4x8_avg_mmi),
  1004. SadMxNAvgParam(4, 4, &vpx_sad4x4_avg_mmi),
  1005. };
  1006. INSTANTIATE_TEST_CASE_P(MMI, SADavgTest, ::testing::ValuesIn(avg_mmi_tests));
  1007. const SadMxNx4Param x4d_mmi_tests[] = {
  1008. SadMxNx4Param(64, 64, &vpx_sad64x64x4d_mmi),
  1009. SadMxNx4Param(64, 32, &vpx_sad64x32x4d_mmi),
  1010. SadMxNx4Param(32, 64, &vpx_sad32x64x4d_mmi),
  1011. SadMxNx4Param(32, 32, &vpx_sad32x32x4d_mmi),
  1012. SadMxNx4Param(32, 16, &vpx_sad32x16x4d_mmi),
  1013. SadMxNx4Param(16, 32, &vpx_sad16x32x4d_mmi),
  1014. SadMxNx4Param(16, 16, &vpx_sad16x16x4d_mmi),
  1015. SadMxNx4Param(16, 8, &vpx_sad16x8x4d_mmi),
  1016. SadMxNx4Param(8, 16, &vpx_sad8x16x4d_mmi),
  1017. SadMxNx4Param(8, 8, &vpx_sad8x8x4d_mmi),
  1018. SadMxNx4Param(8, 4, &vpx_sad8x4x4d_mmi),
  1019. SadMxNx4Param(4, 8, &vpx_sad4x8x4d_mmi),
  1020. SadMxNx4Param(4, 4, &vpx_sad4x4x4d_mmi),
  1021. };
  1022. INSTANTIATE_TEST_CASE_P(MMI, SADx4Test, ::testing::ValuesIn(x4d_mmi_tests));
  1023. #endif // HAVE_MMI
  1024. } // namespace