@drutech/react-native-audio-analyzer 1.1.1-alpha.1

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 (223) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +124 -0
  3. package/android/CMakeCache.txt +372 -0
  4. package/android/CMakeLists.txt +44 -0
  5. package/android/Makefile +211 -0
  6. package/android/build.gradle +110 -0
  7. package/android/cmake_install.cmake +49 -0
  8. package/android/cpp-adapter.cpp +40 -0
  9. package/android/ffmpeg_16kb/include/config.h +749 -0
  10. package/android/ffmpeg_16kb/include/libavcodec/ac3_parser.h +36 -0
  11. package/android/ffmpeg_16kb/include/libavcodec/adts_parser.h +37 -0
  12. package/android/ffmpeg_16kb/include/libavcodec/arm/mathops.h +108 -0
  13. package/android/ffmpeg_16kb/include/libavcodec/avcodec.h +3192 -0
  14. package/android/ffmpeg_16kb/include/libavcodec/avdct.h +88 -0
  15. package/android/ffmpeg_16kb/include/libavcodec/avfft.h +118 -0
  16. package/android/ffmpeg_16kb/include/libavcodec/bsf.h +332 -0
  17. package/android/ffmpeg_16kb/include/libavcodec/codec.h +375 -0
  18. package/android/ffmpeg_16kb/include/libavcodec/codec_desc.h +128 -0
  19. package/android/ffmpeg_16kb/include/libavcodec/codec_id.h +661 -0
  20. package/android/ffmpeg_16kb/include/libavcodec/codec_par.h +247 -0
  21. package/android/ffmpeg_16kb/include/libavcodec/d3d11va.h +112 -0
  22. package/android/ffmpeg_16kb/include/libavcodec/defs.h +192 -0
  23. package/android/ffmpeg_16kb/include/libavcodec/dirac.h +131 -0
  24. package/android/ffmpeg_16kb/include/libavcodec/dv_profile.h +82 -0
  25. package/android/ffmpeg_16kb/include/libavcodec/dxva2.h +93 -0
  26. package/android/ffmpeg_16kb/include/libavcodec/jni.h +46 -0
  27. package/android/ffmpeg_16kb/include/libavcodec/mathops.h +255 -0
  28. package/android/ffmpeg_16kb/include/libavcodec/mediacodec.h +103 -0
  29. package/android/ffmpeg_16kb/include/libavcodec/packet.h +731 -0
  30. package/android/ffmpeg_16kb/include/libavcodec/qsv.h +109 -0
  31. package/android/ffmpeg_16kb/include/libavcodec/vdpau.h +157 -0
  32. package/android/ffmpeg_16kb/include/libavcodec/version.h +45 -0
  33. package/android/ffmpeg_16kb/include/libavcodec/version_major.h +52 -0
  34. package/android/ffmpeg_16kb/include/libavcodec/videotoolbox.h +150 -0
  35. package/android/ffmpeg_16kb/include/libavcodec/vorbis_parser.h +74 -0
  36. package/android/ffmpeg_16kb/include/libavcodec/x86/mathops.h +133 -0
  37. package/android/ffmpeg_16kb/include/libavcodec/xvmc.h +171 -0
  38. package/android/ffmpeg_16kb/include/libavdevice/avdevice.h +397 -0
  39. package/android/ffmpeg_16kb/include/libavdevice/version.h +45 -0
  40. package/android/ffmpeg_16kb/include/libavdevice/version_major.h +36 -0
  41. package/android/ffmpeg_16kb/include/libavfilter/avfilter.h +1491 -0
  42. package/android/ffmpeg_16kb/include/libavfilter/buffersink.h +173 -0
  43. package/android/ffmpeg_16kb/include/libavfilter/buffersrc.h +218 -0
  44. package/android/ffmpeg_16kb/include/libavfilter/version.h +48 -0
  45. package/android/ffmpeg_16kb/include/libavfilter/version_major.h +38 -0
  46. package/android/ffmpeg_16kb/include/libavformat/avformat.h +2826 -0
  47. package/android/ffmpeg_16kb/include/libavformat/avio.h +837 -0
  48. package/android/ffmpeg_16kb/include/libavformat/network.h +341 -0
  49. package/android/ffmpeg_16kb/include/libavformat/os_support.h +317 -0
  50. package/android/ffmpeg_16kb/include/libavformat/url.h +409 -0
  51. package/android/ffmpeg_16kb/include/libavformat/version.h +47 -0
  52. package/android/ffmpeg_16kb/include/libavformat/version_major.h +52 -0
  53. package/android/ffmpeg_16kb/include/libavutil/aarch64/timer.h +50 -0
  54. package/android/ffmpeg_16kb/include/libavutil/adler32.h +63 -0
  55. package/android/ffmpeg_16kb/include/libavutil/aes.h +69 -0
  56. package/android/ffmpeg_16kb/include/libavutil/aes_ctr.h +99 -0
  57. package/android/ffmpeg_16kb/include/libavutil/ambient_viewing_environment.h +72 -0
  58. package/android/ffmpeg_16kb/include/libavutil/arm/timer.h +46 -0
  59. package/android/ffmpeg_16kb/include/libavutil/attributes.h +173 -0
  60. package/android/ffmpeg_16kb/include/libavutil/attributes_internal.h +34 -0
  61. package/android/ffmpeg_16kb/include/libavutil/audio_fifo.h +186 -0
  62. package/android/ffmpeg_16kb/include/libavutil/avassert.h +75 -0
  63. package/android/ffmpeg_16kb/include/libavutil/avconfig.h +6 -0
  64. package/android/ffmpeg_16kb/include/libavutil/avstring.h +429 -0
  65. package/android/ffmpeg_16kb/include/libavutil/avutil.h +371 -0
  66. package/android/ffmpeg_16kb/include/libavutil/base64.h +72 -0
  67. package/android/ffmpeg_16kb/include/libavutil/blowfish.h +82 -0
  68. package/android/ffmpeg_16kb/include/libavutil/bprint.h +251 -0
  69. package/android/ffmpeg_16kb/include/libavutil/bswap.h +111 -0
  70. package/android/ffmpeg_16kb/include/libavutil/buffer.h +322 -0
  71. package/android/ffmpeg_16kb/include/libavutil/camellia.h +70 -0
  72. package/android/ffmpeg_16kb/include/libavutil/cast5.h +80 -0
  73. package/android/ffmpeg_16kb/include/libavutil/channel_layout.h +783 -0
  74. package/android/ffmpeg_16kb/include/libavutil/common.h +578 -0
  75. package/android/ffmpeg_16kb/include/libavutil/cpu.h +134 -0
  76. package/android/ffmpeg_16kb/include/libavutil/crc.h +102 -0
  77. package/android/ffmpeg_16kb/include/libavutil/csp.h +150 -0
  78. package/android/ffmpeg_16kb/include/libavutil/des.h +81 -0
  79. package/android/ffmpeg_16kb/include/libavutil/detection_bbox.h +108 -0
  80. package/android/ffmpeg_16kb/include/libavutil/dict.h +241 -0
  81. package/android/ffmpeg_16kb/include/libavutil/display.h +109 -0
  82. package/android/ffmpeg_16kb/include/libavutil/dovi_meta.h +236 -0
  83. package/android/ffmpeg_16kb/include/libavutil/downmix_info.h +115 -0
  84. package/android/ffmpeg_16kb/include/libavutil/encryption_info.h +205 -0
  85. package/android/ffmpeg_16kb/include/libavutil/error.h +128 -0
  86. package/android/ffmpeg_16kb/include/libavutil/eval.h +140 -0
  87. package/android/ffmpeg_16kb/include/libavutil/ffversion.h +5 -0
  88. package/android/ffmpeg_16kb/include/libavutil/fifo.h +448 -0
  89. package/android/ffmpeg_16kb/include/libavutil/file.h +115 -0
  90. package/android/ffmpeg_16kb/include/libavutil/film_grain_params.h +260 -0
  91. package/android/ffmpeg_16kb/include/libavutil/frame.h +964 -0
  92. package/android/ffmpeg_16kb/include/libavutil/getenv_utf8.h +86 -0
  93. package/android/ffmpeg_16kb/include/libavutil/hash.h +264 -0
  94. package/android/ffmpeg_16kb/include/libavutil/hdr_dynamic_metadata.h +343 -0
  95. package/android/ffmpeg_16kb/include/libavutil/hdr_dynamic_vivid_metadata.h +285 -0
  96. package/android/ffmpeg_16kb/include/libavutil/hmac.h +99 -0
  97. package/android/ffmpeg_16kb/include/libavutil/hwcontext.h +610 -0
  98. package/android/ffmpeg_16kb/include/libavutil/hwcontext_cuda.h +69 -0
  99. package/android/ffmpeg_16kb/include/libavutil/hwcontext_d3d11va.h +178 -0
  100. package/android/ffmpeg_16kb/include/libavutil/hwcontext_drm.h +169 -0
  101. package/android/ffmpeg_16kb/include/libavutil/hwcontext_dxva2.h +75 -0
  102. package/android/ffmpeg_16kb/include/libavutil/hwcontext_mediacodec.h +61 -0
  103. package/android/ffmpeg_16kb/include/libavutil/hwcontext_opencl.h +100 -0
  104. package/android/ffmpeg_16kb/include/libavutil/hwcontext_qsv.h +64 -0
  105. package/android/ffmpeg_16kb/include/libavutil/hwcontext_vaapi.h +117 -0
  106. package/android/ffmpeg_16kb/include/libavutil/hwcontext_vdpau.h +44 -0
  107. package/android/ffmpeg_16kb/include/libavutil/hwcontext_videotoolbox.h +96 -0
  108. package/android/ffmpeg_16kb/include/libavutil/hwcontext_vulkan.h +281 -0
  109. package/android/ffmpeg_16kb/include/libavutil/imgutils.h +331 -0
  110. package/android/ffmpeg_16kb/include/libavutil/internal.h +190 -0
  111. package/android/ffmpeg_16kb/include/libavutil/intfloat.h +77 -0
  112. package/android/ffmpeg_16kb/include/libavutil/intreadwrite.h +644 -0
  113. package/android/ffmpeg_16kb/include/libavutil/lfg.h +81 -0
  114. package/android/ffmpeg_16kb/include/libavutil/libm.h +471 -0
  115. package/android/ffmpeg_16kb/include/libavutil/log.h +387 -0
  116. package/android/ffmpeg_16kb/include/libavutil/lzo.h +66 -0
  117. package/android/ffmpeg_16kb/include/libavutil/macros.h +80 -0
  118. package/android/ffmpeg_16kb/include/libavutil/mastering_display_metadata.h +128 -0
  119. package/android/ffmpeg_16kb/include/libavutil/mathematics.h +245 -0
  120. package/android/ffmpeg_16kb/include/libavutil/md5.h +89 -0
  121. package/android/ffmpeg_16kb/include/libavutil/mem.h +609 -0
  122. package/android/ffmpeg_16kb/include/libavutil/motion_vector.h +57 -0
  123. package/android/ffmpeg_16kb/include/libavutil/murmur3.h +115 -0
  124. package/android/ffmpeg_16kb/include/libavutil/opt.h +891 -0
  125. package/android/ffmpeg_16kb/include/libavutil/parseutils.h +197 -0
  126. package/android/ffmpeg_16kb/include/libavutil/pixdesc.h +435 -0
  127. package/android/ffmpeg_16kb/include/libavutil/pixelutils.h +51 -0
  128. package/android/ffmpeg_16kb/include/libavutil/pixfmt.h +691 -0
  129. package/android/ffmpeg_16kb/include/libavutil/random_seed.h +43 -0
  130. package/android/ffmpeg_16kb/include/libavutil/rational.h +221 -0
  131. package/android/ffmpeg_16kb/include/libavutil/rc4.h +69 -0
  132. package/android/ffmpeg_16kb/include/libavutil/replaygain.h +50 -0
  133. package/android/ffmpeg_16kb/include/libavutil/reverse.h +28 -0
  134. package/android/ffmpeg_16kb/include/libavutil/ripemd.h +83 -0
  135. package/android/ffmpeg_16kb/include/libavutil/samplefmt.h +269 -0
  136. package/android/ffmpeg_16kb/include/libavutil/sha.h +90 -0
  137. package/android/ffmpeg_16kb/include/libavutil/sha512.h +92 -0
  138. package/android/ffmpeg_16kb/include/libavutil/spherical.h +227 -0
  139. package/android/ffmpeg_16kb/include/libavutil/stereo3d.h +229 -0
  140. package/android/ffmpeg_16kb/include/libavutil/tea.h +71 -0
  141. package/android/ffmpeg_16kb/include/libavutil/thread.h +204 -0
  142. package/android/ffmpeg_16kb/include/libavutil/threadmessage.h +115 -0
  143. package/android/ffmpeg_16kb/include/libavutil/time.h +56 -0
  144. package/android/ffmpeg_16kb/include/libavutil/timecode.h +199 -0
  145. package/android/ffmpeg_16kb/include/libavutil/timer.h +156 -0
  146. package/android/ffmpeg_16kb/include/libavutil/timestamp.h +78 -0
  147. package/android/ffmpeg_16kb/include/libavutil/tree.h +137 -0
  148. package/android/ffmpeg_16kb/include/libavutil/twofish.h +70 -0
  149. package/android/ffmpeg_16kb/include/libavutil/tx.h +176 -0
  150. package/android/ffmpeg_16kb/include/libavutil/uuid.h +146 -0
  151. package/android/ffmpeg_16kb/include/libavutil/version.h +122 -0
  152. package/android/ffmpeg_16kb/include/libavutil/video_enc_params.h +171 -0
  153. package/android/ffmpeg_16kb/include/libavutil/x86/asm.h +154 -0
  154. package/android/ffmpeg_16kb/include/libavutil/x86/emms.h +58 -0
  155. package/android/ffmpeg_16kb/include/libavutil/x86/timer.h +50 -0
  156. package/android/ffmpeg_16kb/include/libavutil/xtea.h +94 -0
  157. package/android/ffmpeg_16kb/include/libswresample/swresample.h +650 -0
  158. package/android/ffmpeg_16kb/include/libswresample/version.h +46 -0
  159. package/android/ffmpeg_16kb/include/libswresample/version_major.h +31 -0
  160. package/android/ffmpeg_16kb/include/libswscale/swscale.h +436 -0
  161. package/android/ffmpeg_16kb/include/libswscale/version.h +44 -0
  162. package/android/ffmpeg_16kb/include/libswscale/version_major.h +35 -0
  163. package/android/ffmpeg_16kb/lib/arm64-v8a/libavcodec.so +0 -0
  164. package/android/ffmpeg_16kb/lib/arm64-v8a/libavdevice.so +0 -0
  165. package/android/ffmpeg_16kb/lib/arm64-v8a/libavfilter.so +0 -0
  166. package/android/ffmpeg_16kb/lib/arm64-v8a/libavformat.so +0 -0
  167. package/android/ffmpeg_16kb/lib/arm64-v8a/libavutil.so +0 -0
  168. package/android/ffmpeg_16kb/lib/arm64-v8a/libswresample.so +0 -0
  169. package/android/ffmpeg_16kb/lib/arm64-v8a/libswscale.so +0 -0
  170. package/android/ffmpeg_16kb/lib/armeabi-v7a/libavcodec_neon.so +0 -0
  171. package/android/ffmpeg_16kb/lib/armeabi-v7a/libavdevice_neon.so +0 -0
  172. package/android/ffmpeg_16kb/lib/armeabi-v7a/libavfilter_neon.so +0 -0
  173. package/android/ffmpeg_16kb/lib/armeabi-v7a/libavformat_neon.so +0 -0
  174. package/android/ffmpeg_16kb/lib/armeabi-v7a/libavutil_neon.so +0 -0
  175. package/android/ffmpeg_16kb/lib/armeabi-v7a/libswresample_neon.so +0 -0
  176. package/android/ffmpeg_16kb/lib/armeabi-v7a/libswscale_neon.so +0 -0
  177. package/android/ffmpeg_16kb/lib/x86/libavcodec.so +0 -0
  178. package/android/ffmpeg_16kb/lib/x86/libavdevice.so +0 -0
  179. package/android/ffmpeg_16kb/lib/x86/libavfilter.so +0 -0
  180. package/android/ffmpeg_16kb/lib/x86/libavformat.so +0 -0
  181. package/android/ffmpeg_16kb/lib/x86/libavutil.so +0 -0
  182. package/android/ffmpeg_16kb/lib/x86/libswresample.so +0 -0
  183. package/android/ffmpeg_16kb/lib/x86/libswscale.so +0 -0
  184. package/android/ffmpeg_16kb/lib/x86_64/libavcodec.so +0 -0
  185. package/android/ffmpeg_16kb/lib/x86_64/libavdevice.so +0 -0
  186. package/android/ffmpeg_16kb/lib/x86_64/libavfilter.so +0 -0
  187. package/android/ffmpeg_16kb/lib/x86_64/libavformat.so +0 -0
  188. package/android/ffmpeg_16kb/lib/x86_64/libavutil.so +0 -0
  189. package/android/ffmpeg_16kb/lib/x86_64/libswresample.so +0 -0
  190. package/android/ffmpeg_16kb/lib/x86_64/libswscale.so +0 -0
  191. package/android/gradle.properties +5 -0
  192. package/android/src/main/AndroidManifest.xml +3 -0
  193. package/android/src/main/AndroidManifestNew.xml +2 -0
  194. package/android/src/main/java/com/audioanalyzer/AmplitudeData.java +20 -0
  195. package/android/src/main/java/com/audioanalyzer/AudioAnalyzerModule.java +52 -0
  196. package/android/src/main/java/com/audioanalyzer/AudioAnalyzerPackage.java +28 -0
  197. package/cpp/react-native-audio-analyzer.cpp +143 -0
  198. package/cpp/react-native-audio-analyzer.h +27 -0
  199. package/ios/AudioAnalyzer.h +19 -0
  200. package/ios/AudioAnalyzer.mm +43 -0
  201. package/lib/commonjs/helpers.js +34 -0
  202. package/lib/commonjs/helpers.js.map +1 -0
  203. package/lib/commonjs/helpers.test.js +49 -0
  204. package/lib/commonjs/helpers.test.js.map +1 -0
  205. package/lib/commonjs/index.js +35 -0
  206. package/lib/commonjs/index.js.map +1 -0
  207. package/lib/module/helpers.js +27 -0
  208. package/lib/module/helpers.js.map +1 -0
  209. package/lib/module/helpers.test.js +47 -0
  210. package/lib/module/helpers.test.js.map +1 -0
  211. package/lib/module/index.js +15 -0
  212. package/lib/module/index.js.map +1 -0
  213. package/lib/typescript/src/helpers.d.ts +3 -0
  214. package/lib/typescript/src/helpers.d.ts.map +1 -0
  215. package/lib/typescript/src/helpers.test.d.ts +2 -0
  216. package/lib/typescript/src/helpers.test.d.ts.map +1 -0
  217. package/lib/typescript/src/index.d.ts +7 -0
  218. package/lib/typescript/src/index.d.ts.map +1 -0
  219. package/package.json +163 -0
  220. package/react-native-audio-analyzer.podspec +44 -0
  221. package/src/helpers.test.ts +59 -0
  222. package/src/helpers.ts +34 -0
  223. package/src/index.tsx +30 -0
@@ -0,0 +1,578 @@
1
+ /*
2
+ * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ /**
22
+ * @file
23
+ * common internal and external API header
24
+ */
25
+
26
+ #ifndef AVUTIL_COMMON_H
27
+ #define AVUTIL_COMMON_H
28
+
29
+ #if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS) && !defined(UINT64_C)
30
+ #error missing -D__STDC_CONSTANT_MACROS / #define __STDC_CONSTANT_MACROS
31
+ #endif
32
+
33
+ #include <errno.h>
34
+ #include <inttypes.h>
35
+ #include <limits.h>
36
+ #include <math.h>
37
+ #include <stdint.h>
38
+ #include <stdio.h>
39
+ #include <stdlib.h>
40
+ #include <string.h>
41
+
42
+ #include "attributes.h"
43
+ #include "macros.h"
44
+
45
+ //rounded division & shift
46
+ #define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b))
47
+ /* assume b>0 */
48
+ #define ROUNDED_DIV(a,b) (((a)>=0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
49
+ /* Fast a/(1<<b) rounded toward +inf. Assume a>=0 and b>=0 */
50
+ #define AV_CEIL_RSHIFT(a,b) (!av_builtin_constant_p(b) ? -((-(a)) >> (b)) \
51
+ : ((a) + (1<<(b)) - 1) >> (b))
52
+ /* Backwards compat. */
53
+ #define FF_CEIL_RSHIFT AV_CEIL_RSHIFT
54
+
55
+ #define FFUDIV(a,b) (((a)>0 ?(a):(a)-(b)+1) / (b))
56
+ #define FFUMOD(a,b) ((a)-(b)*FFUDIV(a,b))
57
+
58
+ /**
59
+ * Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they
60
+ * are not representable as absolute values of their type. This is the same
61
+ * as with *abs()
62
+ * @see FFNABS()
63
+ */
64
+ #define FFABS(a) ((a) >= 0 ? (a) : (-(a)))
65
+ #define FFSIGN(a) ((a) > 0 ? 1 : -1)
66
+
67
+ /**
68
+ * Negative Absolute value.
69
+ * this works for all integers of all types.
70
+ * As with many macros, this evaluates its argument twice, it thus must not have
71
+ * a sideeffect, that is FFNABS(x++) has undefined behavior.
72
+ */
73
+ #define FFNABS(a) ((a) <= 0 ? (a) : (-(a)))
74
+
75
+ /**
76
+ * Unsigned Absolute value.
77
+ * This takes the absolute value of a signed int and returns it as a unsigned.
78
+ * This also works with INT_MIN which would otherwise not be representable
79
+ * As with many macros, this evaluates its argument twice.
80
+ */
81
+ #define FFABSU(a) ((a) <= 0 ? -(unsigned)(a) : (unsigned)(a))
82
+ #define FFABS64U(a) ((a) <= 0 ? -(uint64_t)(a) : (uint64_t)(a))
83
+
84
+ /* misc math functions */
85
+
86
+ #ifdef HAVE_AV_CONFIG_H
87
+ # include "config.h"
88
+ # include "intmath.h"
89
+ #endif
90
+
91
+ #ifndef av_ceil_log2
92
+ # define av_ceil_log2 av_ceil_log2_c
93
+ #endif
94
+ #ifndef av_clip
95
+ # define av_clip av_clip_c
96
+ #endif
97
+ #ifndef av_clip64
98
+ # define av_clip64 av_clip64_c
99
+ #endif
100
+ #ifndef av_clip_uint8
101
+ # define av_clip_uint8 av_clip_uint8_c
102
+ #endif
103
+ #ifndef av_clip_int8
104
+ # define av_clip_int8 av_clip_int8_c
105
+ #endif
106
+ #ifndef av_clip_uint16
107
+ # define av_clip_uint16 av_clip_uint16_c
108
+ #endif
109
+ #ifndef av_clip_int16
110
+ # define av_clip_int16 av_clip_int16_c
111
+ #endif
112
+ #ifndef av_clipl_int32
113
+ # define av_clipl_int32 av_clipl_int32_c
114
+ #endif
115
+ #ifndef av_clip_intp2
116
+ # define av_clip_intp2 av_clip_intp2_c
117
+ #endif
118
+ #ifndef av_clip_uintp2
119
+ # define av_clip_uintp2 av_clip_uintp2_c
120
+ #endif
121
+ #ifndef av_mod_uintp2
122
+ # define av_mod_uintp2 av_mod_uintp2_c
123
+ #endif
124
+ #ifndef av_sat_add32
125
+ # define av_sat_add32 av_sat_add32_c
126
+ #endif
127
+ #ifndef av_sat_dadd32
128
+ # define av_sat_dadd32 av_sat_dadd32_c
129
+ #endif
130
+ #ifndef av_sat_sub32
131
+ # define av_sat_sub32 av_sat_sub32_c
132
+ #endif
133
+ #ifndef av_sat_dsub32
134
+ # define av_sat_dsub32 av_sat_dsub32_c
135
+ #endif
136
+ #ifndef av_sat_add64
137
+ # define av_sat_add64 av_sat_add64_c
138
+ #endif
139
+ #ifndef av_sat_sub64
140
+ # define av_sat_sub64 av_sat_sub64_c
141
+ #endif
142
+ #ifndef av_clipf
143
+ # define av_clipf av_clipf_c
144
+ #endif
145
+ #ifndef av_clipd
146
+ # define av_clipd av_clipd_c
147
+ #endif
148
+ #ifndef av_popcount
149
+ # define av_popcount av_popcount_c
150
+ #endif
151
+ #ifndef av_popcount64
152
+ # define av_popcount64 av_popcount64_c
153
+ #endif
154
+ #ifndef av_parity
155
+ # define av_parity av_parity_c
156
+ #endif
157
+
158
+ #ifndef av_log2
159
+ av_const int av_log2(unsigned v);
160
+ #endif
161
+
162
+ #ifndef av_log2_16bit
163
+ av_const int av_log2_16bit(unsigned v);
164
+ #endif
165
+
166
+ /**
167
+ * Clip a signed integer value into the amin-amax range.
168
+ * @param a value to clip
169
+ * @param amin minimum value of the clip range
170
+ * @param amax maximum value of the clip range
171
+ * @return clipped value
172
+ */
173
+ static av_always_inline av_const int av_clip_c(int a, int amin, int amax)
174
+ {
175
+ #if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
176
+ if (amin > amax) abort();
177
+ #endif
178
+ if (a < amin) return amin;
179
+ else if (a > amax) return amax;
180
+ else return a;
181
+ }
182
+
183
+ /**
184
+ * Clip a signed 64bit integer value into the amin-amax range.
185
+ * @param a value to clip
186
+ * @param amin minimum value of the clip range
187
+ * @param amax maximum value of the clip range
188
+ * @return clipped value
189
+ */
190
+ static av_always_inline av_const int64_t av_clip64_c(int64_t a, int64_t amin, int64_t amax)
191
+ {
192
+ #if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
193
+ if (amin > amax) abort();
194
+ #endif
195
+ if (a < amin) return amin;
196
+ else if (a > amax) return amax;
197
+ else return a;
198
+ }
199
+
200
+ /**
201
+ * Clip a signed integer value into the 0-255 range.
202
+ * @param a value to clip
203
+ * @return clipped value
204
+ */
205
+ static av_always_inline av_const uint8_t av_clip_uint8_c(int a)
206
+ {
207
+ if (a&(~0xFF)) return (~a)>>31;
208
+ else return a;
209
+ }
210
+
211
+ /**
212
+ * Clip a signed integer value into the -128,127 range.
213
+ * @param a value to clip
214
+ * @return clipped value
215
+ */
216
+ static av_always_inline av_const int8_t av_clip_int8_c(int a)
217
+ {
218
+ if ((a+0x80U) & ~0xFF) return (a>>31) ^ 0x7F;
219
+ else return a;
220
+ }
221
+
222
+ /**
223
+ * Clip a signed integer value into the 0-65535 range.
224
+ * @param a value to clip
225
+ * @return clipped value
226
+ */
227
+ static av_always_inline av_const uint16_t av_clip_uint16_c(int a)
228
+ {
229
+ if (a&(~0xFFFF)) return (~a)>>31;
230
+ else return a;
231
+ }
232
+
233
+ /**
234
+ * Clip a signed integer value into the -32768,32767 range.
235
+ * @param a value to clip
236
+ * @return clipped value
237
+ */
238
+ static av_always_inline av_const int16_t av_clip_int16_c(int a)
239
+ {
240
+ if ((a+0x8000U) & ~0xFFFF) return (a>>31) ^ 0x7FFF;
241
+ else return a;
242
+ }
243
+
244
+ /**
245
+ * Clip a signed 64-bit integer value into the -2147483648,2147483647 range.
246
+ * @param a value to clip
247
+ * @return clipped value
248
+ */
249
+ static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a)
250
+ {
251
+ if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (int32_t)((a>>63) ^ 0x7FFFFFFF);
252
+ else return (int32_t)a;
253
+ }
254
+
255
+ /**
256
+ * Clip a signed integer into the -(2^p),(2^p-1) range.
257
+ * @param a value to clip
258
+ * @param p bit position to clip at
259
+ * @return clipped value
260
+ */
261
+ static av_always_inline av_const int av_clip_intp2_c(int a, int p)
262
+ {
263
+ if (((unsigned)a + (1 << p)) & ~((2 << p) - 1))
264
+ return (a >> 31) ^ ((1 << p) - 1);
265
+ else
266
+ return a;
267
+ }
268
+
269
+ /**
270
+ * Clip a signed integer to an unsigned power of two range.
271
+ * @param a value to clip
272
+ * @param p bit position to clip at
273
+ * @return clipped value
274
+ */
275
+ static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
276
+ {
277
+ if (a & ~((1<<p) - 1)) return (~a) >> 31 & ((1<<p) - 1);
278
+ else return a;
279
+ }
280
+
281
+ /**
282
+ * Clear high bits from an unsigned integer starting with specific bit position
283
+ * @param a value to clip
284
+ * @param p bit position to clip at
285
+ * @return clipped value
286
+ */
287
+ static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p)
288
+ {
289
+ return a & ((1U << p) - 1);
290
+ }
291
+
292
+ /**
293
+ * Add two signed 32-bit values with saturation.
294
+ *
295
+ * @param a one value
296
+ * @param b another value
297
+ * @return sum with signed saturation
298
+ */
299
+ static av_always_inline int av_sat_add32_c(int a, int b)
300
+ {
301
+ return av_clipl_int32((int64_t)a + b);
302
+ }
303
+
304
+ /**
305
+ * Add a doubled value to another value with saturation at both stages.
306
+ *
307
+ * @param a first value
308
+ * @param b value doubled and added to a
309
+ * @return sum sat(a + sat(2*b)) with signed saturation
310
+ */
311
+ static av_always_inline int av_sat_dadd32_c(int a, int b)
312
+ {
313
+ return av_sat_add32(a, av_sat_add32(b, b));
314
+ }
315
+
316
+ /**
317
+ * Subtract two signed 32-bit values with saturation.
318
+ *
319
+ * @param a one value
320
+ * @param b another value
321
+ * @return difference with signed saturation
322
+ */
323
+ static av_always_inline int av_sat_sub32_c(int a, int b)
324
+ {
325
+ return av_clipl_int32((int64_t)a - b);
326
+ }
327
+
328
+ /**
329
+ * Subtract a doubled value from another value with saturation at both stages.
330
+ *
331
+ * @param a first value
332
+ * @param b value doubled and subtracted from a
333
+ * @return difference sat(a - sat(2*b)) with signed saturation
334
+ */
335
+ static av_always_inline int av_sat_dsub32_c(int a, int b)
336
+ {
337
+ return av_sat_sub32(a, av_sat_add32(b, b));
338
+ }
339
+
340
+ /**
341
+ * Add two signed 64-bit values with saturation.
342
+ *
343
+ * @param a one value
344
+ * @param b another value
345
+ * @return sum with signed saturation
346
+ */
347
+ static av_always_inline int64_t av_sat_add64_c(int64_t a, int64_t b) {
348
+ #if (!defined(__INTEL_COMPILER) && AV_GCC_VERSION_AT_LEAST(5,1)) || AV_HAS_BUILTIN(__builtin_add_overflow)
349
+ int64_t tmp;
350
+ return !__builtin_add_overflow(a, b, &tmp) ? tmp : (tmp < 0 ? INT64_MAX : INT64_MIN);
351
+ #else
352
+ int64_t s = a+(uint64_t)b;
353
+ if ((int64_t)(a^b | ~s^b) >= 0)
354
+ return INT64_MAX ^ (b >> 63);
355
+ return s;
356
+ #endif
357
+ }
358
+
359
+ /**
360
+ * Subtract two signed 64-bit values with saturation.
361
+ *
362
+ * @param a one value
363
+ * @param b another value
364
+ * @return difference with signed saturation
365
+ */
366
+ static av_always_inline int64_t av_sat_sub64_c(int64_t a, int64_t b) {
367
+ #if (!defined(__INTEL_COMPILER) && AV_GCC_VERSION_AT_LEAST(5,1)) || AV_HAS_BUILTIN(__builtin_sub_overflow)
368
+ int64_t tmp;
369
+ return !__builtin_sub_overflow(a, b, &tmp) ? tmp : (tmp < 0 ? INT64_MAX : INT64_MIN);
370
+ #else
371
+ if (b <= 0 && a >= INT64_MAX + b)
372
+ return INT64_MAX;
373
+ if (b >= 0 && a <= INT64_MIN + b)
374
+ return INT64_MIN;
375
+ return a - b;
376
+ #endif
377
+ }
378
+
379
+ /**
380
+ * Clip a float value into the amin-amax range.
381
+ * If a is nan or -inf amin will be returned.
382
+ * If a is +inf amax will be returned.
383
+ * @param a value to clip
384
+ * @param amin minimum value of the clip range
385
+ * @param amax maximum value of the clip range
386
+ * @return clipped value
387
+ */
388
+ static av_always_inline av_const float av_clipf_c(float a, float amin, float amax)
389
+ {
390
+ #if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
391
+ if (amin > amax) abort();
392
+ #endif
393
+ return FFMIN(FFMAX(a, amin), amax);
394
+ }
395
+
396
+ /**
397
+ * Clip a double value into the amin-amax range.
398
+ * If a is nan or -inf amin will be returned.
399
+ * If a is +inf amax will be returned.
400
+ * @param a value to clip
401
+ * @param amin minimum value of the clip range
402
+ * @param amax maximum value of the clip range
403
+ * @return clipped value
404
+ */
405
+ static av_always_inline av_const double av_clipd_c(double a, double amin, double amax)
406
+ {
407
+ #if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
408
+ if (amin > amax) abort();
409
+ #endif
410
+ return FFMIN(FFMAX(a, amin), amax);
411
+ }
412
+
413
+ /** Compute ceil(log2(x)).
414
+ * @param x value used to compute ceil(log2(x))
415
+ * @return computed ceiling of log2(x)
416
+ */
417
+ static av_always_inline av_const int av_ceil_log2_c(int x)
418
+ {
419
+ return av_log2((x - 1U) << 1);
420
+ }
421
+
422
+ /**
423
+ * Count number of bits set to one in x
424
+ * @param x value to count bits of
425
+ * @return the number of bits set to one in x
426
+ */
427
+ static av_always_inline av_const int av_popcount_c(uint32_t x)
428
+ {
429
+ x -= (x >> 1) & 0x55555555;
430
+ x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
431
+ x = (x + (x >> 4)) & 0x0F0F0F0F;
432
+ x += x >> 8;
433
+ return (x + (x >> 16)) & 0x3F;
434
+ }
435
+
436
+ /**
437
+ * Count number of bits set to one in x
438
+ * @param x value to count bits of
439
+ * @return the number of bits set to one in x
440
+ */
441
+ static av_always_inline av_const int av_popcount64_c(uint64_t x)
442
+ {
443
+ return av_popcount((uint32_t)x) + av_popcount((uint32_t)(x >> 32));
444
+ }
445
+
446
+ static av_always_inline av_const int av_parity_c(uint32_t v)
447
+ {
448
+ return av_popcount(v) & 1;
449
+ }
450
+
451
+ /**
452
+ * Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form.
453
+ *
454
+ * @param val Output value, must be an lvalue of type uint32_t.
455
+ * @param GET_BYTE Expression reading one byte from the input.
456
+ * Evaluated up to 7 times (4 for the currently
457
+ * assigned Unicode range). With a memory buffer
458
+ * input, this could be *ptr++, or if you want to make sure
459
+ * that *ptr stops at the end of a NULL terminated string then
460
+ * *ptr ? *ptr++ : 0
461
+ * @param ERROR Expression to be evaluated on invalid input,
462
+ * typically a goto statement.
463
+ *
464
+ * @warning ERROR should not contain a loop control statement which
465
+ * could interact with the internal while loop, and should force an
466
+ * exit from the macro code (e.g. through a goto or a return) in order
467
+ * to prevent undefined results.
468
+ */
469
+ #define GET_UTF8(val, GET_BYTE, ERROR)\
470
+ val= (GET_BYTE);\
471
+ {\
472
+ uint32_t top = (val & 128) >> 1;\
473
+ if ((val & 0xc0) == 0x80 || val >= 0xFE)\
474
+ {ERROR}\
475
+ while (val & top) {\
476
+ unsigned int tmp = (GET_BYTE) - 128;\
477
+ if(tmp>>6)\
478
+ {ERROR}\
479
+ val= (val<<6) + tmp;\
480
+ top <<= 5;\
481
+ }\
482
+ val &= (top << 1) - 1;\
483
+ }
484
+
485
+ /**
486
+ * Convert a UTF-16 character (2 or 4 bytes) to its 32-bit UCS-4 encoded form.
487
+ *
488
+ * @param val Output value, must be an lvalue of type uint32_t.
489
+ * @param GET_16BIT Expression returning two bytes of UTF-16 data converted
490
+ * to native byte order. Evaluated one or two times.
491
+ * @param ERROR Expression to be evaluated on invalid input,
492
+ * typically a goto statement.
493
+ */
494
+ #define GET_UTF16(val, GET_16BIT, ERROR)\
495
+ val = (GET_16BIT);\
496
+ {\
497
+ unsigned int hi = val - 0xD800;\
498
+ if (hi < 0x800) {\
499
+ val = (GET_16BIT) - 0xDC00;\
500
+ if (val > 0x3FFU || hi > 0x3FFU)\
501
+ {ERROR}\
502
+ val += (hi<<10) + 0x10000;\
503
+ }\
504
+ }\
505
+
506
+ /**
507
+ * @def PUT_UTF8(val, tmp, PUT_BYTE)
508
+ * Convert a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long).
509
+ * @param val is an input-only argument and should be of type uint32_t. It holds
510
+ * a UCS-4 encoded Unicode character that is to be converted to UTF-8. If
511
+ * val is given as a function it is executed only once.
512
+ * @param tmp is a temporary variable and should be of type uint8_t. It
513
+ * represents an intermediate value during conversion that is to be
514
+ * output by PUT_BYTE.
515
+ * @param PUT_BYTE writes the converted UTF-8 bytes to any proper destination.
516
+ * It could be a function or a statement, and uses tmp as the input byte.
517
+ * For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be
518
+ * executed up to 4 times for values in the valid UTF-8 range and up to
519
+ * 7 times in the general case, depending on the length of the converted
520
+ * Unicode character.
521
+ */
522
+ #define PUT_UTF8(val, tmp, PUT_BYTE)\
523
+ {\
524
+ int bytes, shift;\
525
+ uint32_t in = val;\
526
+ if (in < 0x80) {\
527
+ tmp = in;\
528
+ PUT_BYTE\
529
+ } else {\
530
+ bytes = (av_log2(in) + 4) / 5;\
531
+ shift = (bytes - 1) * 6;\
532
+ tmp = (256 - (256 >> bytes)) | (in >> shift);\
533
+ PUT_BYTE\
534
+ while (shift >= 6) {\
535
+ shift -= 6;\
536
+ tmp = 0x80 | ((in >> shift) & 0x3f);\
537
+ PUT_BYTE\
538
+ }\
539
+ }\
540
+ }
541
+
542
+ /**
543
+ * @def PUT_UTF16(val, tmp, PUT_16BIT)
544
+ * Convert a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes).
545
+ * @param val is an input-only argument and should be of type uint32_t. It holds
546
+ * a UCS-4 encoded Unicode character that is to be converted to UTF-16. If
547
+ * val is given as a function it is executed only once.
548
+ * @param tmp is a temporary variable and should be of type uint16_t. It
549
+ * represents an intermediate value during conversion that is to be
550
+ * output by PUT_16BIT.
551
+ * @param PUT_16BIT writes the converted UTF-16 data to any proper destination
552
+ * in desired endianness. It could be a function or a statement, and uses tmp
553
+ * as the input byte. For example, PUT_BYTE could be "*output++ = tmp;"
554
+ * PUT_BYTE will be executed 1 or 2 times depending on input character.
555
+ */
556
+ #define PUT_UTF16(val, tmp, PUT_16BIT)\
557
+ {\
558
+ uint32_t in = val;\
559
+ if (in < 0x10000) {\
560
+ tmp = in;\
561
+ PUT_16BIT\
562
+ } else {\
563
+ tmp = 0xD800 | ((in - 0x10000) >> 10);\
564
+ PUT_16BIT\
565
+ tmp = 0xDC00 | ((in - 0x10000) & 0x3FF);\
566
+ PUT_16BIT\
567
+ }\
568
+ }\
569
+
570
+
571
+
572
+ #include "mem.h"
573
+
574
+ #ifdef HAVE_AV_CONFIG_H
575
+ # include "internal.h"
576
+ #endif /* HAVE_AV_CONFIG_H */
577
+
578
+ #endif /* AVUTIL_COMMON_H */
@@ -0,0 +1,134 @@
1
+ /*
2
+ * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ #ifndef AVUTIL_CPU_H
22
+ #define AVUTIL_CPU_H
23
+
24
+ #include <stddef.h>
25
+
26
+ #define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */
27
+
28
+ /* lower 16 bits - CPU features */
29
+ #define AV_CPU_FLAG_MMX 0x0001 ///< standard MMX
30
+ #define AV_CPU_FLAG_MMXEXT 0x0002 ///< SSE integer functions or AMD MMX ext
31
+ #define AV_CPU_FLAG_MMX2 0x0002 ///< SSE integer functions or AMD MMX ext
32
+ #define AV_CPU_FLAG_3DNOW 0x0004 ///< AMD 3DNOW
33
+ #define AV_CPU_FLAG_SSE 0x0008 ///< SSE functions
34
+ #define AV_CPU_FLAG_SSE2 0x0010 ///< PIV SSE2 functions
35
+ #define AV_CPU_FLAG_SSE2SLOW 0x40000000 ///< SSE2 supported, but usually not faster
36
+ ///< than regular MMX/SSE (e.g. Core1)
37
+ #define AV_CPU_FLAG_3DNOWEXT 0x0020 ///< AMD 3DNowExt
38
+ #define AV_CPU_FLAG_SSE3 0x0040 ///< Prescott SSE3 functions
39
+ #define AV_CPU_FLAG_SSE3SLOW 0x20000000 ///< SSE3 supported, but usually not faster
40
+ ///< than regular MMX/SSE (e.g. Core1)
41
+ #define AV_CPU_FLAG_SSSE3 0x0080 ///< Conroe SSSE3 functions
42
+ #define AV_CPU_FLAG_SSSE3SLOW 0x4000000 ///< SSSE3 supported, but usually not faster
43
+ #define AV_CPU_FLAG_ATOM 0x10000000 ///< Atom processor, some SSSE3 instructions are slower
44
+ #define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions
45
+ #define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions
46
+ #define AV_CPU_FLAG_AESNI 0x80000 ///< Advanced Encryption Standard functions
47
+ #define AV_CPU_FLAG_AVX 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used
48
+ #define AV_CPU_FLAG_AVXSLOW 0x8000000 ///< AVX supported, but slow when using YMM registers (e.g. Bulldozer)
49
+ #define AV_CPU_FLAG_XOP 0x0400 ///< Bulldozer XOP functions
50
+ #define AV_CPU_FLAG_FMA4 0x0800 ///< Bulldozer FMA4 functions
51
+ #define AV_CPU_FLAG_CMOV 0x1000 ///< supports cmov instruction
52
+ #define AV_CPU_FLAG_AVX2 0x8000 ///< AVX2 functions: requires OS support even if YMM registers aren't used
53
+ #define AV_CPU_FLAG_FMA3 0x10000 ///< Haswell FMA3 functions
54
+ #define AV_CPU_FLAG_BMI1 0x20000 ///< Bit Manipulation Instruction Set 1
55
+ #define AV_CPU_FLAG_BMI2 0x40000 ///< Bit Manipulation Instruction Set 2
56
+ #define AV_CPU_FLAG_AVX512 0x100000 ///< AVX-512 functions: requires OS support even if YMM/ZMM registers aren't used
57
+ #define AV_CPU_FLAG_AVX512ICL 0x200000 ///< F/CD/BW/DQ/VL/VNNI/IFMA/VBMI/VBMI2/VPOPCNTDQ/BITALG/GFNI/VAES/VPCLMULQDQ
58
+ #define AV_CPU_FLAG_SLOW_GATHER 0x2000000 ///< CPU has slow gathers.
59
+
60
+ #define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard
61
+ #define AV_CPU_FLAG_VSX 0x0002 ///< ISA 2.06
62
+ #define AV_CPU_FLAG_POWER8 0x0004 ///< ISA 2.07
63
+
64
+ #define AV_CPU_FLAG_ARMV5TE (1 << 0)
65
+ #define AV_CPU_FLAG_ARMV6 (1 << 1)
66
+ #define AV_CPU_FLAG_ARMV6T2 (1 << 2)
67
+ #define AV_CPU_FLAG_VFP (1 << 3)
68
+ #define AV_CPU_FLAG_VFPV3 (1 << 4)
69
+ #define AV_CPU_FLAG_NEON (1 << 5)
70
+ #define AV_CPU_FLAG_ARMV8 (1 << 6)
71
+ #define AV_CPU_FLAG_VFP_VM (1 << 7) ///< VFPv2 vector mode, deprecated in ARMv7-A and unavailable in various CPUs implementations
72
+ #define AV_CPU_FLAG_SETEND (1 <<16)
73
+
74
+ #define AV_CPU_FLAG_MMI (1 << 0)
75
+ #define AV_CPU_FLAG_MSA (1 << 1)
76
+
77
+ //Loongarch SIMD extension.
78
+ #define AV_CPU_FLAG_LSX (1 << 0)
79
+ #define AV_CPU_FLAG_LASX (1 << 1)
80
+
81
+ // RISC-V extensions
82
+ #define AV_CPU_FLAG_RVI (1 << 0) ///< I (full GPR bank)
83
+ #define AV_CPU_FLAG_RVF (1 << 1) ///< F (single precision FP)
84
+ #define AV_CPU_FLAG_RVD (1 << 2) ///< D (double precision FP)
85
+ #define AV_CPU_FLAG_RVV_I32 (1 << 3) ///< Vectors of 8/16/32-bit int's */
86
+ #define AV_CPU_FLAG_RVV_F32 (1 << 4) ///< Vectors of float's */
87
+ #define AV_CPU_FLAG_RVV_I64 (1 << 5) ///< Vectors of 64-bit int's */
88
+ #define AV_CPU_FLAG_RVV_F64 (1 << 6) ///< Vectors of double's
89
+ #define AV_CPU_FLAG_RVB_BASIC (1 << 7) ///< Basic bit-manipulations
90
+
91
+ /**
92
+ * Return the flags which specify extensions supported by the CPU.
93
+ * The returned value is affected by av_force_cpu_flags() if that was used
94
+ * before. So av_get_cpu_flags() can easily be used in an application to
95
+ * detect the enabled cpu flags.
96
+ */
97
+ int av_get_cpu_flags(void);
98
+
99
+ /**
100
+ * Disables cpu detection and forces the specified flags.
101
+ * -1 is a special case that disables forcing of specific flags.
102
+ */
103
+ void av_force_cpu_flags(int flags);
104
+
105
+ /**
106
+ * Parse CPU caps from a string and update the given AV_CPU_* flags based on that.
107
+ *
108
+ * @return negative on error.
109
+ */
110
+ int av_parse_cpu_caps(unsigned *flags, const char *s);
111
+
112
+ /**
113
+ * @return the number of logical CPU cores present.
114
+ */
115
+ int av_cpu_count(void);
116
+
117
+ /**
118
+ * Overrides cpu count detection and forces the specified count.
119
+ * Count < 1 disables forcing of specific count.
120
+ */
121
+ void av_cpu_force_count(int count);
122
+
123
+ /**
124
+ * Get the maximum data alignment that may be required by FFmpeg.
125
+ *
126
+ * Note that this is affected by the build configuration and the CPU flags mask,
127
+ * so e.g. if the CPU supports AVX, but libavutil has been built with
128
+ * --disable-avx or the AV_CPU_FLAG_AVX flag has been disabled through
129
+ * av_set_cpu_flags_mask(), then this function will behave as if AVX is not
130
+ * present.
131
+ */
132
+ size_t av_cpu_max_align(void);
133
+
134
+ #endif /* AVUTIL_CPU_H */