react-native-vision-camera-spoof-detector 1.1.23 → 1.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/android/CMakeLists.txt +12 -0
  2. package/android/build.gradle +10 -9
  3. package/android/src/main/cpp/cpp-adapter.cpp +6 -3
  4. package/ios/HybridSpoofDetectorOutput.swift +112 -72
  5. package/package.json +1 -1
  6. package/android/src/main/cpp/CMakeLists.txt +0 -33
  7. package/android/src/main/cpp/FaceAntiSpoofJSI.cpp +0 -142
  8. package/android/src/main/cpp/FastYuvJni.cpp +0 -111
  9. package/android/src/main/cpp/fast_yuv.cpp +0 -342
  10. package/android/src/main/cpp/fast_yuv.h +0 -23
  11. package/android/src/main/cpp/libyuv/.clang-format +0 -6
  12. package/android/src/main/cpp/libyuv/.gn +0 -40
  13. package/android/src/main/cpp/libyuv/.vpython3 +0 -410
  14. package/android/src/main/cpp/libyuv/AUTHORS +0 -7
  15. package/android/src/main/cpp/libyuv/Android.bp +0 -202
  16. package/android/src/main/cpp/libyuv/Android.mk +0 -106
  17. package/android/src/main/cpp/libyuv/BUILD.gn +0 -490
  18. package/android/src/main/cpp/libyuv/CM_linux_packages.cmake +0 -70
  19. package/android/src/main/cpp/libyuv/CMakeLists.txt +0 -259
  20. package/android/src/main/cpp/libyuv/DEPS +0 -935
  21. package/android/src/main/cpp/libyuv/DIR_METADATA +0 -3
  22. package/android/src/main/cpp/libyuv/LICENSE +0 -29
  23. package/android/src/main/cpp/libyuv/OWNERS +0 -11
  24. package/android/src/main/cpp/libyuv/PATENTS +0 -24
  25. package/android/src/main/cpp/libyuv/PRESUBMIT.py +0 -65
  26. package/android/src/main/cpp/libyuv/README.chromium +0 -11
  27. package/android/src/main/cpp/libyuv/README.md +0 -19
  28. package/android/src/main/cpp/libyuv/build_overrides/build.gni +0 -60
  29. package/android/src/main/cpp/libyuv/build_overrides/gtest.gni +0 -19
  30. package/android/src/main/cpp/libyuv/build_overrides/partition_alloc.gni +0 -17
  31. package/android/src/main/cpp/libyuv/codereview.settings +0 -5
  32. package/android/src/main/cpp/libyuv/docs/deprecated_builds.md +0 -409
  33. package/android/src/main/cpp/libyuv/docs/environment_variables.md +0 -64
  34. package/android/src/main/cpp/libyuv/docs/feature_detection.md +0 -108
  35. package/android/src/main/cpp/libyuv/docs/filtering.md +0 -196
  36. package/android/src/main/cpp/libyuv/docs/formats.md +0 -208
  37. package/android/src/main/cpp/libyuv/docs/getting_started.md +0 -296
  38. package/android/src/main/cpp/libyuv/docs/rotation.md +0 -107
  39. package/android/src/main/cpp/libyuv/download_vs_toolchain.py +0 -29
  40. package/android/src/main/cpp/libyuv/include/libyuv/basic_types.h +0 -68
  41. package/android/src/main/cpp/libyuv/include/libyuv/compare.h +0 -111
  42. package/android/src/main/cpp/libyuv/include/libyuv/compare_row.h +0 -112
  43. package/android/src/main/cpp/libyuv/include/libyuv/convert.h +0 -1117
  44. package/android/src/main/cpp/libyuv/include/libyuv/convert_argb.h +0 -2335
  45. package/android/src/main/cpp/libyuv/include/libyuv/convert_from.h +0 -203
  46. package/android/src/main/cpp/libyuv/include/libyuv/convert_from_argb.h +0 -394
  47. package/android/src/main/cpp/libyuv/include/libyuv/cpu_id.h +0 -147
  48. package/android/src/main/cpp/libyuv/include/libyuv/cpu_support.h +0 -99
  49. package/android/src/main/cpp/libyuv/include/libyuv/loongson_intrinsics.h +0 -1949
  50. package/android/src/main/cpp/libyuv/include/libyuv/mjpeg_decoder.h +0 -195
  51. package/android/src/main/cpp/libyuv/include/libyuv/planar_functions.h +0 -1131
  52. package/android/src/main/cpp/libyuv/include/libyuv/rotate.h +0 -296
  53. package/android/src/main/cpp/libyuv/include/libyuv/rotate_argb.h +0 -37
  54. package/android/src/main/cpp/libyuv/include/libyuv/rotate_row.h +0 -265
  55. package/android/src/main/cpp/libyuv/include/libyuv/row.h +0 -6738
  56. package/android/src/main/cpp/libyuv/include/libyuv/row_sve.h +0 -2154
  57. package/android/src/main/cpp/libyuv/include/libyuv/scale.h +0 -336
  58. package/android/src/main/cpp/libyuv/include/libyuv/scale_argb.h +0 -76
  59. package/android/src/main/cpp/libyuv/include/libyuv/scale_rgb.h +0 -42
  60. package/android/src/main/cpp/libyuv/include/libyuv/scale_row.h +0 -1726
  61. package/android/src/main/cpp/libyuv/include/libyuv/scale_uv.h +0 -51
  62. package/android/src/main/cpp/libyuv/include/libyuv/version.h +0 -16
  63. package/android/src/main/cpp/libyuv/include/libyuv/video_common.h +0 -222
  64. package/android/src/main/cpp/libyuv/include/libyuv.h +0 -33
  65. package/android/src/main/cpp/libyuv/infra/config/OWNERS +0 -3
  66. package/android/src/main/cpp/libyuv/infra/config/PRESUBMIT.py +0 -17
  67. package/android/src/main/cpp/libyuv/infra/config/README.md +0 -2
  68. package/android/src/main/cpp/libyuv/infra/config/codereview.settings +0 -6
  69. package/android/src/main/cpp/libyuv/infra/config/commit-queue.cfg +0 -144
  70. package/android/src/main/cpp/libyuv/infra/config/cr-buildbucket.cfg +0 -1185
  71. package/android/src/main/cpp/libyuv/infra/config/luci-logdog.cfg +0 -9
  72. package/android/src/main/cpp/libyuv/infra/config/luci-milo.cfg +0 -246
  73. package/android/src/main/cpp/libyuv/infra/config/luci-scheduler.cfg +0 -385
  74. package/android/src/main/cpp/libyuv/infra/config/main.star +0 -402
  75. package/android/src/main/cpp/libyuv/infra/config/project.cfg +0 -16
  76. package/android/src/main/cpp/libyuv/infra/config/realms.cfg +0 -111
  77. package/android/src/main/cpp/libyuv/libyuv.gni +0 -34
  78. package/android/src/main/cpp/libyuv/libyuv.gyp +0 -149
  79. package/android/src/main/cpp/libyuv/libyuv.gypi +0 -87
  80. package/android/src/main/cpp/libyuv/linux.mk +0 -96
  81. package/android/src/main/cpp/libyuv/public.mk +0 -13
  82. package/android/src/main/cpp/libyuv/pylintrc +0 -49
  83. package/android/src/main/cpp/libyuv/riscv_script/prepare_toolchain_qemu.sh +0 -74
  84. package/android/src/main/cpp/libyuv/riscv_script/riscv-clang.cmake +0 -56
  85. package/android/src/main/cpp/libyuv/riscv_script/run_qemu.sh +0 -15
  86. package/android/src/main/cpp/libyuv/source/compare.cc +0 -435
  87. package/android/src/main/cpp/libyuv/source/compare_common.cc +0 -74
  88. package/android/src/main/cpp/libyuv/source/compare_gcc.cc +0 -362
  89. package/android/src/main/cpp/libyuv/source/compare_neon.cc +0 -96
  90. package/android/src/main/cpp/libyuv/source/compare_neon64.cc +0 -223
  91. package/android/src/main/cpp/libyuv/source/compare_win.cc +0 -241
  92. package/android/src/main/cpp/libyuv/source/convert.cc +0 -4746
  93. package/android/src/main/cpp/libyuv/source/convert_argb.cc +0 -9179
  94. package/android/src/main/cpp/libyuv/source/convert_from.cc +0 -866
  95. package/android/src/main/cpp/libyuv/source/convert_from_argb.cc +0 -3671
  96. package/android/src/main/cpp/libyuv/source/convert_jpeg.cc +0 -602
  97. package/android/src/main/cpp/libyuv/source/convert_to_argb.cc +0 -391
  98. package/android/src/main/cpp/libyuv/source/convert_to_i420.cc +0 -288
  99. package/android/src/main/cpp/libyuv/source/cpu_id.cc +0 -496
  100. package/android/src/main/cpp/libyuv/source/mjpeg_decoder.cc +0 -580
  101. package/android/src/main/cpp/libyuv/source/mjpeg_validate.cc +0 -71
  102. package/android/src/main/cpp/libyuv/source/planar_functions.cc +0 -5663
  103. package/android/src/main/cpp/libyuv/source/rotate.cc +0 -1241
  104. package/android/src/main/cpp/libyuv/source/rotate_any.cc +0 -76
  105. package/android/src/main/cpp/libyuv/source/rotate_argb.cc +0 -259
  106. package/android/src/main/cpp/libyuv/source/rotate_common.cc +0 -208
  107. package/android/src/main/cpp/libyuv/source/rotate_gcc.cc +0 -505
  108. package/android/src/main/cpp/libyuv/source/rotate_lsx.cc +0 -233
  109. package/android/src/main/cpp/libyuv/source/rotate_neon.cc +0 -219
  110. package/android/src/main/cpp/libyuv/source/rotate_neon64.cc +0 -273
  111. package/android/src/main/cpp/libyuv/source/rotate_sme.cc +0 -174
  112. package/android/src/main/cpp/libyuv/source/rotate_win.cc +0 -253
  113. package/android/src/main/cpp/libyuv/source/row_any.cc +0 -2519
  114. package/android/src/main/cpp/libyuv/source/row_common.cc +0 -4461
  115. package/android/src/main/cpp/libyuv/source/row_gcc.cc +0 -9570
  116. package/android/src/main/cpp/libyuv/source/row_lasx.cc +0 -2343
  117. package/android/src/main/cpp/libyuv/source/row_lsx.cc +0 -3030
  118. package/android/src/main/cpp/libyuv/source/row_neon.cc +0 -4026
  119. package/android/src/main/cpp/libyuv/source/row_neon64.cc +0 -5617
  120. package/android/src/main/cpp/libyuv/source/row_rvv.cc +0 -2599
  121. package/android/src/main/cpp/libyuv/source/row_sme.cc +0 -1183
  122. package/android/src/main/cpp/libyuv/source/row_sve.cc +0 -1088
  123. package/android/src/main/cpp/libyuv/source/row_win.cc +0 -6453
  124. package/android/src/main/cpp/libyuv/source/scale.cc +0 -2710
  125. package/android/src/main/cpp/libyuv/source/scale_any.cc +0 -991
  126. package/android/src/main/cpp/libyuv/source/scale_argb.cc +0 -1158
  127. package/android/src/main/cpp/libyuv/source/scale_common.cc +0 -1977
  128. package/android/src/main/cpp/libyuv/source/scale_gcc.cc +0 -2947
  129. package/android/src/main/cpp/libyuv/source/scale_lsx.cc +0 -739
  130. package/android/src/main/cpp/libyuv/source/scale_neon.cc +0 -1449
  131. package/android/src/main/cpp/libyuv/source/scale_neon64.cc +0 -1552
  132. package/android/src/main/cpp/libyuv/source/scale_rgb.cc +0 -82
  133. package/android/src/main/cpp/libyuv/source/scale_rvv.cc +0 -1971
  134. package/android/src/main/cpp/libyuv/source/scale_sme.cc +0 -555
  135. package/android/src/main/cpp/libyuv/source/scale_uv.cc +0 -1159
  136. package/android/src/main/cpp/libyuv/source/scale_win.cc +0 -1392
  137. package/android/src/main/cpp/libyuv/source/test.sh +0 -35
  138. package/android/src/main/cpp/libyuv/source/video_common.cc +0 -62
  139. package/android/src/main/cpp/libyuv/tools_libyuv/OWNERS +0 -4
  140. package/android/src/main/cpp/libyuv/tools_libyuv/autoroller/roll_deps.py +0 -931
  141. package/android/src/main/cpp/libyuv/tools_libyuv/autoroller/unittests/roll_deps_test.py +0 -164
  142. package/android/src/main/cpp/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS +0 -21
  143. package/android/src/main/cpp/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium.new +0 -13
  144. package/android/src/main/cpp/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium.old +0 -13
  145. package/android/src/main/cpp/libyuv/tools_libyuv/get_landmines.py +0 -38
  146. package/android/src/main/cpp/libyuv/tools_libyuv/msan/OWNERS +0 -3
  147. package/android/src/main/cpp/libyuv/tools_libyuv/msan/blacklist.txt +0 -9
  148. package/android/src/main/cpp/libyuv/tools_libyuv/ubsan/OWNERS +0 -3
  149. package/android/src/main/cpp/libyuv/tools_libyuv/ubsan/blacklist.txt +0 -15
  150. package/android/src/main/cpp/libyuv/tools_libyuv/ubsan/vptr_blacklist.txt +0 -25
  151. package/android/src/main/cpp/libyuv/unit_test/basictypes_test.cc +0 -43
  152. package/android/src/main/cpp/libyuv/unit_test/color_test.cc +0 -848
  153. package/android/src/main/cpp/libyuv/unit_test/compare_test.cc +0 -739
  154. package/android/src/main/cpp/libyuv/unit_test/convert_argb_test.cc +0 -2867
  155. package/android/src/main/cpp/libyuv/unit_test/convert_test.cc +0 -2133
  156. package/android/src/main/cpp/libyuv/unit_test/cpu_test.cc +0 -427
  157. package/android/src/main/cpp/libyuv/unit_test/cpu_thread_test.cc +0 -63
  158. package/android/src/main/cpp/libyuv/unit_test/math_test.cc +0 -160
  159. package/android/src/main/cpp/libyuv/unit_test/planar_test.cc +0 -4731
  160. package/android/src/main/cpp/libyuv/unit_test/rotate_argb_test.cc +0 -334
  161. package/android/src/main/cpp/libyuv/unit_test/rotate_test.cc +0 -962
  162. package/android/src/main/cpp/libyuv/unit_test/scale_argb_test.cc +0 -590
  163. package/android/src/main/cpp/libyuv/unit_test/scale_plane_test.cc +0 -465
  164. package/android/src/main/cpp/libyuv/unit_test/scale_rgb_test.cc +0 -280
  165. package/android/src/main/cpp/libyuv/unit_test/scale_test.cc +0 -1135
  166. package/android/src/main/cpp/libyuv/unit_test/scale_uv_test.cc +0 -249
  167. package/android/src/main/cpp/libyuv/unit_test/testdata/arm_v7.txt +0 -12
  168. package/android/src/main/cpp/libyuv/unit_test/testdata/mips.txt +0 -7
  169. package/android/src/main/cpp/libyuv/unit_test/testdata/mips_loongson2k.txt +0 -5
  170. package/android/src/main/cpp/libyuv/unit_test/testdata/mips_loongson3.txt +0 -10
  171. package/android/src/main/cpp/libyuv/unit_test/testdata/mips_loongson_mmi.txt +0 -7
  172. package/android/src/main/cpp/libyuv/unit_test/testdata/riscv64.txt +0 -4
  173. package/android/src/main/cpp/libyuv/unit_test/testdata/riscv64_rvv.txt +0 -4
  174. package/android/src/main/cpp/libyuv/unit_test/testdata/riscv64_rvv_zvfh.txt +0 -4
  175. package/android/src/main/cpp/libyuv/unit_test/testdata/tegra3.txt +0 -23
  176. package/android/src/main/cpp/libyuv/unit_test/testdata/test0.jpg +0 -0
  177. package/android/src/main/cpp/libyuv/unit_test/testdata/test1.jpg +0 -0
  178. package/android/src/main/cpp/libyuv/unit_test/testdata/test2.jpg +0 -0
  179. package/android/src/main/cpp/libyuv/unit_test/testdata/test3.jpg +0 -0
  180. package/android/src/main/cpp/libyuv/unit_test/testdata/test4.jpg +0 -0
  181. package/android/src/main/cpp/libyuv/unit_test/unit_test.cc +0 -581
  182. package/android/src/main/cpp/libyuv/unit_test/unit_test.h +0 -232
  183. package/android/src/main/cpp/libyuv/unit_test/video_common_test.cc +0 -112
  184. package/android/src/main/cpp/libyuv/util/Makefile +0 -9
  185. package/android/src/main/cpp/libyuv/util/color.cc +0 -120
  186. package/android/src/main/cpp/libyuv/util/compare.cc +0 -67
  187. package/android/src/main/cpp/libyuv/util/cpuid.c +0 -211
  188. package/android/src/main/cpp/libyuv/util/i444tonv12_eg.cc +0 -28
  189. package/android/src/main/cpp/libyuv/util/psnr.cc +0 -291
  190. package/android/src/main/cpp/libyuv/util/psnr.h +0 -47
  191. package/android/src/main/cpp/libyuv/util/psnr_main.cc +0 -620
  192. package/android/src/main/cpp/libyuv/util/ssim.cc +0 -364
  193. package/android/src/main/cpp/libyuv/util/ssim.h +0 -38
  194. package/android/src/main/cpp/libyuv/util/yuvconstants.c +0 -114
  195. package/android/src/main/cpp/libyuv/util/yuvconvert.cc +0 -367
  196. package/android/src/main/cpp/libyuv/winarm.mk +0 -47
  197. package/android/src/main/java/com/faceantispoof/ByteBufferPool.kt +0 -68
  198. package/android/src/main/java/com/faceantispoof/FastYuv.kt +0 -51
  199. package/android/src/main/java/com/faceantispoof/YuvToFloatArrayConverter.kt +0 -584
  200. package/android/src/main/java/com/faceantispoof/YuvToRgbConverter.kt +0 -73
@@ -1,1135 +0,0 @@
1
- /*
2
- * Copyright 2011 The LibYuv 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
-
11
- #include <stdlib.h>
12
- #include <time.h>
13
-
14
- #include "../unit_test/unit_test.h"
15
- #include "libyuv/cpu_id.h"
16
- #include "libyuv/scale.h"
17
-
18
- #ifdef ENABLE_ROW_TESTS
19
- #include "libyuv/scale_row.h" // For ScaleRowDown2Box_Odd_C
20
- #endif
21
-
22
- #define STRINGIZE(line) #line
23
- #define FILELINESTR(file, line) file ":" STRINGIZE(line)
24
-
25
- #if defined(__riscv) && !defined(__clang__)
26
- #define DISABLE_SLOW_TESTS
27
- #undef ENABLE_FULL_TESTS
28
- #endif
29
-
30
- #if !defined(DISABLE_SLOW_TESTS) || defined(__x86_64__) || defined(__i386__)
31
- // SLOW TESTS are those that are unoptimized C code.
32
- // FULL TESTS are optimized but test many variations of the same code.
33
- #define ENABLE_FULL_TESTS
34
- #endif
35
-
36
- namespace libyuv {
37
-
38
- // Test scaling with C vs Opt and return maximum pixel difference. 0 = exact.
39
- static int I420TestFilter(int src_width,
40
- int src_height,
41
- int dst_width,
42
- int dst_height,
43
- FilterMode f,
44
- int benchmark_iterations,
45
- int disable_cpu_flags,
46
- int benchmark_cpu_info) {
47
- if (!SizeValid(src_width, src_height, dst_width, dst_height)) {
48
- return 0;
49
- }
50
-
51
- int i, j;
52
- int src_width_uv = (Abs(src_width) + 1) >> 1;
53
- int src_height_uv = (Abs(src_height) + 1) >> 1;
54
-
55
- int64_t src_y_plane_size = (Abs(src_width)) * (Abs(src_height));
56
- int64_t src_uv_plane_size = (src_width_uv) * (src_height_uv);
57
-
58
- int src_stride_y = Abs(src_width);
59
- int src_stride_uv = src_width_uv;
60
-
61
- align_buffer_page_end(src_y, src_y_plane_size);
62
- align_buffer_page_end(src_u, src_uv_plane_size);
63
- align_buffer_page_end(src_v, src_uv_plane_size);
64
- if (!src_y || !src_u || !src_v) {
65
- printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n");
66
- return 0;
67
- }
68
- MemRandomize(src_y, src_y_plane_size);
69
- MemRandomize(src_u, src_uv_plane_size);
70
- MemRandomize(src_v, src_uv_plane_size);
71
-
72
- int dst_width_uv = (dst_width + 1) >> 1;
73
- int dst_height_uv = (dst_height + 1) >> 1;
74
-
75
- int64_t dst_y_plane_size = (dst_width) * (dst_height);
76
- int64_t dst_uv_plane_size = (dst_width_uv) * (dst_height_uv);
77
-
78
- int dst_stride_y = dst_width;
79
- int dst_stride_uv = dst_width_uv;
80
-
81
- align_buffer_page_end(dst_y_c, dst_y_plane_size);
82
- align_buffer_page_end(dst_u_c, dst_uv_plane_size);
83
- align_buffer_page_end(dst_v_c, dst_uv_plane_size);
84
- align_buffer_page_end(dst_y_opt, dst_y_plane_size);
85
- align_buffer_page_end(dst_u_opt, dst_uv_plane_size);
86
- align_buffer_page_end(dst_v_opt, dst_uv_plane_size);
87
- if (!dst_y_c || !dst_u_c || !dst_v_c || !dst_y_opt || !dst_u_opt ||
88
- !dst_v_opt) {
89
- printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n");
90
- return 0;
91
- }
92
-
93
- MaskCpuFlags(disable_cpu_flags); // Disable all CPU optimization.
94
- double c_time = get_time();
95
- I420Scale(src_y, src_stride_y, src_u, src_stride_uv, src_v, src_stride_uv,
96
- src_width, src_height, dst_y_c, dst_stride_y, dst_u_c,
97
- dst_stride_uv, dst_v_c, dst_stride_uv, dst_width, dst_height, f);
98
- c_time = (get_time() - c_time);
99
-
100
- MaskCpuFlags(benchmark_cpu_info); // Enable all CPU optimization.
101
- double opt_time = get_time();
102
- for (i = 0; i < benchmark_iterations; ++i) {
103
- I420Scale(src_y, src_stride_y, src_u, src_stride_uv, src_v, src_stride_uv,
104
- src_width, src_height, dst_y_opt, dst_stride_y, dst_u_opt,
105
- dst_stride_uv, dst_v_opt, dst_stride_uv, dst_width, dst_height,
106
- f);
107
- }
108
- opt_time = (get_time() - opt_time) / benchmark_iterations;
109
- // Report performance of C vs OPT.
110
- printf("filter %d - %8d us C - %8d us OPT\n", f,
111
- static_cast<int>(c_time * 1e6), static_cast<int>(opt_time * 1e6));
112
-
113
- // C version may be a little off from the optimized. Order of
114
- // operations may introduce rounding somewhere. So do a difference
115
- // of the buffers and look to see that the max difference is not
116
- // over 3.
117
- int max_diff = 0;
118
- for (i = 0; i < (dst_height); ++i) {
119
- for (j = 0; j < (dst_width); ++j) {
120
- int abs_diff = Abs(dst_y_c[(i * dst_stride_y) + j] -
121
- dst_y_opt[(i * dst_stride_y) + j]);
122
- if (abs_diff > max_diff) {
123
- max_diff = abs_diff;
124
- }
125
- }
126
- }
127
-
128
- for (i = 0; i < (dst_height_uv); ++i) {
129
- for (j = 0; j < (dst_width_uv); ++j) {
130
- int abs_diff = Abs(dst_u_c[(i * dst_stride_uv) + j] -
131
- dst_u_opt[(i * dst_stride_uv) + j]);
132
- if (abs_diff > max_diff) {
133
- max_diff = abs_diff;
134
- }
135
- abs_diff = Abs(dst_v_c[(i * dst_stride_uv) + j] -
136
- dst_v_opt[(i * dst_stride_uv) + j]);
137
- if (abs_diff > max_diff) {
138
- max_diff = abs_diff;
139
- }
140
- }
141
- }
142
-
143
- free_aligned_buffer_page_end(dst_y_c);
144
- free_aligned_buffer_page_end(dst_u_c);
145
- free_aligned_buffer_page_end(dst_v_c);
146
- free_aligned_buffer_page_end(dst_y_opt);
147
- free_aligned_buffer_page_end(dst_u_opt);
148
- free_aligned_buffer_page_end(dst_v_opt);
149
- free_aligned_buffer_page_end(src_y);
150
- free_aligned_buffer_page_end(src_u);
151
- free_aligned_buffer_page_end(src_v);
152
-
153
- return max_diff;
154
- }
155
-
156
- // Test scaling with 8 bit C vs 12 bit C and return maximum pixel difference.
157
- // 0 = exact.
158
- static int I420TestFilter_12(int src_width,
159
- int src_height,
160
- int dst_width,
161
- int dst_height,
162
- FilterMode f,
163
- int benchmark_iterations,
164
- int disable_cpu_flags,
165
- int benchmark_cpu_info) {
166
- if (!SizeValid(src_width, src_height, dst_width, dst_height)) {
167
- return 0;
168
- }
169
-
170
- int i;
171
- int src_width_uv = (Abs(src_width) + 1) >> 1;
172
- int src_height_uv = (Abs(src_height) + 1) >> 1;
173
-
174
- int64_t src_y_plane_size = (Abs(src_width)) * (Abs(src_height));
175
- int64_t src_uv_plane_size = (src_width_uv) * (src_height_uv);
176
-
177
- int src_stride_y = Abs(src_width);
178
- int src_stride_uv = src_width_uv;
179
-
180
- align_buffer_page_end(src_y, src_y_plane_size);
181
- align_buffer_page_end(src_u, src_uv_plane_size);
182
- align_buffer_page_end(src_v, src_uv_plane_size);
183
- align_buffer_page_end(src_y_12, src_y_plane_size * 2);
184
- align_buffer_page_end(src_u_12, src_uv_plane_size * 2);
185
- align_buffer_page_end(src_v_12, src_uv_plane_size * 2);
186
- if (!src_y || !src_u || !src_v || !src_y_12 || !src_u_12 || !src_v_12) {
187
- printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n");
188
- return 0;
189
- }
190
- uint16_t* p_src_y_12 = reinterpret_cast<uint16_t*>(src_y_12);
191
- uint16_t* p_src_u_12 = reinterpret_cast<uint16_t*>(src_u_12);
192
- uint16_t* p_src_v_12 = reinterpret_cast<uint16_t*>(src_v_12);
193
-
194
- MemRandomize(src_y, src_y_plane_size);
195
- MemRandomize(src_u, src_uv_plane_size);
196
- MemRandomize(src_v, src_uv_plane_size);
197
-
198
- for (i = 0; i < src_y_plane_size; ++i) {
199
- p_src_y_12[i] = src_y[i];
200
- }
201
- for (i = 0; i < src_uv_plane_size; ++i) {
202
- p_src_u_12[i] = src_u[i];
203
- p_src_v_12[i] = src_v[i];
204
- }
205
-
206
- int dst_width_uv = (dst_width + 1) >> 1;
207
- int dst_height_uv = (dst_height + 1) >> 1;
208
-
209
- int dst_y_plane_size = (dst_width) * (dst_height);
210
- int dst_uv_plane_size = (dst_width_uv) * (dst_height_uv);
211
-
212
- int dst_stride_y = dst_width;
213
- int dst_stride_uv = dst_width_uv;
214
-
215
- align_buffer_page_end(dst_y_8, dst_y_plane_size);
216
- align_buffer_page_end(dst_u_8, dst_uv_plane_size);
217
- align_buffer_page_end(dst_v_8, dst_uv_plane_size);
218
- align_buffer_page_end(dst_y_12, dst_y_plane_size * 2);
219
- align_buffer_page_end(dst_u_12, dst_uv_plane_size * 2);
220
- align_buffer_page_end(dst_v_12, dst_uv_plane_size * 2);
221
-
222
- uint16_t* p_dst_y_12 = reinterpret_cast<uint16_t*>(dst_y_12);
223
- uint16_t* p_dst_u_12 = reinterpret_cast<uint16_t*>(dst_u_12);
224
- uint16_t* p_dst_v_12 = reinterpret_cast<uint16_t*>(dst_v_12);
225
-
226
- MaskCpuFlags(disable_cpu_flags); // Disable all CPU optimization.
227
- I420Scale(src_y, src_stride_y, src_u, src_stride_uv, src_v, src_stride_uv,
228
- src_width, src_height, dst_y_8, dst_stride_y, dst_u_8,
229
- dst_stride_uv, dst_v_8, dst_stride_uv, dst_width, dst_height, f);
230
- MaskCpuFlags(benchmark_cpu_info); // Enable all CPU optimization.
231
- for (i = 0; i < benchmark_iterations; ++i) {
232
- I420Scale_12(p_src_y_12, src_stride_y, p_src_u_12, src_stride_uv,
233
- p_src_v_12, src_stride_uv, src_width, src_height, p_dst_y_12,
234
- dst_stride_y, p_dst_u_12, dst_stride_uv, p_dst_v_12,
235
- dst_stride_uv, dst_width, dst_height, f);
236
- }
237
-
238
- // Expect an exact match.
239
- int max_diff = 0;
240
- for (i = 0; i < dst_y_plane_size; ++i) {
241
- int abs_diff = Abs(dst_y_8[i] - p_dst_y_12[i]);
242
- if (abs_diff > max_diff) {
243
- max_diff = abs_diff;
244
- }
245
- }
246
- for (i = 0; i < dst_uv_plane_size; ++i) {
247
- int abs_diff = Abs(dst_u_8[i] - p_dst_u_12[i]);
248
- if (abs_diff > max_diff) {
249
- max_diff = abs_diff;
250
- }
251
- abs_diff = Abs(dst_v_8[i] - p_dst_v_12[i]);
252
- if (abs_diff > max_diff) {
253
- max_diff = abs_diff;
254
- }
255
- }
256
-
257
- free_aligned_buffer_page_end(dst_y_8);
258
- free_aligned_buffer_page_end(dst_u_8);
259
- free_aligned_buffer_page_end(dst_v_8);
260
- free_aligned_buffer_page_end(dst_y_12);
261
- free_aligned_buffer_page_end(dst_u_12);
262
- free_aligned_buffer_page_end(dst_v_12);
263
- free_aligned_buffer_page_end(src_y);
264
- free_aligned_buffer_page_end(src_u);
265
- free_aligned_buffer_page_end(src_v);
266
- free_aligned_buffer_page_end(src_y_12);
267
- free_aligned_buffer_page_end(src_u_12);
268
- free_aligned_buffer_page_end(src_v_12);
269
-
270
- return max_diff;
271
- }
272
-
273
- // Test scaling with 8 bit C vs 16 bit C and return maximum pixel difference.
274
- // 0 = exact.
275
- static int I420TestFilter_16(int src_width,
276
- int src_height,
277
- int dst_width,
278
- int dst_height,
279
- FilterMode f,
280
- int benchmark_iterations,
281
- int disable_cpu_flags,
282
- int benchmark_cpu_info) {
283
- if (!SizeValid(src_width, src_height, dst_width, dst_height)) {
284
- return 0;
285
- }
286
-
287
- int i;
288
- int src_width_uv = (Abs(src_width) + 1) >> 1;
289
- int src_height_uv = (Abs(src_height) + 1) >> 1;
290
-
291
- int64_t src_y_plane_size = (Abs(src_width)) * (Abs(src_height));
292
- int64_t src_uv_plane_size = (src_width_uv) * (src_height_uv);
293
-
294
- int src_stride_y = Abs(src_width);
295
- int src_stride_uv = src_width_uv;
296
-
297
- align_buffer_page_end(src_y, src_y_plane_size);
298
- align_buffer_page_end(src_u, src_uv_plane_size);
299
- align_buffer_page_end(src_v, src_uv_plane_size);
300
- align_buffer_page_end(src_y_16, src_y_plane_size * 2);
301
- align_buffer_page_end(src_u_16, src_uv_plane_size * 2);
302
- align_buffer_page_end(src_v_16, src_uv_plane_size * 2);
303
- if (!src_y || !src_u || !src_v || !src_y_16 || !src_u_16 || !src_v_16) {
304
- printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n");
305
- return 0;
306
- }
307
- uint16_t* p_src_y_16 = reinterpret_cast<uint16_t*>(src_y_16);
308
- uint16_t* p_src_u_16 = reinterpret_cast<uint16_t*>(src_u_16);
309
- uint16_t* p_src_v_16 = reinterpret_cast<uint16_t*>(src_v_16);
310
-
311
- MemRandomize(src_y, src_y_plane_size);
312
- MemRandomize(src_u, src_uv_plane_size);
313
- MemRandomize(src_v, src_uv_plane_size);
314
-
315
- for (i = 0; i < src_y_plane_size; ++i) {
316
- p_src_y_16[i] = src_y[i];
317
- }
318
- for (i = 0; i < src_uv_plane_size; ++i) {
319
- p_src_u_16[i] = src_u[i];
320
- p_src_v_16[i] = src_v[i];
321
- }
322
-
323
- int dst_width_uv = (dst_width + 1) >> 1;
324
- int dst_height_uv = (dst_height + 1) >> 1;
325
-
326
- int dst_y_plane_size = (dst_width) * (dst_height);
327
- int dst_uv_plane_size = (dst_width_uv) * (dst_height_uv);
328
-
329
- int dst_stride_y = dst_width;
330
- int dst_stride_uv = dst_width_uv;
331
-
332
- align_buffer_page_end(dst_y_8, dst_y_plane_size);
333
- align_buffer_page_end(dst_u_8, dst_uv_plane_size);
334
- align_buffer_page_end(dst_v_8, dst_uv_plane_size);
335
- align_buffer_page_end(dst_y_16, dst_y_plane_size * 2);
336
- align_buffer_page_end(dst_u_16, dst_uv_plane_size * 2);
337
- align_buffer_page_end(dst_v_16, dst_uv_plane_size * 2);
338
-
339
- uint16_t* p_dst_y_16 = reinterpret_cast<uint16_t*>(dst_y_16);
340
- uint16_t* p_dst_u_16 = reinterpret_cast<uint16_t*>(dst_u_16);
341
- uint16_t* p_dst_v_16 = reinterpret_cast<uint16_t*>(dst_v_16);
342
-
343
- MaskCpuFlags(disable_cpu_flags); // Disable all CPU optimization.
344
- I420Scale(src_y, src_stride_y, src_u, src_stride_uv, src_v, src_stride_uv,
345
- src_width, src_height, dst_y_8, dst_stride_y, dst_u_8,
346
- dst_stride_uv, dst_v_8, dst_stride_uv, dst_width, dst_height, f);
347
- MaskCpuFlags(benchmark_cpu_info); // Enable all CPU optimization.
348
- for (i = 0; i < benchmark_iterations; ++i) {
349
- I420Scale_16(p_src_y_16, src_stride_y, p_src_u_16, src_stride_uv,
350
- p_src_v_16, src_stride_uv, src_width, src_height, p_dst_y_16,
351
- dst_stride_y, p_dst_u_16, dst_stride_uv, p_dst_v_16,
352
- dst_stride_uv, dst_width, dst_height, f);
353
- }
354
-
355
- // Expect an exact match.
356
- int max_diff = 0;
357
- for (i = 0; i < dst_y_plane_size; ++i) {
358
- int abs_diff = Abs(dst_y_8[i] - p_dst_y_16[i]);
359
- if (abs_diff > max_diff) {
360
- max_diff = abs_diff;
361
- }
362
- }
363
- for (i = 0; i < dst_uv_plane_size; ++i) {
364
- int abs_diff = Abs(dst_u_8[i] - p_dst_u_16[i]);
365
- if (abs_diff > max_diff) {
366
- max_diff = abs_diff;
367
- }
368
- abs_diff = Abs(dst_v_8[i] - p_dst_v_16[i]);
369
- if (abs_diff > max_diff) {
370
- max_diff = abs_diff;
371
- }
372
- }
373
-
374
- free_aligned_buffer_page_end(dst_y_8);
375
- free_aligned_buffer_page_end(dst_u_8);
376
- free_aligned_buffer_page_end(dst_v_8);
377
- free_aligned_buffer_page_end(dst_y_16);
378
- free_aligned_buffer_page_end(dst_u_16);
379
- free_aligned_buffer_page_end(dst_v_16);
380
- free_aligned_buffer_page_end(src_y);
381
- free_aligned_buffer_page_end(src_u);
382
- free_aligned_buffer_page_end(src_v);
383
- free_aligned_buffer_page_end(src_y_16);
384
- free_aligned_buffer_page_end(src_u_16);
385
- free_aligned_buffer_page_end(src_v_16);
386
-
387
- return max_diff;
388
- }
389
-
390
- // Test scaling with C vs Opt and return maximum pixel difference. 0 = exact.
391
- static int I444TestFilter(int src_width,
392
- int src_height,
393
- int dst_width,
394
- int dst_height,
395
- FilterMode f,
396
- int benchmark_iterations,
397
- int disable_cpu_flags,
398
- int benchmark_cpu_info) {
399
- if (!SizeValid(src_width, src_height, dst_width, dst_height)) {
400
- return 0;
401
- }
402
-
403
- int i, j;
404
- int src_width_uv = Abs(src_width);
405
- int src_height_uv = Abs(src_height);
406
-
407
- int64_t src_y_plane_size = (Abs(src_width)) * (Abs(src_height));
408
- int64_t src_uv_plane_size = (src_width_uv) * (src_height_uv);
409
-
410
- int src_stride_y = Abs(src_width);
411
- int src_stride_uv = src_width_uv;
412
-
413
- align_buffer_page_end(src_y, src_y_plane_size);
414
- align_buffer_page_end(src_u, src_uv_plane_size);
415
- align_buffer_page_end(src_v, src_uv_plane_size);
416
- if (!src_y || !src_u || !src_v) {
417
- printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n");
418
- return 0;
419
- }
420
- MemRandomize(src_y, src_y_plane_size);
421
- MemRandomize(src_u, src_uv_plane_size);
422
- MemRandomize(src_v, src_uv_plane_size);
423
-
424
- int dst_width_uv = dst_width;
425
- int dst_height_uv = dst_height;
426
-
427
- int64_t dst_y_plane_size = (dst_width) * (dst_height);
428
- int64_t dst_uv_plane_size = (dst_width_uv) * (dst_height_uv);
429
-
430
- int dst_stride_y = dst_width;
431
- int dst_stride_uv = dst_width_uv;
432
-
433
- align_buffer_page_end(dst_y_c, dst_y_plane_size);
434
- align_buffer_page_end(dst_u_c, dst_uv_plane_size);
435
- align_buffer_page_end(dst_v_c, dst_uv_plane_size);
436
- align_buffer_page_end(dst_y_opt, dst_y_plane_size);
437
- align_buffer_page_end(dst_u_opt, dst_uv_plane_size);
438
- align_buffer_page_end(dst_v_opt, dst_uv_plane_size);
439
- if (!dst_y_c || !dst_u_c || !dst_v_c || !dst_y_opt || !dst_u_opt ||
440
- !dst_v_opt) {
441
- printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n");
442
- return 0;
443
- }
444
-
445
- MaskCpuFlags(disable_cpu_flags); // Disable all CPU optimization.
446
- double c_time = get_time();
447
- I444Scale(src_y, src_stride_y, src_u, src_stride_uv, src_v, src_stride_uv,
448
- src_width, src_height, dst_y_c, dst_stride_y, dst_u_c,
449
- dst_stride_uv, dst_v_c, dst_stride_uv, dst_width, dst_height, f);
450
- c_time = (get_time() - c_time);
451
-
452
- MaskCpuFlags(benchmark_cpu_info); // Enable all CPU optimization.
453
- double opt_time = get_time();
454
- for (i = 0; i < benchmark_iterations; ++i) {
455
- I444Scale(src_y, src_stride_y, src_u, src_stride_uv, src_v, src_stride_uv,
456
- src_width, src_height, dst_y_opt, dst_stride_y, dst_u_opt,
457
- dst_stride_uv, dst_v_opt, dst_stride_uv, dst_width, dst_height,
458
- f);
459
- }
460
- opt_time = (get_time() - opt_time) / benchmark_iterations;
461
- // Report performance of C vs OPT.
462
- printf("filter %d - %8d us C - %8d us OPT\n", f,
463
- static_cast<int>(c_time * 1e6), static_cast<int>(opt_time * 1e6));
464
-
465
- // C version may be a little off from the optimized. Order of
466
- // operations may introduce rounding somewhere. So do a difference
467
- // of the buffers and look to see that the max difference is not
468
- // over 3.
469
- int max_diff = 0;
470
- for (i = 0; i < (dst_height); ++i) {
471
- for (j = 0; j < (dst_width); ++j) {
472
- int abs_diff = Abs(dst_y_c[(i * dst_stride_y) + j] -
473
- dst_y_opt[(i * dst_stride_y) + j]);
474
- if (abs_diff > max_diff) {
475
- max_diff = abs_diff;
476
- }
477
- }
478
- }
479
-
480
- for (i = 0; i < (dst_height_uv); ++i) {
481
- for (j = 0; j < (dst_width_uv); ++j) {
482
- int abs_diff = Abs(dst_u_c[(i * dst_stride_uv) + j] -
483
- dst_u_opt[(i * dst_stride_uv) + j]);
484
- if (abs_diff > max_diff) {
485
- max_diff = abs_diff;
486
- }
487
- abs_diff = Abs(dst_v_c[(i * dst_stride_uv) + j] -
488
- dst_v_opt[(i * dst_stride_uv) + j]);
489
- if (abs_diff > max_diff) {
490
- max_diff = abs_diff;
491
- }
492
- }
493
- }
494
-
495
- free_aligned_buffer_page_end(dst_y_c);
496
- free_aligned_buffer_page_end(dst_u_c);
497
- free_aligned_buffer_page_end(dst_v_c);
498
- free_aligned_buffer_page_end(dst_y_opt);
499
- free_aligned_buffer_page_end(dst_u_opt);
500
- free_aligned_buffer_page_end(dst_v_opt);
501
- free_aligned_buffer_page_end(src_y);
502
- free_aligned_buffer_page_end(src_u);
503
- free_aligned_buffer_page_end(src_v);
504
-
505
- return max_diff;
506
- }
507
-
508
- // Test scaling with 8 bit C vs 12 bit C and return maximum pixel difference.
509
- // 0 = exact.
510
- static int I444TestFilter_12(int src_width,
511
- int src_height,
512
- int dst_width,
513
- int dst_height,
514
- FilterMode f,
515
- int benchmark_iterations,
516
- int disable_cpu_flags,
517
- int benchmark_cpu_info) {
518
- if (!SizeValid(src_width, src_height, dst_width, dst_height)) {
519
- return 0;
520
- }
521
-
522
- int i;
523
- int src_width_uv = Abs(src_width);
524
- int src_height_uv = Abs(src_height);
525
-
526
- int64_t src_y_plane_size = (Abs(src_width)) * (Abs(src_height));
527
- int64_t src_uv_plane_size = (src_width_uv) * (src_height_uv);
528
-
529
- int src_stride_y = Abs(src_width);
530
- int src_stride_uv = src_width_uv;
531
-
532
- align_buffer_page_end(src_y, src_y_plane_size);
533
- align_buffer_page_end(src_u, src_uv_plane_size);
534
- align_buffer_page_end(src_v, src_uv_plane_size);
535
- align_buffer_page_end(src_y_12, src_y_plane_size * 2);
536
- align_buffer_page_end(src_u_12, src_uv_plane_size * 2);
537
- align_buffer_page_end(src_v_12, src_uv_plane_size * 2);
538
- if (!src_y || !src_u || !src_v || !src_y_12 || !src_u_12 || !src_v_12) {
539
- printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n");
540
- return 0;
541
- }
542
- uint16_t* p_src_y_12 = reinterpret_cast<uint16_t*>(src_y_12);
543
- uint16_t* p_src_u_12 = reinterpret_cast<uint16_t*>(src_u_12);
544
- uint16_t* p_src_v_12 = reinterpret_cast<uint16_t*>(src_v_12);
545
-
546
- MemRandomize(src_y, src_y_plane_size);
547
- MemRandomize(src_u, src_uv_plane_size);
548
- MemRandomize(src_v, src_uv_plane_size);
549
-
550
- for (i = 0; i < src_y_plane_size; ++i) {
551
- p_src_y_12[i] = src_y[i];
552
- }
553
- for (i = 0; i < src_uv_plane_size; ++i) {
554
- p_src_u_12[i] = src_u[i];
555
- p_src_v_12[i] = src_v[i];
556
- }
557
-
558
- int dst_width_uv = dst_width;
559
- int dst_height_uv = dst_height;
560
-
561
- int dst_y_plane_size = (dst_width) * (dst_height);
562
- int dst_uv_plane_size = (dst_width_uv) * (dst_height_uv);
563
-
564
- int dst_stride_y = dst_width;
565
- int dst_stride_uv = dst_width_uv;
566
-
567
- align_buffer_page_end(dst_y_8, dst_y_plane_size);
568
- align_buffer_page_end(dst_u_8, dst_uv_plane_size);
569
- align_buffer_page_end(dst_v_8, dst_uv_plane_size);
570
- align_buffer_page_end(dst_y_12, dst_y_plane_size * 2);
571
- align_buffer_page_end(dst_u_12, dst_uv_plane_size * 2);
572
- align_buffer_page_end(dst_v_12, dst_uv_plane_size * 2);
573
-
574
- uint16_t* p_dst_y_12 = reinterpret_cast<uint16_t*>(dst_y_12);
575
- uint16_t* p_dst_u_12 = reinterpret_cast<uint16_t*>(dst_u_12);
576
- uint16_t* p_dst_v_12 = reinterpret_cast<uint16_t*>(dst_v_12);
577
-
578
- MaskCpuFlags(disable_cpu_flags); // Disable all CPU optimization.
579
- I444Scale(src_y, src_stride_y, src_u, src_stride_uv, src_v, src_stride_uv,
580
- src_width, src_height, dst_y_8, dst_stride_y, dst_u_8,
581
- dst_stride_uv, dst_v_8, dst_stride_uv, dst_width, dst_height, f);
582
- MaskCpuFlags(benchmark_cpu_info); // Enable all CPU optimization.
583
- for (i = 0; i < benchmark_iterations; ++i) {
584
- I444Scale_12(p_src_y_12, src_stride_y, p_src_u_12, src_stride_uv,
585
- p_src_v_12, src_stride_uv, src_width, src_height, p_dst_y_12,
586
- dst_stride_y, p_dst_u_12, dst_stride_uv, p_dst_v_12,
587
- dst_stride_uv, dst_width, dst_height, f);
588
- }
589
-
590
- // Expect an exact match.
591
- int max_diff = 0;
592
- for (i = 0; i < dst_y_plane_size; ++i) {
593
- int abs_diff = Abs(dst_y_8[i] - p_dst_y_12[i]);
594
- if (abs_diff > max_diff) {
595
- max_diff = abs_diff;
596
- }
597
- }
598
- for (i = 0; i < dst_uv_plane_size; ++i) {
599
- int abs_diff = Abs(dst_u_8[i] - p_dst_u_12[i]);
600
- if (abs_diff > max_diff) {
601
- max_diff = abs_diff;
602
- }
603
- abs_diff = Abs(dst_v_8[i] - p_dst_v_12[i]);
604
- if (abs_diff > max_diff) {
605
- max_diff = abs_diff;
606
- }
607
- }
608
-
609
- free_aligned_buffer_page_end(dst_y_8);
610
- free_aligned_buffer_page_end(dst_u_8);
611
- free_aligned_buffer_page_end(dst_v_8);
612
- free_aligned_buffer_page_end(dst_y_12);
613
- free_aligned_buffer_page_end(dst_u_12);
614
- free_aligned_buffer_page_end(dst_v_12);
615
- free_aligned_buffer_page_end(src_y);
616
- free_aligned_buffer_page_end(src_u);
617
- free_aligned_buffer_page_end(src_v);
618
- free_aligned_buffer_page_end(src_y_12);
619
- free_aligned_buffer_page_end(src_u_12);
620
- free_aligned_buffer_page_end(src_v_12);
621
-
622
- return max_diff;
623
- }
624
-
625
- // Test scaling with 8 bit C vs 16 bit C and return maximum pixel difference.
626
- // 0 = exact.
627
- static int I444TestFilter_16(int src_width,
628
- int src_height,
629
- int dst_width,
630
- int dst_height,
631
- FilterMode f,
632
- int benchmark_iterations,
633
- int disable_cpu_flags,
634
- int benchmark_cpu_info) {
635
- if (!SizeValid(src_width, src_height, dst_width, dst_height)) {
636
- return 0;
637
- }
638
-
639
- int i;
640
- int src_width_uv = Abs(src_width);
641
- int src_height_uv = Abs(src_height);
642
-
643
- int64_t src_y_plane_size = (Abs(src_width)) * (Abs(src_height));
644
- int64_t src_uv_plane_size = (src_width_uv) * (src_height_uv);
645
-
646
- int src_stride_y = Abs(src_width);
647
- int src_stride_uv = src_width_uv;
648
-
649
- align_buffer_page_end(src_y, src_y_plane_size);
650
- align_buffer_page_end(src_u, src_uv_plane_size);
651
- align_buffer_page_end(src_v, src_uv_plane_size);
652
- align_buffer_page_end(src_y_16, src_y_plane_size * 2);
653
- align_buffer_page_end(src_u_16, src_uv_plane_size * 2);
654
- align_buffer_page_end(src_v_16, src_uv_plane_size * 2);
655
- if (!src_y || !src_u || !src_v || !src_y_16 || !src_u_16 || !src_v_16) {
656
- printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n");
657
- return 0;
658
- }
659
- uint16_t* p_src_y_16 = reinterpret_cast<uint16_t*>(src_y_16);
660
- uint16_t* p_src_u_16 = reinterpret_cast<uint16_t*>(src_u_16);
661
- uint16_t* p_src_v_16 = reinterpret_cast<uint16_t*>(src_v_16);
662
-
663
- MemRandomize(src_y, src_y_plane_size);
664
- MemRandomize(src_u, src_uv_plane_size);
665
- MemRandomize(src_v, src_uv_plane_size);
666
-
667
- for (i = 0; i < src_y_plane_size; ++i) {
668
- p_src_y_16[i] = src_y[i];
669
- }
670
- for (i = 0; i < src_uv_plane_size; ++i) {
671
- p_src_u_16[i] = src_u[i];
672
- p_src_v_16[i] = src_v[i];
673
- }
674
-
675
- int dst_width_uv = dst_width;
676
- int dst_height_uv = dst_height;
677
-
678
- int dst_y_plane_size = (dst_width) * (dst_height);
679
- int dst_uv_plane_size = (dst_width_uv) * (dst_height_uv);
680
-
681
- int dst_stride_y = dst_width;
682
- int dst_stride_uv = dst_width_uv;
683
-
684
- align_buffer_page_end(dst_y_8, dst_y_plane_size);
685
- align_buffer_page_end(dst_u_8, dst_uv_plane_size);
686
- align_buffer_page_end(dst_v_8, dst_uv_plane_size);
687
- align_buffer_page_end(dst_y_16, dst_y_plane_size * 2);
688
- align_buffer_page_end(dst_u_16, dst_uv_plane_size * 2);
689
- align_buffer_page_end(dst_v_16, dst_uv_plane_size * 2);
690
-
691
- uint16_t* p_dst_y_16 = reinterpret_cast<uint16_t*>(dst_y_16);
692
- uint16_t* p_dst_u_16 = reinterpret_cast<uint16_t*>(dst_u_16);
693
- uint16_t* p_dst_v_16 = reinterpret_cast<uint16_t*>(dst_v_16);
694
-
695
- MaskCpuFlags(disable_cpu_flags); // Disable all CPU optimization.
696
- I444Scale(src_y, src_stride_y, src_u, src_stride_uv, src_v, src_stride_uv,
697
- src_width, src_height, dst_y_8, dst_stride_y, dst_u_8,
698
- dst_stride_uv, dst_v_8, dst_stride_uv, dst_width, dst_height, f);
699
- MaskCpuFlags(benchmark_cpu_info); // Enable all CPU optimization.
700
- for (i = 0; i < benchmark_iterations; ++i) {
701
- I444Scale_16(p_src_y_16, src_stride_y, p_src_u_16, src_stride_uv,
702
- p_src_v_16, src_stride_uv, src_width, src_height, p_dst_y_16,
703
- dst_stride_y, p_dst_u_16, dst_stride_uv, p_dst_v_16,
704
- dst_stride_uv, dst_width, dst_height, f);
705
- }
706
-
707
- // Expect an exact match.
708
- int max_diff = 0;
709
- for (i = 0; i < dst_y_plane_size; ++i) {
710
- int abs_diff = Abs(dst_y_8[i] - p_dst_y_16[i]);
711
- if (abs_diff > max_diff) {
712
- max_diff = abs_diff;
713
- }
714
- }
715
- for (i = 0; i < dst_uv_plane_size; ++i) {
716
- int abs_diff = Abs(dst_u_8[i] - p_dst_u_16[i]);
717
- if (abs_diff > max_diff) {
718
- max_diff = abs_diff;
719
- }
720
- abs_diff = Abs(dst_v_8[i] - p_dst_v_16[i]);
721
- if (abs_diff > max_diff) {
722
- max_diff = abs_diff;
723
- }
724
- }
725
-
726
- free_aligned_buffer_page_end(dst_y_8);
727
- free_aligned_buffer_page_end(dst_u_8);
728
- free_aligned_buffer_page_end(dst_v_8);
729
- free_aligned_buffer_page_end(dst_y_16);
730
- free_aligned_buffer_page_end(dst_u_16);
731
- free_aligned_buffer_page_end(dst_v_16);
732
- free_aligned_buffer_page_end(src_y);
733
- free_aligned_buffer_page_end(src_u);
734
- free_aligned_buffer_page_end(src_v);
735
- free_aligned_buffer_page_end(src_y_16);
736
- free_aligned_buffer_page_end(src_u_16);
737
- free_aligned_buffer_page_end(src_v_16);
738
-
739
- return max_diff;
740
- }
741
-
742
- // Test scaling with C vs Opt and return maximum pixel difference. 0 = exact.
743
- static int NV12TestFilter(int src_width,
744
- int src_height,
745
- int dst_width,
746
- int dst_height,
747
- FilterMode f,
748
- int benchmark_iterations,
749
- int disable_cpu_flags,
750
- int benchmark_cpu_info) {
751
- if (!SizeValid(src_width, src_height, dst_width, dst_height)) {
752
- return 0;
753
- }
754
-
755
- int i, j;
756
- int src_width_uv = (Abs(src_width) + 1) >> 1;
757
- int src_height_uv = (Abs(src_height) + 1) >> 1;
758
-
759
- int64_t src_y_plane_size = (Abs(src_width)) * (Abs(src_height));
760
- int64_t src_uv_plane_size = (src_width_uv) * (src_height_uv)*2;
761
-
762
- int src_stride_y = Abs(src_width);
763
- int src_stride_uv = src_width_uv * 2;
764
-
765
- align_buffer_page_end(src_y, src_y_plane_size);
766
- align_buffer_page_end(src_uv, src_uv_plane_size);
767
- if (!src_y || !src_uv) {
768
- printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n");
769
- return 0;
770
- }
771
- MemRandomize(src_y, src_y_plane_size);
772
- MemRandomize(src_uv, src_uv_plane_size);
773
-
774
- int dst_width_uv = (dst_width + 1) >> 1;
775
- int dst_height_uv = (dst_height + 1) >> 1;
776
-
777
- int64_t dst_y_plane_size = (dst_width) * (dst_height);
778
- int64_t dst_uv_plane_size = (dst_width_uv) * (dst_height_uv)*2;
779
-
780
- int dst_stride_y = dst_width;
781
- int dst_stride_uv = dst_width_uv * 2;
782
-
783
- align_buffer_page_end(dst_y_c, dst_y_plane_size);
784
- align_buffer_page_end(dst_uv_c, dst_uv_plane_size);
785
- align_buffer_page_end(dst_y_opt, dst_y_plane_size);
786
- align_buffer_page_end(dst_uv_opt, dst_uv_plane_size);
787
- if (!dst_y_c || !dst_uv_c || !dst_y_opt || !dst_uv_opt) {
788
- printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n");
789
- return 0;
790
- }
791
-
792
- MaskCpuFlags(disable_cpu_flags); // Disable all CPU optimization.
793
- double c_time = get_time();
794
- NV12Scale(src_y, src_stride_y, src_uv, src_stride_uv, src_width, src_height,
795
- dst_y_c, dst_stride_y, dst_uv_c, dst_stride_uv, dst_width,
796
- dst_height, f);
797
- c_time = (get_time() - c_time);
798
-
799
- MaskCpuFlags(benchmark_cpu_info); // Enable all CPU optimization.
800
- double opt_time = get_time();
801
- for (i = 0; i < benchmark_iterations; ++i) {
802
- NV12Scale(src_y, src_stride_y, src_uv, src_stride_uv, src_width, src_height,
803
- dst_y_opt, dst_stride_y, dst_uv_opt, dst_stride_uv, dst_width,
804
- dst_height, f);
805
- }
806
- opt_time = (get_time() - opt_time) / benchmark_iterations;
807
- // Report performance of C vs OPT.
808
- printf("filter %d - %8d us C - %8d us OPT\n", f,
809
- static_cast<int>(c_time * 1e6), static_cast<int>(opt_time * 1e6));
810
-
811
- // C version may be a little off from the optimized. Order of
812
- // operations may introduce rounding somewhere. So do a difference
813
- // of the buffers and look to see that the max difference is not
814
- // over 3.
815
- int max_diff = 0;
816
- for (i = 0; i < (dst_height); ++i) {
817
- for (j = 0; j < (dst_width); ++j) {
818
- int abs_diff = Abs(dst_y_c[(i * dst_stride_y) + j] -
819
- dst_y_opt[(i * dst_stride_y) + j]);
820
- if (abs_diff > max_diff) {
821
- max_diff = abs_diff;
822
- }
823
- }
824
- }
825
-
826
- for (i = 0; i < (dst_height_uv); ++i) {
827
- for (j = 0; j < (dst_width_uv * 2); ++j) {
828
- int abs_diff = Abs(dst_uv_c[(i * dst_stride_uv) + j] -
829
- dst_uv_opt[(i * dst_stride_uv) + j]);
830
- if (abs_diff > max_diff) {
831
- max_diff = abs_diff;
832
- }
833
- }
834
- }
835
-
836
- free_aligned_buffer_page_end(dst_y_c);
837
- free_aligned_buffer_page_end(dst_uv_c);
838
- free_aligned_buffer_page_end(dst_y_opt);
839
- free_aligned_buffer_page_end(dst_uv_opt);
840
- free_aligned_buffer_page_end(src_y);
841
- free_aligned_buffer_page_end(src_uv);
842
-
843
- return max_diff;
844
- }
845
-
846
- // The following adjustments in dimensions ensure the scale factor will be
847
- // exactly achieved.
848
- // 2 is chroma subsample.
849
- #define DX(x, nom, denom) static_cast<int>(((Abs(x) / nom + 1) / 2) * nom * 2)
850
- #define SX(x, nom, denom) static_cast<int>(((x / nom + 1) / 2) * denom * 2)
851
-
852
- #define TEST_FACTOR1(DISABLED_, name, filter, nom, denom, max_diff) \
853
- TEST_F(LibYUVScaleTest, I420ScaleDownBy##name##_##filter) { \
854
- int diff = I420TestFilter( \
855
- SX(benchmark_width_, nom, denom), SX(benchmark_height_, nom, denom), \
856
- DX(benchmark_width_, nom, denom), DX(benchmark_height_, nom, denom), \
857
- kFilter##filter, benchmark_iterations_, disable_cpu_flags_, \
858
- benchmark_cpu_info_); \
859
- EXPECT_LE(diff, max_diff); \
860
- } \
861
- TEST_F(LibYUVScaleTest, I444ScaleDownBy##name##_##filter) { \
862
- int diff = I444TestFilter( \
863
- SX(benchmark_width_, nom, denom), SX(benchmark_height_, nom, denom), \
864
- DX(benchmark_width_, nom, denom), DX(benchmark_height_, nom, denom), \
865
- kFilter##filter, benchmark_iterations_, disable_cpu_flags_, \
866
- benchmark_cpu_info_); \
867
- EXPECT_LE(diff, max_diff); \
868
- } \
869
- TEST_F(LibYUVScaleTest, DISABLED_##I420ScaleDownBy##name##_##filter##_12) { \
870
- int diff = I420TestFilter_12( \
871
- SX(benchmark_width_, nom, denom), SX(benchmark_height_, nom, denom), \
872
- DX(benchmark_width_, nom, denom), DX(benchmark_height_, nom, denom), \
873
- kFilter##filter, benchmark_iterations_, disable_cpu_flags_, \
874
- benchmark_cpu_info_); \
875
- EXPECT_LE(diff, max_diff); \
876
- } \
877
- TEST_F(LibYUVScaleTest, DISABLED_##I444ScaleDownBy##name##_##filter##_12) { \
878
- int diff = I444TestFilter_12( \
879
- SX(benchmark_width_, nom, denom), SX(benchmark_height_, nom, denom), \
880
- DX(benchmark_width_, nom, denom), DX(benchmark_height_, nom, denom), \
881
- kFilter##filter, benchmark_iterations_, disable_cpu_flags_, \
882
- benchmark_cpu_info_); \
883
- EXPECT_LE(diff, max_diff); \
884
- } \
885
- TEST_F(LibYUVScaleTest, NV12ScaleDownBy##name##_##filter) { \
886
- int diff = NV12TestFilter( \
887
- SX(benchmark_width_, nom, denom), SX(benchmark_height_, nom, denom), \
888
- DX(benchmark_width_, nom, denom), DX(benchmark_height_, nom, denom), \
889
- kFilter##filter, benchmark_iterations_, disable_cpu_flags_, \
890
- benchmark_cpu_info_); \
891
- EXPECT_LE(diff, max_diff); \
892
- }
893
-
894
- // Test a scale factor with all 4 filters. Expect unfiltered to be exact, but
895
- // filtering is different fixed point implementations for SSSE3, Neon and C.
896
- #ifndef DISABLE_SLOW_TESTS
897
- #define TEST_FACTOR(name, nom, denom, boxdiff) \
898
- TEST_FACTOR1(, name, None, nom, denom, 0) \
899
- TEST_FACTOR1(, name, Linear, nom, denom, 3) \
900
- TEST_FACTOR1(, name, Bilinear, nom, denom, 3) \
901
- TEST_FACTOR1(, name, Box, nom, denom, boxdiff)
902
- #else
903
- #if defined(ENABLE_FULL_TESTS)
904
- #define TEST_FACTOR(name, nom, denom, boxdiff) \
905
- TEST_FACTOR1(DISABLED_, name, None, nom, denom, 0) \
906
- TEST_FACTOR1(DISABLED_, name, Linear, nom, denom, 3) \
907
- TEST_FACTOR1(DISABLED_, name, Bilinear, nom, denom, 3) \
908
- TEST_FACTOR1(DISABLED_, name, Box, nom, denom, boxdiff)
909
- #else
910
- #define TEST_FACTOR(name, nom, denom, boxdiff) \
911
- TEST_FACTOR1(DISABLED_, name, Bilinear, nom, denom, 3) \
912
- TEST_FACTOR1(DISABLED_, name, Box, nom, denom, boxdiff)
913
- #endif
914
- #endif
915
-
916
- TEST_FACTOR(2, 1, 2, 0)
917
- TEST_FACTOR(4, 1, 4, 0)
918
- #ifndef DISABLE_SLOW_TESTS
919
- TEST_FACTOR(8, 1, 8, 0)
920
- #endif
921
- TEST_FACTOR(3by4, 3, 4, 1)
922
- TEST_FACTOR(3by8, 3, 8, 1)
923
- TEST_FACTOR(3, 1, 3, 0)
924
- #undef TEST_FACTOR1
925
- #undef TEST_FACTOR
926
- #undef SX
927
- #undef DX
928
-
929
- #define TEST_SCALETO1(DISABLED_, name, width, height, filter, max_diff) \
930
- TEST_F(LibYUVScaleTest, I420##name##To##width##x##height##_##filter) { \
931
- int diff = I420TestFilter(benchmark_width_, benchmark_height_, width, \
932
- height, kFilter##filter, benchmark_iterations_, \
933
- disable_cpu_flags_, benchmark_cpu_info_); \
934
- EXPECT_LE(diff, max_diff); \
935
- } \
936
- TEST_F(LibYUVScaleTest, I444##name##To##width##x##height##_##filter) { \
937
- int diff = I444TestFilter(benchmark_width_, benchmark_height_, width, \
938
- height, kFilter##filter, benchmark_iterations_, \
939
- disable_cpu_flags_, benchmark_cpu_info_); \
940
- EXPECT_LE(diff, max_diff); \
941
- } \
942
- TEST_F(LibYUVScaleTest, \
943
- DISABLED_##I420##name##To##width##x##height##_##filter##_12) { \
944
- int diff = I420TestFilter_12( \
945
- benchmark_width_, benchmark_height_, width, height, kFilter##filter, \
946
- benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_); \
947
- EXPECT_LE(diff, max_diff); \
948
- } \
949
- TEST_F(LibYUVScaleTest, \
950
- DISABLED_##I444##name##To##width##x##height##_##filter##_12) { \
951
- int diff = I444TestFilter_12( \
952
- benchmark_width_, benchmark_height_, width, height, kFilter##filter, \
953
- benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_); \
954
- EXPECT_LE(diff, max_diff); \
955
- } \
956
- TEST_F(LibYUVScaleTest, \
957
- DISABLED_##I420##name##To##width##x##height##_##filter##_16) { \
958
- int diff = I420TestFilter_16( \
959
- benchmark_width_, benchmark_height_, width, height, kFilter##filter, \
960
- benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_); \
961
- EXPECT_LE(diff, max_diff); \
962
- } \
963
- TEST_F(LibYUVScaleTest, \
964
- DISABLED_##I444##name##To##width##x##height##_##filter##_16) { \
965
- int diff = I444TestFilter_16( \
966
- benchmark_width_, benchmark_height_, width, height, kFilter##filter, \
967
- benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_); \
968
- EXPECT_LE(diff, max_diff); \
969
- } \
970
- TEST_F(LibYUVScaleTest, NV12##name##To##width##x##height##_##filter) { \
971
- int diff = NV12TestFilter(benchmark_width_, benchmark_height_, width, \
972
- height, kFilter##filter, benchmark_iterations_, \
973
- disable_cpu_flags_, benchmark_cpu_info_); \
974
- EXPECT_LE(diff, max_diff); \
975
- } \
976
- TEST_F(LibYUVScaleTest, I420##name##From##width##x##height##_##filter) { \
977
- int diff = I420TestFilter(width, height, Abs(benchmark_width_), \
978
- Abs(benchmark_height_), kFilter##filter, \
979
- benchmark_iterations_, disable_cpu_flags_, \
980
- benchmark_cpu_info_); \
981
- EXPECT_LE(diff, max_diff); \
982
- } \
983
- TEST_F(LibYUVScaleTest, I444##name##From##width##x##height##_##filter) { \
984
- int diff = I444TestFilter(width, height, Abs(benchmark_width_), \
985
- Abs(benchmark_height_), kFilter##filter, \
986
- benchmark_iterations_, disable_cpu_flags_, \
987
- benchmark_cpu_info_); \
988
- EXPECT_LE(diff, max_diff); \
989
- } \
990
- TEST_F(LibYUVScaleTest, \
991
- DISABLED_##I420##name##From##width##x##height##_##filter##_12) { \
992
- int diff = I420TestFilter_12(width, height, Abs(benchmark_width_), \
993
- Abs(benchmark_height_), kFilter##filter, \
994
- benchmark_iterations_, disable_cpu_flags_, \
995
- benchmark_cpu_info_); \
996
- EXPECT_LE(diff, max_diff); \
997
- } \
998
- TEST_F(LibYUVScaleTest, \
999
- DISABLED_##I444##name##From##width##x##height##_##filter##_12) { \
1000
- int diff = I444TestFilter_12(width, height, Abs(benchmark_width_), \
1001
- Abs(benchmark_height_), kFilter##filter, \
1002
- benchmark_iterations_, disable_cpu_flags_, \
1003
- benchmark_cpu_info_); \
1004
- EXPECT_LE(diff, max_diff); \
1005
- } \
1006
- TEST_F(LibYUVScaleTest, \
1007
- DISABLED_##I420##name##From##width##x##height##_##filter##_16) { \
1008
- int diff = I420TestFilter_16(width, height, Abs(benchmark_width_), \
1009
- Abs(benchmark_height_), kFilter##filter, \
1010
- benchmark_iterations_, disable_cpu_flags_, \
1011
- benchmark_cpu_info_); \
1012
- EXPECT_LE(diff, max_diff); \
1013
- } \
1014
- TEST_F(LibYUVScaleTest, \
1015
- DISABLED_##I444##name##From##width##x##height##_##filter##_16) { \
1016
- int diff = I444TestFilter_16(width, height, Abs(benchmark_width_), \
1017
- Abs(benchmark_height_), kFilter##filter, \
1018
- benchmark_iterations_, disable_cpu_flags_, \
1019
- benchmark_cpu_info_); \
1020
- EXPECT_LE(diff, max_diff); \
1021
- } \
1022
- TEST_F(LibYUVScaleTest, NV12##name##From##width##x##height##_##filter) { \
1023
- int diff = NV12TestFilter(width, height, Abs(benchmark_width_), \
1024
- Abs(benchmark_height_), kFilter##filter, \
1025
- benchmark_iterations_, disable_cpu_flags_, \
1026
- benchmark_cpu_info_); \
1027
- EXPECT_LE(diff, max_diff); \
1028
- }
1029
-
1030
- #ifndef DISABLE_SLOW_TESTS
1031
- // Test scale to a specified size with all 4 filters.
1032
- #define TEST_SCALETO(name, width, height) \
1033
- TEST_SCALETO1(, name, width, height, None, 0) \
1034
- TEST_SCALETO1(, name, width, height, Linear, 3) \
1035
- TEST_SCALETO1(, name, width, height, Bilinear, 3) \
1036
- TEST_SCALETO1(, name, width, height, Box, 3)
1037
- #else
1038
- #if defined(ENABLE_FULL_TESTS)
1039
- #define TEST_SCALETO(name, width, height) \
1040
- TEST_SCALETO1(DISABLED_, name, width, height, None, 0) \
1041
- TEST_SCALETO1(DISABLED_, name, width, height, Linear, 3) \
1042
- TEST_SCALETO1(DISABLED_, name, width, height, Bilinear, 3) \
1043
- TEST_SCALETO1(DISABLED_, name, width, height, Box, 3)
1044
- #else
1045
- #define TEST_SCALETO(name, width, height) \
1046
- TEST_SCALETO1(DISABLED_, name, width, height, Bilinear, 3) \
1047
- TEST_SCALETO1(DISABLED_, name, width, height, Box, 3)
1048
- #endif
1049
- #endif
1050
-
1051
- TEST_SCALETO(Scale, 1, 1)
1052
- TEST_SCALETO(Scale, 569, 480)
1053
- TEST_SCALETO(Scale, 640, 360)
1054
- #ifndef DISABLE_SLOW_TESTS
1055
- TEST_SCALETO(Scale, 256, 144) /* 128x72 * 2 */
1056
- TEST_SCALETO(Scale, 264, 216)
1057
- TEST_SCALETO(Scale, 320, 240)
1058
- TEST_SCALETO(Scale, 1280, 720)
1059
- TEST_SCALETO(Scale, 1920, 1080)
1060
- TEST_SCALETO(Scale, 1080, 1920) // for rotated phones
1061
- #endif // DISABLE_SLOW_TESTS
1062
- #undef TEST_SCALETO1
1063
- #undef TEST_SCALETO
1064
-
1065
- #define TEST_SCALESWAPXY1(DISABLED_, name, filter, max_diff) \
1066
- TEST_F(LibYUVScaleTest, I420##name##SwapXY_##filter) { \
1067
- int diff = I420TestFilter(benchmark_width_, benchmark_height_, \
1068
- benchmark_height_, benchmark_width_, \
1069
- kFilter##filter, benchmark_iterations_, \
1070
- disable_cpu_flags_, benchmark_cpu_info_); \
1071
- EXPECT_LE(diff, max_diff); \
1072
- } \
1073
- TEST_F(LibYUVScaleTest, I444##name##SwapXY_##filter) { \
1074
- int diff = I444TestFilter(benchmark_width_, benchmark_height_, \
1075
- benchmark_height_, benchmark_width_, \
1076
- kFilter##filter, benchmark_iterations_, \
1077
- disable_cpu_flags_, benchmark_cpu_info_); \
1078
- EXPECT_LE(diff, max_diff); \
1079
- } \
1080
- TEST_F(LibYUVScaleTest, DISABLED_##I420##name##SwapXY_##filter##_12) { \
1081
- int diff = I420TestFilter_12(benchmark_width_, benchmark_height_, \
1082
- benchmark_height_, benchmark_width_, \
1083
- kFilter##filter, benchmark_iterations_, \
1084
- disable_cpu_flags_, benchmark_cpu_info_); \
1085
- EXPECT_LE(diff, max_diff); \
1086
- } \
1087
- TEST_F(LibYUVScaleTest, DISABLED_##I444##name##SwapXY_##filter##_12) { \
1088
- int diff = I444TestFilter_12(benchmark_width_, benchmark_height_, \
1089
- benchmark_height_, benchmark_width_, \
1090
- kFilter##filter, benchmark_iterations_, \
1091
- disable_cpu_flags_, benchmark_cpu_info_); \
1092
- EXPECT_LE(diff, max_diff); \
1093
- } \
1094
- TEST_F(LibYUVScaleTest, DISABLED_##I420##name##SwapXY_##filter##_16) { \
1095
- int diff = I420TestFilter_16(benchmark_width_, benchmark_height_, \
1096
- benchmark_height_, benchmark_width_, \
1097
- kFilter##filter, benchmark_iterations_, \
1098
- disable_cpu_flags_, benchmark_cpu_info_); \
1099
- EXPECT_LE(diff, max_diff); \
1100
- } \
1101
- TEST_F(LibYUVScaleTest, DISABLED_##I444##name##SwapXY_##filter##_16) { \
1102
- int diff = I444TestFilter_16(benchmark_width_, benchmark_height_, \
1103
- benchmark_height_, benchmark_width_, \
1104
- kFilter##filter, benchmark_iterations_, \
1105
- disable_cpu_flags_, benchmark_cpu_info_); \
1106
- EXPECT_LE(diff, max_diff); \
1107
- } \
1108
- TEST_F(LibYUVScaleTest, NV12##name##SwapXY_##filter) { \
1109
- int diff = NV12TestFilter(benchmark_width_, benchmark_height_, \
1110
- benchmark_height_, benchmark_width_, \
1111
- kFilter##filter, benchmark_iterations_, \
1112
- disable_cpu_flags_, benchmark_cpu_info_); \
1113
- EXPECT_LE(diff, max_diff); \
1114
- }
1115
-
1116
- // Test scale to a specified size with all 4 filters.
1117
- #ifndef DISABLE_SLOW_TESTS
1118
- TEST_SCALESWAPXY1(, Scale, None, 0)
1119
- TEST_SCALESWAPXY1(, Scale, Linear, 3)
1120
- TEST_SCALESWAPXY1(, Scale, Bilinear, 3)
1121
- TEST_SCALESWAPXY1(, Scale, Box, 3)
1122
- #else
1123
- #if defined(ENABLE_FULL_TESTS)
1124
- TEST_SCALESWAPXY1(DISABLED_, Scale, None, 0)
1125
- TEST_SCALESWAPXY1(DISABLED_, Scale, Linear, 3)
1126
- TEST_SCALESWAPXY1(DISABLED_, Scale, Bilinear, 3)
1127
- TEST_SCALESWAPXY1(DISABLED_, Scale, Box, 3)
1128
- #else
1129
- TEST_SCALESWAPXY1(DISABLED_, Scale, Bilinear, 3)
1130
- TEST_SCALESWAPXY1(DISABLED_, Scale, Box, 3)
1131
- #endif
1132
- #endif
1133
- #undef TEST_SCALESWAPXY1
1134
-
1135
- } // namespace libyuv