gravix-rtc-react-native 0.0.0-stage → 0.2.0

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 (378) hide show
  1. package/CHANGELOG.md +134 -0
  2. package/LICENSE +20 -0
  3. package/LICENSES/Apache-2.0.txt +175 -0
  4. package/NOTICE +68 -0
  5. package/README.md +313 -2
  6. package/android/build.gradle +137 -0
  7. package/android/consumer-rules.pro +29 -0
  8. package/android/src/main/AndroidManifest.xml +9 -0
  9. package/android/src/main/cpp/CMakeLists.txt +48 -0
  10. package/android/src/main/cpp/gx_dfn_engine.c +332 -0
  11. package/android/src/main/cpp/gx_fx_jni.cpp +34 -0
  12. package/android/src/main/cpp/gx_ns_jni.c +162 -0
  13. package/android/src/main/cpp/third_party/onnxruntime/LICENSE +21 -0
  14. package/android/src/main/cpp/third_party/onnxruntime/include/onnxruntime_c_api.h +9227 -0
  15. package/android/src/main/cpp/third_party/onnxruntime/include/onnxruntime_ep_c_api.h +3315 -0
  16. package/android/src/main/cpp/third_party/onnxruntime/include/onnxruntime_error_code.h +98 -0
  17. package/android/src/main/java/com/gravitycompile/gravixrtc/GravixAudioHooks.kt +144 -0
  18. package/android/src/main/java/com/gravitycompile/gravixrtc/GravixAudioModule.kt +105 -0
  19. package/android/src/main/java/com/gravitycompile/gravixrtc/GravixNativeAudio.kt +310 -0
  20. package/android/src/main/java/com/gravitycompile/gravixrtc/GravixRtc.kt +134 -0
  21. package/android/src/main/java/com/gravitycompile/gravixrtc/GravixRtcModule.kt +176 -0
  22. package/android/src/main/java/com/gravitycompile/gravixrtc/GravixRtcPackage.kt +39 -0
  23. package/android/src/main/java/com/gravitycompile/gravixrtc/audio/AudioDeviceKind.java +44 -0
  24. package/android/src/main/java/com/gravitycompile/gravixrtc/audio/AudioManagerUtils.kt +120 -0
  25. package/android/src/main/java/com/gravitycompile/gravixrtc/audio/AudioSwitchManager.java +270 -0
  26. package/android/src/main/java/com/gravitycompile/gravixrtc/audio/AudioType.kt +50 -0
  27. package/android/src/main/java/com/gravitycompile/gravixrtc/music/MusicCaptureRouter.kt +375 -0
  28. package/android/src/main/java/com/gravitycompile/gravixrtc/music/MusicDecoder.kt +339 -0
  29. package/android/src/main/java/com/gravitycompile/gravixrtc/music/MusicInterruptionWatcher.kt +82 -0
  30. package/android/src/main/java/com/gravitycompile/gravixrtc/music/MusicMicRelease.kt +117 -0
  31. package/android/src/main/java/com/gravitycompile/gravixrtc/music/MusicMixKernel.kt +191 -0
  32. package/android/src/main/java/com/gravitycompile/gravixrtc/music/MusicMixerEngine.kt +617 -0
  33. package/android/src/main/java/com/gravitycompile/gravixrtc/processing/AudioRoutePolicy.kt +137 -0
  34. package/android/src/main/java/com/gravitycompile/gravixrtc/processing/GravixCaptureProcessing.kt +67 -0
  35. package/android/src/main/java/com/gravitycompile/gravixrtc/processing/GxCaptureDump.kt +143 -0
  36. package/android/src/main/java/com/gravitycompile/gravixrtc/processing/GxCaptureSwitcher.kt +196 -0
  37. package/android/src/main/java/com/gravitycompile/gravixrtc/processing/GxNoiseProcessor.kt +795 -0
  38. package/android/src/main/java/com/gravitycompile/gravixrtc/processing/GxNsLogic.kt +180 -0
  39. package/android/src/main/java/com/gravitycompile/gravixrtc/processing/GxNsNative.kt +83 -0
  40. package/android/src/main/java/com/gravitycompile/gravixrtc/processing/GxNsStudio.kt +372 -0
  41. package/android/src/main/java/com/gravitycompile/gravixrtc/processing/GxRecordStartGuard.kt +76 -0
  42. package/android/src/main/java/com/gravitycompile/gravixrtc/processing/GxRecorderSeam.kt +434 -0
  43. package/android/src/main/java/com/gravitycompile/gravixrtc/processing/GxSingerSource.kt +37 -0
  44. package/android/src/main/java/com/gravitycompile/gravixrtc/processing/GxVoiceFx.kt +160 -0
  45. package/android/src/main/java/com/gravitycompile/gravixrtc/processing/OtherAppAudioPolicy.kt +143 -0
  46. package/android/src/main/java/org/webrtc/audio/WebRtcAudioTrackHelper.kt +43 -0
  47. package/docs/ANDROID_NATIVE_HOOKS.md +102 -0
  48. package/docs/FEATURE_MATRIX.md +192 -0
  49. package/docs/IOS_NATIVE_HOOKS.md +190 -0
  50. package/gravix-rtc-react-native.podspec +49 -0
  51. package/ios/GravixRtc.h +7 -0
  52. package/ios/GravixRtc.mm +273 -0
  53. package/ios/GravixRtcSetup.h +29 -0
  54. package/ios/GravixRtcSetup.m +52 -0
  55. package/ios/audio/GravixRtcIosAudio.m +157 -0
  56. package/ios/audio/GxAudioDevice.h +62 -0
  57. package/ios/audio/GxAudioDevice.m +857 -0
  58. package/ios/audio/GxAudioSetup.h +34 -0
  59. package/ios/audio/GxAudioSetup.m +70 -0
  60. package/ios/audio/GxCompat.swift +53 -0
  61. package/ios/audio/GxIosAudio.swift +99 -0
  62. package/ios/audio/GxMusicController.swift +150 -0
  63. package/ios/audio/GxMusicPost.swift +362 -0
  64. package/ios/audio/GxNoiseProcessor.swift +718 -0
  65. package/ios/audio/GxNsDfn3CoreML.swift +195 -0
  66. package/ios/audio/GxNsStudioEngine.swift +237 -0
  67. package/ios/audio/GxNsStudioPack.swift +212 -0
  68. package/ios/audio/GxVoiceFx.swift +161 -0
  69. package/ios/audio/gx_adm_state.h +153 -0
  70. package/ios/gxcore/apple/gx_music_post.c +312 -0
  71. package/ios/gxcore/apple/gx_pcm.c +30 -0
  72. package/ios/gxcore/apple/gxns_build.h +19 -0
  73. package/ios/gxcore/apple/gxns_ios.c +17 -0
  74. package/ios/gxcore/apple/include/gx_fx.h +3 -0
  75. package/ios/gxcore/apple/include/gx_music_post.h +88 -0
  76. package/ios/gxcore/apple/include/gx_ns.h +3 -0
  77. package/ios/gxcore/apple/include/gx_pcm.h +33 -0
  78. package/ios/gxcore/apple/include/gxns_ios.h +18 -0
  79. package/ios/gxcore/apple/include/module.modulemap +10 -0
  80. package/ios/gxcore/apple/shim/rnnoise.h +2 -0
  81. package/ios/gxcore/apple/shim/speex_resampler.h +2 -0
  82. package/ios/gxcore/apple/units/gx_fx_forward.cpp +3 -0
  83. package/ios/gxcore/apple/units/gx_ns.c +7 -0
  84. package/ios/gxcore/apple/units/gx_ns_timer.c +7 -0
  85. package/ios/gxcore/apple/units/rnnoise_celt_lpc.c +7 -0
  86. package/ios/gxcore/apple/units/rnnoise_denoise.c +7 -0
  87. package/ios/gxcore/apple/units/rnnoise_kiss_fft.c +7 -0
  88. package/ios/gxcore/apple/units/rnnoise_pitch.c +7 -0
  89. package/ios/gxcore/apple/units/rnnoise_rnn.c +7 -0
  90. package/ios/gxcore/apple/units/rnnoise_rnn_data.c +7 -0
  91. package/ios/gxcore/apple/units/speexdsp_resample.c +7 -0
  92. package/ios/resources/ns/DFN3-NOTICE.txt +10 -0
  93. package/ios/resources/ns/DeepFilterNet-LICENSE-APACHE +201 -0
  94. package/ios/resources/ns/DeepFilterNet-LICENSE-MIT +19 -0
  95. package/ios/resources/ns/gxns_dfn3.mlmodelc/analytics/coremldata.bin +0 -0
  96. package/ios/resources/ns/gxns_dfn3.mlmodelc/coremldata.bin +0 -0
  97. package/ios/resources/ns/gxns_dfn3.mlmodelc/metadata.json +338 -0
  98. package/ios/resources/ns/gxns_dfn3.mlmodelc/model.mil +927 -0
  99. package/ios/resources/ns/gxns_dfn3.mlmodelc/weights/weight.bin +0 -0
  100. package/lib/module/android/bindings.js +49 -0
  101. package/lib/module/android/bindings.js.map +1 -0
  102. package/lib/module/android/index.js +13 -0
  103. package/lib/module/android/index.js.map +1 -0
  104. package/lib/module/android/micMute.js +341 -0
  105. package/lib/module/android/micMute.js.map +1 -0
  106. package/lib/module/android/nativeAudio.js +47 -0
  107. package/lib/module/android/nativeAudio.js.map +1 -0
  108. package/lib/module/android/noiseSuppression.js +170 -0
  109. package/lib/module/android/noiseSuppression.js.map +1 -0
  110. package/lib/module/android/roomMusic.js +142 -0
  111. package/lib/module/android/roomMusic.js.map +1 -0
  112. package/lib/module/android/singerMode.js +31 -0
  113. package/lib/module/android/singerMode.js.map +1 -0
  114. package/lib/module/android/voiceEffects.js +65 -0
  115. package/lib/module/android/voiceEffects.js.map +1 -0
  116. package/lib/module/audio/AudioManager.js +79 -0
  117. package/lib/module/audio/AudioManager.js.map +1 -0
  118. package/lib/module/audio/AudioSession.js +90 -0
  119. package/lib/module/audio/AudioSession.js.map +1 -0
  120. package/lib/module/audio/remoteVolume.js +54 -0
  121. package/lib/module/audio/remoteVolume.js.map +1 -0
  122. package/lib/module/components/VideoView.js +109 -0
  123. package/lib/module/components/VideoView.js.map +1 -0
  124. package/lib/module/features/audioScenario.js +53 -0
  125. package/lib/module/features/audioScenario.js.map +1 -0
  126. package/lib/module/features/beauty.js +828 -0
  127. package/lib/module/features/beauty.js.map +1 -0
  128. package/lib/module/features/micRelease.js +89 -0
  129. package/lib/module/features/micRelease.js.map +1 -0
  130. package/lib/module/features/noiseSuppression.js +213 -0
  131. package/lib/module/features/noiseSuppression.js.map +1 -0
  132. package/lib/module/features/roomMusic.js +90 -0
  133. package/lib/module/features/roomMusic.js.map +1 -0
  134. package/lib/module/features/roomMusicAndroid.js +294 -0
  135. package/lib/module/features/roomMusicAndroid.js.map +1 -0
  136. package/lib/module/features/roomMusicIos.js +250 -0
  137. package/lib/module/features/roomMusicIos.js.map +1 -0
  138. package/lib/module/features/roomMusicTypes.js +53 -0
  139. package/lib/module/features/roomMusicTypes.js.map +1 -0
  140. package/lib/module/features/screenShare.js +22 -0
  141. package/lib/module/features/screenShare.js.map +1 -0
  142. package/lib/module/features/singerMode.js +73 -0
  143. package/lib/module/features/singerMode.js.map +1 -0
  144. package/lib/module/features/voiceEffects.js +148 -0
  145. package/lib/module/features/voiceEffects.js.map +1 -0
  146. package/lib/module/hooks/context.js +34 -0
  147. package/lib/module/hooks/context.js.map +1 -0
  148. package/lib/module/hooks/hooks.js +145 -0
  149. package/lib/module/hooks/hooks.js.map +1 -0
  150. package/lib/module/hooks/types.js +4 -0
  151. package/lib/module/hooks/types.js.map +1 -0
  152. package/lib/module/hooks/useRoomEvents.js +30 -0
  153. package/lib/module/hooks/useRoomEvents.js.map +1 -0
  154. package/lib/module/index.js +43 -0
  155. package/lib/module/index.js.map +1 -0
  156. package/lib/module/ios/autoAttach.js +14 -0
  157. package/lib/module/ios/autoAttach.js.map +1 -0
  158. package/lib/module/ios/iosAudio.js +149 -0
  159. package/lib/module/ios/iosAudio.js.map +1 -0
  160. package/lib/module/join/appStateLifecycle.js +54 -0
  161. package/lib/module/join/appStateLifecycle.js.map +1 -0
  162. package/lib/module/micPolicy.js +249 -0
  163. package/lib/module/micPolicy.js.map +1 -0
  164. package/lib/module/native/NativeGravixAudio.js +18 -0
  165. package/lib/module/native/NativeGravixAudio.js.map +1 -0
  166. package/lib/module/native/NativeGravixRtc.js +13 -0
  167. package/lib/module/native/NativeGravixRtc.js.map +1 -0
  168. package/lib/module/native/module.js +23 -0
  169. package/lib/module/native/module.js.map +1 -0
  170. package/lib/module/package.json +1 -0
  171. package/lib/module/polyfills/DOMException.js +22 -0
  172. package/lib/module/polyfills/DOMException.js.map +1 -0
  173. package/lib/module/polyfills/early.js +18 -0
  174. package/lib/module/polyfills/early.js.map +1 -0
  175. package/lib/module/polyfills/event.js +71 -0
  176. package/lib/module/polyfills/event.js.map +1 -0
  177. package/lib/module/polyfills/sha256.js +92 -0
  178. package/lib/module/polyfills/sha256.js.map +1 -0
  179. package/lib/module/polyfills/subtleHmac.js +91 -0
  180. package/lib/module/polyfills/subtleHmac.js.map +1 -0
  181. package/lib/module/polyfills/textCoding.js +164 -0
  182. package/lib/module/polyfills/textCoding.js.map +1 -0
  183. package/lib/module/registerGlobals.js +135 -0
  184. package/lib/module/registerGlobals.js.map +1 -0
  185. package/lib/module/unsupported.js +90 -0
  186. package/lib/module/unsupported.js.map +1 -0
  187. package/lib/module/version.js +7 -0
  188. package/lib/module/version.js.map +1 -0
  189. package/lib/typescript/package.json +1 -0
  190. package/lib/typescript/src/android/bindings.d.ts +14 -0
  191. package/lib/typescript/src/android/bindings.d.ts.map +1 -0
  192. package/lib/typescript/src/android/index.d.ts +9 -0
  193. package/lib/typescript/src/android/index.d.ts.map +1 -0
  194. package/lib/typescript/src/android/micMute.d.ts +124 -0
  195. package/lib/typescript/src/android/micMute.d.ts.map +1 -0
  196. package/lib/typescript/src/android/nativeAudio.d.ts +40 -0
  197. package/lib/typescript/src/android/nativeAudio.d.ts.map +1 -0
  198. package/lib/typescript/src/android/noiseSuppression.d.ts +48 -0
  199. package/lib/typescript/src/android/noiseSuppression.d.ts.map +1 -0
  200. package/lib/typescript/src/android/roomMusic.d.ts +80 -0
  201. package/lib/typescript/src/android/roomMusic.d.ts.map +1 -0
  202. package/lib/typescript/src/android/singerMode.d.ts +27 -0
  203. package/lib/typescript/src/android/singerMode.d.ts.map +1 -0
  204. package/lib/typescript/src/android/voiceEffects.d.ts +30 -0
  205. package/lib/typescript/src/android/voiceEffects.d.ts.map +1 -0
  206. package/lib/typescript/src/audio/AudioManager.d.ts +32 -0
  207. package/lib/typescript/src/audio/AudioManager.d.ts.map +1 -0
  208. package/lib/typescript/src/audio/AudioSession.d.ts +70 -0
  209. package/lib/typescript/src/audio/AudioSession.d.ts.map +1 -0
  210. package/lib/typescript/src/audio/remoteVolume.d.ts +8 -0
  211. package/lib/typescript/src/audio/remoteVolume.d.ts.map +1 -0
  212. package/lib/typescript/src/components/VideoView.d.ts +44 -0
  213. package/lib/typescript/src/components/VideoView.d.ts.map +1 -0
  214. package/lib/typescript/src/features/audioScenario.d.ts +24 -0
  215. package/lib/typescript/src/features/audioScenario.d.ts.map +1 -0
  216. package/lib/typescript/src/features/beauty.d.ts +377 -0
  217. package/lib/typescript/src/features/beauty.d.ts.map +1 -0
  218. package/lib/typescript/src/features/micRelease.d.ts +28 -0
  219. package/lib/typescript/src/features/micRelease.d.ts.map +1 -0
  220. package/lib/typescript/src/features/noiseSuppression.d.ts +64 -0
  221. package/lib/typescript/src/features/noiseSuppression.d.ts.map +1 -0
  222. package/lib/typescript/src/features/roomMusic.d.ts +41 -0
  223. package/lib/typescript/src/features/roomMusic.d.ts.map +1 -0
  224. package/lib/typescript/src/features/roomMusicAndroid.d.ts +60 -0
  225. package/lib/typescript/src/features/roomMusicAndroid.d.ts.map +1 -0
  226. package/lib/typescript/src/features/roomMusicIos.d.ts +56 -0
  227. package/lib/typescript/src/features/roomMusicIos.d.ts.map +1 -0
  228. package/lib/typescript/src/features/roomMusicTypes.d.ts +76 -0
  229. package/lib/typescript/src/features/roomMusicTypes.d.ts.map +1 -0
  230. package/lib/typescript/src/features/screenShare.d.ts +12 -0
  231. package/lib/typescript/src/features/screenShare.d.ts.map +1 -0
  232. package/lib/typescript/src/features/singerMode.d.ts +20 -0
  233. package/lib/typescript/src/features/singerMode.d.ts.map +1 -0
  234. package/lib/typescript/src/features/voiceEffects.d.ts +46 -0
  235. package/lib/typescript/src/features/voiceEffects.d.ts.map +1 -0
  236. package/lib/typescript/src/hooks/context.d.ts +12 -0
  237. package/lib/typescript/src/hooks/context.d.ts.map +1 -0
  238. package/lib/typescript/src/hooks/hooks.d.ts +54 -0
  239. package/lib/typescript/src/hooks/hooks.d.ts.map +1 -0
  240. package/lib/typescript/src/hooks/types.d.ts +8 -0
  241. package/lib/typescript/src/hooks/types.d.ts.map +1 -0
  242. package/lib/typescript/src/hooks/useRoomEvents.d.ts +13 -0
  243. package/lib/typescript/src/hooks/useRoomEvents.d.ts.map +1 -0
  244. package/lib/typescript/src/index.d.ts +37 -0
  245. package/lib/typescript/src/index.d.ts.map +1 -0
  246. package/lib/typescript/src/ios/autoAttach.d.ts +2 -0
  247. package/lib/typescript/src/ios/autoAttach.d.ts.map +1 -0
  248. package/lib/typescript/src/ios/iosAudio.d.ts +96 -0
  249. package/lib/typescript/src/ios/iosAudio.d.ts.map +1 -0
  250. package/lib/typescript/src/join/appStateLifecycle.d.ts +14 -0
  251. package/lib/typescript/src/join/appStateLifecycle.d.ts.map +1 -0
  252. package/lib/typescript/src/micPolicy.d.ts +104 -0
  253. package/lib/typescript/src/micPolicy.d.ts.map +1 -0
  254. package/lib/typescript/src/native/NativeGravixAudio.d.ts +21 -0
  255. package/lib/typescript/src/native/NativeGravixAudio.d.ts.map +1 -0
  256. package/lib/typescript/src/native/NativeGravixRtc.d.ts +31 -0
  257. package/lib/typescript/src/native/NativeGravixRtc.d.ts.map +1 -0
  258. package/lib/typescript/src/native/module.d.ts +7 -0
  259. package/lib/typescript/src/native/module.d.ts.map +1 -0
  260. package/lib/typescript/src/polyfills/DOMException.d.ts +3 -0
  261. package/lib/typescript/src/polyfills/DOMException.d.ts.map +1 -0
  262. package/lib/typescript/src/polyfills/early.d.ts +2 -0
  263. package/lib/typescript/src/polyfills/early.d.ts.map +1 -0
  264. package/lib/typescript/src/polyfills/event.d.ts +2 -0
  265. package/lib/typescript/src/polyfills/event.d.ts.map +1 -0
  266. package/lib/typescript/src/polyfills/sha256.d.ts +3 -0
  267. package/lib/typescript/src/polyfills/sha256.d.ts.map +1 -0
  268. package/lib/typescript/src/polyfills/subtleHmac.d.ts +37 -0
  269. package/lib/typescript/src/polyfills/subtleHmac.d.ts.map +1 -0
  270. package/lib/typescript/src/polyfills/textCoding.d.ts +36 -0
  271. package/lib/typescript/src/polyfills/textCoding.d.ts.map +1 -0
  272. package/lib/typescript/src/registerGlobals.d.ts +42 -0
  273. package/lib/typescript/src/registerGlobals.d.ts.map +1 -0
  274. package/lib/typescript/src/unsupported.d.ts +42 -0
  275. package/lib/typescript/src/unsupported.d.ts.map +1 -0
  276. package/lib/typescript/src/version.d.ts +3 -0
  277. package/lib/typescript/src/version.d.ts.map +1 -0
  278. package/metro/index.js +39 -0
  279. package/metro/noise-stub.js +10 -0
  280. package/native/gxfx/include/gx_fx.h +82 -0
  281. package/native/gxfx/src/gx_fx.cpp +527 -0
  282. package/native/gxfx/third_party/README.md +4 -0
  283. package/native/gxfx/third_party/signalsmith-linear/LICENSE.txt +21 -0
  284. package/native/gxfx/third_party/signalsmith-linear/approx.h +191 -0
  285. package/native/gxfx/third_party/signalsmith-linear/fft.h +1386 -0
  286. package/native/gxfx/third_party/signalsmith-linear/linear.h +1129 -0
  287. package/native/gxfx/third_party/signalsmith-linear/platform/approx-cmsisdsp.h +40 -0
  288. package/native/gxfx/third_party/signalsmith-linear/platform/basic-fill-warnings.h +61 -0
  289. package/native/gxfx/third_party/signalsmith-linear/platform/fft-accelerate.h +340 -0
  290. package/native/gxfx/third_party/signalsmith-linear/platform/fft-cmsisdsp.h +307 -0
  291. package/native/gxfx/third_party/signalsmith-linear/platform/fft-ipp.h +532 -0
  292. package/native/gxfx/third_party/signalsmith-linear/platform/fft-linear.h +213 -0
  293. package/native/gxfx/third_party/signalsmith-linear/platform/fft-pffft-double.h +221 -0
  294. package/native/gxfx/third_party/signalsmith-linear/platform/fft-pffft.h +221 -0
  295. package/native/gxfx/third_party/signalsmith-linear/platform/linear-accelerate.h +593 -0
  296. package/native/gxfx/third_party/signalsmith-linear/platform/linear-cmsisdsp.h +713 -0
  297. package/native/gxfx/third_party/signalsmith-linear/platform/linear-xsimd-dispatch.cpp +6 -0
  298. package/native/gxfx/third_party/signalsmith-linear/platform/linear-xsimd.h +818 -0
  299. package/native/gxfx/third_party/signalsmith-linear/stft.h +700 -0
  300. package/native/gxfx/third_party/signalsmith-stretch-LICENSE.txt +21 -0
  301. package/native/gxfx/third_party/signalsmith-stretch.h +1060 -0
  302. package/native/gxns/CMakeLists.txt +67 -0
  303. package/native/gxns/include/gx_ns.h +285 -0
  304. package/native/gxns/src/gx_ns.c +1518 -0
  305. package/native/gxns/src/gx_ns_timer.c +84 -0
  306. package/native/gxns/src/gx_ns_timer.h +29 -0
  307. package/native/gxns/third_party/VENDOR.md +43 -0
  308. package/native/gxns/third_party/rnnoise/AUTHORS +1 -0
  309. package/native/gxns/third_party/rnnoise/COPYING +31 -0
  310. package/native/gxns/third_party/rnnoise/include/rnnoise.h +117 -0
  311. package/native/gxns/third_party/rnnoise/src/_kiss_fft_guts.h +182 -0
  312. package/native/gxns/third_party/rnnoise/src/arch.h +261 -0
  313. package/native/gxns/third_party/rnnoise/src/celt_lpc.c +172 -0
  314. package/native/gxns/third_party/rnnoise/src/celt_lpc.h +45 -0
  315. package/native/gxns/third_party/rnnoise/src/common.h +48 -0
  316. package/native/gxns/third_party/rnnoise/src/denoise.c +664 -0
  317. package/native/gxns/third_party/rnnoise/src/kiss_fft.c +601 -0
  318. package/native/gxns/third_party/rnnoise/src/kiss_fft.h +203 -0
  319. package/native/gxns/third_party/rnnoise/src/opus_types.h +159 -0
  320. package/native/gxns/third_party/rnnoise/src/pitch.c +523 -0
  321. package/native/gxns/third_party/rnnoise/src/pitch.h +149 -0
  322. package/native/gxns/third_party/rnnoise/src/rnn.c +178 -0
  323. package/native/gxns/third_party/rnnoise/src/rnn.h +65 -0
  324. package/native/gxns/third_party/rnnoise/src/rnn_data.c +11051 -0
  325. package/native/gxns/third_party/rnnoise/src/rnn_data.h +34 -0
  326. package/native/gxns/third_party/rnnoise/src/tansig_table.h +45 -0
  327. package/native/gxns/third_party/speexdsp/AUTHORS +18 -0
  328. package/native/gxns/third_party/speexdsp/COPYING +35 -0
  329. package/native/gxns/third_party/speexdsp/arch.h +232 -0
  330. package/native/gxns/third_party/speexdsp/resample.c +1239 -0
  331. package/native/gxns/third_party/speexdsp/resample_neon.h +339 -0
  332. package/native/gxns/third_party/speexdsp/resample_sse.h +128 -0
  333. package/native/gxns/third_party/speexdsp/speex_resampler.h +343 -0
  334. package/package.json +186 -4
  335. package/src/android/bindings.ts +61 -0
  336. package/src/android/index.ts +10 -0
  337. package/src/android/micMute.ts +422 -0
  338. package/src/android/nativeAudio.ts +94 -0
  339. package/src/android/noiseSuppression.ts +209 -0
  340. package/src/android/roomMusic.ts +193 -0
  341. package/src/android/singerMode.ts +53 -0
  342. package/src/android/voiceEffects.ts +126 -0
  343. package/src/audio/AudioManager.ts +111 -0
  344. package/src/audio/AudioSession.ts +190 -0
  345. package/src/audio/remoteVolume.ts +58 -0
  346. package/src/components/VideoView.tsx +152 -0
  347. package/src/features/audioScenario.ts +58 -0
  348. package/src/features/beauty.ts +1057 -0
  349. package/src/features/micRelease.ts +108 -0
  350. package/src/features/noiseSuppression.ts +251 -0
  351. package/src/features/roomMusic.ts +106 -0
  352. package/src/features/roomMusicAndroid.ts +310 -0
  353. package/src/features/roomMusicIos.ts +300 -0
  354. package/src/features/roomMusicTypes.ts +97 -0
  355. package/src/features/screenShare.ts +19 -0
  356. package/src/features/singerMode.ts +70 -0
  357. package/src/features/voiceEffects.ts +245 -0
  358. package/src/hooks/context.tsx +38 -0
  359. package/src/hooks/hooks.ts +247 -0
  360. package/src/hooks/types.ts +10 -0
  361. package/src/hooks/useRoomEvents.ts +35 -0
  362. package/src/index.tsx +134 -0
  363. package/src/ios/autoAttach.ts +11 -0
  364. package/src/ios/iosAudio.ts +202 -0
  365. package/src/join/appStateLifecycle.ts +55 -0
  366. package/src/micPolicy.ts +312 -0
  367. package/src/native/NativeGravixAudio.ts +30 -0
  368. package/src/native/NativeGravixRtc.ts +38 -0
  369. package/src/native/module.ts +22 -0
  370. package/src/polyfills/DOMException.ts +20 -0
  371. package/src/polyfills/early.ts +16 -0
  372. package/src/polyfills/event.ts +88 -0
  373. package/src/polyfills/sha256.ts +112 -0
  374. package/src/polyfills/subtleHmac.ts +124 -0
  375. package/src/polyfills/textCoding.ts +197 -0
  376. package/src/registerGlobals.ts +201 -0
  377. package/src/unsupported.ts +139 -0
  378. package/src/version.ts +4 -0
@@ -0,0 +1,84 @@
1
+ /* Copyright (c) 2024-2026 Gravity Compile. MIT License; see LICENSE. */
2
+ #include "gx_ns_timer.h"
3
+
4
+ #include <time.h>
5
+
6
+ #if defined(__EMSCRIPTEN__)
7
+ #include <emscripten.h>
8
+ #elif defined(__APPLE__)
9
+ #include <mach/mach_time.h>
10
+ #endif
11
+
12
+ static int bucket_of(uint32_t us) {
13
+ if (us < 1000) return (int)us;
14
+ if (us < 10000) return 1000 + (int)((us - 1000) / 10);
15
+ if (us < 100000) return 1900 + (int)((us - 10000) / 100);
16
+ return GX_TIMER_BUCKETS - 1;
17
+ }
18
+
19
+ static uint32_t upper_edge(int b) {
20
+ if (b < 1000) return (uint32_t)b;
21
+ if (b < 1900) return 1000u + (uint32_t)(b - 1000) * 10u + 9u;
22
+ if (b < 2800) return 10000u + (uint32_t)(b - 1900) * 100u + 99u;
23
+ return 100000u;
24
+ }
25
+
26
+ void gx_timer_clear(gx_timer *t) {
27
+ int i;
28
+ for (i = 0; i < GX_TIMER_BUCKETS; i++) atomic_store_explicit(&t->hist[i], 0, memory_order_relaxed);
29
+ atomic_store_explicit(&t->count, 0, memory_order_relaxed);
30
+ atomic_store_explicit(&t->max_us, 0, memory_order_relaxed);
31
+ atomic_store_explicit(&t->over, 0, memory_order_relaxed);
32
+ atomic_store_explicit(&t->consecutive, 0, memory_order_relaxed);
33
+ }
34
+
35
+ void gx_timer_init(gx_timer *t, uint32_t budget_us) {
36
+ t->budget_us = budget_us;
37
+ gx_timer_clear(t);
38
+ }
39
+
40
+ void gx_timer_add(gx_timer *t, uint32_t us) {
41
+ int b = bucket_of(us);
42
+ atomic_fetch_add_explicit(&t->hist[b], 1, memory_order_relaxed);
43
+ atomic_fetch_add_explicit(&t->count, 1, memory_order_relaxed);
44
+ if (us > atomic_load_explicit(&t->max_us, memory_order_relaxed))
45
+ atomic_store_explicit(&t->max_us, us, memory_order_relaxed);
46
+ if (us > t->budget_us) {
47
+ atomic_fetch_add_explicit(&t->over, 1, memory_order_relaxed);
48
+ atomic_fetch_add_explicit(&t->consecutive, 1, memory_order_relaxed);
49
+ } else {
50
+ atomic_store_explicit(&t->consecutive, 0, memory_order_relaxed);
51
+ }
52
+ }
53
+
54
+ uint32_t gx_timer_percentile(gx_timer *t, double p) {
55
+ uint32_t total = 0, acc = 0, need;
56
+ int i;
57
+ for (i = 0; i < GX_TIMER_BUCKETS; i++) total += atomic_load_explicit(&t->hist[i], memory_order_relaxed);
58
+ if (total == 0) return 0;
59
+ need = (uint32_t)(p * (double)total + 0.999999);
60
+ if (need < 1) need = 1;
61
+ if (need > total) need = total;
62
+ for (i = 0; i < GX_TIMER_BUCKETS; i++) {
63
+ acc += atomic_load_explicit(&t->hist[i], memory_order_relaxed);
64
+ if (acc >= need) {
65
+ uint32_t e = upper_edge(i), m = atomic_load_explicit(&t->max_us, memory_order_relaxed);
66
+ return e < m ? e : m;
67
+ }
68
+ }
69
+ return atomic_load_explicit(&t->max_us, memory_order_relaxed);
70
+ }
71
+
72
+ uint64_t gx_timer_now_ns(void) {
73
+ #if defined(__EMSCRIPTEN__)
74
+ return (uint64_t)(emscripten_get_now() * 1e6);
75
+ #elif defined(__APPLE__)
76
+ static mach_timebase_info_data_t tb; /* filled on first use (gx_ns_create calls this) */
77
+ if (tb.denom == 0) mach_timebase_info(&tb);
78
+ return mach_absolute_time() * tb.numer / tb.denom;
79
+ #else
80
+ struct timespec ts;
81
+ clock_gettime(CLOCK_MONOTONIC, &ts);
82
+ return (uint64_t)ts.tv_sec * 1000000000ull + (uint64_t)ts.tv_nsec;
83
+ #endif
84
+ }
@@ -0,0 +1,29 @@
1
+ /* Copyright (c) 2024-2026 Gravity Compile. MIT License; see LICENSE. */
2
+ /* Frame-time histogram (internal). Lock-free: one writer (audio thread),
3
+ * readers on any thread with relaxed atomics. Resolution: 1 us below 1 ms,
4
+ * 10 us below 10 ms, 100 us below 100 ms. */
5
+ #ifndef GX_NS_TIMER_H
6
+ #define GX_NS_TIMER_H
7
+
8
+ #include <stdatomic.h>
9
+ #include <stdint.h>
10
+
11
+ #define GX_TIMER_BUCKETS (1000 + 900 + 900 + 1)
12
+
13
+ typedef struct {
14
+ _Atomic uint32_t hist[GX_TIMER_BUCKETS];
15
+ _Atomic uint32_t count;
16
+ _Atomic uint32_t max_us;
17
+ _Atomic uint32_t over;
18
+ _Atomic uint32_t consecutive;
19
+ uint32_t budget_us;
20
+ } gx_timer;
21
+
22
+ void gx_timer_init(gx_timer *t, uint32_t budget_us);
23
+ void gx_timer_clear(gx_timer *t);
24
+ void gx_timer_add(gx_timer *t, uint32_t us);
25
+ /* p in (0, 1]; returns the upper edge of the bucket holding that percentile. */
26
+ uint32_t gx_timer_percentile(gx_timer *t, double p);
27
+ uint64_t gx_timer_now_ns(void);
28
+
29
+ #endif
@@ -0,0 +1,43 @@
1
+ # Vendored third-party C sources (gx_ns)
2
+
3
+ Both components are BSD-3-Clause. Their license texts are kept next to the
4
+ sources (`rnnoise/COPYING`, `speexdsp/COPYING`) and copied to the repo's
5
+ `LICENSES/` folder; see `NOTICE`.
6
+
7
+ ## rnnoise/ — RNNoise 0.1.1 (Xiph.Org / Jean-Marc Valin)
8
+ - Upstream: https://github.com/xiph/rnnoise
9
+ - Tag `v0.1.1`, commit `6cbfd53eb348a8d394e0757b4025c6ded34eb2b6` (2024-04-10).
10
+ - Files: `include/rnnoise.h`, the library sources from upstream `src/compile.sh`
11
+ (`denoise.c rnn.c rnn_data.c pitch.c kiss_fft.c celt_lpc.c`) and their headers,
12
+ `COPYING`, `AUTHORS`. Not vendored: training code, `rnn_reader.c`
13
+ (model-from-file; we only use the built-in model), autotools files.
14
+ - Weights: the built-in 0.1 model in `rnn_data.c`.
15
+ - Local patch (marked `GRAVIX PATCH`): `rnnoise_reset()` in `src/denoise.c` and
16
+ its declaration in `include/rnnoise.h` — clears the state in place without
17
+ allocating (upstream `rnnoise_init` callocs the GRU state).
18
+
19
+ ### Why 0.1.1 and not 0.2 (measured 2026-10-21, NDK r28 clang -O2, gc-sections, stripped .so)
20
+ | ABI | 0.1.1 | 0.2 |
21
+ |---|---|---|
22
+ | arm64-v8a | 124,496 B | does not build (`vec_neon.h` includes a missing `os_support.h`) |
23
+ | armeabi-v7a (NEON) | 109,240 B | same build error |
24
+ | x86_64 | 131,512 B | 1,468,336 B |
25
+ The 0.2 weight tables alone are ~1.4 MB (arch-independent), over the
26
+ <= 1 MB per-ABI budget before the resampler, gx_ns core and JNI glue are added.
27
+ Note: the 0.2 release tarball's `rnnoise_data.c` differs from the
28
+ `rnnoise_data-0b50c45.tar.gz` that `download_model.sh` fetches for tag v0.2.
29
+ Irrelevant for 0.1.1; recorded so nobody chases it again.
30
+
31
+ ## speexdsp/ — Speex resampler (Xiph.Org Foundation, Jean-Marc Valin)
32
+ - Upstream: https://github.com/xiph/speexdsp
33
+ - Tag `SpeexDSP-1.2.1`, commit `1b28a0f61bc31162979e1f26f3981fc3637095c8`.
34
+ - Files: `libspeexdsp/resample.c`, `resample_neon.h`, `resample_sse.h`,
35
+ `arch.h`, `include/speex/speex_resampler.h` (placed flat), `COPYING`, `AUTHORS`.
36
+ Unmodified.
37
+ - Build defines: `OUTSIDE_SPEEX FLOATING_POINT RANDOM_PREFIX=gx EXPORT=`
38
+ (+ `USE_NEON` on arm64 / `USE_SSE` on x86 when wanted).
39
+
40
+ ## Whole gx_ns library (RNNoise 0.1.1 + resampler + gx_ns core, no JNI), 2026-10-21
41
+ NDK r28 clang -O2 -std=gnu11, gc-sections, hidden visibility, stripped .so:
42
+ arm64-v8a (USE_NEON) 149,352 B; armeabi-v7a 129,204 B; x86_64 (USE_SSE) 158,480 B; x86 156,488 B.
43
+ The Android size gate (bundletool per ABI, with JNI glue) is still to be run by the integrator.
@@ -0,0 +1 @@
1
+ Jean-Marc Valin <jmvalin@jmvalin.ca>
@@ -0,0 +1,31 @@
1
+ Copyright (c) 2017, Mozilla
2
+ Copyright (c) 2007-2017, Jean-Marc Valin
3
+ Copyright (c) 2005-2017, Xiph.Org Foundation
4
+ Copyright (c) 2003-2004, Mark Borgerding
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions
8
+ are met:
9
+
10
+ - Redistributions of source code must retain the above copyright
11
+ notice, this list of conditions and the following disclaimer.
12
+
13
+ - Redistributions in binary form must reproduce the above copyright
14
+ notice, this list of conditions and the following disclaimer in the
15
+ documentation and/or other materials provided with the distribution.
16
+
17
+ - Neither the name of the Xiph.Org Foundation nor the names of its
18
+ contributors may be used to endorse or promote products derived from
19
+ this software without specific prior written permission.
20
+
21
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
25
+ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,117 @@
1
+ /* Copyright (c) 2018 Gregor Richards
2
+ * Copyright (c) 2017 Mozilla */
3
+ /*
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions
6
+ are met:
7
+
8
+ - Redistributions of source code must retain the above copyright
9
+ notice, this list of conditions and the following disclaimer.
10
+
11
+ - Redistributions in binary form must reproduce the above copyright
12
+ notice, this list of conditions and the following disclaimer in the
13
+ documentation and/or other materials provided with the distribution.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
19
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
+ */
27
+
28
+ #ifndef RNNOISE_H
29
+ #define RNNOISE_H 1
30
+
31
+ #include <stdio.h>
32
+
33
+ #ifdef __cplusplus
34
+ extern "C" {
35
+ #endif
36
+
37
+ #ifndef RNNOISE_EXPORT
38
+ # if defined(WIN32)
39
+ # if defined(RNNOISE_BUILD) && defined(DLL_EXPORT)
40
+ # define RNNOISE_EXPORT __declspec(dllexport)
41
+ # else
42
+ # define RNNOISE_EXPORT
43
+ # endif
44
+ # elif defined(__GNUC__) && defined(RNNOISE_BUILD)
45
+ # define RNNOISE_EXPORT __attribute__ ((visibility ("default")))
46
+ # else
47
+ # define RNNOISE_EXPORT
48
+ # endif
49
+ #endif
50
+
51
+ typedef struct DenoiseState DenoiseState;
52
+ typedef struct RNNModel RNNModel;
53
+
54
+ /**
55
+ * Return the size of DenoiseState
56
+ */
57
+ RNNOISE_EXPORT int rnnoise_get_size();
58
+
59
+ /**
60
+ * Return the number of samples processed by rnnoise_process_frame at a time
61
+ */
62
+ RNNOISE_EXPORT int rnnoise_get_frame_size();
63
+
64
+ /**
65
+ * Initializes a pre-allocated DenoiseState
66
+ *
67
+ * If model is NULL the default model is used.
68
+ *
69
+ * See: rnnoise_create() and rnnoise_model_from_file()
70
+ */
71
+ RNNOISE_EXPORT int rnnoise_init(DenoiseState *st, RNNModel *model);
72
+
73
+ /**
74
+ * Allocate and initialize a DenoiseState
75
+ *
76
+ * If model is NULL the default model is used.
77
+ *
78
+ * The returned pointer MUST be freed with rnnoise_destroy().
79
+ */
80
+ RNNOISE_EXPORT DenoiseState *rnnoise_create(RNNModel *model);
81
+
82
+ /**
83
+ * Free a DenoiseState produced by rnnoise_create.
84
+ *
85
+ * The optional custom model must be freed by rnnoise_model_free() after.
86
+ */
87
+ RNNOISE_EXPORT void rnnoise_destroy(DenoiseState *st);
88
+
89
+ /* GRAVIX PATCH (gx_ns): allocation-free reset, see src/denoise.c. */
90
+ RNNOISE_EXPORT void rnnoise_reset(DenoiseState *st);
91
+
92
+ /**
93
+ * Denoise a frame of samples
94
+ *
95
+ * in and out must be at least rnnoise_get_frame_size() large.
96
+ */
97
+ RNNOISE_EXPORT float rnnoise_process_frame(DenoiseState *st, float *out, const float *in);
98
+
99
+ /**
100
+ * Load a model from a file
101
+ *
102
+ * It must be deallocated with rnnoise_model_free()
103
+ */
104
+ RNNOISE_EXPORT RNNModel *rnnoise_model_from_file(FILE *f);
105
+
106
+ /**
107
+ * Free a custom model
108
+ *
109
+ * It must be called after all the DenoiseStates referring to it are freed.
110
+ */
111
+ RNNOISE_EXPORT void rnnoise_model_free(RNNModel *model);
112
+
113
+ #ifdef __cplusplus
114
+ }
115
+ #endif
116
+
117
+ #endif
@@ -0,0 +1,182 @@
1
+ /*Copyright (c) 2003-2004, Mark Borgerding
2
+
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ * Redistributions of source code must retain the above copyright notice,
9
+ this list of conditions and the following disclaimer.
10
+ * Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the
12
+ documentation and/or other materials provided with the distribution.
13
+
14
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
18
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24
+ POSSIBILITY OF SUCH DAMAGE.*/
25
+
26
+ #ifndef KISS_FFT_GUTS_H
27
+ #define KISS_FFT_GUTS_H
28
+
29
+ #define MIN(a,b) ((a)<(b) ? (a):(b))
30
+ #define MAX(a,b) ((a)>(b) ? (a):(b))
31
+
32
+ /* kiss_fft.h
33
+ defines kiss_fft_scalar as either short or a float type
34
+ and defines
35
+ typedef struct { kiss_fft_scalar r; kiss_fft_scalar i; }kiss_fft_cpx; */
36
+ #include "kiss_fft.h"
37
+
38
+ /*
39
+ Explanation of macros dealing with complex math:
40
+
41
+ C_MUL(m,a,b) : m = a*b
42
+ C_FIXDIV( c , div ) : if a fixed point impl., c /= div. noop otherwise
43
+ C_SUB( res, a,b) : res = a - b
44
+ C_SUBFROM( res , a) : res -= a
45
+ C_ADDTO( res , a) : res += a
46
+ * */
47
+ #ifdef FIXED_POINT
48
+ #include "arch.h"
49
+
50
+
51
+ #define SAMP_MAX 2147483647
52
+ #define TWID_MAX 32767
53
+ #define TRIG_UPSCALE 1
54
+
55
+ #define SAMP_MIN -SAMP_MAX
56
+
57
+
58
+ # define S_MUL(a,b) MULT16_32_Q15(b, a)
59
+
60
+ # define C_MUL(m,a,b) \
61
+ do{ (m).r = SUB32_ovflw(S_MUL((a).r,(b).r) , S_MUL((a).i,(b).i)); \
62
+ (m).i = ADD32_ovflw(S_MUL((a).r,(b).i) , S_MUL((a).i,(b).r)); }while(0)
63
+
64
+ # define C_MULC(m,a,b) \
65
+ do{ (m).r = ADD32_ovflw(S_MUL((a).r,(b).r) , S_MUL((a).i,(b).i)); \
66
+ (m).i = SUB32_ovflw(S_MUL((a).i,(b).r) , S_MUL((a).r,(b).i)); }while(0)
67
+
68
+ # define C_MULBYSCALAR( c, s ) \
69
+ do{ (c).r = S_MUL( (c).r , s ) ;\
70
+ (c).i = S_MUL( (c).i , s ) ; }while(0)
71
+
72
+ # define DIVSCALAR(x,k) \
73
+ (x) = S_MUL( x, (TWID_MAX-((k)>>1))/(k)+1 )
74
+
75
+ # define C_FIXDIV(c,div) \
76
+ do { DIVSCALAR( (c).r , div); \
77
+ DIVSCALAR( (c).i , div); }while (0)
78
+
79
+ #define C_ADD( res, a,b)\
80
+ do {(res).r=ADD32_ovflw((a).r,(b).r); (res).i=ADD32_ovflw((a).i,(b).i); \
81
+ }while(0)
82
+ #define C_SUB( res, a,b)\
83
+ do {(res).r=SUB32_ovflw((a).r,(b).r); (res).i=SUB32_ovflw((a).i,(b).i); \
84
+ }while(0)
85
+ #define C_ADDTO( res , a)\
86
+ do {(res).r = ADD32_ovflw((res).r, (a).r); (res).i = ADD32_ovflw((res).i,(a).i);\
87
+ }while(0)
88
+
89
+ #define C_SUBFROM( res , a)\
90
+ do {(res).r = ADD32_ovflw((res).r,(a).r); (res).i = SUB32_ovflw((res).i,(a).i); \
91
+ }while(0)
92
+
93
+ #if defined(OPUS_ARM_INLINE_ASM)
94
+ #include "arm/kiss_fft_armv4.h"
95
+ #endif
96
+
97
+ #if defined(OPUS_ARM_INLINE_EDSP)
98
+ #include "arm/kiss_fft_armv5e.h"
99
+ #endif
100
+ #if defined(MIPSr1_ASM)
101
+ #include "mips/kiss_fft_mipsr1.h"
102
+ #endif
103
+
104
+ #else /* not FIXED_POINT*/
105
+
106
+ # define S_MUL(a,b) ( (a)*(b) )
107
+ #define C_MUL(m,a,b) \
108
+ do{ (m).r = (a).r*(b).r - (a).i*(b).i;\
109
+ (m).i = (a).r*(b).i + (a).i*(b).r; }while(0)
110
+ #define C_MULC(m,a,b) \
111
+ do{ (m).r = (a).r*(b).r + (a).i*(b).i;\
112
+ (m).i = (a).i*(b).r - (a).r*(b).i; }while(0)
113
+
114
+ #define C_MUL4(m,a,b) C_MUL(m,a,b)
115
+
116
+ # define C_FIXDIV(c,div) /* NOOP */
117
+ # define C_MULBYSCALAR( c, s ) \
118
+ do{ (c).r *= (s);\
119
+ (c).i *= (s); }while(0)
120
+ #endif
121
+
122
+ #ifndef CHECK_OVERFLOW_OP
123
+ # define CHECK_OVERFLOW_OP(a,op,b) /* noop */
124
+ #endif
125
+
126
+ #ifndef C_ADD
127
+ #define C_ADD( res, a,b)\
128
+ do { \
129
+ CHECK_OVERFLOW_OP((a).r,+,(b).r)\
130
+ CHECK_OVERFLOW_OP((a).i,+,(b).i)\
131
+ (res).r=(a).r+(b).r; (res).i=(a).i+(b).i; \
132
+ }while(0)
133
+ #define C_SUB( res, a,b)\
134
+ do { \
135
+ CHECK_OVERFLOW_OP((a).r,-,(b).r)\
136
+ CHECK_OVERFLOW_OP((a).i,-,(b).i)\
137
+ (res).r=(a).r-(b).r; (res).i=(a).i-(b).i; \
138
+ }while(0)
139
+ #define C_ADDTO( res , a)\
140
+ do { \
141
+ CHECK_OVERFLOW_OP((res).r,+,(a).r)\
142
+ CHECK_OVERFLOW_OP((res).i,+,(a).i)\
143
+ (res).r += (a).r; (res).i += (a).i;\
144
+ }while(0)
145
+
146
+ #define C_SUBFROM( res , a)\
147
+ do {\
148
+ CHECK_OVERFLOW_OP((res).r,-,(a).r)\
149
+ CHECK_OVERFLOW_OP((res).i,-,(a).i)\
150
+ (res).r -= (a).r; (res).i -= (a).i; \
151
+ }while(0)
152
+ #endif /* C_ADD defined */
153
+
154
+ #ifdef FIXED_POINT
155
+ /*# define KISS_FFT_COS(phase) TRIG_UPSCALE*floor(MIN(32767,MAX(-32767,.5+32768 * cos (phase))))
156
+ # define KISS_FFT_SIN(phase) TRIG_UPSCALE*floor(MIN(32767,MAX(-32767,.5+32768 * sin (phase))))*/
157
+ # define KISS_FFT_COS(phase) floor(.5+TWID_MAX*cos (phase))
158
+ # define KISS_FFT_SIN(phase) floor(.5+TWID_MAX*sin (phase))
159
+ # define HALF_OF(x) ((x)>>1)
160
+ #elif defined(USE_SIMD)
161
+ # define KISS_FFT_COS(phase) _mm_set1_ps( cos(phase) )
162
+ # define KISS_FFT_SIN(phase) _mm_set1_ps( sin(phase) )
163
+ # define HALF_OF(x) ((x)*_mm_set1_ps(.5f))
164
+ #else
165
+ # define KISS_FFT_COS(phase) (kiss_fft_scalar) cos(phase)
166
+ # define KISS_FFT_SIN(phase) (kiss_fft_scalar) sin(phase)
167
+ # define HALF_OF(x) ((x)*.5f)
168
+ #endif
169
+
170
+ #define kf_cexp(x,phase) \
171
+ do{ \
172
+ (x)->r = KISS_FFT_COS(phase);\
173
+ (x)->i = KISS_FFT_SIN(phase);\
174
+ }while(0)
175
+
176
+ #define kf_cexp2(x,phase) \
177
+ do{ \
178
+ (x)->r = TRIG_UPSCALE*celt_cos_norm((phase));\
179
+ (x)->i = TRIG_UPSCALE*celt_cos_norm((phase)-32768);\
180
+ }while(0)
181
+
182
+ #endif /* KISS_FFT_GUTS_H */