react-native-vision-camera-spoof-detector 1.0.22 → 1.0.23

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 (193) hide show
  1. package/README.md +442 -442
  2. package/android/build.gradle +12 -4
  3. package/android/src/main/cpp/CMakeLists.txt +101 -94
  4. package/android/src/main/cpp/libyuv/.clang-format +6 -6
  5. package/android/src/main/cpp/libyuv/.gn +40 -40
  6. package/android/src/main/cpp/libyuv/.vpython3 +410 -410
  7. package/android/src/main/cpp/libyuv/AUTHORS +7 -7
  8. package/android/src/main/cpp/libyuv/Android.bp +202 -202
  9. package/android/src/main/cpp/libyuv/Android.mk +106 -106
  10. package/android/src/main/cpp/libyuv/BUILD.gn +490 -490
  11. package/android/src/main/cpp/libyuv/CM_linux_packages.cmake +70 -70
  12. package/android/src/main/cpp/libyuv/CMakeLists.txt +259 -252
  13. package/android/src/main/cpp/libyuv/DEPS +935 -935
  14. package/android/src/main/cpp/libyuv/DIR_METADATA +3 -3
  15. package/android/src/main/cpp/libyuv/LICENSE +29 -29
  16. package/android/src/main/cpp/libyuv/OWNERS +11 -11
  17. package/android/src/main/cpp/libyuv/PATENTS +23 -23
  18. package/android/src/main/cpp/libyuv/PRESUBMIT.py +65 -65
  19. package/android/src/main/cpp/libyuv/README.chromium +11 -11
  20. package/android/src/main/cpp/libyuv/README.md +19 -19
  21. package/android/src/main/cpp/libyuv/build_overrides/build.gni +60 -60
  22. package/android/src/main/cpp/libyuv/build_overrides/gtest.gni +19 -19
  23. package/android/src/main/cpp/libyuv/build_overrides/partition_alloc.gni +17 -17
  24. package/android/src/main/cpp/libyuv/codereview.settings +5 -5
  25. package/android/src/main/cpp/libyuv/docs/deprecated_builds.md +409 -409
  26. package/android/src/main/cpp/libyuv/docs/environment_variables.md +64 -64
  27. package/android/src/main/cpp/libyuv/docs/feature_detection.md +108 -108
  28. package/android/src/main/cpp/libyuv/docs/filtering.md +196 -196
  29. package/android/src/main/cpp/libyuv/docs/formats.md +208 -208
  30. package/android/src/main/cpp/libyuv/docs/getting_started.md +296 -296
  31. package/android/src/main/cpp/libyuv/docs/rotation.md +107 -107
  32. package/android/src/main/cpp/libyuv/download_vs_toolchain.py +29 -29
  33. package/android/src/main/cpp/libyuv/include/libyuv/basic_types.h +68 -68
  34. package/android/src/main/cpp/libyuv/include/libyuv/compare.h +111 -111
  35. package/android/src/main/cpp/libyuv/include/libyuv/compare_row.h +112 -112
  36. package/android/src/main/cpp/libyuv/include/libyuv/convert.h +1117 -1117
  37. package/android/src/main/cpp/libyuv/include/libyuv/convert_argb.h +2335 -2335
  38. package/android/src/main/cpp/libyuv/include/libyuv/convert_from.h +203 -203
  39. package/android/src/main/cpp/libyuv/include/libyuv/convert_from_argb.h +394 -394
  40. package/android/src/main/cpp/libyuv/include/libyuv/cpu_id.h +147 -147
  41. package/android/src/main/cpp/libyuv/include/libyuv/cpu_support.h +99 -99
  42. package/android/src/main/cpp/libyuv/include/libyuv/loongson_intrinsics.h +1949 -1949
  43. package/android/src/main/cpp/libyuv/include/libyuv/mjpeg_decoder.h +195 -195
  44. package/android/src/main/cpp/libyuv/include/libyuv/planar_functions.h +1131 -1131
  45. package/android/src/main/cpp/libyuv/include/libyuv/rotate.h +296 -296
  46. package/android/src/main/cpp/libyuv/include/libyuv/rotate_argb.h +37 -37
  47. package/android/src/main/cpp/libyuv/include/libyuv/rotate_row.h +265 -265
  48. package/android/src/main/cpp/libyuv/include/libyuv/row.h +6738 -6738
  49. package/android/src/main/cpp/libyuv/include/libyuv/row_sve.h +2154 -2154
  50. package/android/src/main/cpp/libyuv/include/libyuv/scale.h +336 -336
  51. package/android/src/main/cpp/libyuv/include/libyuv/scale_argb.h +76 -76
  52. package/android/src/main/cpp/libyuv/include/libyuv/scale_rgb.h +42 -42
  53. package/android/src/main/cpp/libyuv/include/libyuv/scale_row.h +1726 -1726
  54. package/android/src/main/cpp/libyuv/include/libyuv/scale_uv.h +51 -51
  55. package/android/src/main/cpp/libyuv/include/libyuv/version.h +16 -16
  56. package/android/src/main/cpp/libyuv/include/libyuv/video_common.h +222 -222
  57. package/android/src/main/cpp/libyuv/include/libyuv.h +33 -33
  58. package/android/src/main/cpp/libyuv/infra/config/OWNERS +3 -3
  59. package/android/src/main/cpp/libyuv/infra/config/PRESUBMIT.py +17 -17
  60. package/android/src/main/cpp/libyuv/infra/config/README.md +2 -2
  61. package/android/src/main/cpp/libyuv/infra/config/codereview.settings +6 -6
  62. package/android/src/main/cpp/libyuv/infra/config/commit-queue.cfg +144 -144
  63. package/android/src/main/cpp/libyuv/infra/config/cr-buildbucket.cfg +1185 -1185
  64. package/android/src/main/cpp/libyuv/infra/config/luci-logdog.cfg +9 -9
  65. package/android/src/main/cpp/libyuv/infra/config/luci-milo.cfg +246 -246
  66. package/android/src/main/cpp/libyuv/infra/config/luci-scheduler.cfg +385 -385
  67. package/android/src/main/cpp/libyuv/infra/config/main.star +402 -402
  68. package/android/src/main/cpp/libyuv/infra/config/project.cfg +16 -16
  69. package/android/src/main/cpp/libyuv/infra/config/realms.cfg +111 -111
  70. package/android/src/main/cpp/libyuv/libyuv.gni +34 -34
  71. package/android/src/main/cpp/libyuv/libyuv.gyp +149 -149
  72. package/android/src/main/cpp/libyuv/libyuv.gypi +87 -87
  73. package/android/src/main/cpp/libyuv/linux.mk +96 -96
  74. package/android/src/main/cpp/libyuv/public.mk +13 -13
  75. package/android/src/main/cpp/libyuv/pylintrc +49 -49
  76. package/android/src/main/cpp/libyuv/riscv_script/prepare_toolchain_qemu.sh +74 -74
  77. package/android/src/main/cpp/libyuv/riscv_script/riscv-clang.cmake +56 -56
  78. package/android/src/main/cpp/libyuv/riscv_script/run_qemu.sh +15 -15
  79. package/android/src/main/cpp/libyuv/source/compare.cc +435 -435
  80. package/android/src/main/cpp/libyuv/source/compare_common.cc +74 -74
  81. package/android/src/main/cpp/libyuv/source/compare_gcc.cc +362 -362
  82. package/android/src/main/cpp/libyuv/source/compare_neon.cc +96 -96
  83. package/android/src/main/cpp/libyuv/source/compare_neon64.cc +223 -223
  84. package/android/src/main/cpp/libyuv/source/compare_win.cc +241 -241
  85. package/android/src/main/cpp/libyuv/source/convert.cc +4746 -4746
  86. package/android/src/main/cpp/libyuv/source/convert_argb.cc +9179 -9179
  87. package/android/src/main/cpp/libyuv/source/convert_from.cc +866 -866
  88. package/android/src/main/cpp/libyuv/source/convert_from_argb.cc +3671 -3671
  89. package/android/src/main/cpp/libyuv/source/convert_jpeg.cc +602 -602
  90. package/android/src/main/cpp/libyuv/source/convert_to_argb.cc +391 -391
  91. package/android/src/main/cpp/libyuv/source/convert_to_i420.cc +288 -288
  92. package/android/src/main/cpp/libyuv/source/cpu_id.cc +496 -496
  93. package/android/src/main/cpp/libyuv/source/mjpeg_decoder.cc +580 -580
  94. package/android/src/main/cpp/libyuv/source/mjpeg_validate.cc +71 -71
  95. package/android/src/main/cpp/libyuv/source/planar_functions.cc +5663 -5663
  96. package/android/src/main/cpp/libyuv/source/rotate.cc +1241 -1241
  97. package/android/src/main/cpp/libyuv/source/rotate_any.cc +76 -76
  98. package/android/src/main/cpp/libyuv/source/rotate_argb.cc +259 -259
  99. package/android/src/main/cpp/libyuv/source/rotate_common.cc +208 -208
  100. package/android/src/main/cpp/libyuv/source/rotate_gcc.cc +505 -505
  101. package/android/src/main/cpp/libyuv/source/rotate_lsx.cc +233 -233
  102. package/android/src/main/cpp/libyuv/source/rotate_neon.cc +219 -219
  103. package/android/src/main/cpp/libyuv/source/rotate_neon64.cc +273 -273
  104. package/android/src/main/cpp/libyuv/source/rotate_sme.cc +174 -174
  105. package/android/src/main/cpp/libyuv/source/rotate_win.cc +253 -253
  106. package/android/src/main/cpp/libyuv/source/row_any.cc +2519 -2519
  107. package/android/src/main/cpp/libyuv/source/row_common.cc +4461 -4461
  108. package/android/src/main/cpp/libyuv/source/row_gcc.cc +9570 -9570
  109. package/android/src/main/cpp/libyuv/source/row_lasx.cc +2343 -2343
  110. package/android/src/main/cpp/libyuv/source/row_lsx.cc +3030 -3030
  111. package/android/src/main/cpp/libyuv/source/row_neon.cc +4026 -4026
  112. package/android/src/main/cpp/libyuv/source/row_neon64.cc +5617 -5617
  113. package/android/src/main/cpp/libyuv/source/row_rvv.cc +2599 -2599
  114. package/android/src/main/cpp/libyuv/source/row_sme.cc +1183 -1183
  115. package/android/src/main/cpp/libyuv/source/row_sve.cc +1088 -1088
  116. package/android/src/main/cpp/libyuv/source/row_win.cc +6453 -6453
  117. package/android/src/main/cpp/libyuv/source/scale.cc +2710 -2710
  118. package/android/src/main/cpp/libyuv/source/scale_any.cc +991 -991
  119. package/android/src/main/cpp/libyuv/source/scale_argb.cc +1158 -1158
  120. package/android/src/main/cpp/libyuv/source/scale_common.cc +1977 -1977
  121. package/android/src/main/cpp/libyuv/source/scale_gcc.cc +2947 -2947
  122. package/android/src/main/cpp/libyuv/source/scale_lsx.cc +739 -739
  123. package/android/src/main/cpp/libyuv/source/scale_neon.cc +1449 -1449
  124. package/android/src/main/cpp/libyuv/source/scale_neon64.cc +1552 -1552
  125. package/android/src/main/cpp/libyuv/source/scale_rgb.cc +82 -82
  126. package/android/src/main/cpp/libyuv/source/scale_rvv.cc +1971 -1971
  127. package/android/src/main/cpp/libyuv/source/scale_sme.cc +555 -555
  128. package/android/src/main/cpp/libyuv/source/scale_uv.cc +1159 -1159
  129. package/android/src/main/cpp/libyuv/source/scale_win.cc +1392 -1392
  130. package/android/src/main/cpp/libyuv/source/test.sh +35 -35
  131. package/android/src/main/cpp/libyuv/source/video_common.cc +62 -62
  132. package/android/src/main/cpp/libyuv/tools_libyuv/OWNERS +4 -4
  133. package/android/src/main/cpp/libyuv/tools_libyuv/autoroller/roll_deps.py +931 -931
  134. package/android/src/main/cpp/libyuv/tools_libyuv/autoroller/unittests/roll_deps_test.py +164 -164
  135. package/android/src/main/cpp/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS +21 -21
  136. package/android/src/main/cpp/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium.new +13 -13
  137. package/android/src/main/cpp/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium.old +13 -13
  138. package/android/src/main/cpp/libyuv/tools_libyuv/get_landmines.py +38 -38
  139. package/android/src/main/cpp/libyuv/tools_libyuv/msan/OWNERS +3 -3
  140. package/android/src/main/cpp/libyuv/tools_libyuv/msan/blacklist.txt +9 -9
  141. package/android/src/main/cpp/libyuv/tools_libyuv/ubsan/OWNERS +3 -3
  142. package/android/src/main/cpp/libyuv/tools_libyuv/ubsan/blacklist.txt +15 -15
  143. package/android/src/main/cpp/libyuv/tools_libyuv/ubsan/vptr_blacklist.txt +25 -25
  144. package/android/src/main/cpp/libyuv/unit_test/basictypes_test.cc +43 -43
  145. package/android/src/main/cpp/libyuv/unit_test/color_test.cc +848 -848
  146. package/android/src/main/cpp/libyuv/unit_test/compare_test.cc +739 -739
  147. package/android/src/main/cpp/libyuv/unit_test/convert_argb_test.cc +2867 -2867
  148. package/android/src/main/cpp/libyuv/unit_test/convert_test.cc +2133 -2133
  149. package/android/src/main/cpp/libyuv/unit_test/cpu_test.cc +427 -427
  150. package/android/src/main/cpp/libyuv/unit_test/cpu_thread_test.cc +63 -63
  151. package/android/src/main/cpp/libyuv/unit_test/math_test.cc +160 -160
  152. package/android/src/main/cpp/libyuv/unit_test/planar_test.cc +4731 -4731
  153. package/android/src/main/cpp/libyuv/unit_test/rotate_argb_test.cc +334 -334
  154. package/android/src/main/cpp/libyuv/unit_test/rotate_test.cc +962 -962
  155. package/android/src/main/cpp/libyuv/unit_test/scale_argb_test.cc +590 -590
  156. package/android/src/main/cpp/libyuv/unit_test/scale_plane_test.cc +465 -465
  157. package/android/src/main/cpp/libyuv/unit_test/scale_rgb_test.cc +280 -280
  158. package/android/src/main/cpp/libyuv/unit_test/scale_test.cc +1135 -1135
  159. package/android/src/main/cpp/libyuv/unit_test/scale_uv_test.cc +249 -249
  160. package/android/src/main/cpp/libyuv/unit_test/testdata/arm_v7.txt +12 -12
  161. package/android/src/main/cpp/libyuv/unit_test/testdata/mips.txt +7 -7
  162. package/android/src/main/cpp/libyuv/unit_test/testdata/mips_loongson2k.txt +5 -5
  163. package/android/src/main/cpp/libyuv/unit_test/testdata/mips_loongson3.txt +10 -10
  164. package/android/src/main/cpp/libyuv/unit_test/testdata/mips_loongson_mmi.txt +7 -7
  165. package/android/src/main/cpp/libyuv/unit_test/testdata/riscv64.txt +3 -3
  166. package/android/src/main/cpp/libyuv/unit_test/testdata/riscv64_rvv.txt +3 -3
  167. package/android/src/main/cpp/libyuv/unit_test/testdata/riscv64_rvv_zvfh.txt +3 -3
  168. package/android/src/main/cpp/libyuv/unit_test/testdata/tegra3.txt +23 -23
  169. package/android/src/main/cpp/libyuv/unit_test/unit_test.cc +581 -581
  170. package/android/src/main/cpp/libyuv/unit_test/unit_test.h +232 -232
  171. package/android/src/main/cpp/libyuv/unit_test/video_common_test.cc +112 -112
  172. package/android/src/main/cpp/libyuv/util/Makefile +9 -9
  173. package/android/src/main/cpp/libyuv/util/color.cc +120 -120
  174. package/android/src/main/cpp/libyuv/util/compare.cc +67 -67
  175. package/android/src/main/cpp/libyuv/util/cpuid.c +211 -211
  176. package/android/src/main/cpp/libyuv/util/i444tonv12_eg.cc +27 -27
  177. package/android/src/main/cpp/libyuv/util/psnr.cc +291 -291
  178. package/android/src/main/cpp/libyuv/util/psnr.h +47 -47
  179. package/android/src/main/cpp/libyuv/util/psnr_main.cc +620 -620
  180. package/android/src/main/cpp/libyuv/util/ssim.cc +364 -364
  181. package/android/src/main/cpp/libyuv/util/ssim.h +38 -38
  182. package/android/src/main/cpp/libyuv/util/yuvconstants.c +114 -114
  183. package/android/src/main/cpp/libyuv/util/yuvconvert.cc +367 -367
  184. package/android/src/main/cpp/libyuv/winarm.mk +47 -47
  185. package/package.json +86 -86
  186. package/android/.gradle/8.9/checksums/checksums.lock +0 -0
  187. package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
  188. package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
  189. package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
  190. package/android/.gradle/8.9/gc.properties +0 -0
  191. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  192. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  193. package/android/.gradle/vcs-1/gc.properties +0 -0
@@ -1,147 +1,147 @@
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 INCLUDE_LIBYUV_CPU_ID_H_
12
- #define INCLUDE_LIBYUV_CPU_ID_H_
13
-
14
- #include "libyuv/basic_types.h"
15
-
16
- #ifdef __cplusplus
17
- namespace libyuv {
18
- extern "C" {
19
- #endif
20
-
21
- // Internal flag to indicate cpuid requires initialization.
22
- static const int kCpuInitialized = 0x1;
23
-
24
- // These flags are only valid on Arm processors.
25
- static const int kCpuHasARM = 0x2;
26
- static const int kCpuHasNEON = 0x100;
27
- static const int kCpuHasNeonDotProd = 0x200;
28
- static const int kCpuHasNeonI8MM = 0x400;
29
- static const int kCpuHasSVE = 0x800;
30
- static const int kCpuHasSVE2 = 0x1000;
31
- static const int kCpuHasSME = 0x2000;
32
- static const int kCpuHasSME2 = 0x4000;
33
- static const int kCpuHasSVEF32MM = 0x8000;
34
-
35
- // These flags are only valid on RISCV processors.
36
- static const int kCpuHasRISCV = 0x4;
37
- static const int kCpuHasRVV = 0x100;
38
- static const int kCpuHasRVVZVFH = 0x200;
39
-
40
- // These flags are only valid on x86 processors.
41
- static const int kCpuHasX86 = 0x8;
42
- static const int kCpuHasSSE2 = 0x100;
43
- static const int kCpuHasSSSE3 = 0x200;
44
- static const int kCpuHasSSE41 = 0x400;
45
- static const int kCpuHasSSE42 = 0x800;
46
- static const int kCpuHasAVX = 0x1000;
47
- static const int kCpuHasAVX2 = 0x2000;
48
- static const int kCpuHasERMS = 0x4000;
49
- static const int kCpuHasFSMR = 0x8000;
50
- static const int kCpuHasFMA3 = 0x10000;
51
- static const int kCpuHasF16C = 0x20000;
52
- static const int kCpuHasAVX512BW = 0x40000;
53
- static const int kCpuHasAVX512VL = 0x80000;
54
- static const int kCpuHasAVX512VNNI = 0x100000;
55
- static const int kCpuHasAVX512VBMI = 0x200000;
56
- static const int kCpuHasAVX512VBMI2 = 0x400000;
57
- static const int kCpuHasAVX512VBITALG = 0x800000;
58
- static const int kCpuHasAVX10 = 0x1000000;
59
- static const int kCpuHasAVX10_2 = 0x2000000;
60
- static const int kCpuHasAVXVNNI = 0x4000000;
61
- static const int kCpuHasAVXVNNIINT8 = 0x8000000;
62
- static const int kCpuHasAMXINT8 = 0x10000000;
63
-
64
- // These flags are only valid on LOONGARCH processors.
65
- static const int kCpuHasLOONGARCH = 0x20;
66
- static const int kCpuHasLSX = 0x100;
67
- static const int kCpuHasLASX = 0x200;
68
-
69
- // Optional init function. TestCpuFlag does an auto-init.
70
- // Returns cpu_info flags.
71
- LIBYUV_API
72
- int InitCpuFlags(void);
73
-
74
- // Detect CPU has SSE2 etc.
75
- // Test_flag parameter should be one of kCpuHas constants above.
76
- // Returns non-zero if instruction set is detected
77
- static __inline int TestCpuFlag(int test_flag) {
78
- LIBYUV_API extern int cpu_info_;
79
- #ifdef __ATOMIC_RELAXED
80
- int cpu_info = __atomic_load_n(&cpu_info_, __ATOMIC_RELAXED);
81
- #else
82
- int cpu_info = cpu_info_;
83
- #endif
84
- return (!cpu_info ? InitCpuFlags() : cpu_info) & test_flag;
85
- }
86
-
87
- // Internal function for parsing /proc/cpuinfo.
88
- LIBYUV_API
89
- int ArmCpuCaps(const char* cpuinfo_name);
90
- LIBYUV_API
91
- int RiscvCpuCaps(const char* cpuinfo_name);
92
-
93
- #ifdef __linux__
94
- // On Linux, parse AArch64 features from getauxval(AT_HWCAP{,2}).
95
- LIBYUV_API
96
- int AArch64CpuCaps(unsigned long hwcap, unsigned long hwcap2);
97
- #else
98
- LIBYUV_API
99
- int AArch64CpuCaps();
100
- #endif
101
-
102
- // For testing, allow CPU flags to be disabled.
103
- // ie MaskCpuFlags(~kCpuHasSSSE3) to disable SSSE3.
104
- // MaskCpuFlags(-1) to enable all cpu specific optimizations.
105
- // MaskCpuFlags(1) to disable all cpu specific optimizations.
106
- // MaskCpuFlags(0) to reset state so next call will auto init.
107
- // Returns cpu_info flags.
108
- LIBYUV_API
109
- int MaskCpuFlags(int enable_flags);
110
-
111
- // Sets the CPU flags to |cpu_flags|, bypassing the detection code. |cpu_flags|
112
- // should be a valid combination of the kCpuHas constants above and include
113
- // kCpuInitialized. Use this method when running in a sandboxed process where
114
- // the detection code might fail (as it might access /proc/cpuinfo). In such
115
- // cases the cpu_info can be obtained from a non sandboxed process by calling
116
- // InitCpuFlags() and passed to the sandboxed process (via command line
117
- // parameters, IPC...) which can then call this method to initialize the CPU
118
- // flags.
119
- // Notes:
120
- // - when specifying 0 for |cpu_flags|, the auto initialization is enabled
121
- // again.
122
- // - enabling CPU features that are not supported by the CPU will result in
123
- // undefined behavior.
124
- // TODO(fbarchard): consider writing a helper function that translates from
125
- // other library CPU info to libyuv CPU info and add a .md doc that explains
126
- // CPU detection.
127
- static __inline void SetCpuFlags(int cpu_flags) {
128
- LIBYUV_API extern int cpu_info_;
129
- #ifdef __ATOMIC_RELAXED
130
- __atomic_store_n(&cpu_info_, cpu_flags, __ATOMIC_RELAXED);
131
- #else
132
- cpu_info_ = cpu_flags;
133
- #endif
134
- }
135
-
136
- // Low level cpuid for X86. Returns zeros on other CPUs.
137
- // eax is the info type that you want.
138
- // ecx is typically the cpu number, and should normally be zero.
139
- LIBYUV_API
140
- void CpuId(int info_eax, int info_ecx, int* cpu_info);
141
-
142
- #ifdef __cplusplus
143
- } // extern "C"
144
- } // namespace libyuv
145
- #endif
146
-
147
- #endif // INCLUDE_LIBYUV_CPU_ID_H_
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 INCLUDE_LIBYUV_CPU_ID_H_
12
+ #define INCLUDE_LIBYUV_CPU_ID_H_
13
+
14
+ #include "libyuv/basic_types.h"
15
+
16
+ #ifdef __cplusplus
17
+ namespace libyuv {
18
+ extern "C" {
19
+ #endif
20
+
21
+ // Internal flag to indicate cpuid requires initialization.
22
+ static const int kCpuInitialized = 0x1;
23
+
24
+ // These flags are only valid on Arm processors.
25
+ static const int kCpuHasARM = 0x2;
26
+ static const int kCpuHasNEON = 0x100;
27
+ static const int kCpuHasNeonDotProd = 0x200;
28
+ static const int kCpuHasNeonI8MM = 0x400;
29
+ static const int kCpuHasSVE = 0x800;
30
+ static const int kCpuHasSVE2 = 0x1000;
31
+ static const int kCpuHasSME = 0x2000;
32
+ static const int kCpuHasSME2 = 0x4000;
33
+ static const int kCpuHasSVEF32MM = 0x8000;
34
+
35
+ // These flags are only valid on RISCV processors.
36
+ static const int kCpuHasRISCV = 0x4;
37
+ static const int kCpuHasRVV = 0x100;
38
+ static const int kCpuHasRVVZVFH = 0x200;
39
+
40
+ // These flags are only valid on x86 processors.
41
+ static const int kCpuHasX86 = 0x8;
42
+ static const int kCpuHasSSE2 = 0x100;
43
+ static const int kCpuHasSSSE3 = 0x200;
44
+ static const int kCpuHasSSE41 = 0x400;
45
+ static const int kCpuHasSSE42 = 0x800;
46
+ static const int kCpuHasAVX = 0x1000;
47
+ static const int kCpuHasAVX2 = 0x2000;
48
+ static const int kCpuHasERMS = 0x4000;
49
+ static const int kCpuHasFSMR = 0x8000;
50
+ static const int kCpuHasFMA3 = 0x10000;
51
+ static const int kCpuHasF16C = 0x20000;
52
+ static const int kCpuHasAVX512BW = 0x40000;
53
+ static const int kCpuHasAVX512VL = 0x80000;
54
+ static const int kCpuHasAVX512VNNI = 0x100000;
55
+ static const int kCpuHasAVX512VBMI = 0x200000;
56
+ static const int kCpuHasAVX512VBMI2 = 0x400000;
57
+ static const int kCpuHasAVX512VBITALG = 0x800000;
58
+ static const int kCpuHasAVX10 = 0x1000000;
59
+ static const int kCpuHasAVX10_2 = 0x2000000;
60
+ static const int kCpuHasAVXVNNI = 0x4000000;
61
+ static const int kCpuHasAVXVNNIINT8 = 0x8000000;
62
+ static const int kCpuHasAMXINT8 = 0x10000000;
63
+
64
+ // These flags are only valid on LOONGARCH processors.
65
+ static const int kCpuHasLOONGARCH = 0x20;
66
+ static const int kCpuHasLSX = 0x100;
67
+ static const int kCpuHasLASX = 0x200;
68
+
69
+ // Optional init function. TestCpuFlag does an auto-init.
70
+ // Returns cpu_info flags.
71
+ LIBYUV_API
72
+ int InitCpuFlags(void);
73
+
74
+ // Detect CPU has SSE2 etc.
75
+ // Test_flag parameter should be one of kCpuHas constants above.
76
+ // Returns non-zero if instruction set is detected
77
+ static __inline int TestCpuFlag(int test_flag) {
78
+ LIBYUV_API extern int cpu_info_;
79
+ #ifdef __ATOMIC_RELAXED
80
+ int cpu_info = __atomic_load_n(&cpu_info_, __ATOMIC_RELAXED);
81
+ #else
82
+ int cpu_info = cpu_info_;
83
+ #endif
84
+ return (!cpu_info ? InitCpuFlags() : cpu_info) & test_flag;
85
+ }
86
+
87
+ // Internal function for parsing /proc/cpuinfo.
88
+ LIBYUV_API
89
+ int ArmCpuCaps(const char* cpuinfo_name);
90
+ LIBYUV_API
91
+ int RiscvCpuCaps(const char* cpuinfo_name);
92
+
93
+ #ifdef __linux__
94
+ // On Linux, parse AArch64 features from getauxval(AT_HWCAP{,2}).
95
+ LIBYUV_API
96
+ int AArch64CpuCaps(unsigned long hwcap, unsigned long hwcap2);
97
+ #else
98
+ LIBYUV_API
99
+ int AArch64CpuCaps();
100
+ #endif
101
+
102
+ // For testing, allow CPU flags to be disabled.
103
+ // ie MaskCpuFlags(~kCpuHasSSSE3) to disable SSSE3.
104
+ // MaskCpuFlags(-1) to enable all cpu specific optimizations.
105
+ // MaskCpuFlags(1) to disable all cpu specific optimizations.
106
+ // MaskCpuFlags(0) to reset state so next call will auto init.
107
+ // Returns cpu_info flags.
108
+ LIBYUV_API
109
+ int MaskCpuFlags(int enable_flags);
110
+
111
+ // Sets the CPU flags to |cpu_flags|, bypassing the detection code. |cpu_flags|
112
+ // should be a valid combination of the kCpuHas constants above and include
113
+ // kCpuInitialized. Use this method when running in a sandboxed process where
114
+ // the detection code might fail (as it might access /proc/cpuinfo). In such
115
+ // cases the cpu_info can be obtained from a non sandboxed process by calling
116
+ // InitCpuFlags() and passed to the sandboxed process (via command line
117
+ // parameters, IPC...) which can then call this method to initialize the CPU
118
+ // flags.
119
+ // Notes:
120
+ // - when specifying 0 for |cpu_flags|, the auto initialization is enabled
121
+ // again.
122
+ // - enabling CPU features that are not supported by the CPU will result in
123
+ // undefined behavior.
124
+ // TODO(fbarchard): consider writing a helper function that translates from
125
+ // other library CPU info to libyuv CPU info and add a .md doc that explains
126
+ // CPU detection.
127
+ static __inline void SetCpuFlags(int cpu_flags) {
128
+ LIBYUV_API extern int cpu_info_;
129
+ #ifdef __ATOMIC_RELAXED
130
+ __atomic_store_n(&cpu_info_, cpu_flags, __ATOMIC_RELAXED);
131
+ #else
132
+ cpu_info_ = cpu_flags;
133
+ #endif
134
+ }
135
+
136
+ // Low level cpuid for X86. Returns zeros on other CPUs.
137
+ // eax is the info type that you want.
138
+ // ecx is typically the cpu number, and should normally be zero.
139
+ LIBYUV_API
140
+ void CpuId(int info_eax, int info_ecx, int* cpu_info);
141
+
142
+ #ifdef __cplusplus
143
+ } // extern "C"
144
+ } // namespace libyuv
145
+ #endif
146
+
147
+ #endif // INCLUDE_LIBYUV_CPU_ID_H_
@@ -1,99 +1,99 @@
1
- /*
2
- * Copyright 2024 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 INCLUDE_LIBYUV_CPU_SUPPORT_H_
12
- #define INCLUDE_LIBYUV_CPU_SUPPORT_H_
13
-
14
- #ifdef __cplusplus
15
- namespace libyuv {
16
- extern "C" {
17
- #endif
18
-
19
- #if defined(__pnacl__) || defined(__CLR_VER) || \
20
- (defined(__native_client__) && defined(__x86_64__)) || \
21
- (defined(__i386__) && !defined(__SSE__) && !defined(__clang__))
22
- #define LIBYUV_DISABLE_X86
23
- #endif
24
-
25
- #if defined(__native_client__)
26
- #define LIBYUV_DISABLE_NEON
27
- #endif
28
-
29
- // MemorySanitizer does not support assembly code yet. http://crbug.com/344505
30
- #if defined(__has_feature)
31
- #if __has_feature(memory_sanitizer)
32
- #if !defined(LIBYUV_DISABLE_NEON)
33
- #define LIBYUV_DISABLE_NEON
34
- #endif
35
- #if !defined(LIBYUV_DISABLE_SME)
36
- #define LIBYUV_DISABLE_SME
37
- #endif
38
- #if !defined(LIBYUV_DISABLE_SVE)
39
- #define LIBYUV_DISABLE_SVE
40
- #endif
41
- #if !defined(LIBYUV_DISABLE_X86)
42
- #define LIBYUV_DISABLE_X86
43
- #endif
44
- #endif // __has_feature(memory_sanitizer)
45
- #endif // defined(__has_feature)
46
-
47
- // clang >= 3.5.0 required for Arm64.
48
- #if defined(__clang__) && defined(__aarch64__) && !defined(LIBYUV_DISABLE_NEON)
49
- #if (__clang_major__ < 3) || (__clang_major__ == 3 && (__clang_minor__ < 5))
50
- #define LIBYUV_DISABLE_NEON
51
- #endif // clang >= 3.5
52
- #endif // __clang__
53
-
54
- // GCC >= 4.7.0 required for AVX2.
55
- #if defined(__GNUC__) && !defined(LIBYUV_ENABLE_ROWWIN) && \
56
- (defined(__x86_64__) || defined(__i386__))
57
- #if (__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 7))
58
- #define GCC_HAS_AVX2 1
59
- #endif // GNUC >= 4.7
60
- #endif // __GNUC__
61
-
62
- // clang >= 3.4.0 required for AVX2.
63
- #if defined(__clang__) && !defined(LIBYUV_ENABLE_ROWWIN) && \
64
- (defined(__x86_64__) || defined(__i386__))
65
- #if (__clang_major__ > 3) || (__clang_major__ == 3 && (__clang_minor__ >= 4))
66
- #define CLANG_HAS_AVX2 1
67
- #endif // clang >= 3.4
68
- #endif // __clang__
69
-
70
- // clang >= 6.0.0 required for AVX512.
71
- #if defined(__clang__) && !defined(LIBYUV_ENABLE_ROWWIN) && \
72
- (defined(__x86_64__) || defined(__i386__))
73
- // clang in xcode follows a different versioning scheme.
74
- // TODO(fbarchard): fix xcode 9 ios b/789.
75
- #if (__clang_major__ >= 7) && !defined(__APPLE__)
76
- #define CLANG_HAS_AVX512 1
77
- #endif // clang >= 7
78
- #endif // __clang__
79
-
80
- // Visual C 2012 required for AVX2.
81
- #if defined(_M_IX86) && \
82
- (!defined(__clang__) || defined(LIBYUV_ENABLE_ROWWIN)) && \
83
- defined(_MSC_VER) && _MSC_VER >= 1700
84
- #define VISUALC_HAS_AVX2 1
85
- #endif // VisualStudio >= 2012
86
-
87
- // Clang 19 required for SME due to needing __arm_tpidr2_save from compiler-rt,
88
- // only enabled on Linux and Android (both define __linux__) for now.
89
- #if !defined(LIBYUV_DISABLE_SME) && defined(__aarch64__) && \
90
- defined(__linux__) && defined(__clang__) && (__clang_major__ >= 19)
91
- #define CLANG_HAS_SME 1
92
- #endif
93
-
94
- #ifdef __cplusplus
95
- } // extern "C"
96
- } // namespace libyuv
97
- #endif
98
-
99
- #endif // INCLUDE_LIBYUV_CPU_SUPPORT_H_
1
+ /*
2
+ * Copyright 2024 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 INCLUDE_LIBYUV_CPU_SUPPORT_H_
12
+ #define INCLUDE_LIBYUV_CPU_SUPPORT_H_
13
+
14
+ #ifdef __cplusplus
15
+ namespace libyuv {
16
+ extern "C" {
17
+ #endif
18
+
19
+ #if defined(__pnacl__) || defined(__CLR_VER) || \
20
+ (defined(__native_client__) && defined(__x86_64__)) || \
21
+ (defined(__i386__) && !defined(__SSE__) && !defined(__clang__))
22
+ #define LIBYUV_DISABLE_X86
23
+ #endif
24
+
25
+ #if defined(__native_client__)
26
+ #define LIBYUV_DISABLE_NEON
27
+ #endif
28
+
29
+ // MemorySanitizer does not support assembly code yet. http://crbug.com/344505
30
+ #if defined(__has_feature)
31
+ #if __has_feature(memory_sanitizer)
32
+ #if !defined(LIBYUV_DISABLE_NEON)
33
+ #define LIBYUV_DISABLE_NEON
34
+ #endif
35
+ #if !defined(LIBYUV_DISABLE_SME)
36
+ #define LIBYUV_DISABLE_SME
37
+ #endif
38
+ #if !defined(LIBYUV_DISABLE_SVE)
39
+ #define LIBYUV_DISABLE_SVE
40
+ #endif
41
+ #if !defined(LIBYUV_DISABLE_X86)
42
+ #define LIBYUV_DISABLE_X86
43
+ #endif
44
+ #endif // __has_feature(memory_sanitizer)
45
+ #endif // defined(__has_feature)
46
+
47
+ // clang >= 3.5.0 required for Arm64.
48
+ #if defined(__clang__) && defined(__aarch64__) && !defined(LIBYUV_DISABLE_NEON)
49
+ #if (__clang_major__ < 3) || (__clang_major__ == 3 && (__clang_minor__ < 5))
50
+ #define LIBYUV_DISABLE_NEON
51
+ #endif // clang >= 3.5
52
+ #endif // __clang__
53
+
54
+ // GCC >= 4.7.0 required for AVX2.
55
+ #if defined(__GNUC__) && !defined(LIBYUV_ENABLE_ROWWIN) && \
56
+ (defined(__x86_64__) || defined(__i386__))
57
+ #if (__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 7))
58
+ #define GCC_HAS_AVX2 1
59
+ #endif // GNUC >= 4.7
60
+ #endif // __GNUC__
61
+
62
+ // clang >= 3.4.0 required for AVX2.
63
+ #if defined(__clang__) && !defined(LIBYUV_ENABLE_ROWWIN) && \
64
+ (defined(__x86_64__) || defined(__i386__))
65
+ #if (__clang_major__ > 3) || (__clang_major__ == 3 && (__clang_minor__ >= 4))
66
+ #define CLANG_HAS_AVX2 1
67
+ #endif // clang >= 3.4
68
+ #endif // __clang__
69
+
70
+ // clang >= 6.0.0 required for AVX512.
71
+ #if defined(__clang__) && !defined(LIBYUV_ENABLE_ROWWIN) && \
72
+ (defined(__x86_64__) || defined(__i386__))
73
+ // clang in xcode follows a different versioning scheme.
74
+ // TODO(fbarchard): fix xcode 9 ios b/789.
75
+ #if (__clang_major__ >= 7) && !defined(__APPLE__)
76
+ #define CLANG_HAS_AVX512 1
77
+ #endif // clang >= 7
78
+ #endif // __clang__
79
+
80
+ // Visual C 2012 required for AVX2.
81
+ #if defined(_M_IX86) && \
82
+ (!defined(__clang__) || defined(LIBYUV_ENABLE_ROWWIN)) && \
83
+ defined(_MSC_VER) && _MSC_VER >= 1700
84
+ #define VISUALC_HAS_AVX2 1
85
+ #endif // VisualStudio >= 2012
86
+
87
+ // Clang 19 required for SME due to needing __arm_tpidr2_save from compiler-rt,
88
+ // only enabled on Linux and Android (both define __linux__) for now.
89
+ #if !defined(LIBYUV_DISABLE_SME) && defined(__aarch64__) && \
90
+ defined(__linux__) && defined(__clang__) && (__clang_major__ >= 19)
91
+ #define CLANG_HAS_SME 1
92
+ #endif
93
+
94
+ #ifdef __cplusplus
95
+ } // extern "C"
96
+ } // namespace libyuv
97
+ #endif
98
+
99
+ #endif // INCLUDE_LIBYUV_CPU_SUPPORT_H_