test_intra_pred_speed.cc 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. /*
  2. * Copyright (c) 2015 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. // Test and time VPX intra-predictor functions
  11. #include <stdio.h>
  12. #include <string.h>
  13. #include "third_party/googletest/src/include/gtest/gtest.h"
  14. #include "./vpx_dsp_rtcd.h"
  15. #include "test/acm_random.h"
  16. #include "test/clear_system_state.h"
  17. #include "test/md5_helper.h"
  18. #include "vpx/vpx_integer.h"
  19. #include "vpx_ports/mem.h"
  20. #include "vpx_ports/vpx_timer.h"
  21. // -----------------------------------------------------------------------------
  22. namespace {
  23. typedef void (*VpxPredFunc)(uint8_t *dst, ptrdiff_t y_stride,
  24. const uint8_t *above, const uint8_t *left);
  25. const int kBPS = 32;
  26. const int kTotalPixels = 32 * kBPS;
  27. const int kNumVp9IntraPredFuncs = 13;
  28. const char *kVp9IntraPredNames[kNumVp9IntraPredFuncs] = {
  29. "DC_PRED", "DC_LEFT_PRED", "DC_TOP_PRED", "DC_128_PRED", "V_PRED",
  30. "H_PRED", "D45_PRED", "D135_PRED", "D117_PRED", "D153_PRED",
  31. "D207_PRED", "D63_PRED", "TM_PRED"
  32. };
  33. template <typename Pixel>
  34. struct IntraPredTestMem {
  35. void Init(int block_size, int bd) {
  36. libvpx_test::ACMRandom rnd(libvpx_test::ACMRandom::DeterministicSeed());
  37. Pixel *const above = above_mem + 16;
  38. const int mask = (1 << bd) - 1;
  39. for (int i = 0; i < kTotalPixels; ++i) ref_src[i] = rnd.Rand16() & mask;
  40. for (int i = 0; i < kBPS; ++i) left[i] = rnd.Rand16() & mask;
  41. for (int i = -1; i < kBPS; ++i) above[i] = rnd.Rand16() & mask;
  42. // some code assumes the top row has been extended:
  43. // d45/d63 C-code, for instance, but not the assembly.
  44. // TODO(jzern): this style of extension isn't strictly necessary.
  45. ASSERT_LE(block_size, kBPS);
  46. for (int i = block_size; i < 2 * kBPS; ++i) {
  47. above[i] = above[block_size - 1];
  48. }
  49. }
  50. DECLARE_ALIGNED(16, Pixel, src[kTotalPixels]);
  51. DECLARE_ALIGNED(16, Pixel, ref_src[kTotalPixels]);
  52. DECLARE_ALIGNED(16, Pixel, left[kBPS]);
  53. DECLARE_ALIGNED(16, Pixel, above_mem[2 * kBPS + 16]);
  54. };
  55. typedef IntraPredTestMem<uint8_t> Vp9IntraPredTestMem;
  56. void CheckMd5Signature(const char name[], const char *const signatures[],
  57. const void *data, size_t data_size, int elapsed_time,
  58. int idx) {
  59. libvpx_test::MD5 md5;
  60. md5.Add(reinterpret_cast<const uint8_t *>(data), data_size);
  61. printf("Mode %s[%12s]: %5d ms MD5: %s\n", name, kVp9IntraPredNames[idx],
  62. elapsed_time, md5.Get());
  63. EXPECT_STREQ(signatures[idx], md5.Get());
  64. }
  65. void TestIntraPred(const char name[], VpxPredFunc const *pred_funcs,
  66. const char *const signatures[], int block_size) {
  67. const int kNumTests = static_cast<int>(
  68. 2.e10 / (block_size * block_size * kNumVp9IntraPredFuncs));
  69. Vp9IntraPredTestMem intra_pred_test_mem;
  70. const uint8_t *const above = intra_pred_test_mem.above_mem + 16;
  71. intra_pred_test_mem.Init(block_size, 8);
  72. for (int k = 0; k < kNumVp9IntraPredFuncs; ++k) {
  73. if (pred_funcs[k] == NULL) continue;
  74. memcpy(intra_pred_test_mem.src, intra_pred_test_mem.ref_src,
  75. sizeof(intra_pred_test_mem.src));
  76. vpx_usec_timer timer;
  77. vpx_usec_timer_start(&timer);
  78. for (int num_tests = 0; num_tests < kNumTests; ++num_tests) {
  79. pred_funcs[k](intra_pred_test_mem.src, kBPS, above,
  80. intra_pred_test_mem.left);
  81. }
  82. libvpx_test::ClearSystemState();
  83. vpx_usec_timer_mark(&timer);
  84. const int elapsed_time =
  85. static_cast<int>(vpx_usec_timer_elapsed(&timer) / 1000);
  86. CheckMd5Signature(name, signatures, intra_pred_test_mem.src,
  87. sizeof(intra_pred_test_mem.src), elapsed_time, k);
  88. }
  89. }
  90. void TestIntraPred4(VpxPredFunc const *pred_funcs) {
  91. static const char *const kSignatures[kNumVp9IntraPredFuncs] = {
  92. "e7ed7353c3383fff942e500e9bfe82fe", "2a4a26fcc6ce005eadc08354d196c8a9",
  93. "269d92eff86f315d9c38fe7640d85b15", "ae2960eea9f71ee3dabe08b282ec1773",
  94. "6c1abcc44e90148998b51acd11144e9c", "f7bb3186e1ef8a2b326037ff898cad8e",
  95. "364c1f3fb2f445f935aec2a70a67eaa4", "141624072a4a56773f68fadbdd07c4a7",
  96. "7be49b08687a5f24df3a2c612fca3876", "459bb5d9fd5b238348179c9a22108cd6",
  97. "73edb8831bf1bdfce21ae8eaa43b1234", "2e2457f2009c701a355a8b25eb74fcda",
  98. "52ae4e8bdbe41494c1f43051d4dd7f0b"
  99. };
  100. TestIntraPred("Intra4", pred_funcs, kSignatures, 4);
  101. }
  102. void TestIntraPred8(VpxPredFunc const *pred_funcs) {
  103. static const char *const kSignatures[kNumVp9IntraPredFuncs] = {
  104. "d8bbae5d6547cfc17e4f5f44c8730e88", "373bab6d931868d41a601d9d88ce9ac3",
  105. "6fdd5ff4ff79656c14747598ca9e3706", "d9661c2811d6a73674f40ffb2b841847",
  106. "7c722d10b19ccff0b8c171868e747385", "f81dd986eb2b50f750d3a7da716b7e27",
  107. "d500f2c8fc78f46a4c74e4dcf51f14fb", "0e3523f9cab2142dd37fd07ec0760bce",
  108. "79ac4efe907f0a0f1885d43066cfedee", "19ecf2432ac305057de3b6578474eec6",
  109. "4f985b61acc6dd5d2d2585fa89ea2e2d", "f1bb25a9060dd262f405f15a38f5f674",
  110. "209ea00801584829e9a0f7be7d4a74ba"
  111. };
  112. TestIntraPred("Intra8", pred_funcs, kSignatures, 8);
  113. }
  114. void TestIntraPred16(VpxPredFunc const *pred_funcs) {
  115. static const char *const kSignatures[kNumVp9IntraPredFuncs] = {
  116. "50971c07ce26977d30298538fffec619", "527a6b9e0dc5b21b98cf276305432bef",
  117. "7eff2868f80ebc2c43a4f367281d80f7", "67cd60512b54964ef6aff1bd4816d922",
  118. "48371c87dc95c08a33b2048f89cf6468", "b0acf2872ee411d7530af6d2625a7084",
  119. "f32aafed4d8d3776ed58bcb6188756d5", "dae208f3dca583529cff49b73f7c4183",
  120. "7af66a2f4c8e0b4908e40f047e60c47c", "125e3ab6ab9bc961f183ec366a7afa88",
  121. "6b90f25b23983c35386b9fd704427622", "f8d6b11d710edc136a7c62c917435f93",
  122. "ed308f18614a362917f411c218aee532"
  123. };
  124. TestIntraPred("Intra16", pred_funcs, kSignatures, 16);
  125. }
  126. void TestIntraPred32(VpxPredFunc const *pred_funcs) {
  127. static const char *const kSignatures[kNumVp9IntraPredFuncs] = {
  128. "a0a618c900e65ae521ccc8af789729f2", "985aaa7c72b4a6c2fb431d32100cf13a",
  129. "10662d09febc3ca13ee4e700120daeb5", "b3b01379ba08916ef6b1b35f7d9ad51c",
  130. "9f4261755795af97e34679c333ec7004", "bc2c9da91ad97ef0d1610fb0a9041657",
  131. "75c79b1362ad18abfcdb1aa0aacfc21d", "4039bb7da0f6860090d3c57b5c85468f",
  132. "b29fff7b61804e68383e3a609b33da58", "e1aa5e49067fd8dba66c2eb8d07b7a89",
  133. "4e042822909c1c06d3b10a88281df1eb", "72eb9d9e0e67c93f4c66b70348e9fef7",
  134. "a22d102bcb51ca798aac12ca4ae8f2e8"
  135. };
  136. TestIntraPred("Intra32", pred_funcs, kSignatures, 32);
  137. }
  138. } // namespace
  139. // Defines a test case for |arch| (e.g., C, SSE2, ...) passing the predictors
  140. // to |test_func|. The test name is 'arch.test_func', e.g., C.TestIntraPred4.
  141. #define INTRA_PRED_TEST(arch, test_func, dc, dc_left, dc_top, dc_128, v, h, \
  142. d45, d135, d117, d153, d207, d63, tm) \
  143. TEST(arch, test_func) { \
  144. static const VpxPredFunc vpx_intra_pred[] = { \
  145. dc, dc_left, dc_top, dc_128, v, h, d45, d135, d117, d153, d207, d63, tm \
  146. }; \
  147. test_func(vpx_intra_pred); \
  148. }
  149. // -----------------------------------------------------------------------------
  150. INTRA_PRED_TEST(C, TestIntraPred4, vpx_dc_predictor_4x4_c,
  151. vpx_dc_left_predictor_4x4_c, vpx_dc_top_predictor_4x4_c,
  152. vpx_dc_128_predictor_4x4_c, vpx_v_predictor_4x4_c,
  153. vpx_h_predictor_4x4_c, vpx_d45_predictor_4x4_c,
  154. vpx_d135_predictor_4x4_c, vpx_d117_predictor_4x4_c,
  155. vpx_d153_predictor_4x4_c, vpx_d207_predictor_4x4_c,
  156. vpx_d63_predictor_4x4_c, vpx_tm_predictor_4x4_c)
  157. INTRA_PRED_TEST(C, TestIntraPred8, vpx_dc_predictor_8x8_c,
  158. vpx_dc_left_predictor_8x8_c, vpx_dc_top_predictor_8x8_c,
  159. vpx_dc_128_predictor_8x8_c, vpx_v_predictor_8x8_c,
  160. vpx_h_predictor_8x8_c, vpx_d45_predictor_8x8_c,
  161. vpx_d135_predictor_8x8_c, vpx_d117_predictor_8x8_c,
  162. vpx_d153_predictor_8x8_c, vpx_d207_predictor_8x8_c,
  163. vpx_d63_predictor_8x8_c, vpx_tm_predictor_8x8_c)
  164. INTRA_PRED_TEST(C, TestIntraPred16, vpx_dc_predictor_16x16_c,
  165. vpx_dc_left_predictor_16x16_c, vpx_dc_top_predictor_16x16_c,
  166. vpx_dc_128_predictor_16x16_c, vpx_v_predictor_16x16_c,
  167. vpx_h_predictor_16x16_c, vpx_d45_predictor_16x16_c,
  168. vpx_d135_predictor_16x16_c, vpx_d117_predictor_16x16_c,
  169. vpx_d153_predictor_16x16_c, vpx_d207_predictor_16x16_c,
  170. vpx_d63_predictor_16x16_c, vpx_tm_predictor_16x16_c)
  171. INTRA_PRED_TEST(C, TestIntraPred32, vpx_dc_predictor_32x32_c,
  172. vpx_dc_left_predictor_32x32_c, vpx_dc_top_predictor_32x32_c,
  173. vpx_dc_128_predictor_32x32_c, vpx_v_predictor_32x32_c,
  174. vpx_h_predictor_32x32_c, vpx_d45_predictor_32x32_c,
  175. vpx_d135_predictor_32x32_c, vpx_d117_predictor_32x32_c,
  176. vpx_d153_predictor_32x32_c, vpx_d207_predictor_32x32_c,
  177. vpx_d63_predictor_32x32_c, vpx_tm_predictor_32x32_c)
  178. #if HAVE_SSE2
  179. INTRA_PRED_TEST(SSE2, TestIntraPred4, vpx_dc_predictor_4x4_sse2,
  180. vpx_dc_left_predictor_4x4_sse2, vpx_dc_top_predictor_4x4_sse2,
  181. vpx_dc_128_predictor_4x4_sse2, vpx_v_predictor_4x4_sse2,
  182. vpx_h_predictor_4x4_sse2, vpx_d45_predictor_4x4_sse2, NULL,
  183. NULL, NULL, vpx_d207_predictor_4x4_sse2, NULL,
  184. vpx_tm_predictor_4x4_sse2)
  185. INTRA_PRED_TEST(SSE2, TestIntraPred8, vpx_dc_predictor_8x8_sse2,
  186. vpx_dc_left_predictor_8x8_sse2, vpx_dc_top_predictor_8x8_sse2,
  187. vpx_dc_128_predictor_8x8_sse2, vpx_v_predictor_8x8_sse2,
  188. vpx_h_predictor_8x8_sse2, vpx_d45_predictor_8x8_sse2, NULL,
  189. NULL, NULL, NULL, NULL, vpx_tm_predictor_8x8_sse2)
  190. INTRA_PRED_TEST(SSE2, TestIntraPred16, vpx_dc_predictor_16x16_sse2,
  191. vpx_dc_left_predictor_16x16_sse2,
  192. vpx_dc_top_predictor_16x16_sse2,
  193. vpx_dc_128_predictor_16x16_sse2, vpx_v_predictor_16x16_sse2,
  194. vpx_h_predictor_16x16_sse2, NULL, NULL, NULL, NULL, NULL, NULL,
  195. vpx_tm_predictor_16x16_sse2)
  196. INTRA_PRED_TEST(SSE2, TestIntraPred32, vpx_dc_predictor_32x32_sse2,
  197. vpx_dc_left_predictor_32x32_sse2,
  198. vpx_dc_top_predictor_32x32_sse2,
  199. vpx_dc_128_predictor_32x32_sse2, vpx_v_predictor_32x32_sse2,
  200. vpx_h_predictor_32x32_sse2, NULL, NULL, NULL, NULL, NULL, NULL,
  201. vpx_tm_predictor_32x32_sse2)
  202. #endif // HAVE_SSE2
  203. #if HAVE_SSSE3
  204. INTRA_PRED_TEST(SSSE3, TestIntraPred4, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
  205. NULL, NULL, vpx_d153_predictor_4x4_ssse3, NULL,
  206. vpx_d63_predictor_4x4_ssse3, NULL)
  207. INTRA_PRED_TEST(SSSE3, TestIntraPred8, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
  208. NULL, NULL, vpx_d153_predictor_8x8_ssse3,
  209. vpx_d207_predictor_8x8_ssse3, vpx_d63_predictor_8x8_ssse3, NULL)
  210. INTRA_PRED_TEST(SSSE3, TestIntraPred16, NULL, NULL, NULL, NULL, NULL, NULL,
  211. vpx_d45_predictor_16x16_ssse3, NULL, NULL,
  212. vpx_d153_predictor_16x16_ssse3, vpx_d207_predictor_16x16_ssse3,
  213. vpx_d63_predictor_16x16_ssse3, NULL)
  214. INTRA_PRED_TEST(SSSE3, TestIntraPred32, NULL, NULL, NULL, NULL, NULL, NULL,
  215. vpx_d45_predictor_32x32_ssse3, NULL, NULL,
  216. vpx_d153_predictor_32x32_ssse3, vpx_d207_predictor_32x32_ssse3,
  217. vpx_d63_predictor_32x32_ssse3, NULL)
  218. #endif // HAVE_SSSE3
  219. #if HAVE_DSPR2
  220. INTRA_PRED_TEST(DSPR2, TestIntraPred4, vpx_dc_predictor_4x4_dspr2, NULL, NULL,
  221. NULL, NULL, vpx_h_predictor_4x4_dspr2, NULL, NULL, NULL, NULL,
  222. NULL, NULL, vpx_tm_predictor_4x4_dspr2)
  223. INTRA_PRED_TEST(DSPR2, TestIntraPred8, vpx_dc_predictor_8x8_dspr2, NULL, NULL,
  224. NULL, NULL, vpx_h_predictor_8x8_dspr2, NULL, NULL, NULL, NULL,
  225. NULL, NULL, vpx_tm_predictor_8x8_c)
  226. INTRA_PRED_TEST(DSPR2, TestIntraPred16, vpx_dc_predictor_16x16_dspr2, NULL,
  227. NULL, NULL, NULL, vpx_h_predictor_16x16_dspr2, NULL, NULL, NULL,
  228. NULL, NULL, NULL, NULL)
  229. #endif // HAVE_DSPR2
  230. #if HAVE_NEON
  231. INTRA_PRED_TEST(NEON, TestIntraPred4, vpx_dc_predictor_4x4_neon,
  232. vpx_dc_left_predictor_4x4_neon, vpx_dc_top_predictor_4x4_neon,
  233. vpx_dc_128_predictor_4x4_neon, vpx_v_predictor_4x4_neon,
  234. vpx_h_predictor_4x4_neon, vpx_d45_predictor_4x4_neon,
  235. vpx_d135_predictor_4x4_neon, NULL, NULL, NULL, NULL,
  236. vpx_tm_predictor_4x4_neon)
  237. INTRA_PRED_TEST(NEON, TestIntraPred8, vpx_dc_predictor_8x8_neon,
  238. vpx_dc_left_predictor_8x8_neon, vpx_dc_top_predictor_8x8_neon,
  239. vpx_dc_128_predictor_8x8_neon, vpx_v_predictor_8x8_neon,
  240. vpx_h_predictor_8x8_neon, vpx_d45_predictor_8x8_neon,
  241. vpx_d135_predictor_8x8_neon, NULL, NULL, NULL, NULL,
  242. vpx_tm_predictor_8x8_neon)
  243. INTRA_PRED_TEST(NEON, TestIntraPred16, vpx_dc_predictor_16x16_neon,
  244. vpx_dc_left_predictor_16x16_neon,
  245. vpx_dc_top_predictor_16x16_neon,
  246. vpx_dc_128_predictor_16x16_neon, vpx_v_predictor_16x16_neon,
  247. vpx_h_predictor_16x16_neon, vpx_d45_predictor_16x16_neon,
  248. vpx_d135_predictor_16x16_neon, NULL, NULL, NULL, NULL,
  249. vpx_tm_predictor_16x16_neon)
  250. INTRA_PRED_TEST(NEON, TestIntraPred32, vpx_dc_predictor_32x32_neon,
  251. vpx_dc_left_predictor_32x32_neon,
  252. vpx_dc_top_predictor_32x32_neon,
  253. vpx_dc_128_predictor_32x32_neon, vpx_v_predictor_32x32_neon,
  254. vpx_h_predictor_32x32_neon, vpx_d45_predictor_32x32_neon,
  255. vpx_d135_predictor_32x32_neon, NULL, NULL, NULL, NULL,
  256. vpx_tm_predictor_32x32_neon)
  257. #endif // HAVE_NEON
  258. #if HAVE_MSA
  259. INTRA_PRED_TEST(MSA, TestIntraPred4, vpx_dc_predictor_4x4_msa,
  260. vpx_dc_left_predictor_4x4_msa, vpx_dc_top_predictor_4x4_msa,
  261. vpx_dc_128_predictor_4x4_msa, vpx_v_predictor_4x4_msa,
  262. vpx_h_predictor_4x4_msa, NULL, NULL, NULL, NULL, NULL, NULL,
  263. vpx_tm_predictor_4x4_msa)
  264. INTRA_PRED_TEST(MSA, TestIntraPred8, vpx_dc_predictor_8x8_msa,
  265. vpx_dc_left_predictor_8x8_msa, vpx_dc_top_predictor_8x8_msa,
  266. vpx_dc_128_predictor_8x8_msa, vpx_v_predictor_8x8_msa,
  267. vpx_h_predictor_8x8_msa, NULL, NULL, NULL, NULL, NULL, NULL,
  268. vpx_tm_predictor_8x8_msa)
  269. INTRA_PRED_TEST(MSA, TestIntraPred16, vpx_dc_predictor_16x16_msa,
  270. vpx_dc_left_predictor_16x16_msa, vpx_dc_top_predictor_16x16_msa,
  271. vpx_dc_128_predictor_16x16_msa, vpx_v_predictor_16x16_msa,
  272. vpx_h_predictor_16x16_msa, NULL, NULL, NULL, NULL, NULL, NULL,
  273. vpx_tm_predictor_16x16_msa)
  274. INTRA_PRED_TEST(MSA, TestIntraPred32, vpx_dc_predictor_32x32_msa,
  275. vpx_dc_left_predictor_32x32_msa, vpx_dc_top_predictor_32x32_msa,
  276. vpx_dc_128_predictor_32x32_msa, vpx_v_predictor_32x32_msa,
  277. vpx_h_predictor_32x32_msa, NULL, NULL, NULL, NULL, NULL, NULL,
  278. vpx_tm_predictor_32x32_msa)
  279. #endif // HAVE_MSA
  280. #if HAVE_VSX
  281. // TODO(crbug.com/webm/1522): Fix test failures.
  282. #if 0
  283. INTRA_PRED_TEST(VSX, TestIntraPred4, NULL, NULL, NULL, NULL, NULL,
  284. vpx_h_predictor_4x4_vsx, NULL, NULL, NULL, NULL, NULL, NULL,
  285. vpx_tm_predictor_4x4_vsx)
  286. INTRA_PRED_TEST(VSX, TestIntraPred8, vpx_dc_predictor_8x8_vsx, NULL, NULL, NULL,
  287. NULL, vpx_h_predictor_8x8_vsx, vpx_d45_predictor_8x8_vsx, NULL,
  288. NULL, NULL, NULL, vpx_d63_predictor_8x8_vsx,
  289. vpx_tm_predictor_8x8_vsx)
  290. #endif
  291. INTRA_PRED_TEST(VSX, TestIntraPred16, vpx_dc_predictor_16x16_vsx,
  292. vpx_dc_left_predictor_16x16_vsx, vpx_dc_top_predictor_16x16_vsx,
  293. vpx_dc_128_predictor_16x16_vsx, vpx_v_predictor_16x16_vsx,
  294. vpx_h_predictor_16x16_vsx, vpx_d45_predictor_16x16_vsx, NULL,
  295. NULL, NULL, NULL, vpx_d63_predictor_16x16_vsx,
  296. vpx_tm_predictor_16x16_vsx)
  297. INTRA_PRED_TEST(VSX, TestIntraPred32, vpx_dc_predictor_32x32_vsx,
  298. vpx_dc_left_predictor_32x32_vsx, vpx_dc_top_predictor_32x32_vsx,
  299. vpx_dc_128_predictor_32x32_vsx, vpx_v_predictor_32x32_vsx,
  300. vpx_h_predictor_32x32_vsx, vpx_d45_predictor_32x32_vsx, NULL,
  301. NULL, NULL, NULL, vpx_d63_predictor_32x32_vsx,
  302. vpx_tm_predictor_32x32_vsx)
  303. #endif // HAVE_VSX
  304. // -----------------------------------------------------------------------------
  305. #if CONFIG_VP9_HIGHBITDEPTH
  306. namespace {
  307. typedef void (*VpxHighbdPredFunc)(uint16_t *dst, ptrdiff_t y_stride,
  308. const uint16_t *above, const uint16_t *left,
  309. int bd);
  310. typedef IntraPredTestMem<uint16_t> Vp9HighbdIntraPredTestMem;
  311. void TestHighbdIntraPred(const char name[], VpxHighbdPredFunc const *pred_funcs,
  312. const char *const signatures[], int block_size) {
  313. const int kNumTests = static_cast<int>(
  314. 2.e10 / (block_size * block_size * kNumVp9IntraPredFuncs));
  315. Vp9HighbdIntraPredTestMem intra_pred_test_mem;
  316. const uint16_t *const above = intra_pred_test_mem.above_mem + 16;
  317. intra_pred_test_mem.Init(block_size, 12);
  318. for (int k = 0; k < kNumVp9IntraPredFuncs; ++k) {
  319. if (pred_funcs[k] == NULL) continue;
  320. memcpy(intra_pred_test_mem.src, intra_pred_test_mem.ref_src,
  321. sizeof(intra_pred_test_mem.src));
  322. vpx_usec_timer timer;
  323. vpx_usec_timer_start(&timer);
  324. for (int num_tests = 0; num_tests < kNumTests; ++num_tests) {
  325. pred_funcs[k](intra_pred_test_mem.src, kBPS, above,
  326. intra_pred_test_mem.left, 12);
  327. }
  328. libvpx_test::ClearSystemState();
  329. vpx_usec_timer_mark(&timer);
  330. const int elapsed_time =
  331. static_cast<int>(vpx_usec_timer_elapsed(&timer) / 1000);
  332. CheckMd5Signature(name, signatures, intra_pred_test_mem.src,
  333. sizeof(intra_pred_test_mem.src), elapsed_time, k);
  334. }
  335. }
  336. void TestHighbdIntraPred4(VpxHighbdPredFunc const *pred_funcs) {
  337. static const char *const kSignatures[kNumVp9IntraPredFuncs] = {
  338. "11f74af6c5737df472f3275cbde062fa", "51bea056b6447c93f6eb8f6b7e8f6f71",
  339. "27e97f946766331795886f4de04c5594", "53ab15974b049111fb596c5168ec7e3f",
  340. "f0b640bb176fbe4584cf3d32a9b0320a", "729783ca909e03afd4b47111c80d967b",
  341. "fbf1c30793d9f32812e4d9f905d53530", "293fc903254a33754133314c6cdba81f",
  342. "f8074d704233e73dfd35b458c6092374", "aa6363d08544a1ec4da33d7a0be5640d",
  343. "462abcfdfa3d087bb33c9a88f2aec491", "863eab65d22550dd44a2397277c1ec71",
  344. "23d61df1574d0fa308f9731811047c4b"
  345. };
  346. TestHighbdIntraPred("Intra4", pred_funcs, kSignatures, 4);
  347. }
  348. void TestHighbdIntraPred8(VpxHighbdPredFunc const *pred_funcs) {
  349. static const char *const kSignatures[kNumVp9IntraPredFuncs] = {
  350. "03da8829fe94663047fd108c5fcaa71d", "ecdb37b8120a2d3a4c706b016bd1bfd7",
  351. "1d4543ed8d2b9368cb96898095fe8a75", "f791c9a67b913cbd82d9da8ecede30e2",
  352. "065c70646f4dbaff913282f55a45a441", "51f87123616662ef7c35691497dfd0ba",
  353. "2a5b0131ef4716f098ee65e6df01e3dd", "9ffe186a6bc7db95275f1bbddd6f7aba",
  354. "a3258a2eae2e2bd55cb8f71351b22998", "8d909f0a2066e39b3216092c6289ece4",
  355. "d183abb30b9f24c886a0517e991b22c7", "702a42fe4c7d665dc561b2aeeb60f311",
  356. "7b5dbbbe7ae3a4ac2948731600bde5d6"
  357. };
  358. TestHighbdIntraPred("Intra8", pred_funcs, kSignatures, 8);
  359. }
  360. void TestHighbdIntraPred16(VpxHighbdPredFunc const *pred_funcs) {
  361. static const char *const kSignatures[kNumVp9IntraPredFuncs] = {
  362. "e33cb3f56a878e2fddb1b2fc51cdd275", "c7bff6f04b6052c8ab335d726dbbd52d",
  363. "d0b0b47b654a9bcc5c6008110a44589b", "78f5da7b10b2b9ab39f114a33b6254e9",
  364. "c78e31d23831abb40d6271a318fdd6f3", "90d1347f4ec9198a0320daecb6ff90b8",
  365. "d2c623746cbb64a0c9e29c10f2c57041", "cf28bd387b81ad3e5f1a1c779a4b70a0",
  366. "24c304330431ddeaf630f6ce94af2eac", "91a329798036bf64e8e00a87b131b8b1",
  367. "d39111f22885307f920796a42084c872", "e2e702f7250ece98dd8f3f2854c31eeb",
  368. "e2fb05b01eb8b88549e85641d8ce5b59"
  369. };
  370. TestHighbdIntraPred("Intra16", pred_funcs, kSignatures, 16);
  371. }
  372. void TestHighbdIntraPred32(VpxHighbdPredFunc const *pred_funcs) {
  373. static const char *const kSignatures[kNumVp9IntraPredFuncs] = {
  374. "a3e8056ba7e36628cce4917cd956fedd", "cc7d3024fe8748b512407edee045377e",
  375. "2aab0a0f330a1d3e19b8ecb8f06387a3", "a547bc3fb7b06910bf3973122a426661",
  376. "26f712514da95042f93d6e8dc8e431dc", "bb08c6e16177081daa3d936538dbc2e3",
  377. "8f031af3e2650e89620d8d2c3a843d8b", "42867c8553285e94ee8e4df7abafbda8",
  378. "6496bdee96100667833f546e1be3d640", "2ebfa25bf981377e682e580208504300",
  379. "3e8ae52fd1f607f348aa4cb436c71ab7", "3d4efe797ca82193613696753ea624c4",
  380. "cb8aab6d372278f3131e8d99efde02d9"
  381. };
  382. TestHighbdIntraPred("Intra32", pred_funcs, kSignatures, 32);
  383. }
  384. } // namespace
  385. // Defines a test case for |arch| (e.g., C, SSE2, ...) passing the predictors
  386. // to |test_func|. The test name is 'arch.test_func', e.g., C.TestIntraPred4.
  387. #define HIGHBD_INTRA_PRED_TEST(arch, test_func, dc, dc_left, dc_top, dc_128, \
  388. v, h, d45, d135, d117, d153, d207, d63, tm) \
  389. TEST(arch, test_func) { \
  390. static const VpxHighbdPredFunc vpx_intra_pred[] = { \
  391. dc, dc_left, dc_top, dc_128, v, h, d45, d135, d117, d153, d207, d63, tm \
  392. }; \
  393. test_func(vpx_intra_pred); \
  394. }
  395. // -----------------------------------------------------------------------------
  396. HIGHBD_INTRA_PRED_TEST(
  397. C, TestHighbdIntraPred4, vpx_highbd_dc_predictor_4x4_c,
  398. vpx_highbd_dc_left_predictor_4x4_c, vpx_highbd_dc_top_predictor_4x4_c,
  399. vpx_highbd_dc_128_predictor_4x4_c, vpx_highbd_v_predictor_4x4_c,
  400. vpx_highbd_h_predictor_4x4_c, vpx_highbd_d45_predictor_4x4_c,
  401. vpx_highbd_d135_predictor_4x4_c, vpx_highbd_d117_predictor_4x4_c,
  402. vpx_highbd_d153_predictor_4x4_c, vpx_highbd_d207_predictor_4x4_c,
  403. vpx_highbd_d63_predictor_4x4_c, vpx_highbd_tm_predictor_4x4_c)
  404. HIGHBD_INTRA_PRED_TEST(
  405. C, TestHighbdIntraPred8, vpx_highbd_dc_predictor_8x8_c,
  406. vpx_highbd_dc_left_predictor_8x8_c, vpx_highbd_dc_top_predictor_8x8_c,
  407. vpx_highbd_dc_128_predictor_8x8_c, vpx_highbd_v_predictor_8x8_c,
  408. vpx_highbd_h_predictor_8x8_c, vpx_highbd_d45_predictor_8x8_c,
  409. vpx_highbd_d135_predictor_8x8_c, vpx_highbd_d117_predictor_8x8_c,
  410. vpx_highbd_d153_predictor_8x8_c, vpx_highbd_d207_predictor_8x8_c,
  411. vpx_highbd_d63_predictor_8x8_c, vpx_highbd_tm_predictor_8x8_c)
  412. HIGHBD_INTRA_PRED_TEST(
  413. C, TestHighbdIntraPred16, vpx_highbd_dc_predictor_16x16_c,
  414. vpx_highbd_dc_left_predictor_16x16_c, vpx_highbd_dc_top_predictor_16x16_c,
  415. vpx_highbd_dc_128_predictor_16x16_c, vpx_highbd_v_predictor_16x16_c,
  416. vpx_highbd_h_predictor_16x16_c, vpx_highbd_d45_predictor_16x16_c,
  417. vpx_highbd_d135_predictor_16x16_c, vpx_highbd_d117_predictor_16x16_c,
  418. vpx_highbd_d153_predictor_16x16_c, vpx_highbd_d207_predictor_16x16_c,
  419. vpx_highbd_d63_predictor_16x16_c, vpx_highbd_tm_predictor_16x16_c)
  420. HIGHBD_INTRA_PRED_TEST(
  421. C, TestHighbdIntraPred32, vpx_highbd_dc_predictor_32x32_c,
  422. vpx_highbd_dc_left_predictor_32x32_c, vpx_highbd_dc_top_predictor_32x32_c,
  423. vpx_highbd_dc_128_predictor_32x32_c, vpx_highbd_v_predictor_32x32_c,
  424. vpx_highbd_h_predictor_32x32_c, vpx_highbd_d45_predictor_32x32_c,
  425. vpx_highbd_d135_predictor_32x32_c, vpx_highbd_d117_predictor_32x32_c,
  426. vpx_highbd_d153_predictor_32x32_c, vpx_highbd_d207_predictor_32x32_c,
  427. vpx_highbd_d63_predictor_32x32_c, vpx_highbd_tm_predictor_32x32_c)
  428. #if HAVE_SSE2
  429. HIGHBD_INTRA_PRED_TEST(
  430. SSE2, TestHighbdIntraPred4, vpx_highbd_dc_predictor_4x4_sse2,
  431. vpx_highbd_dc_left_predictor_4x4_sse2, vpx_highbd_dc_top_predictor_4x4_sse2,
  432. vpx_highbd_dc_128_predictor_4x4_sse2, vpx_highbd_v_predictor_4x4_sse2,
  433. vpx_highbd_h_predictor_4x4_sse2, NULL, vpx_highbd_d135_predictor_4x4_sse2,
  434. vpx_highbd_d117_predictor_4x4_sse2, vpx_highbd_d153_predictor_4x4_sse2,
  435. vpx_highbd_d207_predictor_4x4_sse2, vpx_highbd_d63_predictor_4x4_sse2,
  436. vpx_highbd_tm_predictor_4x4_c)
  437. HIGHBD_INTRA_PRED_TEST(SSE2, TestHighbdIntraPred8,
  438. vpx_highbd_dc_predictor_8x8_sse2,
  439. vpx_highbd_dc_left_predictor_8x8_sse2,
  440. vpx_highbd_dc_top_predictor_8x8_sse2,
  441. vpx_highbd_dc_128_predictor_8x8_sse2,
  442. vpx_highbd_v_predictor_8x8_sse2,
  443. vpx_highbd_h_predictor_8x8_sse2, NULL, NULL, NULL, NULL,
  444. NULL, NULL, vpx_highbd_tm_predictor_8x8_sse2)
  445. HIGHBD_INTRA_PRED_TEST(SSE2, TestHighbdIntraPred16,
  446. vpx_highbd_dc_predictor_16x16_sse2,
  447. vpx_highbd_dc_left_predictor_16x16_sse2,
  448. vpx_highbd_dc_top_predictor_16x16_sse2,
  449. vpx_highbd_dc_128_predictor_16x16_sse2,
  450. vpx_highbd_v_predictor_16x16_sse2,
  451. vpx_highbd_h_predictor_16x16_sse2, NULL, NULL, NULL,
  452. NULL, NULL, NULL, vpx_highbd_tm_predictor_16x16_sse2)
  453. HIGHBD_INTRA_PRED_TEST(SSE2, TestHighbdIntraPred32,
  454. vpx_highbd_dc_predictor_32x32_sse2,
  455. vpx_highbd_dc_left_predictor_32x32_sse2,
  456. vpx_highbd_dc_top_predictor_32x32_sse2,
  457. vpx_highbd_dc_128_predictor_32x32_sse2,
  458. vpx_highbd_v_predictor_32x32_sse2,
  459. vpx_highbd_h_predictor_32x32_sse2, NULL, NULL, NULL,
  460. NULL, NULL, NULL, vpx_highbd_tm_predictor_32x32_sse2)
  461. #endif // HAVE_SSE2
  462. #if HAVE_SSSE3
  463. HIGHBD_INTRA_PRED_TEST(SSSE3, TestHighbdIntraPred4, NULL, NULL, NULL, NULL,
  464. NULL, NULL, vpx_highbd_d45_predictor_4x4_ssse3, NULL,
  465. NULL, NULL, NULL, NULL, NULL)
  466. HIGHBD_INTRA_PRED_TEST(SSSE3, TestHighbdIntraPred8, NULL, NULL, NULL, NULL,
  467. NULL, NULL, vpx_highbd_d45_predictor_8x8_ssse3,
  468. vpx_highbd_d135_predictor_8x8_ssse3,
  469. vpx_highbd_d117_predictor_8x8_ssse3,
  470. vpx_highbd_d153_predictor_8x8_ssse3,
  471. vpx_highbd_d207_predictor_8x8_ssse3,
  472. vpx_highbd_d63_predictor_8x8_ssse3, NULL)
  473. HIGHBD_INTRA_PRED_TEST(SSSE3, TestHighbdIntraPred16, NULL, NULL, NULL, NULL,
  474. NULL, NULL, vpx_highbd_d45_predictor_16x16_ssse3,
  475. vpx_highbd_d135_predictor_16x16_ssse3,
  476. vpx_highbd_d117_predictor_16x16_ssse3,
  477. vpx_highbd_d153_predictor_16x16_ssse3,
  478. vpx_highbd_d207_predictor_16x16_ssse3,
  479. vpx_highbd_d63_predictor_16x16_ssse3, NULL)
  480. HIGHBD_INTRA_PRED_TEST(SSSE3, TestHighbdIntraPred32, NULL, NULL, NULL, NULL,
  481. NULL, NULL, vpx_highbd_d45_predictor_32x32_ssse3,
  482. vpx_highbd_d135_predictor_32x32_ssse3,
  483. vpx_highbd_d117_predictor_32x32_ssse3,
  484. vpx_highbd_d153_predictor_32x32_ssse3,
  485. vpx_highbd_d207_predictor_32x32_ssse3,
  486. vpx_highbd_d63_predictor_32x32_ssse3, NULL)
  487. #endif // HAVE_SSSE3
  488. #if HAVE_NEON
  489. HIGHBD_INTRA_PRED_TEST(
  490. NEON, TestHighbdIntraPred4, vpx_highbd_dc_predictor_4x4_neon,
  491. vpx_highbd_dc_left_predictor_4x4_neon, vpx_highbd_dc_top_predictor_4x4_neon,
  492. vpx_highbd_dc_128_predictor_4x4_neon, vpx_highbd_v_predictor_4x4_neon,
  493. vpx_highbd_h_predictor_4x4_neon, vpx_highbd_d45_predictor_4x4_neon,
  494. vpx_highbd_d135_predictor_4x4_neon, NULL, NULL, NULL, NULL,
  495. vpx_highbd_tm_predictor_4x4_neon)
  496. HIGHBD_INTRA_PRED_TEST(
  497. NEON, TestHighbdIntraPred8, vpx_highbd_dc_predictor_8x8_neon,
  498. vpx_highbd_dc_left_predictor_8x8_neon, vpx_highbd_dc_top_predictor_8x8_neon,
  499. vpx_highbd_dc_128_predictor_8x8_neon, vpx_highbd_v_predictor_8x8_neon,
  500. vpx_highbd_h_predictor_8x8_neon, vpx_highbd_d45_predictor_8x8_neon,
  501. vpx_highbd_d135_predictor_8x8_neon, NULL, NULL, NULL, NULL,
  502. vpx_highbd_tm_predictor_8x8_neon)
  503. HIGHBD_INTRA_PRED_TEST(NEON, TestHighbdIntraPred16,
  504. vpx_highbd_dc_predictor_16x16_neon,
  505. vpx_highbd_dc_left_predictor_16x16_neon,
  506. vpx_highbd_dc_top_predictor_16x16_neon,
  507. vpx_highbd_dc_128_predictor_16x16_neon,
  508. vpx_highbd_v_predictor_16x16_neon,
  509. vpx_highbd_h_predictor_16x16_neon,
  510. vpx_highbd_d45_predictor_16x16_neon,
  511. vpx_highbd_d135_predictor_16x16_neon, NULL, NULL, NULL,
  512. NULL, vpx_highbd_tm_predictor_16x16_neon)
  513. HIGHBD_INTRA_PRED_TEST(NEON, TestHighbdIntraPred32,
  514. vpx_highbd_dc_predictor_32x32_neon,
  515. vpx_highbd_dc_left_predictor_32x32_neon,
  516. vpx_highbd_dc_top_predictor_32x32_neon,
  517. vpx_highbd_dc_128_predictor_32x32_neon,
  518. vpx_highbd_v_predictor_32x32_neon,
  519. vpx_highbd_h_predictor_32x32_neon,
  520. vpx_highbd_d45_predictor_32x32_neon,
  521. vpx_highbd_d135_predictor_32x32_neon, NULL, NULL, NULL,
  522. NULL, vpx_highbd_tm_predictor_32x32_neon)
  523. #endif // HAVE_NEON
  524. #endif // CONFIG_VP9_HIGHBITDEPTH
  525. #include "test/test_libvpx.cc"