@mentra/bluetooth-sdk 0.1.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 (278) hide show
  1. package/README.md +278 -0
  2. package/android/build.gradle +167 -0
  3. package/android/lc3Lib/CMakeLists.txt +6 -0
  4. package/android/lc3Lib/build.gradle +109 -0
  5. package/android/lc3Lib/proguard-rules.pro +33 -0
  6. package/android/lc3Lib/src/main/AndroidManifest.xml +2 -0
  7. package/android/lc3Lib/src/main/cpp/CMakeLists.txt +8 -0
  8. package/android/lc3Lib/src/main/cpp/google_opus_stuff/CMakeLists.txt +30 -0
  9. package/android/lc3Lib/src/main/cpp/google_opus_stuff/jni/CMakeLists.txt +7 -0
  10. package/android/lc3Lib/src/main/cpp/google_opus_stuff/jni/ogg_opus_encoder.cc +96 -0
  11. package/android/lc3Lib/src/main/cpp/google_opus_stuff/jni/ogg_opus_encoder.h +53 -0
  12. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/Makefile.am +6 -0
  13. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/config_types.h +26 -0
  14. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/config_types.h.in +26 -0
  15. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/ogg.h +209 -0
  16. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/os_types.h +158 -0
  17. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus.h +981 -0
  18. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_custom.h +342 -0
  19. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_defines.h +799 -0
  20. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_multistream.h +660 -0
  21. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_projection.h +568 -0
  22. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_types.h +166 -0
  23. package/android/lc3Lib/src/main/cpp/google_opus_stuff/ogg_opus_encoder.cc +268 -0
  24. package/android/lc3Lib/src/main/cpp/google_opus_stuff/ogg_opus_encoder.h +115 -0
  25. package/android/lc3Lib/src/main/cpp/google_opus_stuff/opus_tools/opus_header.h +59 -0
  26. package/android/lc3Lib/src/main/cpp/liblc3/CMakeLists.txt +38 -0
  27. package/android/lc3Lib/src/main/cpp/liblc3/include/lc3.h +309 -0
  28. package/android/lc3Lib/src/main/cpp/liblc3/include/lc3_private.h +162 -0
  29. package/android/lc3Lib/src/main/cpp/liblc3/include/rnnoise.h +114 -0
  30. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/CMakeLists.txt +19 -0
  31. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/attdet.c +92 -0
  32. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/attdet.h +44 -0
  33. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/bits.c +375 -0
  34. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/bits.h +315 -0
  35. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/bwdet.c +129 -0
  36. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/bwdet.h +69 -0
  37. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/common.h +148 -0
  38. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/energy.c +70 -0
  39. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/energy.h +43 -0
  40. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/fastmath.h +158 -0
  41. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/lc3.c +702 -0
  42. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/ltpf.c +893 -0
  43. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/ltpf.h +111 -0
  44. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/ltpf_arm.h +506 -0
  45. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/ltpf_neon.h +281 -0
  46. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/makefile.mk +35 -0
  47. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/mdct.c +452 -0
  48. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/mdct.h +57 -0
  49. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/mdct_neon.h +296 -0
  50. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/meson.build +46 -0
  51. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/plc.c +61 -0
  52. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/plc.h +57 -0
  53. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/sns.c +880 -0
  54. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/sns.h +103 -0
  55. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/spec.c +904 -0
  56. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/spec.h +119 -0
  57. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/tables.c +3457 -0
  58. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/tables.h +94 -0
  59. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/tns.c +457 -0
  60. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/tns.h +99 -0
  61. package/android/lc3Lib/src/main/cpp/liblc3/liblc3.cpp +159 -0
  62. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/_kiss_fft_guts.h +182 -0
  63. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/arch.h +261 -0
  64. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/celt_lpc.c +279 -0
  65. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/celt_lpc.h +59 -0
  66. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/common.h +48 -0
  67. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/compile.sh +3 -0
  68. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/denoise.c +646 -0
  69. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/kiss_fft.c +601 -0
  70. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/kiss_fft.h +203 -0
  71. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/opus_types.h +159 -0
  72. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/pitch.c +526 -0
  73. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/pitch.h +149 -0
  74. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn.c +178 -0
  75. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn.h +69 -0
  76. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn_data.c +11051 -0
  77. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn_data.h +34 -0
  78. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn_reader.c +168 -0
  79. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn_train.py +66 -0
  80. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/tansig_table.h +45 -0
  81. package/android/lc3Lib/src/main/java/com/mentra/lc3Lib/Lc3Cpp.java +38 -0
  82. package/android/lc3Lib/third_party/CMakeLists.txt +23 -0
  83. package/android/lc3Lib/third_party/CMakeLists_libogg.txt +18 -0
  84. package/android/lc3Lib/third_party/CMakeLists_libopus.txt +18 -0
  85. package/android/lc3Lib/third_party/CMakeLists_opus-tools.txt +23 -0
  86. package/android/lc3Lib/third_party/opus_tools/src/AUTHORS +5 -0
  87. package/android/lc3Lib/third_party/opus_tools/src/CMakeLists.txt +4 -0
  88. package/android/lc3Lib/third_party/opus_tools/src/COPYING +371 -0
  89. package/android/lc3Lib/third_party/opus_tools/src/ChangeLog +3 -0
  90. package/android/lc3Lib/third_party/opus_tools/src/Makefile.am +42 -0
  91. package/android/lc3Lib/third_party/opus_tools/src/Makefile.unix +23 -0
  92. package/android/lc3Lib/third_party/opus_tools/src/NEWS +0 -0
  93. package/android/lc3Lib/third_party/opus_tools/src/README +0 -0
  94. package/android/lc3Lib/third_party/opus_tools/src/autogen.sh +115 -0
  95. package/android/lc3Lib/third_party/opus_tools/src/configure.ac +293 -0
  96. package/android/lc3Lib/third_party/opus_tools/src/src/arch.h +239 -0
  97. package/android/lc3Lib/third_party/opus_tools/src/src/audio-in.c +1046 -0
  98. package/android/lc3Lib/third_party/opus_tools/src/src/diag_range.c +245 -0
  99. package/android/lc3Lib/third_party/opus_tools/src/src/diag_range.h +28 -0
  100. package/android/lc3Lib/third_party/opus_tools/src/src/info_opus.c +320 -0
  101. package/android/lc3Lib/third_party/opus_tools/src/src/info_opus.h +51 -0
  102. package/android/lc3Lib/third_party/opus_tools/src/src/lpc.c +157 -0
  103. package/android/lc3Lib/third_party/opus_tools/src/src/lpc.h +27 -0
  104. package/android/lc3Lib/third_party/opus_tools/src/src/opus_header.c +286 -0
  105. package/android/lc3Lib/third_party/opus_tools/src/src/opus_header.h +59 -0
  106. package/android/lc3Lib/third_party/opus_tools/src/src/opusdec.c +884 -0
  107. package/android/lc3Lib/third_party/opus_tools/src/src/opusenc.c +1021 -0
  108. package/android/lc3Lib/third_party/opus_tools/src/src/opusenc.h +101 -0
  109. package/android/lc3Lib/third_party/opus_tools/src/src/opusinfo.c +639 -0
  110. package/android/lc3Lib/third_party/opus_tools/src/src/opusinfo.h +51 -0
  111. package/android/lc3Lib/third_party/opus_tools/src/src/os_support.h +167 -0
  112. package/android/lc3Lib/third_party/opus_tools/src/src/resample.c +1137 -0
  113. package/android/lc3Lib/third_party/opus_tools/src/src/speex_resampler.h +344 -0
  114. package/android/lc3Lib/third_party/opus_tools/src/src/stack_alloc.h +115 -0
  115. package/android/lc3Lib/third_party/opus_tools/src/src/wav_io.c +125 -0
  116. package/android/lc3Lib/third_party/opus_tools/src/src/wav_io.h +62 -0
  117. package/android/lc3Lib/third_party/opus_tools/src/src/wave_out.c +223 -0
  118. package/android/lc3Lib/third_party/opus_tools/src/src/wave_out.h +60 -0
  119. package/android/settings.gradle +1 -0
  120. package/android/src/main/AndroidManifest.xml +40 -0
  121. package/android/src/main/java/com/mentra/bluetoothsdk/BluetoothSdkModule.kt +528 -0
  122. package/android/src/main/java/com/mentra/bluetoothsdk/Bridge.kt +610 -0
  123. package/android/src/main/java/com/mentra/bluetoothsdk/DeviceManager.kt +1616 -0
  124. package/android/src/main/java/com/mentra/bluetoothsdk/DeviceStore.kt +314 -0
  125. package/android/src/main/java/com/mentra/bluetoothsdk/MentraBluetoothModels.kt +1710 -0
  126. package/android/src/main/java/com/mentra/bluetoothsdk/MentraBluetoothSdk.kt +554 -0
  127. package/android/src/main/java/com/mentra/bluetoothsdk/ObservableStore.kt +68 -0
  128. package/android/src/main/java/com/mentra/bluetoothsdk/controllers/ControllerManager.kt +158 -0
  129. package/android/src/main/java/com/mentra/bluetoothsdk/controllers/R1.kt +934 -0
  130. package/android/src/main/java/com/mentra/bluetoothsdk/services/Foreground.kt +175 -0
  131. package/android/src/main/java/com/mentra/bluetoothsdk/services/PhoneMic.kt +1109 -0
  132. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/G1.java +3974 -0
  133. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/G2.kt +3551 -0
  134. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/Mach1.java +1327 -0
  135. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraLive.java +6959 -0
  136. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraNex.kt +1655 -0
  137. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraosBle.java +53675 -0
  138. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/SGCManager.kt +202 -0
  139. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/Simulated.kt +224 -0
  140. package/android/src/main/java/com/mentra/bluetoothsdk/stt/STTTools.kt +340 -0
  141. package/android/src/main/java/com/mentra/bluetoothsdk/stt/SherpaOnnxTranscriber.kt +465 -0
  142. package/android/src/main/java/com/mentra/bluetoothsdk/stt/VadGateSpeechPolicy.kt +221 -0
  143. package/android/src/main/java/com/mentra/bluetoothsdk/utils/AES.java +106 -0
  144. package/android/src/main/java/com/mentra/bluetoothsdk/utils/AudioSessionMonitor.kt +189 -0
  145. package/android/src/main/java/com/mentra/bluetoothsdk/utils/BitmapJavaUtils.java +169 -0
  146. package/android/src/main/java/com/mentra/bluetoothsdk/utils/BlePhotoUploadService.java +179 -0
  147. package/android/src/main/java/com/mentra/bluetoothsdk/utils/Constants.kt +44 -0
  148. package/android/src/main/java/com/mentra/bluetoothsdk/utils/G1Text.kt +436 -0
  149. package/android/src/main/java/com/mentra/bluetoothsdk/utils/IncidentLogBleRelayNaming.java +29 -0
  150. package/android/src/main/java/com/mentra/bluetoothsdk/utils/IncidentLogBleUploadService.java +76 -0
  151. package/android/src/main/java/com/mentra/bluetoothsdk/utils/K900ProtocolUtils.java +791 -0
  152. package/android/src/main/java/com/mentra/bluetoothsdk/utils/MessageChunker.java +186 -0
  153. package/android/src/main/java/com/mentra/bluetoothsdk/utils/NexSGCUtils.kt +589 -0
  154. package/android/src/main/java/com/mentra/bluetoothsdk/utils/PhoneAudioMonitor.kt +303 -0
  155. package/android/src/main/java/com/mentra/bluetoothsdk/utils/SmartGlassesConnectionState.java +9 -0
  156. package/android/src/main/java/com/mentra/bluetoothsdk/utils/audio/ByteUtilAudioPlayer.java +655 -0
  157. package/android/src/main/java/com/mentra/bluetoothsdk/utils/audio/Lc3Player.java +441 -0
  158. package/android/src/main/java/com/mentra/bluetoothsdk/utils/audio/PCMAudioPlayer.java +431 -0
  159. package/android/src/main/res/values/strings.xml +4 -0
  160. package/app.plugin.js +1 -0
  161. package/build/BluetoothSdk.types.d.ts +498 -0
  162. package/build/BluetoothSdk.types.d.ts.map +1 -0
  163. package/build/BluetoothSdk.types.js +23 -0
  164. package/build/BluetoothSdk.types.js.map +1 -0
  165. package/build/BluetoothSdkModule.d.ts +71 -0
  166. package/build/BluetoothSdkModule.d.ts.map +1 -0
  167. package/build/BluetoothSdkModule.js +106 -0
  168. package/build/BluetoothSdkModule.js.map +1 -0
  169. package/build/index.d.ts +3 -0
  170. package/build/index.d.ts.map +1 -0
  171. package/build/index.js +5 -0
  172. package/build/index.js.map +1 -0
  173. package/expo-module.config.json +9 -0
  174. package/ios/BluetoothSdkModule.swift +665 -0
  175. package/ios/MentraBluetoothSDK.podspec +77 -0
  176. package/ios/Packages/CoreObjC/CoreObjC.xcodeproj/project.pbxproj +213 -0
  177. package/ios/Packages/CoreObjC/PcmConverter.h +22 -0
  178. package/ios/Packages/CoreObjC/PcmConverter.m +266 -0
  179. package/ios/Packages/CoreObjC/attdet.c +92 -0
  180. package/ios/Packages/CoreObjC/attdet.h +44 -0
  181. package/ios/Packages/CoreObjC/bits.c +375 -0
  182. package/ios/Packages/CoreObjC/bits.h +315 -0
  183. package/ios/Packages/CoreObjC/bwdet.c +129 -0
  184. package/ios/Packages/CoreObjC/bwdet.h +69 -0
  185. package/ios/Packages/CoreObjC/common.h +151 -0
  186. package/ios/Packages/CoreObjC/energy.c +70 -0
  187. package/ios/Packages/CoreObjC/energy.h +43 -0
  188. package/ios/Packages/CoreObjC/fastmath.h +158 -0
  189. package/ios/Packages/CoreObjC/lc3.c +704 -0
  190. package/ios/Packages/CoreObjC/lc3.h +313 -0
  191. package/ios/Packages/CoreObjC/lc3_cpp.h +283 -0
  192. package/ios/Packages/CoreObjC/lc3_private.h +163 -0
  193. package/ios/Packages/CoreObjC/ltpf.c +905 -0
  194. package/ios/Packages/CoreObjC/ltpf.h +111 -0
  195. package/ios/Packages/CoreObjC/ltpf_arm.h +506 -0
  196. package/ios/Packages/CoreObjC/ltpf_neon.h +281 -0
  197. package/ios/Packages/CoreObjC/makefile.mk +35 -0
  198. package/ios/Packages/CoreObjC/mdct.c +469 -0
  199. package/ios/Packages/CoreObjC/mdct.h +57 -0
  200. package/ios/Packages/CoreObjC/mdct_neon.h +296 -0
  201. package/ios/Packages/CoreObjC/meson.build +61 -0
  202. package/ios/Packages/CoreObjC/plc.c +61 -0
  203. package/ios/Packages/CoreObjC/plc.h +57 -0
  204. package/ios/Packages/CoreObjC/rnnoise.h +114 -0
  205. package/ios/Packages/CoreObjC/sns.c +880 -0
  206. package/ios/Packages/CoreObjC/sns.h +103 -0
  207. package/ios/Packages/CoreObjC/spec.c +907 -0
  208. package/ios/Packages/CoreObjC/spec.h +119 -0
  209. package/ios/Packages/CoreObjC/tables.c +3457 -0
  210. package/ios/Packages/CoreObjC/tables.h +94 -0
  211. package/ios/Packages/CoreObjC/tns.c +457 -0
  212. package/ios/Packages/CoreObjC/tns.h +99 -0
  213. package/ios/Packages/SherpaOnnx/Model/joiner.onnx +0 -0
  214. package/ios/Packages/SherpaOnnx/Model/tokens.txt +502 -0
  215. package/ios/Packages/SherpaOnnx/SherpaOnnx.swift +1659 -0
  216. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/Headers/cargs.h +162 -0
  217. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/Headers/sherpa-onnx/c-api/c-api.h +1852 -0
  218. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/Headers/sherpa-onnx/c-api/cxx-api.h +674 -0
  219. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/Info.plist +44 -0
  220. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64/libsherpa-onnx.a +0 -0
  221. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64/sherpa-onnx.a +0 -0
  222. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64_x86_64-simulator/libsherpa-onnx.a +0 -0
  223. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64_x86_64-simulator/sherpa-onnx.a +0 -0
  224. package/ios/Packages/VAD/Common/VAD/VADQuality.swift +41 -0
  225. package/ios/Packages/VAD/Common/VAD/VADState.swift +26 -0
  226. package/ios/Packages/VAD/Common/VAD/VADStrategy.swift +29 -0
  227. package/ios/Packages/VAD/Common/VAD/VADType.swift +14 -0
  228. package/ios/Packages/VAD/Data/Configuration.swift +68 -0
  229. package/ios/Packages/VAD/Data/FrameSize.swift +39 -0
  230. package/ios/Packages/VAD/Data/Record.swift +13 -0
  231. package/ios/Packages/VAD/Data/Result.swift +22 -0
  232. package/ios/Packages/VAD/Data/SampleRate.swift +48 -0
  233. package/ios/Packages/VAD/Silero/Model/silero_vad.onnx +0 -0
  234. package/ios/Packages/VAD/Silero/SileroVAD.swift +284 -0
  235. package/ios/Packages/VAD/Silero/SileroVADStrategy.swift +64 -0
  236. package/ios/Packages/libbz2/module.modulemap +5 -0
  237. package/ios/Packages/libbz2/shim.h +1 -0
  238. package/ios/Source/Bridge.swift +353 -0
  239. package/ios/Source/Bridging-Header.h +16 -0
  240. package/ios/Source/DeviceManager.swift +1478 -0
  241. package/ios/Source/DeviceStore.swift +295 -0
  242. package/ios/Source/MentraBluetoothSDK.swift +2439 -0
  243. package/ios/Source/ObservableStore.swift +88 -0
  244. package/ios/Source/PrivacyInfo.xcprivacy +23 -0
  245. package/ios/Source/controllers/ControllerManager.swift +187 -0
  246. package/ios/Source/controllers/R1.swift +827 -0
  247. package/ios/Source/services/PhoneMic.swift +662 -0
  248. package/ios/Source/sgcs/Frame.swift +651 -0
  249. package/ios/Source/sgcs/G1.swift +2505 -0
  250. package/ios/Source/sgcs/G2.swift +3730 -0
  251. package/ios/Source/sgcs/Mach1.swift +543 -0
  252. package/ios/Source/sgcs/MentraLive.swift +4708 -0
  253. package/ios/Source/sgcs/MentraNex.swift +2479 -0
  254. package/ios/Source/sgcs/SGCManager.swift +243 -0
  255. package/ios/Source/sgcs/Simulated.swift +270 -0
  256. package/ios/Source/sgcs/mentraos_ble.pb.swift +3811 -0
  257. package/ios/Source/stt/STTTools.swift +154 -0
  258. package/ios/Source/stt/SherpaOnnxTranscriber.swift +401 -0
  259. package/ios/Source/utils/AudioSessionMonitor.swift +283 -0
  260. package/ios/Source/utils/Constants.swift +74 -0
  261. package/ios/Source/utils/Enums.swift +95 -0
  262. package/ios/Source/utils/G1Text.swift +2067 -0
  263. package/ios/Source/utils/JSCExperiment.swift +241 -0
  264. package/ios/Source/utils/MemoryMonitor.swift +44 -0
  265. package/ios/Source/utils/MessageChunker.swift +164 -0
  266. package/ios/Source/utils/Models.swift +135 -0
  267. package/ios/Source/utils/PhoneAudioMonitor.swift +226 -0
  268. package/ios/Source/utils/TarBz2Extractor.swift +206 -0
  269. package/package.json +78 -0
  270. package/plugin/build/index.d.ts +6 -0
  271. package/plugin/build/index.js +12 -0
  272. package/plugin/build/withAndroid.d.ts +4 -0
  273. package/plugin/build/withAndroid.js +80 -0
  274. package/plugin/build/withIos.d.ts +4 -0
  275. package/plugin/build/withIos.js +64 -0
  276. package/src/BluetoothSdk.types.ts +581 -0
  277. package/src/BluetoothSdkModule.ts +259 -0
  278. package/src/index.ts +4 -0
@@ -0,0 +1,94 @@
1
+ /******************************************************************************
2
+ *
3
+ * Copyright 2022 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at:
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ ******************************************************************************/
18
+
19
+ #ifndef __LC3_TABLES_H
20
+ #define __LC3_TABLES_H
21
+
22
+ #include "common.h"
23
+ #include "bits.h"
24
+
25
+
26
+ /**
27
+ * MDCT Twiddles and window coefficients
28
+ */
29
+
30
+ struct lc3_fft_bf3_twiddles { int n3; const struct lc3_complex (*t)[2]; };
31
+ struct lc3_fft_bf2_twiddles { int n2; const struct lc3_complex *t; };
32
+ struct lc3_mdct_rot_def { int n4; const struct lc3_complex *w; };
33
+
34
+ extern const struct lc3_fft_bf3_twiddles *lc3_fft_twiddles_bf3[];
35
+ extern const struct lc3_fft_bf2_twiddles *lc3_fft_twiddles_bf2[][3];
36
+ extern const struct lc3_mdct_rot_def *lc3_mdct_rot[LC3_NUM_DT][LC3_NUM_SRATE];
37
+
38
+ extern const float *lc3_mdct_win[LC3_NUM_DT][LC3_NUM_SRATE];
39
+
40
+
41
+ /**
42
+ * Limits of bands
43
+ */
44
+
45
+ #define LC3_NUM_BANDS 64
46
+
47
+ extern const int lc3_band_lim[LC3_NUM_DT][LC3_NUM_SRATE][LC3_NUM_BANDS+1];
48
+
49
+
50
+ /**
51
+ * SNS Quantization
52
+ */
53
+
54
+ extern const float lc3_sns_lfcb[32][8];
55
+ extern const float lc3_sns_hfcb[32][8];
56
+
57
+ struct lc3_sns_vq_gains {
58
+ int count; const float *v;
59
+ };
60
+
61
+ extern const struct lc3_sns_vq_gains lc3_sns_vq_gains[4];
62
+
63
+ extern const int32_t lc3_sns_mpvq_offsets[][11];
64
+
65
+
66
+ /**
67
+ * TNS Arithmetic Coding
68
+ */
69
+
70
+ extern const struct lc3_ac_model lc3_tns_order_models[];
71
+ extern const uint16_t lc3_tns_order_bits[][8];
72
+
73
+ extern const struct lc3_ac_model lc3_tns_coeffs_models[];
74
+ extern const uint16_t lc3_tns_coeffs_bits[][17];
75
+
76
+
77
+ /**
78
+ * Long Term Postfilter
79
+ */
80
+
81
+ extern const float *lc3_ltpf_cnum[LC3_NUM_SRATE][4];
82
+ extern const float *lc3_ltpf_cden[LC3_NUM_SRATE][4];
83
+
84
+
85
+ /**
86
+ * Spectral Data Arithmetic Coding
87
+ */
88
+
89
+ extern const uint8_t lc3_spectrum_lookup[2][2][256][4];
90
+ extern const struct lc3_ac_model lc3_spectrum_models[];
91
+ extern const uint16_t lc3_spectrum_bits[][17];
92
+
93
+
94
+ #endif /* __LC3_TABLES_H */
@@ -0,0 +1,457 @@
1
+ /******************************************************************************
2
+ *
3
+ * Copyright 2022 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at:
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ ******************************************************************************/
18
+
19
+ #include "tns.h"
20
+ #include "tables.h"
21
+
22
+
23
+ /* ----------------------------------------------------------------------------
24
+ * Filter Coefficients
25
+ * -------------------------------------------------------------------------- */
26
+
27
+ /**
28
+ * Resolve LPC Weighting indication according bitrate
29
+ * dt, nbytes Duration and size of the frame
30
+ * return True when LPC Weighting enabled
31
+ */
32
+ static bool resolve_lpc_weighting(enum lc3_dt dt, int nbytes)
33
+ {
34
+ return nbytes < (dt == LC3_DT_7M5 ? 360/8 : 480/8);
35
+ }
36
+
37
+ /**
38
+ * Return dot product of 2 vectors
39
+ * a, b, n The 2 vectors of size `n`
40
+ * return sum( a[i] * b[i] ), i = [0..n-1]
41
+ */
42
+ LC3_HOT static inline float dot(const float *a, const float *b, int n)
43
+ {
44
+ float v = 0;
45
+
46
+ while (n--)
47
+ v += *(a++) * *(b++);
48
+
49
+ return v;
50
+ }
51
+
52
+ /**
53
+ * LPC Coefficients
54
+ * dt, bw Duration and bandwidth of the frame
55
+ * x Spectral coefficients
56
+ * gain, a Output the prediction gains and LPC coefficients
57
+ */
58
+ LC3_HOT static void compute_lpc_coeffs(
59
+ enum lc3_dt dt, enum lc3_bandwidth bw,
60
+ const float *x, float *gain, float (*a)[9])
61
+ {
62
+ static const int sub_7m5_nb[] = { 9, 26, 43, 60 };
63
+ static const int sub_7m5_wb[] = { 9, 46, 83, 120 };
64
+ static const int sub_7m5_sswb[] = { 9, 66, 123, 180 };
65
+ static const int sub_7m5_swb[] = { 9, 46, 82, 120, 159, 200, 240 };
66
+ static const int sub_7m5_fb[] = { 9, 56, 103, 150, 200, 250, 300 };
67
+
68
+ static const int sub_10m_nb[] = { 12, 34, 57, 80 };
69
+ static const int sub_10m_wb[] = { 12, 61, 110, 160 };
70
+ static const int sub_10m_sswb[] = { 12, 88, 164, 240 };
71
+ static const int sub_10m_swb[] = { 12, 61, 110, 160, 213, 266, 320 };
72
+ static const int sub_10m_fb[] = { 12, 74, 137, 200, 266, 333, 400 };
73
+
74
+ /* --- Normalized autocorrelation --- */
75
+
76
+ static const float lag_window[] = {
77
+ 1.00000000e+00, 9.98028026e-01, 9.92135406e-01, 9.82391584e-01,
78
+ 9.68910791e-01, 9.51849807e-01, 9.31404933e-01, 9.07808230e-01,
79
+ 8.81323137e-01
80
+ };
81
+
82
+ const int *sub = (const int * const [LC3_NUM_DT][LC3_NUM_SRATE]){
83
+ { sub_7m5_nb, sub_7m5_wb, sub_7m5_sswb, sub_7m5_swb, sub_7m5_fb },
84
+ { sub_10m_nb, sub_10m_wb, sub_10m_sswb, sub_10m_swb, sub_10m_fb },
85
+ }[dt][bw];
86
+
87
+ int nfilters = 1 + (bw >= LC3_BANDWIDTH_SWB);
88
+
89
+ const float *xs, *xe = x + *sub;
90
+ float r[2][9];
91
+
92
+ for (int f = 0; f < nfilters; f++) {
93
+ float c[9][3];
94
+
95
+ for (int s = 0; s < 3; s++) {
96
+ xs = xe, xe = x + *(++sub);
97
+
98
+ for (int k = 0; k < 9; k++)
99
+ c[k][s] = dot(xs, xs + k, (xe - xs) - k);
100
+ }
101
+
102
+ float e0 = c[0][0], e1 = c[0][1], e2 = c[0][2];
103
+
104
+ r[f][0] = 3;
105
+ for (int k = 1; k < 9; k++)
106
+ r[f][k] = e0 == 0 || e1 == 0 || e2 == 0 ? 0 :
107
+ (c[k][0]/e0 + c[k][1]/e1 + c[k][2]/e2) * lag_window[k];
108
+ }
109
+
110
+ /* --- Levinson-Durbin recursion --- */
111
+
112
+ for (int f = 0; f < nfilters; f++) {
113
+ float *a0 = a[f], a1[9];
114
+ float err = r[f][0], rc;
115
+
116
+ gain[f] = err;
117
+
118
+ a0[0] = 1;
119
+ for (int k = 1; k < 9; ) {
120
+
121
+ rc = -r[f][k];
122
+ for (int i = 1; i < k; i++)
123
+ rc -= a0[i] * r[f][k-i];
124
+
125
+ rc /= err;
126
+ err *= 1 - rc * rc;
127
+
128
+ for (int i = 1; i < k; i++)
129
+ a1[i] = a0[i] + rc * a0[k-i];
130
+ a1[k++] = rc;
131
+
132
+ rc = -r[f][k];
133
+ for (int i = 1; i < k; i++)
134
+ rc -= a1[i] * r[f][k-i];
135
+
136
+ rc /= err;
137
+ err *= 1 - rc * rc;
138
+
139
+ for (int i = 1; i < k; i++)
140
+ a0[i] = a1[i] + rc * a1[k-i];
141
+ a0[k++] = rc;
142
+ }
143
+
144
+ gain[f] /= err;
145
+ }
146
+ }
147
+
148
+ /**
149
+ * LPC Weighting
150
+ * gain, a Prediction gain and LPC coefficients, weighted as output
151
+ */
152
+ LC3_HOT static void lpc_weighting(float pred_gain, float *a)
153
+ {
154
+ float gamma = 1.f - (1.f - 0.85f) * (2.f - pred_gain) / (2.f - 1.5f);
155
+ float g = 1.f;
156
+
157
+ for (int i = 1; i < 9; i++)
158
+ a[i] *= (g *= gamma);
159
+ }
160
+
161
+ /**
162
+ * LPC reflection
163
+ * a LPC coefficients
164
+ * rc Output refelection coefficients
165
+ */
166
+ LC3_HOT static void lpc_reflection(const float *a, float *rc)
167
+ {
168
+ float e, b[2][7], *b0, *b1;
169
+
170
+ rc[7] = a[1+7];
171
+ e = 1 - rc[7] * rc[7];
172
+
173
+ b1 = b[1];
174
+ for (int i = 0; i < 7; i++)
175
+ b1[i] = (a[1+i] - rc[7] * a[7-i]) / e;
176
+
177
+ for (int k = 6; k > 0; k--) {
178
+ b0 = b1, b1 = b[k & 1];
179
+
180
+ rc[k] = b0[k];
181
+ e = 1 - rc[k] * rc[k];
182
+
183
+ for (int i = 0; i < k; i++)
184
+ b1[i] = (b0[i] - rc[k] * b0[k-1-i]) / e;
185
+ }
186
+
187
+ rc[0] = b1[0];
188
+ }
189
+
190
+ /**
191
+ * Quantization of RC coefficients
192
+ * rc Refelection coefficients
193
+ * rc_order Return order of coefficients
194
+ * rc_i Return quantized coefficients
195
+ */
196
+ static void quantize_rc(const float *rc, int *rc_order, int *rc_q)
197
+ {
198
+ /* Quantization table, sin(delta * (i + 0.5)), delta = Pi / 17 */
199
+
200
+ static float q_thr[] = {
201
+ 9.22683595e-02, 2.73662990e-01, 4.45738356e-01, 6.02634636e-01,
202
+ 7.39008917e-01, 8.50217136e-01, 9.32472229e-01, 9.82973100e-01
203
+ };
204
+
205
+ *rc_order = 8;
206
+
207
+ for (int i = 0; i < 8; i++) {
208
+ float rc_m = fabsf(rc[i]);
209
+
210
+ rc_q[i] = 4 * (rc_m >= q_thr[4]);
211
+ for (int j = 0; j < 4 && rc_m >= q_thr[rc_q[i]]; j++, rc_q[i]++);
212
+
213
+ if (rc[i] < 0)
214
+ rc_q[i] = -rc_q[i];
215
+
216
+ *rc_order = rc_q[i] != 0 ? 8 : *rc_order - 1;
217
+ }
218
+ }
219
+
220
+ /**
221
+ * Unquantization of RC coefficients
222
+ * rc_q Quantized coefficients
223
+ * rc_order Order of coefficients
224
+ * rc Return refelection coefficients
225
+ */
226
+ static void unquantize_rc(const int *rc_q, int rc_order, float rc[8])
227
+ {
228
+ /* Quantization table, sin(delta * i), delta = Pi / 17 */
229
+
230
+ static float q_inv[] = {
231
+ 0.00000000e+00, 1.83749517e-01, 3.61241664e-01, 5.26432173e-01,
232
+ 6.73695641e-01, 7.98017215e-01, 8.95163302e-01, 9.61825645e-01,
233
+ 9.95734176e-01
234
+ };
235
+
236
+ int i;
237
+
238
+ for (i = 0; i < rc_order; i++) {
239
+ float rc_m = q_inv[LC3_ABS(rc_q[i])];
240
+ rc[i] = rc_q[i] < 0 ? -rc_m : rc_m;
241
+ }
242
+ }
243
+
244
+
245
+ /* ----------------------------------------------------------------------------
246
+ * Filtering
247
+ * -------------------------------------------------------------------------- */
248
+
249
+ /**
250
+ * Forward filtering
251
+ * dt, bw Duration and bandwidth of the frame
252
+ * rc_order, rc Order of coefficients, and coefficients
253
+ * x Spectral coefficients, filtered as output
254
+ */
255
+ LC3_HOT static void forward_filtering(
256
+ enum lc3_dt dt, enum lc3_bandwidth bw,
257
+ const int rc_order[2], const float rc[2][8], float *x)
258
+ {
259
+ int nfilters = 1 + (bw >= LC3_BANDWIDTH_SWB);
260
+ int nf = LC3_NE(dt, bw) >> (nfilters - 1);
261
+ int i0, ie = 3*(3 + dt);
262
+
263
+ float s[8] = { 0 };
264
+
265
+ for (int f = 0; f < nfilters; f++) {
266
+
267
+ i0 = ie;
268
+ ie = nf * (1 + f);
269
+
270
+ if (!rc_order[f])
271
+ continue;
272
+
273
+ for (int i = i0; i < ie; i++) {
274
+ float xi = x[i];
275
+ float s0, s1 = xi;
276
+
277
+ for (int k = 0; k < rc_order[f]; k++) {
278
+ s0 = s[k];
279
+ s[k] = s1;
280
+
281
+ s1 = rc[f][k] * xi + s0;
282
+ xi += rc[f][k] * s0;
283
+ }
284
+
285
+ x[i] = xi;
286
+ }
287
+ }
288
+ }
289
+
290
+ /**
291
+ * Inverse filtering
292
+ * dt, bw Duration and bandwidth of the frame
293
+ * rc_order, rc Order of coefficients, and unquantized coefficients
294
+ * x Spectral coefficients, filtered as output
295
+ */
296
+ LC3_HOT static void inverse_filtering(
297
+ enum lc3_dt dt, enum lc3_bandwidth bw,
298
+ const int rc_order[2], const float rc[2][8], float *x)
299
+ {
300
+ int nfilters = 1 + (bw >= LC3_BANDWIDTH_SWB);
301
+ int nf = LC3_NE(dt, bw) >> (nfilters - 1);
302
+ int i0, ie = 3*(3 + dt);
303
+
304
+ float s[8] = { 0 };
305
+
306
+ for (int f = 0; f < nfilters; f++) {
307
+
308
+ i0 = ie;
309
+ ie = nf * (1 + f);
310
+
311
+ if (!rc_order[f])
312
+ continue;
313
+
314
+ for (int i = i0; i < ie; i++) {
315
+ float xi = x[i];
316
+
317
+ xi -= s[7] * rc[f][7];
318
+ for (int k = 6; k >= 0; k--) {
319
+ xi -= s[k] * rc[f][k];
320
+ s[k+1] = s[k] + rc[f][k] * xi;
321
+ }
322
+ s[0] = xi;
323
+ x[i] = xi;
324
+ }
325
+
326
+ for (int k = 7; k >= rc_order[f]; k--)
327
+ s[k] = 0;
328
+ }
329
+ }
330
+
331
+
332
+ /* ----------------------------------------------------------------------------
333
+ * Interface
334
+ * -------------------------------------------------------------------------- */
335
+
336
+ /**
337
+ * TNS analysis
338
+ */
339
+ void lc3_tns_analyze(enum lc3_dt dt, enum lc3_bandwidth bw,
340
+ bool nn_flag, int nbytes, struct lc3_tns_data *data, float *x)
341
+ {
342
+ /* Processing steps :
343
+ * - Determine the LPC (Linear Predictive Coding) Coefficients
344
+ * - Check is the filtering is disabled
345
+ * - The coefficients are weighted on low bitrates and predicition gain
346
+ * - Convert to reflection coefficients and quantize
347
+ * - Finally filter the spectral coefficients */
348
+
349
+ float pred_gain[2], a[2][9];
350
+ float rc[2][8];
351
+
352
+ data->nfilters = 1 + (bw >= LC3_BANDWIDTH_SWB);
353
+ data->lpc_weighting = resolve_lpc_weighting(dt, nbytes);
354
+
355
+ compute_lpc_coeffs(dt, bw, x, pred_gain, a);
356
+
357
+ for (int f = 0; f < data->nfilters; f++) {
358
+
359
+ data->rc_order[f] = 0;
360
+ if (nn_flag || pred_gain[f] <= 1.5f)
361
+ continue;
362
+
363
+ if (data->lpc_weighting && pred_gain[f] < 2.f)
364
+ lpc_weighting(pred_gain[f], a[f]);
365
+
366
+ lpc_reflection(a[f], rc[f]);
367
+
368
+ quantize_rc(rc[f], &data->rc_order[f], data->rc[f]);
369
+ unquantize_rc(data->rc[f], data->rc_order[f], rc[f]);
370
+ }
371
+
372
+ forward_filtering(dt, bw, data->rc_order, rc, x);
373
+ }
374
+
375
+ /**
376
+ * TNS synthesis
377
+ */
378
+ void lc3_tns_synthesize(enum lc3_dt dt, enum lc3_bandwidth bw,
379
+ const struct lc3_tns_data *data, float *x)
380
+ {
381
+ float rc[2][8] = { };
382
+
383
+ for (int f = 0; f < data->nfilters; f++)
384
+ if (data->rc_order[f])
385
+ unquantize_rc(data->rc[f], data->rc_order[f], rc[f]);
386
+
387
+ inverse_filtering(dt, bw, data->rc_order, rc, x);
388
+ }
389
+
390
+ /**
391
+ * Bit consumption of bitstream data
392
+ */
393
+ int lc3_tns_get_nbits(const struct lc3_tns_data *data)
394
+ {
395
+ int nbits = 0;
396
+
397
+ for (int f = 0; f < data->nfilters; f++) {
398
+
399
+ int nbits_2048 = 2048;
400
+ int rc_order = data->rc_order[f];
401
+
402
+ nbits_2048 += rc_order > 0 ? lc3_tns_order_bits
403
+ [data->lpc_weighting][rc_order-1] : 0;
404
+
405
+ for (int i = 0; i < rc_order; i++)
406
+ nbits_2048 += lc3_tns_coeffs_bits[i][8 + data->rc[f][i]];
407
+
408
+ nbits += (nbits_2048 + (1 << 11) - 1) >> 11;
409
+ }
410
+
411
+ return nbits;
412
+ }
413
+
414
+ /**
415
+ * Put bitstream data
416
+ */
417
+ void lc3_tns_put_data(lc3_bits_t *bits, const struct lc3_tns_data *data)
418
+ {
419
+ for (int f = 0; f < data->nfilters; f++) {
420
+ int rc_order = data->rc_order[f];
421
+
422
+ lc3_put_bits(bits, rc_order > 0, 1);
423
+ if (rc_order <= 0)
424
+ continue;
425
+
426
+ lc3_put_symbol(bits,
427
+ lc3_tns_order_models + data->lpc_weighting, rc_order-1);
428
+
429
+ for (int i = 0; i < rc_order; i++)
430
+ lc3_put_symbol(bits,
431
+ lc3_tns_coeffs_models + i, 8 + data->rc[f][i]);
432
+ }
433
+ }
434
+
435
+ /**
436
+ * Get bitstream data
437
+ */
438
+ void lc3_tns_get_data(lc3_bits_t *bits,
439
+ enum lc3_dt dt, enum lc3_bandwidth bw, int nbytes, lc3_tns_data_t *data)
440
+ {
441
+ data->nfilters = 1 + (bw >= LC3_BANDWIDTH_SWB);
442
+ data->lpc_weighting = resolve_lpc_weighting(dt, nbytes);
443
+
444
+ for (int f = 0; f < data->nfilters; f++) {
445
+
446
+ data->rc_order[f] = lc3_get_bit(bits);
447
+ if (!data->rc_order[f])
448
+ continue;
449
+
450
+ data->rc_order[f] += lc3_get_symbol(bits,
451
+ lc3_tns_order_models + data->lpc_weighting);
452
+
453
+ for (int i = 0; i < data->rc_order[f]; i++)
454
+ data->rc[f][i] = (int)lc3_get_symbol(bits,
455
+ lc3_tns_coeffs_models + i) - 8;
456
+ }
457
+ }
@@ -0,0 +1,99 @@
1
+ /******************************************************************************
2
+ *
3
+ * Copyright 2022 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at:
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ ******************************************************************************/
18
+
19
+ /**
20
+ * LC3 - Temporal Noise Shaping
21
+ *
22
+ * Reference : Low Complexity Communication Codec (LC3)
23
+ * Bluetooth Specification v1.0
24
+ */
25
+
26
+ #ifndef __LC3_TNS_H
27
+ #define __LC3_TNS_H
28
+
29
+ #include "common.h"
30
+ #include "bits.h"
31
+
32
+
33
+ /**
34
+ * Bitstream data
35
+ */
36
+
37
+ typedef struct lc3_tns_data {
38
+ int nfilters;
39
+ bool lpc_weighting;
40
+ int rc_order[2];
41
+ int rc[2][8];
42
+ } lc3_tns_data_t;
43
+
44
+
45
+ /* ----------------------------------------------------------------------------
46
+ * Encoding
47
+ * -------------------------------------------------------------------------- */
48
+
49
+ /**
50
+ * TNS analysis
51
+ * dt, bw Duration and bandwidth of the frame
52
+ * nn_flag True when high energy detected near Nyquist frequency
53
+ * nbytes Size in bytes of the frame
54
+ * data Return bitstream data
55
+ * x Spectral coefficients, filtered as output
56
+ */
57
+ void lc3_tns_analyze(enum lc3_dt dt, enum lc3_bandwidth bw,
58
+ bool nn_flag, int nbytes, lc3_tns_data_t *data, float *x);
59
+
60
+ /**
61
+ * Return number of bits coding the data
62
+ * data Bitstream data
63
+ * return Bit consumption
64
+ */
65
+ int lc3_tns_get_nbits(const lc3_tns_data_t *data);
66
+
67
+ /**
68
+ * Put bitstream data
69
+ * bits Bitstream context
70
+ * data Bitstream data
71
+ */
72
+ void lc3_tns_put_data(lc3_bits_t *bits, const lc3_tns_data_t *data);
73
+
74
+
75
+ /* ----------------------------------------------------------------------------
76
+ * Decoding
77
+ * -------------------------------------------------------------------------- */
78
+
79
+ /**
80
+ * Get bitstream data
81
+ * bits Bitstream context
82
+ * dt, bw Duration and bandwidth of the frame
83
+ * nbytes Size in bytes of the frame
84
+ * data Bitstream data
85
+ */
86
+ void lc3_tns_get_data(lc3_bits_t *bits,
87
+ enum lc3_dt dt, enum lc3_bandwidth bw, int nbytes, lc3_tns_data_t *data);
88
+
89
+ /**
90
+ * TNS synthesis
91
+ * dt, bw Duration and bandwidth of the frame
92
+ * data Bitstream data
93
+ * x Spectral coefficients, filtered as output
94
+ */
95
+ void lc3_tns_synthesize(enum lc3_dt dt, enum lc3_bandwidth bw,
96
+ const lc3_tns_data_t *data, float *x);
97
+
98
+
99
+ #endif /* __LC3_TNS_H */