react-native-vision-camera-spoof-detector 1.1.22 → 1.1.24

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 (201) 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/android/src/main/java/com/faceantispoof/FaceAntiSpoofingAdvanced.kt +83 -0
  5. package/android/src/main/java/com/margelo/nitro/camera/spoofdetector/HybridSpoofDetectorOutput.kt +26 -11
  6. package/package.json +1 -1
  7. package/android/src/main/cpp/CMakeLists.txt +0 -33
  8. package/android/src/main/cpp/FaceAntiSpoofJSI.cpp +0 -142
  9. package/android/src/main/cpp/FastYuvJni.cpp +0 -111
  10. package/android/src/main/cpp/fast_yuv.cpp +0 -342
  11. package/android/src/main/cpp/fast_yuv.h +0 -23
  12. package/android/src/main/cpp/libyuv/.clang-format +0 -6
  13. package/android/src/main/cpp/libyuv/.gn +0 -40
  14. package/android/src/main/cpp/libyuv/.vpython3 +0 -410
  15. package/android/src/main/cpp/libyuv/AUTHORS +0 -7
  16. package/android/src/main/cpp/libyuv/Android.bp +0 -202
  17. package/android/src/main/cpp/libyuv/Android.mk +0 -106
  18. package/android/src/main/cpp/libyuv/BUILD.gn +0 -490
  19. package/android/src/main/cpp/libyuv/CM_linux_packages.cmake +0 -70
  20. package/android/src/main/cpp/libyuv/CMakeLists.txt +0 -259
  21. package/android/src/main/cpp/libyuv/DEPS +0 -935
  22. package/android/src/main/cpp/libyuv/DIR_METADATA +0 -3
  23. package/android/src/main/cpp/libyuv/LICENSE +0 -29
  24. package/android/src/main/cpp/libyuv/OWNERS +0 -11
  25. package/android/src/main/cpp/libyuv/PATENTS +0 -24
  26. package/android/src/main/cpp/libyuv/PRESUBMIT.py +0 -65
  27. package/android/src/main/cpp/libyuv/README.chromium +0 -11
  28. package/android/src/main/cpp/libyuv/README.md +0 -19
  29. package/android/src/main/cpp/libyuv/build_overrides/build.gni +0 -60
  30. package/android/src/main/cpp/libyuv/build_overrides/gtest.gni +0 -19
  31. package/android/src/main/cpp/libyuv/build_overrides/partition_alloc.gni +0 -17
  32. package/android/src/main/cpp/libyuv/codereview.settings +0 -5
  33. package/android/src/main/cpp/libyuv/docs/deprecated_builds.md +0 -409
  34. package/android/src/main/cpp/libyuv/docs/environment_variables.md +0 -64
  35. package/android/src/main/cpp/libyuv/docs/feature_detection.md +0 -108
  36. package/android/src/main/cpp/libyuv/docs/filtering.md +0 -196
  37. package/android/src/main/cpp/libyuv/docs/formats.md +0 -208
  38. package/android/src/main/cpp/libyuv/docs/getting_started.md +0 -296
  39. package/android/src/main/cpp/libyuv/docs/rotation.md +0 -107
  40. package/android/src/main/cpp/libyuv/download_vs_toolchain.py +0 -29
  41. package/android/src/main/cpp/libyuv/include/libyuv/basic_types.h +0 -68
  42. package/android/src/main/cpp/libyuv/include/libyuv/compare.h +0 -111
  43. package/android/src/main/cpp/libyuv/include/libyuv/compare_row.h +0 -112
  44. package/android/src/main/cpp/libyuv/include/libyuv/convert.h +0 -1117
  45. package/android/src/main/cpp/libyuv/include/libyuv/convert_argb.h +0 -2335
  46. package/android/src/main/cpp/libyuv/include/libyuv/convert_from.h +0 -203
  47. package/android/src/main/cpp/libyuv/include/libyuv/convert_from_argb.h +0 -394
  48. package/android/src/main/cpp/libyuv/include/libyuv/cpu_id.h +0 -147
  49. package/android/src/main/cpp/libyuv/include/libyuv/cpu_support.h +0 -99
  50. package/android/src/main/cpp/libyuv/include/libyuv/loongson_intrinsics.h +0 -1949
  51. package/android/src/main/cpp/libyuv/include/libyuv/mjpeg_decoder.h +0 -195
  52. package/android/src/main/cpp/libyuv/include/libyuv/planar_functions.h +0 -1131
  53. package/android/src/main/cpp/libyuv/include/libyuv/rotate.h +0 -296
  54. package/android/src/main/cpp/libyuv/include/libyuv/rotate_argb.h +0 -37
  55. package/android/src/main/cpp/libyuv/include/libyuv/rotate_row.h +0 -265
  56. package/android/src/main/cpp/libyuv/include/libyuv/row.h +0 -6738
  57. package/android/src/main/cpp/libyuv/include/libyuv/row_sve.h +0 -2154
  58. package/android/src/main/cpp/libyuv/include/libyuv/scale.h +0 -336
  59. package/android/src/main/cpp/libyuv/include/libyuv/scale_argb.h +0 -76
  60. package/android/src/main/cpp/libyuv/include/libyuv/scale_rgb.h +0 -42
  61. package/android/src/main/cpp/libyuv/include/libyuv/scale_row.h +0 -1726
  62. package/android/src/main/cpp/libyuv/include/libyuv/scale_uv.h +0 -51
  63. package/android/src/main/cpp/libyuv/include/libyuv/version.h +0 -16
  64. package/android/src/main/cpp/libyuv/include/libyuv/video_common.h +0 -222
  65. package/android/src/main/cpp/libyuv/include/libyuv.h +0 -33
  66. package/android/src/main/cpp/libyuv/infra/config/OWNERS +0 -3
  67. package/android/src/main/cpp/libyuv/infra/config/PRESUBMIT.py +0 -17
  68. package/android/src/main/cpp/libyuv/infra/config/README.md +0 -2
  69. package/android/src/main/cpp/libyuv/infra/config/codereview.settings +0 -6
  70. package/android/src/main/cpp/libyuv/infra/config/commit-queue.cfg +0 -144
  71. package/android/src/main/cpp/libyuv/infra/config/cr-buildbucket.cfg +0 -1185
  72. package/android/src/main/cpp/libyuv/infra/config/luci-logdog.cfg +0 -9
  73. package/android/src/main/cpp/libyuv/infra/config/luci-milo.cfg +0 -246
  74. package/android/src/main/cpp/libyuv/infra/config/luci-scheduler.cfg +0 -385
  75. package/android/src/main/cpp/libyuv/infra/config/main.star +0 -402
  76. package/android/src/main/cpp/libyuv/infra/config/project.cfg +0 -16
  77. package/android/src/main/cpp/libyuv/infra/config/realms.cfg +0 -111
  78. package/android/src/main/cpp/libyuv/libyuv.gni +0 -34
  79. package/android/src/main/cpp/libyuv/libyuv.gyp +0 -149
  80. package/android/src/main/cpp/libyuv/libyuv.gypi +0 -87
  81. package/android/src/main/cpp/libyuv/linux.mk +0 -96
  82. package/android/src/main/cpp/libyuv/public.mk +0 -13
  83. package/android/src/main/cpp/libyuv/pylintrc +0 -49
  84. package/android/src/main/cpp/libyuv/riscv_script/prepare_toolchain_qemu.sh +0 -74
  85. package/android/src/main/cpp/libyuv/riscv_script/riscv-clang.cmake +0 -56
  86. package/android/src/main/cpp/libyuv/riscv_script/run_qemu.sh +0 -15
  87. package/android/src/main/cpp/libyuv/source/compare.cc +0 -435
  88. package/android/src/main/cpp/libyuv/source/compare_common.cc +0 -74
  89. package/android/src/main/cpp/libyuv/source/compare_gcc.cc +0 -362
  90. package/android/src/main/cpp/libyuv/source/compare_neon.cc +0 -96
  91. package/android/src/main/cpp/libyuv/source/compare_neon64.cc +0 -223
  92. package/android/src/main/cpp/libyuv/source/compare_win.cc +0 -241
  93. package/android/src/main/cpp/libyuv/source/convert.cc +0 -4746
  94. package/android/src/main/cpp/libyuv/source/convert_argb.cc +0 -9179
  95. package/android/src/main/cpp/libyuv/source/convert_from.cc +0 -866
  96. package/android/src/main/cpp/libyuv/source/convert_from_argb.cc +0 -3671
  97. package/android/src/main/cpp/libyuv/source/convert_jpeg.cc +0 -602
  98. package/android/src/main/cpp/libyuv/source/convert_to_argb.cc +0 -391
  99. package/android/src/main/cpp/libyuv/source/convert_to_i420.cc +0 -288
  100. package/android/src/main/cpp/libyuv/source/cpu_id.cc +0 -496
  101. package/android/src/main/cpp/libyuv/source/mjpeg_decoder.cc +0 -580
  102. package/android/src/main/cpp/libyuv/source/mjpeg_validate.cc +0 -71
  103. package/android/src/main/cpp/libyuv/source/planar_functions.cc +0 -5663
  104. package/android/src/main/cpp/libyuv/source/rotate.cc +0 -1241
  105. package/android/src/main/cpp/libyuv/source/rotate_any.cc +0 -76
  106. package/android/src/main/cpp/libyuv/source/rotate_argb.cc +0 -259
  107. package/android/src/main/cpp/libyuv/source/rotate_common.cc +0 -208
  108. package/android/src/main/cpp/libyuv/source/rotate_gcc.cc +0 -505
  109. package/android/src/main/cpp/libyuv/source/rotate_lsx.cc +0 -233
  110. package/android/src/main/cpp/libyuv/source/rotate_neon.cc +0 -219
  111. package/android/src/main/cpp/libyuv/source/rotate_neon64.cc +0 -273
  112. package/android/src/main/cpp/libyuv/source/rotate_sme.cc +0 -174
  113. package/android/src/main/cpp/libyuv/source/rotate_win.cc +0 -253
  114. package/android/src/main/cpp/libyuv/source/row_any.cc +0 -2519
  115. package/android/src/main/cpp/libyuv/source/row_common.cc +0 -4461
  116. package/android/src/main/cpp/libyuv/source/row_gcc.cc +0 -9570
  117. package/android/src/main/cpp/libyuv/source/row_lasx.cc +0 -2343
  118. package/android/src/main/cpp/libyuv/source/row_lsx.cc +0 -3030
  119. package/android/src/main/cpp/libyuv/source/row_neon.cc +0 -4026
  120. package/android/src/main/cpp/libyuv/source/row_neon64.cc +0 -5617
  121. package/android/src/main/cpp/libyuv/source/row_rvv.cc +0 -2599
  122. package/android/src/main/cpp/libyuv/source/row_sme.cc +0 -1183
  123. package/android/src/main/cpp/libyuv/source/row_sve.cc +0 -1088
  124. package/android/src/main/cpp/libyuv/source/row_win.cc +0 -6453
  125. package/android/src/main/cpp/libyuv/source/scale.cc +0 -2710
  126. package/android/src/main/cpp/libyuv/source/scale_any.cc +0 -991
  127. package/android/src/main/cpp/libyuv/source/scale_argb.cc +0 -1158
  128. package/android/src/main/cpp/libyuv/source/scale_common.cc +0 -1977
  129. package/android/src/main/cpp/libyuv/source/scale_gcc.cc +0 -2947
  130. package/android/src/main/cpp/libyuv/source/scale_lsx.cc +0 -739
  131. package/android/src/main/cpp/libyuv/source/scale_neon.cc +0 -1449
  132. package/android/src/main/cpp/libyuv/source/scale_neon64.cc +0 -1552
  133. package/android/src/main/cpp/libyuv/source/scale_rgb.cc +0 -82
  134. package/android/src/main/cpp/libyuv/source/scale_rvv.cc +0 -1971
  135. package/android/src/main/cpp/libyuv/source/scale_sme.cc +0 -555
  136. package/android/src/main/cpp/libyuv/source/scale_uv.cc +0 -1159
  137. package/android/src/main/cpp/libyuv/source/scale_win.cc +0 -1392
  138. package/android/src/main/cpp/libyuv/source/test.sh +0 -35
  139. package/android/src/main/cpp/libyuv/source/video_common.cc +0 -62
  140. package/android/src/main/cpp/libyuv/tools_libyuv/OWNERS +0 -4
  141. package/android/src/main/cpp/libyuv/tools_libyuv/autoroller/roll_deps.py +0 -931
  142. package/android/src/main/cpp/libyuv/tools_libyuv/autoroller/unittests/roll_deps_test.py +0 -164
  143. package/android/src/main/cpp/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS +0 -21
  144. package/android/src/main/cpp/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium.new +0 -13
  145. package/android/src/main/cpp/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium.old +0 -13
  146. package/android/src/main/cpp/libyuv/tools_libyuv/get_landmines.py +0 -38
  147. package/android/src/main/cpp/libyuv/tools_libyuv/msan/OWNERS +0 -3
  148. package/android/src/main/cpp/libyuv/tools_libyuv/msan/blacklist.txt +0 -9
  149. package/android/src/main/cpp/libyuv/tools_libyuv/ubsan/OWNERS +0 -3
  150. package/android/src/main/cpp/libyuv/tools_libyuv/ubsan/blacklist.txt +0 -15
  151. package/android/src/main/cpp/libyuv/tools_libyuv/ubsan/vptr_blacklist.txt +0 -25
  152. package/android/src/main/cpp/libyuv/unit_test/basictypes_test.cc +0 -43
  153. package/android/src/main/cpp/libyuv/unit_test/color_test.cc +0 -848
  154. package/android/src/main/cpp/libyuv/unit_test/compare_test.cc +0 -739
  155. package/android/src/main/cpp/libyuv/unit_test/convert_argb_test.cc +0 -2867
  156. package/android/src/main/cpp/libyuv/unit_test/convert_test.cc +0 -2133
  157. package/android/src/main/cpp/libyuv/unit_test/cpu_test.cc +0 -427
  158. package/android/src/main/cpp/libyuv/unit_test/cpu_thread_test.cc +0 -63
  159. package/android/src/main/cpp/libyuv/unit_test/math_test.cc +0 -160
  160. package/android/src/main/cpp/libyuv/unit_test/planar_test.cc +0 -4731
  161. package/android/src/main/cpp/libyuv/unit_test/rotate_argb_test.cc +0 -334
  162. package/android/src/main/cpp/libyuv/unit_test/rotate_test.cc +0 -962
  163. package/android/src/main/cpp/libyuv/unit_test/scale_argb_test.cc +0 -590
  164. package/android/src/main/cpp/libyuv/unit_test/scale_plane_test.cc +0 -465
  165. package/android/src/main/cpp/libyuv/unit_test/scale_rgb_test.cc +0 -280
  166. package/android/src/main/cpp/libyuv/unit_test/scale_test.cc +0 -1135
  167. package/android/src/main/cpp/libyuv/unit_test/scale_uv_test.cc +0 -249
  168. package/android/src/main/cpp/libyuv/unit_test/testdata/arm_v7.txt +0 -12
  169. package/android/src/main/cpp/libyuv/unit_test/testdata/mips.txt +0 -7
  170. package/android/src/main/cpp/libyuv/unit_test/testdata/mips_loongson2k.txt +0 -5
  171. package/android/src/main/cpp/libyuv/unit_test/testdata/mips_loongson3.txt +0 -10
  172. package/android/src/main/cpp/libyuv/unit_test/testdata/mips_loongson_mmi.txt +0 -7
  173. package/android/src/main/cpp/libyuv/unit_test/testdata/riscv64.txt +0 -4
  174. package/android/src/main/cpp/libyuv/unit_test/testdata/riscv64_rvv.txt +0 -4
  175. package/android/src/main/cpp/libyuv/unit_test/testdata/riscv64_rvv_zvfh.txt +0 -4
  176. package/android/src/main/cpp/libyuv/unit_test/testdata/tegra3.txt +0 -23
  177. package/android/src/main/cpp/libyuv/unit_test/testdata/test0.jpg +0 -0
  178. package/android/src/main/cpp/libyuv/unit_test/testdata/test1.jpg +0 -0
  179. package/android/src/main/cpp/libyuv/unit_test/testdata/test2.jpg +0 -0
  180. package/android/src/main/cpp/libyuv/unit_test/testdata/test3.jpg +0 -0
  181. package/android/src/main/cpp/libyuv/unit_test/testdata/test4.jpg +0 -0
  182. package/android/src/main/cpp/libyuv/unit_test/unit_test.cc +0 -581
  183. package/android/src/main/cpp/libyuv/unit_test/unit_test.h +0 -232
  184. package/android/src/main/cpp/libyuv/unit_test/video_common_test.cc +0 -112
  185. package/android/src/main/cpp/libyuv/util/Makefile +0 -9
  186. package/android/src/main/cpp/libyuv/util/color.cc +0 -120
  187. package/android/src/main/cpp/libyuv/util/compare.cc +0 -67
  188. package/android/src/main/cpp/libyuv/util/cpuid.c +0 -211
  189. package/android/src/main/cpp/libyuv/util/i444tonv12_eg.cc +0 -28
  190. package/android/src/main/cpp/libyuv/util/psnr.cc +0 -291
  191. package/android/src/main/cpp/libyuv/util/psnr.h +0 -47
  192. package/android/src/main/cpp/libyuv/util/psnr_main.cc +0 -620
  193. package/android/src/main/cpp/libyuv/util/ssim.cc +0 -364
  194. package/android/src/main/cpp/libyuv/util/ssim.h +0 -38
  195. package/android/src/main/cpp/libyuv/util/yuvconstants.c +0 -114
  196. package/android/src/main/cpp/libyuv/util/yuvconvert.cc +0 -367
  197. package/android/src/main/cpp/libyuv/winarm.mk +0 -47
  198. package/android/src/main/java/com/faceantispoof/ByteBufferPool.kt +0 -68
  199. package/android/src/main/java/com/faceantispoof/FastYuv.kt +0 -51
  200. package/android/src/main/java/com/faceantispoof/YuvToFloatArrayConverter.kt +0 -584
  201. package/android/src/main/java/com/faceantispoof/YuvToRgbConverter.kt +0 -73
@@ -1,232 +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
- #ifndef UNIT_TEST_UNIT_TEST_H_ // NOLINT
12
- #define UNIT_TEST_UNIT_TEST_H_
13
-
14
- #include <stddef.h> // For NULL
15
- #ifdef _WIN32
16
- #include <windows.h>
17
- #elif !defined(__hexagon__)
18
- #include <sys/time.h>
19
- #endif
20
-
21
- // pragma to disable warning for ASSERT_NE
22
- #include <gtest/gtest.h> // IWYU pragma: export
23
-
24
- #include "libyuv/basic_types.h"
25
-
26
- #ifndef SIMD_ALIGNED
27
- #if defined(_MSC_VER) && !defined(__CLR_VER)
28
- #define SIMD_ALIGNED(var) __declspec(align(16)) var
29
- #elif defined(__GNUC__) && !defined(__pnacl__)
30
- #define SIMD_ALIGNED(var) var __attribute__((aligned(16)))
31
- #else
32
- #define SIMD_ALIGNED(var) var
33
- #endif
34
- #endif
35
-
36
- static __inline int Abs(int v) {
37
- return v >= 0 ? v : -v;
38
- }
39
-
40
- static __inline float FAbs(float v) {
41
- return v >= 0 ? v : -v;
42
- }
43
- #define OFFBY 0
44
-
45
- // Scaling uses 16.16 fixed point to step thru the source image, so a
46
- // maximum size of 32767.999 can be expressed. 32768 is valid because
47
- // the step is 1 beyond the image but not used.
48
- // Destination size is mainly constrained by valid scale step not the
49
- // absolute size, so it may be possible to relax the destination size
50
- // constraint.
51
- // Source size is unconstrained for most specialized scalers. e.g.
52
- // An image of 65536 scaled to half size would be valid. The test
53
- // could be relaxed for special scale factors.
54
- // If this test is removed, the scaling function should gracefully
55
- // fail with a return code. The test could be changed to know that
56
- // libyuv failed in a controlled way.
57
-
58
- static const int kMaxWidth = 32768;
59
- static const int kMaxHeight = 32768;
60
-
61
- static inline bool SizeValid(int src_width,
62
- int src_height,
63
- int dst_width,
64
- int dst_height) {
65
- if (src_width > kMaxWidth || src_height > kMaxHeight ||
66
- dst_width > kMaxWidth || dst_height > kMaxHeight) {
67
- printf("Warning - size too large to test. Skipping\n");
68
- return false;
69
- }
70
- return true;
71
- }
72
-
73
- #define align_buffer_page_end(var, size) \
74
- uint8_t* var = NULL; \
75
- uint8_t* var##_mem = \
76
- reinterpret_cast<uint8_t*>(malloc(((size) + 4095 + 63) & ~4095)); \
77
- if (var##_mem) \
78
- var = reinterpret_cast<uint8_t*>( \
79
- (intptr_t)(var##_mem + (((size) + 4095 + 63) & ~4095) - (size)) & ~63)
80
-
81
- #define free_aligned_buffer_page_end(var) \
82
- free(var##_mem); \
83
- var = NULL
84
-
85
- #define align_buffer_page_end_16(var, size) \
86
- uint16_t* var = NULL; \
87
- uint8_t* var##_mem = \
88
- reinterpret_cast<uint8_t*>(malloc(((size)*2 + 4095 + 63) & ~4095)); \
89
- if (var##_mem) \
90
- var = reinterpret_cast<uint16_t*>( \
91
- (intptr_t)(var##_mem + (((size)*2 + 4095 + 63) & ~4095) - (size)*2) & \
92
- ~63)
93
-
94
- #define free_aligned_buffer_page_end_16(var) \
95
- free(var##_mem); \
96
- var = NULL
97
-
98
- #ifdef WIN32
99
- static inline double get_time() {
100
- LARGE_INTEGER t, f;
101
- QueryPerformanceCounter(&t);
102
- QueryPerformanceFrequency(&f);
103
- return static_cast<double>(t.QuadPart) / static_cast<double>(f.QuadPart);
104
- }
105
- #elif defined(__hexagon__)
106
- static inline double get_time() {
107
- return 0.;
108
- }
109
- #else
110
- static inline double get_time() {
111
- struct timeval t;
112
- struct timezone tzp;
113
- gettimeofday(&t, &tzp);
114
- return t.tv_sec + t.tv_usec * 1e-6;
115
- }
116
- #endif
117
-
118
- #ifndef SIMD_ALIGNED
119
- #if defined(_MSC_VER) && !defined(__CLR_VER)
120
- #define SIMD_ALIGNED(var) __declspec(align(16)) var
121
- #elif defined(__GNUC__) && !defined(__pnacl__)
122
- #define SIMD_ALIGNED(var) var __attribute__((aligned(16)))
123
- #else
124
- #define SIMD_ALIGNED(var) var
125
- #endif
126
- #endif
127
-
128
- extern unsigned int fastrand_seed;
129
- inline int fastrand() {
130
- fastrand_seed = fastrand_seed * 214013u + 2531011u;
131
- return static_cast<int>((fastrand_seed >> 16) & 0xffff);
132
- }
133
-
134
- // ubsan fails if dst is unaligned unless we use uint8
135
- static inline void MemRandomize(uint8_t* dst, int64_t len) {
136
- int64_t i;
137
- for (i = 0; i < len - 1; i += 2) {
138
- int r = fastrand();
139
- dst[0] = static_cast<uint8_t>(r);
140
- dst[1] = static_cast<uint8_t>(r >> 8);
141
- dst += 2;
142
- }
143
- for (; i < len; ++i) {
144
- *dst++ = fastrand();
145
- }
146
- }
147
-
148
- class LibYUVColorTest : public ::testing::Test {
149
- protected:
150
- LibYUVColorTest();
151
-
152
- int benchmark_iterations_; // Default 1. Use 1000 for benchmarking.
153
- int benchmark_width_; // Default 1280. Use 640 for benchmarking VGA.
154
- int benchmark_height_; // Default 720. Use 360 for benchmarking VGA.
155
- int benchmark_pixels_div1280_; // Total pixels to benchmark / 1280.
156
- int disable_cpu_flags_; // Default 1. Use -1 for benchmarking.
157
- int benchmark_cpu_info_; // Default -1. Use 1 to disable SIMD.
158
- };
159
-
160
- class LibYUVConvertTest : public ::testing::Test {
161
- protected:
162
- LibYUVConvertTest();
163
-
164
- int benchmark_iterations_; // Default 1. Use 1000 for benchmarking.
165
- int benchmark_width_; // Default 1280. Use 640 for benchmarking VGA.
166
- int benchmark_height_; // Default 720. Use 360 for benchmarking VGA.
167
- int benchmark_pixels_div1280_; // Total pixels to benchmark / 1280.
168
- int disable_cpu_flags_; // Default 1. Use -1 for benchmarking.
169
- int benchmark_cpu_info_; // Default -1. Use 1 to disable SIMD.
170
- };
171
-
172
- class LibYUVScaleTest : public ::testing::Test {
173
- protected:
174
- LibYUVScaleTest();
175
-
176
- int benchmark_iterations_; // Default 1. Use 1000 for benchmarking.
177
- int benchmark_width_; // Default 1280. Use 640 for benchmarking VGA.
178
- int benchmark_height_; // Default 720. Use 360 for benchmarking VGA.
179
- int benchmark_pixels_div1280_; // Total pixels to benchmark / 1280.
180
- int disable_cpu_flags_; // Default 1. Use -1 for benchmarking.
181
- int benchmark_cpu_info_; // Default -1. Use 1 to disable SIMD.
182
- };
183
-
184
- class LibYUVRotateTest : public ::testing::Test {
185
- protected:
186
- LibYUVRotateTest();
187
-
188
- int benchmark_iterations_; // Default 1. Use 1000 for benchmarking.
189
- int benchmark_width_; // Default 1280. Use 640 for benchmarking VGA.
190
- int benchmark_height_; // Default 720. Use 360 for benchmarking VGA.
191
- int benchmark_pixels_div1280_; // Total pixels to benchmark / 1280.
192
- int disable_cpu_flags_; // Default 1. Use -1 for benchmarking.
193
- int benchmark_cpu_info_; // Default -1. Use 1 to disable SIMD.
194
- };
195
-
196
- class LibYUVPlanarTest : public ::testing::Test {
197
- protected:
198
- LibYUVPlanarTest();
199
-
200
- int benchmark_iterations_; // Default 1. Use 1000 for benchmarking.
201
- int benchmark_width_; // Default 1280. Use 640 for benchmarking VGA.
202
- int benchmark_height_; // Default 720. Use 360 for benchmarking VGA.
203
- int benchmark_pixels_div1280_; // Total pixels to benchmark / 1280.
204
- int disable_cpu_flags_; // Default 1. Use -1 for benchmarking.
205
- int benchmark_cpu_info_; // Default -1. Use 1 to disable SIMD.
206
- };
207
-
208
- class LibYUVBaseTest : public ::testing::Test {
209
- protected:
210
- LibYUVBaseTest();
211
-
212
- int benchmark_iterations_; // Default 1. Use 1000 for benchmarking.
213
- int benchmark_width_; // Default 1280. Use 640 for benchmarking VGA.
214
- int benchmark_height_; // Default 720. Use 360 for benchmarking VGA.
215
- int benchmark_pixels_div1280_; // Total pixels to benchmark / 1280.
216
- int disable_cpu_flags_; // Default 1. Use -1 for benchmarking.
217
- int benchmark_cpu_info_; // Default -1. Use 1 to disable SIMD.
218
- };
219
-
220
- class LibYUVCompareTest : public ::testing::Test {
221
- protected:
222
- LibYUVCompareTest();
223
-
224
- int benchmark_iterations_; // Default 1. Use 1000 for benchmarking.
225
- int benchmark_width_; // Default 1280. Use 640 for benchmarking VGA.
226
- int benchmark_height_; // Default 720. Use 360 for benchmarking VGA.
227
- int benchmark_pixels_div1280_; // Total pixels to benchmark / 1280.
228
- int disable_cpu_flags_; // Default 1. Use -1 for benchmarking.
229
- int benchmark_cpu_info_; // Default -1. Use 1 to disable SIMD.
230
- };
231
-
232
- #endif // UNIT_TEST_UNIT_TEST_H_ NOLINT
@@ -1,112 +0,0 @@
1
- /*
2
- * Copyright 2012 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 <string.h>
13
-
14
- #include "../unit_test/unit_test.h"
15
- #include "libyuv/video_common.h"
16
-
17
- namespace libyuv {
18
-
19
- // Tests FourCC codes in video common, which are used for ConvertToI420().
20
-
21
- static bool TestValidChar(uint32_t onecc) {
22
- return (onecc >= '0' && onecc <= '9') || (onecc >= 'A' && onecc <= 'Z') ||
23
- (onecc >= 'a' && onecc <= 'z') || (onecc == ' ') || (onecc == 0xff);
24
- }
25
-
26
- static bool TestValidFourCC(uint32_t fourcc, int bpp) {
27
- if (!TestValidChar(fourcc & 0xff) || !TestValidChar((fourcc >> 8) & 0xff) ||
28
- !TestValidChar((fourcc >> 16) & 0xff) ||
29
- !TestValidChar((fourcc >> 24) & 0xff)) {
30
- return false;
31
- }
32
- if (bpp < 0 || bpp > 64) {
33
- return false;
34
- }
35
- return true;
36
- }
37
-
38
- TEST_F(LibYUVBaseTest, TestCanonicalFourCC) {
39
- EXPECT_EQ(static_cast<uint32_t>(FOURCC_I420), CanonicalFourCC(FOURCC_IYUV));
40
- EXPECT_EQ(static_cast<uint32_t>(FOURCC_I420), CanonicalFourCC(FOURCC_YU12));
41
- EXPECT_EQ(static_cast<uint32_t>(FOURCC_I422), CanonicalFourCC(FOURCC_YU16));
42
- EXPECT_EQ(static_cast<uint32_t>(FOURCC_I444), CanonicalFourCC(FOURCC_YU24));
43
- EXPECT_EQ(static_cast<uint32_t>(FOURCC_YUY2), CanonicalFourCC(FOURCC_YUYV));
44
- EXPECT_EQ(static_cast<uint32_t>(FOURCC_YUY2), CanonicalFourCC(FOURCC_YUVS));
45
- EXPECT_EQ(static_cast<uint32_t>(FOURCC_UYVY), CanonicalFourCC(FOURCC_HDYC));
46
- EXPECT_EQ(static_cast<uint32_t>(FOURCC_UYVY), CanonicalFourCC(FOURCC_2VUY));
47
- EXPECT_EQ(static_cast<uint32_t>(FOURCC_MJPG), CanonicalFourCC(FOURCC_JPEG));
48
- EXPECT_EQ(static_cast<uint32_t>(FOURCC_MJPG), CanonicalFourCC(FOURCC_DMB1));
49
- EXPECT_EQ(static_cast<uint32_t>(FOURCC_RAW), CanonicalFourCC(FOURCC_RGB3));
50
- EXPECT_EQ(static_cast<uint32_t>(FOURCC_24BG), CanonicalFourCC(FOURCC_BGR3));
51
- EXPECT_EQ(static_cast<uint32_t>(FOURCC_BGRA), CanonicalFourCC(FOURCC_CM32));
52
- EXPECT_EQ(static_cast<uint32_t>(FOURCC_RAW), CanonicalFourCC(FOURCC_CM24));
53
- EXPECT_EQ(static_cast<uint32_t>(FOURCC_RGBO), CanonicalFourCC(FOURCC_L555));
54
- EXPECT_EQ(static_cast<uint32_t>(FOURCC_RGBP), CanonicalFourCC(FOURCC_L565));
55
- EXPECT_EQ(static_cast<uint32_t>(FOURCC_RGBO), CanonicalFourCC(FOURCC_5551));
56
- }
57
-
58
- TEST_F(LibYUVBaseTest, TestFourCC) {
59
- EXPECT_TRUE(TestValidFourCC(FOURCC_I420, FOURCC_BPP_I420));
60
- EXPECT_TRUE(TestValidFourCC(FOURCC_I420, FOURCC_BPP_I420));
61
- EXPECT_TRUE(TestValidFourCC(FOURCC_I422, FOURCC_BPP_I422));
62
- EXPECT_TRUE(TestValidFourCC(FOURCC_I444, FOURCC_BPP_I444));
63
- EXPECT_TRUE(TestValidFourCC(FOURCC_I400, FOURCC_BPP_I400));
64
- EXPECT_TRUE(TestValidFourCC(FOURCC_NV21, FOURCC_BPP_NV21));
65
- EXPECT_TRUE(TestValidFourCC(FOURCC_NV12, FOURCC_BPP_NV12));
66
- EXPECT_TRUE(TestValidFourCC(FOURCC_YUY2, FOURCC_BPP_YUY2));
67
- EXPECT_TRUE(TestValidFourCC(FOURCC_UYVY, FOURCC_BPP_UYVY));
68
- EXPECT_TRUE(TestValidFourCC(FOURCC_M420, FOURCC_BPP_M420)); // deprecated.
69
- EXPECT_TRUE(TestValidFourCC(FOURCC_Q420, FOURCC_BPP_Q420)); // deprecated.
70
- EXPECT_TRUE(TestValidFourCC(FOURCC_ARGB, FOURCC_BPP_ARGB));
71
- EXPECT_TRUE(TestValidFourCC(FOURCC_BGRA, FOURCC_BPP_BGRA));
72
- EXPECT_TRUE(TestValidFourCC(FOURCC_ABGR, FOURCC_BPP_ABGR));
73
- EXPECT_TRUE(TestValidFourCC(FOURCC_AR30, FOURCC_BPP_AR30));
74
- EXPECT_TRUE(TestValidFourCC(FOURCC_AB30, FOURCC_BPP_AB30));
75
- EXPECT_TRUE(TestValidFourCC(FOURCC_AR64, FOURCC_BPP_AR64));
76
- EXPECT_TRUE(TestValidFourCC(FOURCC_AB64, FOURCC_BPP_AB64));
77
- EXPECT_TRUE(TestValidFourCC(FOURCC_24BG, FOURCC_BPP_24BG));
78
- EXPECT_TRUE(TestValidFourCC(FOURCC_RAW, FOURCC_BPP_RAW));
79
- EXPECT_TRUE(TestValidFourCC(FOURCC_RGBA, FOURCC_BPP_RGBA));
80
- EXPECT_TRUE(TestValidFourCC(FOURCC_RGBP, FOURCC_BPP_RGBP));
81
- EXPECT_TRUE(TestValidFourCC(FOURCC_RGBO, FOURCC_BPP_RGBO));
82
- EXPECT_TRUE(TestValidFourCC(FOURCC_R444, FOURCC_BPP_R444));
83
- EXPECT_TRUE(TestValidFourCC(FOURCC_H420, FOURCC_BPP_H420));
84
- EXPECT_TRUE(TestValidFourCC(FOURCC_H422, FOURCC_BPP_H422));
85
- EXPECT_TRUE(TestValidFourCC(FOURCC_H010, FOURCC_BPP_H010));
86
- EXPECT_TRUE(TestValidFourCC(FOURCC_H210, FOURCC_BPP_H210));
87
- EXPECT_TRUE(TestValidFourCC(FOURCC_I010, FOURCC_BPP_I010));
88
- EXPECT_TRUE(TestValidFourCC(FOURCC_I210, FOURCC_BPP_I210));
89
- EXPECT_TRUE(TestValidFourCC(FOURCC_P010, FOURCC_BPP_P010));
90
- EXPECT_TRUE(TestValidFourCC(FOURCC_P210, FOURCC_BPP_P210));
91
- EXPECT_TRUE(TestValidFourCC(FOURCC_MJPG, FOURCC_BPP_MJPG));
92
- EXPECT_TRUE(TestValidFourCC(FOURCC_YV12, FOURCC_BPP_YV12));
93
- EXPECT_TRUE(TestValidFourCC(FOURCC_YV16, FOURCC_BPP_YV16));
94
- EXPECT_TRUE(TestValidFourCC(FOURCC_YV24, FOURCC_BPP_YV24));
95
- EXPECT_TRUE(TestValidFourCC(FOURCC_YU12, FOURCC_BPP_YU12));
96
- EXPECT_TRUE(TestValidFourCC(FOURCC_IYUV, FOURCC_BPP_IYUV));
97
- EXPECT_TRUE(TestValidFourCC(FOURCC_YU16, FOURCC_BPP_YU16));
98
- EXPECT_TRUE(TestValidFourCC(FOURCC_YU24, FOURCC_BPP_YU24));
99
- EXPECT_TRUE(TestValidFourCC(FOURCC_YUYV, FOURCC_BPP_YUYV));
100
- EXPECT_TRUE(TestValidFourCC(FOURCC_YUVS, FOURCC_BPP_YUVS));
101
- EXPECT_TRUE(TestValidFourCC(FOURCC_HDYC, FOURCC_BPP_HDYC));
102
- EXPECT_TRUE(TestValidFourCC(FOURCC_2VUY, FOURCC_BPP_2VUY));
103
- EXPECT_TRUE(TestValidFourCC(FOURCC_JPEG, FOURCC_BPP_JPEG));
104
- EXPECT_TRUE(TestValidFourCC(FOURCC_DMB1, FOURCC_BPP_DMB1));
105
- EXPECT_TRUE(TestValidFourCC(FOURCC_BA81, FOURCC_BPP_BA81));
106
- EXPECT_TRUE(TestValidFourCC(FOURCC_RGB3, FOURCC_BPP_RGB3));
107
- EXPECT_TRUE(TestValidFourCC(FOURCC_BGR3, FOURCC_BPP_BGR3));
108
- EXPECT_TRUE(TestValidFourCC(FOURCC_H264, FOURCC_BPP_H264));
109
- EXPECT_TRUE(TestValidFourCC(FOURCC_ANY, FOURCC_BPP_ANY));
110
- }
111
-
112
- } // namespace libyuv
@@ -1,9 +0,0 @@
1
- psnr: psnr.cc ssim.cc psnr_main.cc
2
- ifeq ($(CXX),icl)
3
- $(CXX) /arch:SSE2 /Ox /openmp psnr.cc ssim.cc psnr_main.cc
4
- else
5
- $(CXX) -msse2 -O3 -fopenmp -static -o psnr psnr.cc ssim.cc psnr_main.cc -Wl,--strip-all
6
- endif
7
-
8
- # for MacOS
9
- # /usr/local/bin/g++-7 -msse2 -O3 -fopenmp -Bstatic -o psnr psnr.cc ssim.cc psnr_main.cc
@@ -1,120 +0,0 @@
1
- /*
2
- * Copyright 2021 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 <stdio.h>
12
- #include <stdlib.h>
13
- #include <string.h>
14
-
15
- // This utility computes values needed to generate yuvconstants based on
16
- // white point values.
17
- // The yuv formulas are tuned for 8 bit YUV channels.
18
-
19
- // For those MCs that can be represented as kr and kb:
20
- // Full range
21
- // float M[3][3]
22
- // {{1,0,2*(1-kr)},{1,-((2*kb)/((2-kb)*(1-kb-kr))),-((2*kr)/((2-kr)*(1-kb-kr)))},{1,2*(1-kb),0}};
23
- // float B[3]
24
- // {1+(256*(1-kr))/255,1-(256*kb)/(255*(2-kb)*(1-kb-kr))-(256*kr)/(255*(2-kr)*(1-kb-kr)),1+(256*(1-kb))/255};
25
- // Limited range
26
- // float M[3][3]
27
- // {{85/73,0,255/112-(255*kr)/112},{85/73,-((255*kb)/(112*(2-kb)*(1-kb-kr))),-((255*kr)/(112*(2-kr)*(1-kb-kr)))},{85/73,255/112-(255*kb)/112,0}};
28
- // float B[3]
29
- // {77662/43435-(1537*kr)/1785,203/219-(1537*kb)/(1785*(2-kb)*(1-kb-kr))-(1537*kr)/(1785*(2-kr)*(1-kb-kr)),77662/43435-(1537*kb)/1785};
30
-
31
- // mc bt
32
- // 1 bt.709 KR = 0.2126; KB = 0.0722
33
- // 4 fcc KR = 0.30; KB = 0.11
34
- // 6 bt.601 KR = 0.299; KB = 0.114
35
- // 7 SMPTE 240M KR = 0.212; KB = 0.087
36
- // 10 bt2020 KR = 0.2627; KB = 0.0593
37
-
38
- // BT.709 full range YUV to RGB reference
39
- // R = Y + V * 1.5748
40
- // G = Y - U * 0.18732 - V * 0.46812
41
- // B = Y + U * 1.8556
42
- // KR = 0.2126
43
- // KB = 0.0722
44
-
45
- // https://mymusing.co/bt601-yuv-to-rgb-conversion-color/
46
-
47
- // // Y contribution to R,G,B. Scale and bias.
48
- // #define YG 16320 /* round(1.000 * 64 * 256 * 256 / 257) */
49
- // #define YB 32 /* 64 / 2 */
50
- //
51
- // // U and V contributions to R,G,B.
52
- // #define UB 113 /* round(1.77200 * 64) */
53
- // #define UG 22 /* round(0.34414 * 64) */
54
- // #define VG 46 /* round(0.71414 * 64) */
55
- // #define VR 90 /* round(1.40200 * 64) */
56
- //
57
- // // Bias values to round, and subtract 128 from U and V.
58
- // #define BB (-UB * 128 + YB)
59
- // #define BG (UG * 128 + VG * 128 + YB)
60
- // #define BR (-VR * 128 + YB)
61
-
62
- int round(float v) {
63
- return (int)(v + 0.5);
64
- }
65
-
66
- int main(int argc, const char* argv[]) {
67
- if (argc < 2) {
68
- printf("color kr kb\n");
69
- return -1;
70
- }
71
- float kr = atof(argv[1]);
72
- float kb = atof(argv[2]);
73
- float kg = 1 - kr - kb;
74
-
75
- float vr = 2 * (1 - kr);
76
- float ug = 2 * ((1 - kb) * kb / kg);
77
- float vg = 2 * ((1 - kr) * kr / kg);
78
- float ub = 2 * (1 - kb);
79
-
80
- printf("Full range\n");
81
- printf("R = Y + V * %5f\n", vr);
82
- printf("G = Y - U * %6f - V * %6f\n", ug, vg);
83
- printf("B = Y + U * %5f\n", ub);
84
-
85
- printf("KR = %4f; ", kr);
86
- printf("KB = %4f\n", kb);
87
- // printf("KG = %4f\n", kg);
88
- // #define YG 16320 /* round(1.000 * 64 * 256 * 256 / 257) */
89
- // #define YB 32 /* 64 / 2 */
90
- //
91
- // // U and V contributions to R,G,B.
92
-
93
- printf("UB %-3d /* round(%f * 64) */\n", round(ub * 64), ub);
94
- printf("UG %-3d /* round(%f * 64) */\n", round(ug * 64), ug);
95
- printf("VG %-3d /* round(%f * 64) */\n", round(vg * 64), vg);
96
- printf("VR %-3d /* round(%f * 64) */\n", round(vr * 64), vr);
97
-
98
- vr = 255.f / 224.f * 2 * (1 - kr);
99
- ug = 255.f / 224.f * 2 * ((1 - kb) * kb / kg);
100
- vg = 255.f / 224.f * 2 * ((1 - kr) * kr / kg);
101
- ub = 255.f / 224.f * 2 * (1 - kb);
102
-
103
- printf("Limited range\n");
104
- printf("R = (Y - 16) * 1.164 + V * %5f\n", vr);
105
- printf("G = (Y - 16) * 1.164 - U * %6f - V * %6f\n", ug, vg);
106
- printf("B = (Y - 16) * 1.164 + U * %5f\n", ub);
107
-
108
- // printf("KG = %4f\n", kg);
109
- // #define YG 16320 /* round(1.000 * 64 * 256 * 256 / 257) */
110
- // #define YB 32 /* 64 / 2 */
111
- //
112
- // // U and V contributions to R,G,B.
113
-
114
- printf("UB %-3d /* round(%f * 64) */\n", round(ub * 64), ub);
115
- printf("UG %-3d /* round(%f * 64) */\n", round(ug * 64), ug);
116
- printf("VG %-3d /* round(%f * 64) */\n", round(vg * 64), vg);
117
- printf("VR %-3d /* round(%f * 64) */\n", round(vr * 64), vr);
118
-
119
- return 0;
120
- }
@@ -1,67 +0,0 @@
1
- /*
2
- * Copyright 2012 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 <stdio.h>
12
- #include <stdlib.h>
13
- #include <string.h>
14
- #include <time.h>
15
-
16
- #include "libyuv/basic_types.h"
17
- #include "libyuv/compare.h"
18
- #include "libyuv/version.h"
19
-
20
- int main(int argc, char** argv) {
21
- if (argc < 1) {
22
- printf("libyuv compare v%d\n", LIBYUV_VERSION);
23
- printf("compare file1.yuv file2.yuv\n");
24
- return -1;
25
- }
26
- char* name1 = argv[1];
27
- char* name2 = (argc > 2) ? argv[2] : NULL;
28
- FILE* fin1 = fopen(name1, "rb");
29
- FILE* fin2 = name2 ? fopen(name2, "rb") : NULL;
30
-
31
- const int kBlockSize = 32768;
32
- uint8_t buf1[kBlockSize];
33
- uint8_t buf2[kBlockSize];
34
- uint32_t hash1 = 5381;
35
- uint32_t hash2 = 5381;
36
- uint64_t sum_square_err = 0;
37
- uint64_t size_min = 0;
38
- int amt1 = 0;
39
- int amt2 = 0;
40
- do {
41
- amt1 = static_cast<int>(fread(buf1, 1, kBlockSize, fin1));
42
- if (amt1 > 0) {
43
- hash1 = libyuv::HashDjb2(buf1, amt1, hash1);
44
- }
45
- if (fin2) {
46
- amt2 = static_cast<int>(fread(buf2, 1, kBlockSize, fin2));
47
- if (amt2 > 0) {
48
- hash2 = libyuv::HashDjb2(buf2, amt2, hash2);
49
- }
50
- int amt_min = (amt1 < amt2) ? amt1 : amt2;
51
- size_min += amt_min;
52
- sum_square_err += libyuv::ComputeSumSquareError(buf1, buf2, amt_min);
53
- }
54
- } while (amt1 > 0 || amt2 > 0);
55
-
56
- printf("hash1 %x", hash1);
57
- if (fin2) {
58
- printf(", hash2 %x", hash2);
59
- double mse =
60
- static_cast<double>(sum_square_err) / static_cast<double>(size_min);
61
- printf(", mse %.2f", mse);
62
- double psnr = libyuv::SumSquareErrorToPsnr(sum_square_err, size_min);
63
- printf(", psnr %.2f\n", psnr);
64
- fclose(fin2);
65
- }
66
- fclose(fin1);
67
- }