@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,154 @@
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
+ #ifndef AVUTIL_X86_ASM_H
22
+ #define AVUTIL_X86_ASM_H
23
+
24
+ #include <stdint.h>
25
+ #include "config.h"
26
+
27
+ typedef struct xmm_reg { uint64_t a, b; } xmm_reg;
28
+ typedef struct ymm_reg { uint64_t a, b, c, d; } ymm_reg;
29
+
30
+ #if ARCH_X86_64
31
+ # define FF_OPSIZE "q"
32
+ # define FF_REG_a "rax"
33
+ # define FF_REG_b "rbx"
34
+ # define FF_REG_c "rcx"
35
+ # define FF_REG_d "rdx"
36
+ # define FF_REG_D "rdi"
37
+ # define FF_REG_S "rsi"
38
+ # define FF_PTR_SIZE "8"
39
+ typedef int64_t x86_reg;
40
+
41
+ /* FF_REG_SP is defined in Solaris sys headers, so use FF_REG_sp */
42
+ # define FF_REG_sp "rsp"
43
+ # define FF_REG_BP "rbp"
44
+ # define FF_REGBP rbp
45
+ # define FF_REGa rax
46
+ # define FF_REGb rbx
47
+ # define FF_REGc rcx
48
+ # define FF_REGd rdx
49
+ # define FF_REGSP rsp
50
+
51
+ #elif ARCH_X86_32
52
+
53
+ # define FF_OPSIZE "l"
54
+ # define FF_REG_a "eax"
55
+ # define FF_REG_b "ebx"
56
+ # define FF_REG_c "ecx"
57
+ # define FF_REG_d "edx"
58
+ # define FF_REG_D "edi"
59
+ # define FF_REG_S "esi"
60
+ # define FF_PTR_SIZE "4"
61
+ typedef int32_t x86_reg;
62
+
63
+ # define FF_REG_sp "esp"
64
+ # define FF_REG_BP "ebp"
65
+ # define FF_REGBP ebp
66
+ # define FF_REGa eax
67
+ # define FF_REGb ebx
68
+ # define FF_REGc ecx
69
+ # define FF_REGd edx
70
+ # define FF_REGSP esp
71
+ #else
72
+ typedef int x86_reg;
73
+ #endif
74
+
75
+ #define HAVE_7REGS (ARCH_X86_64 || (HAVE_EBX_AVAILABLE && HAVE_EBP_AVAILABLE))
76
+ #define HAVE_6REGS (ARCH_X86_64 || (HAVE_EBX_AVAILABLE || HAVE_EBP_AVAILABLE))
77
+
78
+ #if ARCH_X86_64 && defined(PIC)
79
+ # define BROKEN_RELOCATIONS 1
80
+ #endif
81
+
82
+ /*
83
+ * If gcc is not set to support sse (-msse) it will not accept xmm registers
84
+ * in the clobber list for inline asm. XMM_CLOBBERS takes a list of xmm
85
+ * registers to be marked as clobbered and evaluates to nothing if they are
86
+ * not supported, or to the list itself if they are supported. Since a clobber
87
+ * list may not be empty, XMM_CLOBBERS_ONLY should be used if the xmm
88
+ * registers are the only in the clobber list.
89
+ * For example a list with "eax" and "xmm0" as clobbers should become:
90
+ * : XMM_CLOBBERS("xmm0",) "eax"
91
+ * and a list with only "xmm0" should become:
92
+ * XMM_CLOBBERS_ONLY("xmm0")
93
+ */
94
+ #if HAVE_XMM_CLOBBERS
95
+ # define XMM_CLOBBERS(...) __VA_ARGS__
96
+ # define XMM_CLOBBERS_ONLY(...) : __VA_ARGS__
97
+ #else
98
+ # define XMM_CLOBBERS(...)
99
+ # define XMM_CLOBBERS_ONLY(...)
100
+ #endif
101
+
102
+ /* Use to export labels from asm. */
103
+ #define LABEL_MANGLE(a) EXTERN_PREFIX #a
104
+
105
+ // Use rip-relative addressing if compiling PIC code on x86-64.
106
+ #if ARCH_X86_64 && defined(PIC)
107
+ # define LOCAL_MANGLE(a) #a "(%%rip)"
108
+ #else
109
+ # define LOCAL_MANGLE(a) #a
110
+ #endif
111
+
112
+ #if HAVE_INLINE_ASM_DIRECT_SYMBOL_REFS
113
+ # define MANGLE(a) EXTERN_PREFIX LOCAL_MANGLE(a)
114
+ # define NAMED_CONSTRAINTS_ADD(...)
115
+ # define NAMED_CONSTRAINTS(...)
116
+ # define NAMED_CONSTRAINTS_ARRAY_ADD(...)
117
+ # define NAMED_CONSTRAINTS_ARRAY(...)
118
+ #else
119
+ /* When direct symbol references are used in code passed to a compiler that does not support them
120
+ * then these references need to be converted to named asm constraints instead.
121
+ * Instead of returning a direct symbol MANGLE now returns a named constraint for that specific symbol.
122
+ * In order for this to work there must also be a corresponding entry in the asm-interface. To add this
123
+ * entry use the macro NAMED_CONSTRAINTS() and pass in a list of each symbol reference used in the
124
+ * corresponding block of code. (e.g. NAMED_CONSTRAINTS(var1,var2,var3) where var1 is the first symbol etc. ).
125
+ * If there are already existing constraints then use NAMED_CONSTRAINTS_ADD to add to the existing constraint list.
126
+ */
127
+ # define MANGLE(a) "%["#a"]"
128
+ // Intel/MSVC does not correctly expand va-args so we need a rather ugly hack in order to get it to work
129
+ # define FE_0(P,X) P(X)
130
+ # define FE_1(P,X,X1) P(X), FE_0(P,X1)
131
+ # define FE_2(P,X,X1,X2) P(X), FE_1(P,X1,X2)
132
+ # define FE_3(P,X,X1,X2,X3) P(X), FE_2(P,X1,X2,X3)
133
+ # define FE_4(P,X,X1,X2,X3,X4) P(X), FE_3(P,X1,X2,X3,X4)
134
+ # define FE_5(P,X,X1,X2,X3,X4,X5) P(X), FE_4(P,X1,X2,X3,X4,X5)
135
+ # define FE_6(P,X,X1,X2,X3,X4,X5,X6) P(X), FE_5(P,X1,X2,X3,X4,X5,X6)
136
+ # define FE_7(P,X,X1,X2,X3,X4,X5,X6,X7) P(X), FE_6(P,X1,X2,X3,X4,X5,X6,X7)
137
+ # define FE_8(P,X,X1,X2,X3,X4,X5,X6,X7,X8) P(X), FE_7(P,X1,X2,X3,X4,X5,X6,X7,X8)
138
+ # define FE_9(P,X,X1,X2,X3,X4,X5,X6,X7,X8,X9) P(X), FE_8(P,X1,X2,X3,X4,X5,X6,X7,X8,X9)
139
+ # define GET_FE_IMPL(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME
140
+ # define GET_FE(A) GET_FE_IMPL A
141
+ # define GET_FE_GLUE(x, y) x y
142
+ # define FOR_EACH_VA(P,...) GET_FE_GLUE(GET_FE((__VA_ARGS__,FE_9,FE_8,FE_7,FE_6,FE_5,FE_4,FE_3,FE_2,FE_1,FE_0)), (P,__VA_ARGS__))
143
+ # define NAME_CONSTRAINT(x) [x] "m"(x)
144
+ // Parameters are a list of each symbol reference required
145
+ # define NAMED_CONSTRAINTS_ADD(...) , FOR_EACH_VA(NAME_CONSTRAINT,__VA_ARGS__)
146
+ // Same but without comma for when there are no previously defined constraints
147
+ # define NAMED_CONSTRAINTS(...) FOR_EACH_VA(NAME_CONSTRAINT,__VA_ARGS__)
148
+ // Same as above NAMED_CONSTRAINTS except used for passing arrays/pointers instead of normal variables
149
+ # define NAME_CONSTRAINT_ARRAY(x) [x] "m"(*x)
150
+ # define NAMED_CONSTRAINTS_ARRAY_ADD(...) , FOR_EACH_VA(NAME_CONSTRAINT_ARRAY,__VA_ARGS__)
151
+ # define NAMED_CONSTRAINTS_ARRAY(...) FOR_EACH_VA(NAME_CONSTRAINT_ARRAY,__VA_ARGS__)
152
+ #endif
153
+
154
+ #endif /* AVUTIL_X86_ASM_H */
@@ -0,0 +1,58 @@
1
+ /*
2
+ * This file is part of FFmpeg.
3
+ *
4
+ * FFmpeg is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * FFmpeg is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with FFmpeg; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ #ifndef AVUTIL_X86_EMMS_H
20
+ #define AVUTIL_X86_EMMS_H
21
+
22
+ #include "config.h"
23
+ #include "libavutil/attributes.h"
24
+
25
+ void avpriv_emms_asm(void);
26
+
27
+ #if HAVE_MMX_INLINE
28
+ #ifndef __MMX__
29
+ #include "libavutil/cpu.h"
30
+ #endif
31
+
32
+ # define emms_c emms_c
33
+ /**
34
+ * Empty mmx state.
35
+ * this must be called between any dsp function and float/double code.
36
+ * for example sin(); dsp->idct_put(); emms_c(); cos()
37
+ * Note, *alloc() and *free() also use float code in some libc implementations
38
+ * thus this also applies to them or any function using them.
39
+ */
40
+ static av_always_inline void emms_c(void)
41
+ {
42
+ /* Some inlined functions may also use mmx instructions regardless of
43
+ * runtime cpuflags. With that in mind, we unconditionally empty the
44
+ * mmx state if the target cpu chosen at configure time supports it.
45
+ */
46
+ #if !defined(__MMX__)
47
+ if(av_get_cpu_flags() & AV_CPU_FLAG_MMX)
48
+ #endif
49
+ __asm__ volatile ("emms" ::: "memory");
50
+ }
51
+ #elif HAVE_MMX && HAVE_MM_EMPTY
52
+ # include <mmintrin.h>
53
+ # define emms_c _mm_empty
54
+ #elif HAVE_MMX_EXTERNAL
55
+ # define emms_c avpriv_emms_asm
56
+ #endif /* HAVE_MMX_INLINE */
57
+
58
+ #endif /* AVUTIL_X86_EMMS_H */
@@ -0,0 +1,50 @@
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
+ #ifndef AVUTIL_X86_TIMER_H
22
+ #define AVUTIL_X86_TIMER_H
23
+
24
+ #include <stdint.h>
25
+
26
+ #if HAVE_INLINE_ASM
27
+
28
+ #define FF_TIMER_UNITS "decicycles"
29
+ #define AV_READ_TIME read_time
30
+
31
+ static inline uint64_t read_time(void)
32
+ {
33
+ uint32_t a, d;
34
+ __asm__ volatile(
35
+ #if ARCH_X86_64 || defined(__SSE2__)
36
+ "lfence \n\t"
37
+ #endif
38
+ "rdtsc \n\t"
39
+ : "=a" (a), "=d" (d));
40
+ return ((uint64_t)d << 32) + a;
41
+ }
42
+
43
+ #elif HAVE_RDTSC
44
+
45
+ #include <intrin.h>
46
+ #define AV_READ_TIME __rdtsc
47
+
48
+ #endif /* HAVE_INLINE_ASM */
49
+
50
+ #endif /* AVUTIL_X86_TIMER_H */
@@ -0,0 +1,94 @@
1
+ /*
2
+ * A 32-bit implementation of the XTEA algorithm
3
+ * Copyright (c) 2012 Samuel Pitoiset
4
+ *
5
+ * This file is part of FFmpeg.
6
+ *
7
+ * FFmpeg is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2.1 of the License, or (at your option) any later version.
11
+ *
12
+ * FFmpeg is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ * Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with FFmpeg; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
+ */
21
+
22
+ #ifndef AVUTIL_XTEA_H
23
+ #define AVUTIL_XTEA_H
24
+
25
+ #include <stdint.h>
26
+
27
+ /**
28
+ * @file
29
+ * @brief Public header for libavutil XTEA algorithm
30
+ * @defgroup lavu_xtea XTEA
31
+ * @ingroup lavu_crypto
32
+ * @{
33
+ */
34
+
35
+ typedef struct AVXTEA {
36
+ uint32_t key[16];
37
+ } AVXTEA;
38
+
39
+ /**
40
+ * Allocate an AVXTEA context.
41
+ */
42
+ AVXTEA *av_xtea_alloc(void);
43
+
44
+ /**
45
+ * Initialize an AVXTEA context.
46
+ *
47
+ * @param ctx an AVXTEA context
48
+ * @param key a key of 16 bytes used for encryption/decryption,
49
+ * interpreted as big endian 32 bit numbers
50
+ */
51
+ void av_xtea_init(struct AVXTEA *ctx, const uint8_t key[16]);
52
+
53
+ /**
54
+ * Initialize an AVXTEA context.
55
+ *
56
+ * @param ctx an AVXTEA context
57
+ * @param key a key of 16 bytes used for encryption/decryption,
58
+ * interpreted as little endian 32 bit numbers
59
+ */
60
+ void av_xtea_le_init(struct AVXTEA *ctx, const uint8_t key[16]);
61
+
62
+ /**
63
+ * Encrypt or decrypt a buffer using a previously initialized context,
64
+ * in big endian format.
65
+ *
66
+ * @param ctx an AVXTEA context
67
+ * @param dst destination array, can be equal to src
68
+ * @param src source array, can be equal to dst
69
+ * @param count number of 8 byte blocks
70
+ * @param iv initialization vector for CBC mode, if NULL then ECB will be used
71
+ * @param decrypt 0 for encryption, 1 for decryption
72
+ */
73
+ void av_xtea_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src,
74
+ int count, uint8_t *iv, int decrypt);
75
+
76
+ /**
77
+ * Encrypt or decrypt a buffer using a previously initialized context,
78
+ * in little endian format.
79
+ *
80
+ * @param ctx an AVXTEA context
81
+ * @param dst destination array, can be equal to src
82
+ * @param src source array, can be equal to dst
83
+ * @param count number of 8 byte blocks
84
+ * @param iv initialization vector for CBC mode, if NULL then ECB will be used
85
+ * @param decrypt 0 for encryption, 1 for decryption
86
+ */
87
+ void av_xtea_le_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src,
88
+ int count, uint8_t *iv, int decrypt);
89
+
90
+ /**
91
+ * @}
92
+ */
93
+
94
+ #endif /* AVUTIL_XTEA_H */