@glassly/bluetooth-sdk 0.1.0-dev.26

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 (548) hide show
  1. package/README.md +563 -0
  2. package/android/build.gradle +450 -0
  3. package/android/gradle.properties.example +9 -0
  4. package/android/lc3Lib/CMakeLists.txt +6 -0
  5. package/android/lc3Lib/build.gradle +212 -0
  6. package/android/lc3Lib/proguard-rules.pro +33 -0
  7. package/android/lc3Lib/src/main/AndroidManifest.xml +2 -0
  8. package/android/lc3Lib/src/main/cpp/CMakeLists.txt +8 -0
  9. package/android/lc3Lib/src/main/cpp/google_opus_stuff/CMakeLists.txt +30 -0
  10. package/android/lc3Lib/src/main/cpp/google_opus_stuff/jni/CMakeLists.txt +7 -0
  11. package/android/lc3Lib/src/main/cpp/google_opus_stuff/jni/ogg_opus_encoder.cc +96 -0
  12. package/android/lc3Lib/src/main/cpp/google_opus_stuff/jni/ogg_opus_encoder.h +53 -0
  13. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/Makefile.am +6 -0
  14. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/config_types.h +26 -0
  15. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/config_types.h.in +26 -0
  16. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/ogg.h +209 -0
  17. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/os_types.h +158 -0
  18. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus.h +981 -0
  19. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_custom.h +342 -0
  20. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_defines.h +799 -0
  21. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_multistream.h +660 -0
  22. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_projection.h +568 -0
  23. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_types.h +166 -0
  24. package/android/lc3Lib/src/main/cpp/google_opus_stuff/ogg_opus_encoder.cc +268 -0
  25. package/android/lc3Lib/src/main/cpp/google_opus_stuff/ogg_opus_encoder.h +115 -0
  26. package/android/lc3Lib/src/main/cpp/google_opus_stuff/opus_tools/opus_header.h +59 -0
  27. package/android/lc3Lib/src/main/cpp/liblc3/CMakeLists.txt +38 -0
  28. package/android/lc3Lib/src/main/cpp/liblc3/include/lc3.h +309 -0
  29. package/android/lc3Lib/src/main/cpp/liblc3/include/lc3_private.h +162 -0
  30. package/android/lc3Lib/src/main/cpp/liblc3/include/rnnoise.h +114 -0
  31. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/CMakeLists.txt +19 -0
  32. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/attdet.c +92 -0
  33. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/attdet.h +44 -0
  34. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/bits.c +375 -0
  35. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/bits.h +315 -0
  36. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/bwdet.c +129 -0
  37. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/bwdet.h +69 -0
  38. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/common.h +148 -0
  39. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/energy.c +70 -0
  40. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/energy.h +43 -0
  41. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/fastmath.h +158 -0
  42. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/lc3.c +702 -0
  43. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/ltpf.c +893 -0
  44. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/ltpf.h +111 -0
  45. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/ltpf_arm.h +506 -0
  46. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/ltpf_neon.h +281 -0
  47. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/makefile.mk +35 -0
  48. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/mdct.c +452 -0
  49. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/mdct.h +57 -0
  50. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/mdct_neon.h +296 -0
  51. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/meson.build +46 -0
  52. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/plc.c +61 -0
  53. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/plc.h +57 -0
  54. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/sns.c +880 -0
  55. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/sns.h +103 -0
  56. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/spec.c +904 -0
  57. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/spec.h +119 -0
  58. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/tables.c +3457 -0
  59. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/tables.h +94 -0
  60. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/tns.c +457 -0
  61. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/tns.h +99 -0
  62. package/android/lc3Lib/src/main/cpp/liblc3/liblc3.cpp +159 -0
  63. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/_kiss_fft_guts.h +182 -0
  64. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/arch.h +261 -0
  65. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/celt_lpc.c +279 -0
  66. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/celt_lpc.h +59 -0
  67. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/common.h +48 -0
  68. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/compile.sh +3 -0
  69. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/denoise.c +646 -0
  70. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/kiss_fft.c +601 -0
  71. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/kiss_fft.h +203 -0
  72. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/opus_types.h +159 -0
  73. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/pitch.c +526 -0
  74. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/pitch.h +149 -0
  75. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn.c +178 -0
  76. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn.h +69 -0
  77. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn_data.c +11051 -0
  78. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn_data.h +34 -0
  79. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn_reader.c +168 -0
  80. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn_train.py +66 -0
  81. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/tansig_table.h +45 -0
  82. package/android/lc3Lib/src/main/java/com/glassly/lc3Lib/Lc3Cpp.java +38 -0
  83. package/android/lc3Lib/third_party/CMakeLists.txt +23 -0
  84. package/android/lc3Lib/third_party/CMakeLists_libogg.txt +18 -0
  85. package/android/lc3Lib/third_party/CMakeLists_libopus.txt +18 -0
  86. package/android/lc3Lib/third_party/CMakeLists_opus-tools.txt +23 -0
  87. package/android/lc3Lib/third_party/opus_tools/src/AUTHORS +5 -0
  88. package/android/lc3Lib/third_party/opus_tools/src/CMakeLists.txt +4 -0
  89. package/android/lc3Lib/third_party/opus_tools/src/COPYING +371 -0
  90. package/android/lc3Lib/third_party/opus_tools/src/ChangeLog +3 -0
  91. package/android/lc3Lib/third_party/opus_tools/src/Makefile.am +42 -0
  92. package/android/lc3Lib/third_party/opus_tools/src/Makefile.unix +23 -0
  93. package/android/lc3Lib/third_party/opus_tools/src/NEWS +0 -0
  94. package/android/lc3Lib/third_party/opus_tools/src/README +0 -0
  95. package/android/lc3Lib/third_party/opus_tools/src/autogen.sh +115 -0
  96. package/android/lc3Lib/third_party/opus_tools/src/configure.ac +293 -0
  97. package/android/lc3Lib/third_party/opus_tools/src/src/arch.h +239 -0
  98. package/android/lc3Lib/third_party/opus_tools/src/src/audio-in.c +1046 -0
  99. package/android/lc3Lib/third_party/opus_tools/src/src/diag_range.c +245 -0
  100. package/android/lc3Lib/third_party/opus_tools/src/src/diag_range.h +28 -0
  101. package/android/lc3Lib/third_party/opus_tools/src/src/info_opus.c +320 -0
  102. package/android/lc3Lib/third_party/opus_tools/src/src/info_opus.h +51 -0
  103. package/android/lc3Lib/third_party/opus_tools/src/src/lpc.c +157 -0
  104. package/android/lc3Lib/third_party/opus_tools/src/src/lpc.h +27 -0
  105. package/android/lc3Lib/third_party/opus_tools/src/src/opus_header.c +286 -0
  106. package/android/lc3Lib/third_party/opus_tools/src/src/opus_header.h +59 -0
  107. package/android/lc3Lib/third_party/opus_tools/src/src/opusdec.c +884 -0
  108. package/android/lc3Lib/third_party/opus_tools/src/src/opusenc.c +1021 -0
  109. package/android/lc3Lib/third_party/opus_tools/src/src/opusenc.h +101 -0
  110. package/android/lc3Lib/third_party/opus_tools/src/src/opusinfo.c +639 -0
  111. package/android/lc3Lib/third_party/opus_tools/src/src/opusinfo.h +51 -0
  112. package/android/lc3Lib/third_party/opus_tools/src/src/os_support.h +167 -0
  113. package/android/lc3Lib/third_party/opus_tools/src/src/resample.c +1137 -0
  114. package/android/lc3Lib/third_party/opus_tools/src/src/speex_resampler.h +344 -0
  115. package/android/lc3Lib/third_party/opus_tools/src/src/stack_alloc.h +115 -0
  116. package/android/lc3Lib/third_party/opus_tools/src/src/wav_io.c +125 -0
  117. package/android/lc3Lib/third_party/opus_tools/src/src/wav_io.h +62 -0
  118. package/android/lc3Lib/third_party/opus_tools/src/src/wave_out.c +223 -0
  119. package/android/lc3Lib/third_party/opus_tools/src/src/wave_out.h +60 -0
  120. package/android/settings.gradle +4 -0
  121. package/android/silero/LICENSE.md +17 -0
  122. package/android/silero/build.gradle +50 -0
  123. package/android/silero/proguard-rules.pro +24 -0
  124. package/android/silero/src/androidTest/assets/hello.wav +0 -0
  125. package/android/silero/src/androidTest/java/com/konovalov/vad/silero/VadSileroTest.kt +79 -0
  126. package/android/silero/src/main/assets/LICENSE +21 -0
  127. package/android/silero/src/main/assets/silero_vad.onnx +0 -0
  128. package/android/silero/src/main/java/com/konovalov/vad/silero/Vad.kt +160 -0
  129. package/android/silero/src/main/java/com/konovalov/vad/silero/VadSilero.kt +449 -0
  130. package/android/silero/src/main/java/com/konovalov/vad/silero/config/FrameSize.kt +15 -0
  131. package/android/silero/src/main/java/com/konovalov/vad/silero/config/Mode.kt +14 -0
  132. package/android/silero/src/main/java/com/konovalov/vad/silero/config/SampleRate.kt +12 -0
  133. package/android/silero/src/main/java/com/konovalov/vad/silero/utils/AudioUtils.kt +47 -0
  134. package/android/silero/src/main/java/com/konovalov/vad/silero/utils/TensorMap.kt +41 -0
  135. package/android/silero/src/test/java/com/konovalov/vad/silero/utils/AudioUtilsTest.kt +44 -0
  136. package/android/src/main/AndroidManifest.xml +42 -0
  137. package/android/src/main/assets/G2Firmware/README.md +11 -0
  138. package/android/src/main/java/com/glassly/bluetoothsdk/BluetoothSdk.kt +2325 -0
  139. package/android/src/main/java/com/glassly/bluetoothsdk/BluetoothSdkAnalytics.kt +216 -0
  140. package/android/src/main/java/com/glassly/bluetoothsdk/BluetoothSdkDebug.kt +14 -0
  141. package/android/src/main/java/com/glassly/bluetoothsdk/BluetoothSdkDefaults.kt +7 -0
  142. package/android/src/main/java/com/glassly/bluetoothsdk/BluetoothSdkModule.kt +1088 -0
  143. package/android/src/main/java/com/glassly/bluetoothsdk/Bridge.kt +953 -0
  144. package/android/src/main/java/com/glassly/bluetoothsdk/DeviceManager.kt +2528 -0
  145. package/android/src/main/java/com/glassly/bluetoothsdk/DeviceStore.kt +360 -0
  146. package/android/src/main/java/com/glassly/bluetoothsdk/GeneratedChangelogCatalog.kt +8 -0
  147. package/android/src/main/java/com/glassly/bluetoothsdk/GeneratedReleaseMetadata.kt +11 -0
  148. package/android/src/main/java/com/glassly/bluetoothsdk/LocalNetworkModule.kt +414 -0
  149. package/android/src/main/java/com/glassly/bluetoothsdk/ObservableStore.kt +88 -0
  150. package/android/src/main/java/com/glassly/bluetoothsdk/OtaManifest.kt +191 -0
  151. package/android/src/main/java/com/glassly/bluetoothsdk/ReleaseChangelog.kt +61 -0
  152. package/android/src/main/java/com/glassly/bluetoothsdk/ScopedNetworkReadiness.kt +17 -0
  153. package/android/src/main/java/com/glassly/bluetoothsdk/audio/AudioModels.kt +144 -0
  154. package/android/src/main/java/com/glassly/bluetoothsdk/camera/CameraModels.kt +486 -0
  155. package/android/src/main/java/com/glassly/bluetoothsdk/connection/ConnectionModels.kt +78 -0
  156. package/android/src/main/java/com/glassly/bluetoothsdk/controllers/ControllerManager.kt +158 -0
  157. package/android/src/main/java/com/glassly/bluetoothsdk/controllers/R1.kt +937 -0
  158. package/android/src/main/java/com/glassly/bluetoothsdk/debug/BleTraceLogger.kt +165 -0
  159. package/android/src/main/java/com/glassly/bluetoothsdk/events/BluetoothEvents.kt +178 -0
  160. package/android/src/main/java/com/glassly/bluetoothsdk/internal/MapParsing.kt +140 -0
  161. package/android/src/main/java/com/glassly/bluetoothsdk/net/LocalIpv4.kt +57 -0
  162. package/android/src/main/java/com/glassly/bluetoothsdk/otaserver/LocalOtaServer.kt +304 -0
  163. package/android/src/main/java/com/glassly/bluetoothsdk/otaserver/OtaServerModule.kt +120 -0
  164. package/android/src/main/java/com/glassly/bluetoothsdk/photoreceiver/LocalPhotoReceiverRegistry.java +108 -0
  165. package/android/src/main/java/com/glassly/bluetoothsdk/photoreceiver/LocalPhotoUploadServer.kt +622 -0
  166. package/android/src/main/java/com/glassly/bluetoothsdk/photoreceiver/PhotoReceiverModule.kt +156 -0
  167. package/android/src/main/java/com/glassly/bluetoothsdk/requests/DisplayRequests.kt +56 -0
  168. package/android/src/main/java/com/glassly/bluetoothsdk/services/Foreground.kt +272 -0
  169. package/android/src/main/java/com/glassly/bluetoothsdk/services/PhoneMic.kt +1195 -0
  170. package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/Ar99.java +2653 -0
  171. package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/BesOtaHeartbeatGuard.kt +49 -0
  172. package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/BesOtaProgressMapper.kt +27 -0
  173. package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G1.kt +3878 -0
  174. package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G1TextSanitizer.kt +38 -0
  175. package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2.kt +6428 -0
  176. package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2CfwClassification.kt +49 -0
  177. package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2CfwRenderer.kt +1241 -0
  178. package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2CfwTextureCache.kt +270 -0
  179. package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2FlashProtocol.kt +291 -0
  180. package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2Flasher.kt +411 -0
  181. package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/GlasslyBle.java +43189 -0
  182. package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/Mach1.kt +1280 -0
  183. package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/MentraLive.kt +10817 -0
  184. package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/MentraLiveL2capChannel.kt +274 -0
  185. package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/MentraLivePairingAdvertisement.kt +54 -0
  186. package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/MentraNex.kt +2011 -0
  187. package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/Nimo.kt +2532 -0
  188. package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/SGCManager.kt +470 -0
  189. package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/Simulated.kt +228 -0
  190. package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/ar99/ota/Ar99OtaManager.java +566 -0
  191. package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/ar99/ota/OtaByteUtils.java +18 -0
  192. package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/ar99/ota/OtaCommandConstants.java +35 -0
  193. package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/ar99/ota/OtaCrc32Util.java +13 -0
  194. package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/ar99/ota/OtaGattTransport.java +11 -0
  195. package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/ar99/ota/OtaProtocol.java +92 -0
  196. package/android/src/main/java/com/glassly/bluetoothsdk/speakerid/SpeakerIdEngine.kt +525 -0
  197. package/android/src/main/java/com/glassly/bluetoothsdk/status/DeviceStatus.kt +669 -0
  198. package/android/src/main/java/com/glassly/bluetoothsdk/status/RuntimeState.kt +201 -0
  199. package/android/src/main/java/com/glassly/bluetoothsdk/status/WifiHotspotStatus.kt +189 -0
  200. package/android/src/main/java/com/glassly/bluetoothsdk/streaming/StreamModels.kt +518 -0
  201. package/android/src/main/java/com/glassly/bluetoothsdk/stt/STTTools.kt +391 -0
  202. package/android/src/main/java/com/glassly/bluetoothsdk/stt/SherpaOnnxTranscriber.kt +518 -0
  203. package/android/src/main/java/com/glassly/bluetoothsdk/stt/VadGateSpeechPolicy.kt +229 -0
  204. package/android/src/main/java/com/glassly/bluetoothsdk/tts/TTSTools.kt +248 -0
  205. package/android/src/main/java/com/glassly/bluetoothsdk/types/DeviceModels.kt +96 -0
  206. package/android/src/main/java/com/glassly/bluetoothsdk/utils/AES.java +106 -0
  207. package/android/src/main/java/com/glassly/bluetoothsdk/utils/AudioSessionMonitor.kt +189 -0
  208. package/android/src/main/java/com/glassly/bluetoothsdk/utils/AvifExifStripper.java +573 -0
  209. package/android/src/main/java/com/glassly/bluetoothsdk/utils/BitmapJavaUtils.java +169 -0
  210. package/android/src/main/java/com/glassly/bluetoothsdk/utils/BleJsonCompact.java +496 -0
  211. package/android/src/main/java/com/glassly/bluetoothsdk/utils/BlePhotoUploadService.java +677 -0
  212. package/android/src/main/java/com/glassly/bluetoothsdk/utils/BleWireProtocol.java +108 -0
  213. package/android/src/main/java/com/glassly/bluetoothsdk/utils/Constants.kt +46 -0
  214. package/android/src/main/java/com/glassly/bluetoothsdk/utils/G1Text.kt +436 -0
  215. package/android/src/main/java/com/glassly/bluetoothsdk/utils/HeifExifTagReader.java +199 -0
  216. package/android/src/main/java/com/glassly/bluetoothsdk/utils/IncidentLogBleRelayNaming.java +29 -0
  217. package/android/src/main/java/com/glassly/bluetoothsdk/utils/IncidentLogBleUploadService.java +77 -0
  218. package/android/src/main/java/com/glassly/bluetoothsdk/utils/K900LengthCodec.java +115 -0
  219. package/android/src/main/java/com/glassly/bluetoothsdk/utils/K900ProtocolUtils.java +827 -0
  220. package/android/src/main/java/com/glassly/bluetoothsdk/utils/MessageChunkReassembler.java +228 -0
  221. package/android/src/main/java/com/glassly/bluetoothsdk/utils/MessageChunker.java +325 -0
  222. package/android/src/main/java/com/glassly/bluetoothsdk/utils/NexSGCUtils.kt +698 -0
  223. package/android/src/main/java/com/glassly/bluetoothsdk/utils/PhoneAudioMonitor.kt +348 -0
  224. package/android/src/main/java/com/glassly/bluetoothsdk/utils/SmartGlassesConnectionState.java +9 -0
  225. package/android/src/main/java/com/glassly/bluetoothsdk/utils/audio/Ar99OpusPcmDecoder.java +398 -0
  226. package/android/src/main/java/com/glassly/bluetoothsdk/utils/audio/ByteUtilAudioPlayer.java +655 -0
  227. package/android/src/main/java/com/glassly/bluetoothsdk/utils/audio/Lc3Player.java +441 -0
  228. package/android/src/main/java/com/glassly/bluetoothsdk/utils/audio/PCMAudioPlayer.java +431 -0
  229. package/android/src/main/java/com/glassly/bluetoothsdk/utils/audio/PcmStreamPlayer.kt +328 -0
  230. package/android/src/main/res/values/strings.xml +4 -0
  231. package/android/src/test/java/com/glassly/bluetoothsdk/BluetoothSdkExceptionTest.kt +18 -0
  232. package/android/src/test/java/com/glassly/bluetoothsdk/OtaManifestDowngradeTest.kt +86 -0
  233. package/android/src/test/java/com/glassly/bluetoothsdk/OtaStartResponsePolicyTest.kt +30 -0
  234. package/android/src/test/java/com/glassly/bluetoothsdk/ReleaseChangelogTest.kt +13 -0
  235. package/android/src/test/java/com/glassly/bluetoothsdk/ScopedNetworkReadinessTest.kt +39 -0
  236. package/android/src/test/java/com/glassly/bluetoothsdk/StreamStatusEventTest.kt +29 -0
  237. package/android/src/test/java/com/glassly/bluetoothsdk/camera/PhotoRequestTest.kt +141 -0
  238. package/android/src/test/java/com/glassly/bluetoothsdk/otaserver/LocalOtaServerTest.kt +82 -0
  239. package/android/src/test/java/com/glassly/bluetoothsdk/photoreceiver/LocalPhotoReceiverRegistryTest.java +75 -0
  240. package/android/src/test/java/com/glassly/bluetoothsdk/services/ForegroundServiceTypeTest.kt +69 -0
  241. package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/Ar99AdvertisementMatcherTest.java +22 -0
  242. package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/BesOtaHeartbeatGuardTest.kt +73 -0
  243. package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/BesOtaProgressMapperTest.kt +67 -0
  244. package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/EvenRleTest.kt +63 -0
  245. package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/G1TextSanitizerTest.kt +31 -0
  246. package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/G2CfwClassificationTest.kt +89 -0
  247. package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/G2CfwRendererTest.kt +344 -0
  248. package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/G2CfwTextureCacheTest.kt +200 -0
  249. package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/G2FlashProtocolTest.kt +131 -0
  250. package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/MentraLiveGattCharacteristicsTest.kt +39 -0
  251. package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/MentraLivePairingAdvertisementParserTest.kt +133 -0
  252. package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/NimoProtocolTest.kt +333 -0
  253. package/android/src/test/java/com/glassly/bluetoothsdk/utils/AvifExifStripperTest.java +46 -0
  254. package/android/src/test/java/com/glassly/bluetoothsdk/utils/BinaryMessageChunkerTest.java +84 -0
  255. package/android/src/test/java/com/glassly/bluetoothsdk/utils/BleJsonCompactTest.java +319 -0
  256. package/android/src/test/java/com/glassly/bluetoothsdk/utils/BlePhotoUploadServiceTest.java +107 -0
  257. package/android/src/test/java/com/glassly/bluetoothsdk/utils/K900ProtocolUtilsEndiannessTest.java +172 -0
  258. package/android/src/test/java/com/glassly/bluetoothsdk/utils/K900ProtocolUtilsTest.java +24 -0
  259. package/android/src/test/java/com/glassly/bluetoothsdk/utils/PhoneAudioMonitorTest.kt +45 -0
  260. package/android/src/test/resources/avif_with_exif.avif +0 -0
  261. package/app.plugin.js +3 -0
  262. package/build/BluetoothSdk.types.d.ts +1354 -0
  263. package/build/BluetoothSdk.types.d.ts.map +1 -0
  264. package/build/BluetoothSdk.types.js +41 -0
  265. package/build/BluetoothSdk.types.js.map +1 -0
  266. package/build/_internal.d.ts +17 -0
  267. package/build/_internal.d.ts.map +1 -0
  268. package/build/_internal.js +16 -0
  269. package/build/_internal.js.map +1 -0
  270. package/build/_private/BluetoothSdkModule.d.ts +172 -0
  271. package/build/_private/BluetoothSdkModule.d.ts.map +1 -0
  272. package/build/_private/BluetoothSdkModule.js +300 -0
  273. package/build/_private/BluetoothSdkModule.js.map +1 -0
  274. package/build/_private/LocalNetworkModule.d.ts +38 -0
  275. package/build/_private/LocalNetworkModule.d.ts.map +1 -0
  276. package/build/_private/LocalNetworkModule.js +3 -0
  277. package/build/_private/LocalNetworkModule.js.map +1 -0
  278. package/build/_private/cameraRequestPayload.d.ts +4 -0
  279. package/build/_private/cameraRequestPayload.d.ts.map +1 -0
  280. package/build/_private/cameraRequestPayload.js +32 -0
  281. package/build/_private/cameraRequestPayload.js.map +1 -0
  282. package/build/_private/photoRequestPayload.d.ts +6 -0
  283. package/build/_private/photoRequestPayload.d.ts.map +1 -0
  284. package/build/_private/photoRequestPayload.js +86 -0
  285. package/build/_private/photoRequestPayload.js.map +1 -0
  286. package/build/_private/sdkOtaManifest.d.ts +11 -0
  287. package/build/_private/sdkOtaManifest.d.ts.map +1 -0
  288. package/build/_private/sdkOtaManifest.js +15 -0
  289. package/build/_private/sdkOtaManifest.js.map +1 -0
  290. package/build/changelogs.d.ts +7 -0
  291. package/build/changelogs.d.ts.map +1 -0
  292. package/build/changelogs.js +46 -0
  293. package/build/changelogs.js.map +1 -0
  294. package/build/debug.d.ts +3 -0
  295. package/build/debug.d.ts.map +1 -0
  296. package/build/debug.js +8 -0
  297. package/build/debug.js.map +1 -0
  298. package/build/generated/changelogCatalog.d.ts +9 -0
  299. package/build/generated/changelogCatalog.d.ts.map +1 -0
  300. package/build/generated/changelogCatalog.js +12 -0
  301. package/build/generated/changelogCatalog.js.map +1 -0
  302. package/build/generated/releaseMetadata.d.ts +12 -0
  303. package/build/generated/releaseMetadata.d.ts.map +1 -0
  304. package/build/generated/releaseMetadata.js +10 -0
  305. package/build/generated/releaseMetadata.js.map +1 -0
  306. package/build/index.d.ts +6 -0
  307. package/build/index.d.ts.map +1 -0
  308. package/build/index.js +171 -0
  309. package/build/index.js.map +1 -0
  310. package/build/ota-server/OtaServer.types.d.ts +14 -0
  311. package/build/ota-server/OtaServer.types.d.ts.map +1 -0
  312. package/build/ota-server/OtaServer.types.js +2 -0
  313. package/build/ota-server/OtaServer.types.js.map +1 -0
  314. package/build/ota-server/OtaServerModule.d.ts +21 -0
  315. package/build/ota-server/OtaServerModule.d.ts.map +1 -0
  316. package/build/ota-server/OtaServerModule.js +3 -0
  317. package/build/ota-server/OtaServerModule.js.map +1 -0
  318. package/build/ota-server/OtaServerModule.web.d.ts +10 -0
  319. package/build/ota-server/OtaServerModule.web.d.ts.map +1 -0
  320. package/build/ota-server/OtaServerModule.web.js +12 -0
  321. package/build/ota-server/OtaServerModule.web.js.map +1 -0
  322. package/build/ota-server/index.d.ts +3 -0
  323. package/build/ota-server/index.d.ts.map +1 -0
  324. package/build/ota-server/index.js +3 -0
  325. package/build/ota-server/index.js.map +1 -0
  326. package/build/ota-transport/index.d.ts +67 -0
  327. package/build/ota-transport/index.d.ts.map +1 -0
  328. package/build/ota-transport/index.js +58 -0
  329. package/build/ota-transport/index.js.map +1 -0
  330. package/build/photo-receiver/PhotoReceiver.types.d.ts +18 -0
  331. package/build/photo-receiver/PhotoReceiver.types.d.ts.map +1 -0
  332. package/build/photo-receiver/PhotoReceiver.types.js +2 -0
  333. package/build/photo-receiver/PhotoReceiver.types.js.map +1 -0
  334. package/build/photo-receiver/PhotoReceiverModule.d.ts +10 -0
  335. package/build/photo-receiver/PhotoReceiverModule.d.ts.map +1 -0
  336. package/build/photo-receiver/PhotoReceiverModule.js +3 -0
  337. package/build/photo-receiver/PhotoReceiverModule.js.map +1 -0
  338. package/build/photo-receiver/PhotoReceiverModule.web.d.ts +10 -0
  339. package/build/photo-receiver/PhotoReceiverModule.web.d.ts.map +1 -0
  340. package/build/photo-receiver/PhotoReceiverModule.web.js +12 -0
  341. package/build/photo-receiver/PhotoReceiverModule.web.js.map +1 -0
  342. package/build/photo-receiver/index.d.ts +3 -0
  343. package/build/photo-receiver/index.d.ts.map +1 -0
  344. package/build/photo-receiver/index.js +3 -0
  345. package/build/photo-receiver/index.js.map +1 -0
  346. package/build/react/index.d.ts +5 -0
  347. package/build/react/index.d.ts.map +1 -0
  348. package/build/react/index.js +4 -0
  349. package/build/react/index.js.map +1 -0
  350. package/build/react/useBluetooth.d.ts +100 -0
  351. package/build/react/useBluetooth.d.ts.map +1 -0
  352. package/build/react/useBluetooth.js +167 -0
  353. package/build/react/useBluetooth.js.map +1 -0
  354. package/build/react/useBluetoothEvent.d.ts +6 -0
  355. package/build/react/useBluetoothEvent.d.ts.map +1 -0
  356. package/build/react/useBluetoothEvent.js +21 -0
  357. package/build/react/useBluetoothEvent.js.map +1 -0
  358. package/build/react/useBluetoothScan.d.ts +22 -0
  359. package/build/react/useBluetoothScan.d.ts.map +1 -0
  360. package/build/react/useBluetoothScan.js +135 -0
  361. package/build/react/useBluetoothScan.js.map +1 -0
  362. package/build/react/useBluetoothStatus.d.ts +16 -0
  363. package/build/react/useBluetoothStatus.d.ts.map +1 -0
  364. package/build/react/useBluetoothStatus.js +137 -0
  365. package/build/react/useBluetoothStatus.js.map +1 -0
  366. package/build/react/useGlassesConnection.d.ts +29 -0
  367. package/build/react/useGlassesConnection.d.ts.map +1 -0
  368. package/build/react/useGlassesConnection.js +153 -0
  369. package/build/react/useGlassesConnection.js.map +1 -0
  370. package/build/types/index.d.ts +3 -0
  371. package/build/types/index.d.ts.map +1 -0
  372. package/build/types/index.js +2 -0
  373. package/build/types/index.js.map +1 -0
  374. package/expo-module.config.json +14 -0
  375. package/ios/BackgroundOtaArtifactDownloader.swift +125 -0
  376. package/ios/BluetoothSdkModule.swift +1034 -0
  377. package/ios/GlasslyBluetoothSDK.podspec +106 -0
  378. package/ios/LocalIPv4.swift +150 -0
  379. package/ios/LocalOtaServer.swift +309 -0
  380. package/ios/LocalPhotoUploadServer.swift +754 -0
  381. package/ios/OtaServerModule.swift +147 -0
  382. package/ios/Packages/CoreObjC/CoreObjC.xcodeproj/project.pbxproj +213 -0
  383. package/ios/Packages/CoreObjC/PcmConverter.h +22 -0
  384. package/ios/Packages/CoreObjC/PcmConverter.m +266 -0
  385. package/ios/Packages/CoreObjC/attdet.c +92 -0
  386. package/ios/Packages/CoreObjC/attdet.h +44 -0
  387. package/ios/Packages/CoreObjC/bits.c +375 -0
  388. package/ios/Packages/CoreObjC/bits.h +315 -0
  389. package/ios/Packages/CoreObjC/bwdet.c +129 -0
  390. package/ios/Packages/CoreObjC/bwdet.h +69 -0
  391. package/ios/Packages/CoreObjC/common.h +151 -0
  392. package/ios/Packages/CoreObjC/energy.c +70 -0
  393. package/ios/Packages/CoreObjC/energy.h +43 -0
  394. package/ios/Packages/CoreObjC/fastmath.h +158 -0
  395. package/ios/Packages/CoreObjC/include/PcmConverter.h +22 -0
  396. package/ios/Packages/CoreObjC/lc3.c +704 -0
  397. package/ios/Packages/CoreObjC/lc3.h +313 -0
  398. package/ios/Packages/CoreObjC/lc3_cpp.h +283 -0
  399. package/ios/Packages/CoreObjC/lc3_private.h +163 -0
  400. package/ios/Packages/CoreObjC/ltpf.c +905 -0
  401. package/ios/Packages/CoreObjC/ltpf.h +111 -0
  402. package/ios/Packages/CoreObjC/ltpf_arm.h +506 -0
  403. package/ios/Packages/CoreObjC/ltpf_neon.h +281 -0
  404. package/ios/Packages/CoreObjC/makefile.mk +35 -0
  405. package/ios/Packages/CoreObjC/mdct.c +469 -0
  406. package/ios/Packages/CoreObjC/mdct.h +57 -0
  407. package/ios/Packages/CoreObjC/mdct_neon.h +296 -0
  408. package/ios/Packages/CoreObjC/meson.build +61 -0
  409. package/ios/Packages/CoreObjC/plc.c +61 -0
  410. package/ios/Packages/CoreObjC/plc.h +57 -0
  411. package/ios/Packages/CoreObjC/rnnoise.h +114 -0
  412. package/ios/Packages/CoreObjC/sns.c +880 -0
  413. package/ios/Packages/CoreObjC/sns.h +103 -0
  414. package/ios/Packages/CoreObjC/spec.c +907 -0
  415. package/ios/Packages/CoreObjC/spec.h +119 -0
  416. package/ios/Packages/CoreObjC/tables.c +3457 -0
  417. package/ios/Packages/CoreObjC/tables.h +94 -0
  418. package/ios/Packages/CoreObjC/tns.c +457 -0
  419. package/ios/Packages/CoreObjC/tns.h +99 -0
  420. package/ios/Packages/SherpaOnnx/Model/joiner.onnx +0 -0
  421. package/ios/Packages/SherpaOnnx/Model/tokens.txt +502 -0
  422. package/ios/Packages/SherpaOnnx/SherpaOnnx.swift +2383 -0
  423. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/Info.plist +48 -0
  424. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64/Headers/sherpa-onnx/c-api/c-api.h +4689 -0
  425. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64/Headers/sherpa-onnx/c-api/cxx-api.h +2036 -0
  426. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64/libsherpa-onnx.a +0 -0
  427. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64_x86_64-simulator/Headers/sherpa-onnx/c-api/c-api.h +4689 -0
  428. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64_x86_64-simulator/Headers/sherpa-onnx/c-api/cxx-api.h +2036 -0
  429. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64_x86_64-simulator/libsherpa-onnx.a +0 -0
  430. package/ios/Packages/libbz2/module.modulemap +5 -0
  431. package/ios/Packages/libbz2/shim.h +1 -0
  432. package/ios/PhotoReceiverModule.swift +129 -0
  433. package/ios/Source/BluetoothSDK.swift +2303 -0
  434. package/ios/Source/BluetoothSDKDebug.swift +12 -0
  435. package/ios/Source/BluetoothSdkDefaults.swift +29 -0
  436. package/ios/Source/Bridge.swift +708 -0
  437. package/ios/Source/Bridging-Header.h +16 -0
  438. package/ios/Source/DeviceManager.swift +2109 -0
  439. package/ios/Source/DeviceStore.swift +336 -0
  440. package/ios/Source/GeneratedChangelogCatalog.swift +7 -0
  441. package/ios/Source/GeneratedReleaseMetadata.swift +11 -0
  442. package/ios/Source/ObservableStore.swift +118 -0
  443. package/ios/Source/OtaManifest.swift +211 -0
  444. package/ios/Source/PrivacyInfo.xcprivacy +23 -0
  445. package/ios/Source/ReleaseChangelog.swift +65 -0
  446. package/ios/Source/Resources/G2Firmware/README.md +10 -0
  447. package/ios/Source/audio/AudioModels.swift +178 -0
  448. package/ios/Source/audio/PcmStreamPlayer.swift +410 -0
  449. package/ios/Source/camera/CameraModels.swift +866 -0
  450. package/ios/Source/connection/ScanSession.swift +27 -0
  451. package/ios/Source/controllers/ControllerManager.swift +184 -0
  452. package/ios/Source/controllers/R1.swift +829 -0
  453. package/ios/Source/errors/BluetoothSdkError.swift +19 -0
  454. package/ios/Source/events/BluetoothEvents.swift +342 -0
  455. package/ios/Source/internal/BleTraceLogger.swift +192 -0
  456. package/ios/Source/internal/BluetoothAvailability.swift +78 -0
  457. package/ios/Source/internal/BluetoothSdkAnalytics.swift +199 -0
  458. package/ios/Source/internal/ValueParsing.swift +99 -0
  459. package/ios/Source/requests/DisplayRequests.swift +82 -0
  460. package/ios/Source/services/PhoneMic.swift +662 -0
  461. package/ios/Source/sgcs/Ar99.swift +2451 -0
  462. package/ios/Source/sgcs/Frame.swift +649 -0
  463. package/ios/Source/sgcs/G1.swift +2554 -0
  464. package/ios/Source/sgcs/G2.swift +6887 -0
  465. package/ios/Source/sgcs/G2CfwClassification.swift +43 -0
  466. package/ios/Source/sgcs/G2CfwRenderer.swift +1279 -0
  467. package/ios/Source/sgcs/G2CfwTextureCache.swift +233 -0
  468. package/ios/Source/sgcs/G2FlashProtocol.swift +312 -0
  469. package/ios/Source/sgcs/G2Flasher.swift +773 -0
  470. package/ios/Source/sgcs/Mach1.swift +541 -0
  471. package/ios/Source/sgcs/MentraLive.swift +7011 -0
  472. package/ios/Source/sgcs/MentraLiveL2capChannel.swift +183 -0
  473. package/ios/Source/sgcs/MentraLivePairingAdvertisement.swift +64 -0
  474. package/ios/Source/sgcs/MentraNex.swift +3221 -0
  475. package/ios/Source/sgcs/Nimo.swift +1886 -0
  476. package/ios/Source/sgcs/SGCManager.swift +608 -0
  477. package/ios/Source/sgcs/Simulated.swift +274 -0
  478. package/ios/Source/sgcs/ar99/ota/Ar99OtaManager.swift +637 -0
  479. package/ios/Source/sgcs/glassly_ble.pb.swift +4354 -0
  480. package/ios/Source/speakerid/SpeakerIdEngine.swift +573 -0
  481. package/ios/Source/status/DeviceStatus.swift +981 -0
  482. package/ios/Source/status/RuntimeState.swift +359 -0
  483. package/ios/Source/status/WifiHotspotStatus.swift +345 -0
  484. package/ios/Source/streaming/StreamModels.swift +693 -0
  485. package/ios/Source/stt/STTTools.swift +191 -0
  486. package/ios/Source/stt/SherpaOnnxTranscriber.swift +466 -0
  487. package/ios/Source/tts/TTSTools.swift +171 -0
  488. package/ios/Source/types/DeviceModels.swift +177 -0
  489. package/ios/Source/utils/AudioSessionMonitor.swift +283 -0
  490. package/ios/Source/utils/BinaryCodec.swift +61 -0
  491. package/ios/Source/utils/BleJsonCompact.swift +405 -0
  492. package/ios/Source/utils/BleWireProtocol.swift +92 -0
  493. package/ios/Source/utils/Constants.swift +78 -0
  494. package/ios/Source/utils/Enums.swift +95 -0
  495. package/ios/Source/utils/G1Text.swift +2096 -0
  496. package/ios/Source/utils/JSCExperiment.swift +241 -0
  497. package/ios/Source/utils/MemoryMonitor.swift +44 -0
  498. package/ios/Source/utils/MessageChunkReassembler.swift +190 -0
  499. package/ios/Source/utils/MessageChunker.swift +294 -0
  500. package/ios/Source/utils/Models.swift +135 -0
  501. package/ios/Source/utils/PhoneAudioMonitor.swift +230 -0
  502. package/ios/Source/utils/TarBz2Extractor.swift +257 -0
  503. package/ios/Tests/BluetoothSDKTests/G2CfwClassificationTests.swift +78 -0
  504. package/ios/Tests/BluetoothSDKTests/G2CfwRendererTests.swift +372 -0
  505. package/ios/Tests/BluetoothSDKTests/G2CfwTextureCacheTests.swift +162 -0
  506. package/ios/Tests/BluetoothSDKTests/G2FlashProtocolTests.swift +182 -0
  507. package/ios/Tests/MentraLivePairingAdvertisementTests.swift +160 -0
  508. package/ios/Tests/ReleaseChangelogTests.swift +13 -0
  509. package/package.json +129 -0
  510. package/plugin/build/index.d.ts +10 -0
  511. package/plugin/build/index.js +12 -0
  512. package/plugin/build/withAndroid.d.ts +3 -0
  513. package/plugin/build/withAndroid.js +190 -0
  514. package/plugin/build/withIos.d.ts +5 -0
  515. package/plugin/build/withIos.js +108 -0
  516. package/scripts/inject-ios-sdk-version.mjs +65 -0
  517. package/scripts/public-ota-api.test.mjs +37 -0
  518. package/scripts/verify-release-package.mjs +45 -0
  519. package/scripts/write-release-metadata.mjs +152 -0
  520. package/scripts/write-release-metadata.test.mjs +37 -0
  521. package/src/BluetoothSdk.types.ts +1623 -0
  522. package/src/_internal.ts +16 -0
  523. package/src/_private/BluetoothSdkModule.ts +684 -0
  524. package/src/_private/LocalNetworkModule.ts +50 -0
  525. package/src/_private/cameraRequestPayload.ts +34 -0
  526. package/src/_private/photoRequestPayload.ts +90 -0
  527. package/src/_private/sdkOtaManifest.ts +18 -0
  528. package/src/changelogs.ts +46 -0
  529. package/src/debug.ts +9 -0
  530. package/src/generated/changelogCatalog.ts +13 -0
  531. package/src/generated/releaseMetadata.ts +20 -0
  532. package/src/index.ts +321 -0
  533. package/src/ota-server/OtaServer.types.ts +10 -0
  534. package/src/ota-server/OtaServerModule.ts +23 -0
  535. package/src/ota-server/OtaServerModule.web.ts +17 -0
  536. package/src/ota-server/index.ts +2 -0
  537. package/src/ota-transport/index.ts +116 -0
  538. package/src/photo-receiver/PhotoReceiver.types.ts +20 -0
  539. package/src/photo-receiver/PhotoReceiverModule.ts +11 -0
  540. package/src/photo-receiver/PhotoReceiverModule.web.ts +17 -0
  541. package/src/photo-receiver/index.ts +2 -0
  542. package/src/react/index.ts +21 -0
  543. package/src/react/useBluetooth.ts +309 -0
  544. package/src/react/useBluetoothEvent.ts +35 -0
  545. package/src/react/useBluetoothScan.ts +173 -0
  546. package/src/react/useBluetoothStatus.ts +180 -0
  547. package/src/react/useGlassesConnection.ts +202 -0
  548. package/src/types/index.ts +12 -0
@@ -0,0 +1,111 @@
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 - Long Term Postfilter
21
+ *
22
+ * Reference : Low Complexity Communication Codec (LC3)
23
+ * Bluetooth Specification v1.0
24
+ */
25
+
26
+ #ifndef __LC3_LTPF_H
27
+ #define __LC3_LTPF_H
28
+
29
+ #include "common.h"
30
+ #include "bits.h"
31
+
32
+
33
+ /**
34
+ * LTPF data
35
+ */
36
+
37
+ typedef struct lc3_ltpf_data {
38
+ bool active;
39
+ int pitch_index;
40
+ } lc3_ltpf_data_t;
41
+
42
+
43
+ /* ----------------------------------------------------------------------------
44
+ * Encoding
45
+ * -------------------------------------------------------------------------- */
46
+
47
+ /**
48
+ * LTPF analysis
49
+ * dt, sr Duration and samplerate of the frame
50
+ * ltpf Context of analysis
51
+ * allowed True when activation of LTPF is allowed
52
+ * x [-d..-1] Previous, [0..ns-1] Current samples
53
+ * data Return bitstream data
54
+ * return True when pitch present, False otherwise
55
+ *
56
+ * The `x` vector is aligned on 32 bits
57
+ * The number of previous samples `d` accessed on `x` is :
58
+ * d: { 10, 20, 30, 40, 60 } - 1 for samplerates from 8KHz to 48KHz
59
+ */
60
+ bool lc3_ltpf_analyse(enum lc3_dt dt, enum lc3_srate sr,
61
+ lc3_ltpf_analysis_t *ltpf, const int16_t *x, lc3_ltpf_data_t *data);
62
+
63
+ /**
64
+ * LTPF disable
65
+ * data LTPF data, disabled activation on return
66
+ */
67
+ void lc3_ltpf_disable(lc3_ltpf_data_t *data);
68
+
69
+ /**
70
+ * Return number of bits coding the bitstream data
71
+ * pitch True when pitch present, False otherwise
72
+ * return Bit consumption, including the pitch present flag
73
+ */
74
+ int lc3_ltpf_get_nbits(bool pitch);
75
+
76
+ /**
77
+ * Put bitstream data
78
+ * bits Bitstream context
79
+ * data LTPF data
80
+ */
81
+ void lc3_ltpf_put_data(lc3_bits_t *bits, const lc3_ltpf_data_t *data);
82
+
83
+
84
+ /* ----------------------------------------------------------------------------
85
+ * Decoding
86
+ * -------------------------------------------------------------------------- */
87
+ /**
88
+ * Get bitstream data
89
+ * bits Bitstream context
90
+ * data Return bitstream data
91
+ */
92
+ void lc3_ltpf_get_data(lc3_bits_t *bits, lc3_ltpf_data_t *data);
93
+
94
+ /**
95
+ * LTPF synthesis
96
+ * dt, sr Duration and samplerate of the frame
97
+ * nbytes Size in bytes of the frame
98
+ * ltpf Context of synthesis
99
+ * data Bitstream data, NULL when pitch not present
100
+ * xr Base address of ring buffer of decoded samples
101
+ * x Samples to proceed in the ring buffer, filtered as output
102
+ *
103
+ * The size of the ring buffer is `nh + ns`.
104
+ * The filtering needs an history of at least 18 ms.
105
+ */
106
+ void lc3_ltpf_synthesize(enum lc3_dt dt, enum lc3_srate sr, int nbytes,
107
+ lc3_ltpf_synthesis_t *ltpf, const lc3_ltpf_data_t *data,
108
+ const float *xr, float *x);
109
+
110
+
111
+ #endif /* __LC3_LTPF_H */
@@ -0,0 +1,506 @@
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
+ #if __ARM_FEATURE_SIMD32 || defined(TEST_ARM)
20
+
21
+ #ifndef TEST_ARM
22
+
23
+ #include <arm_acle.h>
24
+
25
+ static inline int16x2_t __pkhbt(int16x2_t a, int16x2_t b)
26
+ {
27
+ int16x2_t r;
28
+ __asm("pkhbt %0, %1, %2" : "=r" (r) : "r" (a), "r" (b));
29
+ return r;
30
+ }
31
+
32
+ #endif /* TEST_ARM */
33
+
34
+
35
+ /**
36
+ * Import
37
+ */
38
+
39
+ static inline int32_t filter_hp50(struct lc3_ltpf_hp50_state *, int32_t);
40
+ static inline float dot(const int16_t *, const int16_t *, int);
41
+
42
+
43
+ /**
44
+ * Resample from 8 / 16 / 32 KHz to 12.8 KHz Template
45
+ */
46
+ #if !defined(resample_8k_12k8) || !defined(resample_16k_12k8) \
47
+ || !defined(resample_32k_12k8)
48
+ static inline void arm_resample_x64k_12k8(const int p, const int16x2_t *h,
49
+ struct lc3_ltpf_hp50_state *hp50, const int16x2_t *x, int16_t *y, int n)
50
+ {
51
+ const int w = 40 / p;
52
+
53
+ x -= w;
54
+
55
+ for (int i = 0; i < 5*n; i += 5) {
56
+ const int16x2_t *hn = h + (i % (2*p)) * (48 / p);
57
+ const int16x2_t *xn = x + (i / (2*p));
58
+
59
+ int32_t un = __smlad(*(xn++), *(hn++), 0);
60
+
61
+ for (int k = 0; k < w; k += 5) {
62
+ un = __smlad(*(xn++), *(hn++), un);
63
+ un = __smlad(*(xn++), *(hn++), un);
64
+ un = __smlad(*(xn++), *(hn++), un);
65
+ un = __smlad(*(xn++), *(hn++), un);
66
+ un = __smlad(*(xn++), *(hn++), un);
67
+ }
68
+
69
+ int32_t yn = filter_hp50(hp50, un);
70
+ *(y++) = (yn + (1 << 15)) >> 16;
71
+ }
72
+ }
73
+ #endif
74
+
75
+ /**
76
+ * Resample from 24 / 48 KHz to 12.8 KHz Template
77
+ */
78
+ #if !defined(resample_24k_12k8) || !defined(resample_48k_12k8)
79
+ static inline void arm_resample_x192k_12k8(const int p, const int16x2_t *h,
80
+ struct lc3_ltpf_hp50_state *hp50, const int16x2_t *x, int16_t *y, int n)
81
+ {
82
+ const int w = 120 / p;
83
+
84
+ x -= w;
85
+
86
+ for (int i = 0; i < 15*n; i += 15) {
87
+ const int16x2_t *hn = h + (i % (2*p)) * (128 / p);
88
+ const int16x2_t *xn = x + (i / (2*p));
89
+
90
+ int32_t un = __smlad(*(xn++), *(hn++), 0);
91
+
92
+ for (int k = 0; k < w; k += 15) {
93
+ un = __smlad(*(xn++), *(hn++), un);
94
+ un = __smlad(*(xn++), *(hn++), un);
95
+ un = __smlad(*(xn++), *(hn++), un);
96
+ un = __smlad(*(xn++), *(hn++), un);
97
+ un = __smlad(*(xn++), *(hn++), un);
98
+ un = __smlad(*(xn++), *(hn++), un);
99
+ un = __smlad(*(xn++), *(hn++), un);
100
+ un = __smlad(*(xn++), *(hn++), un);
101
+ un = __smlad(*(xn++), *(hn++), un);
102
+ un = __smlad(*(xn++), *(hn++), un);
103
+ un = __smlad(*(xn++), *(hn++), un);
104
+ un = __smlad(*(xn++), *(hn++), un);
105
+ un = __smlad(*(xn++), *(hn++), un);
106
+ un = __smlad(*(xn++), *(hn++), un);
107
+ un = __smlad(*(xn++), *(hn++), un);
108
+ }
109
+
110
+ int32_t yn = filter_hp50(hp50, un);
111
+ *(y++) = (yn + (1 << 15)) >> 16;
112
+ }
113
+ }
114
+ #endif
115
+
116
+ /**
117
+ * Resample from 8 Khz to 12.8 KHz
118
+ */
119
+ #ifndef resample_8k_12k8
120
+
121
+ static void arm_resample_8k_12k8(
122
+ struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n)
123
+ {
124
+ static const int16_t alignas(int32_t) h[2*8*12] = {
125
+ 0, 214, 417, -1052, -4529, 26233, -4529, -1052, 417, 214, 0, 0,
126
+ 0, 180, 0, -1522, -2427, 24506, -5289, 0, 763, 156, -28, 0,
127
+ 0, 92, -323, -1361, 0, 19741, -3885, 1317, 861, 0, -61, 0,
128
+ 0, 0, -457, -752, 1873, 13068, 0, 2389, 598, -213, -79, 0,
129
+ 0, -61, -398, 0, 2686, 5997, 5997, 2686, 0, -398, -61, 0,
130
+ 0, -79, -213, 598, 2389, 0, 13068, 1873, -752, -457, 0, 0,
131
+ 0, -61, 0, 861, 1317, -3885, 19741, 0, -1361, -323, 92, 0,
132
+ 0, -28, 156, 763, 0, -5289, 24506, -2427, -1522, 0, 180, 0,
133
+ 0, 0, 214, 417, -1052, -4529, 26233, -4529, -1052, 417, 214, 0,
134
+ 0, 0, 180, 0, -1522, -2427, 24506, -5289, 0, 763, 156, -28,
135
+ 0, 0, 92, -323, -1361, 0, 19741, -3885, 1317, 861, 0, -61,
136
+ 0, 0, 0, -457, -752, 1873, 13068, 0, 2389, 598, -213, -79,
137
+ 0, 0, -61, -398, 0, 2686, 5997, 5997, 2686, 0, -398, -61,
138
+ 0, 0, -79, -213, 598, 2389, 0, 13068, 1873, -752, -457, 0,
139
+ 0, 0, -61, 0, 861, 1317, -3885, 19741, 0, -1361, -323, 92,
140
+ 0, 0, -28, 156, 763, 0, -5289, 24506, -2427, -1522, 0, 180,
141
+ };
142
+
143
+ arm_resample_x64k_12k8(
144
+ 8, (const int16x2_t *)h, hp50, (int16x2_t *)x, y, n);
145
+ }
146
+
147
+ #ifndef TEST_ARM
148
+ #define resample_8k_12k8 arm_resample_8k_12k8
149
+ #endif
150
+
151
+ #endif /* resample_8k_12k8 */
152
+
153
+ /**
154
+ * Resample from 16 Khz to 12.8 KHz
155
+ */
156
+ #ifndef resample_16k_12k8
157
+
158
+ static void arm_resample_16k_12k8(
159
+ struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n)
160
+ {
161
+ static const int16_t alignas(int32_t) h[2*4*24] = {
162
+
163
+ 0, -61, 214, -398, 417, 0, -1052, 2686,
164
+ -4529, 5997, 26233, 5997, -4529, 2686, -1052, 0,
165
+ 417, -398, 214, -61, 0, 0, 0, 0,
166
+
167
+
168
+ 0, -79, 180, -213, 0, 598, -1522, 2389,
169
+ -2427, 0, 24506, 13068, -5289, 1873, 0, -752,
170
+ 763, -457, 156, 0, -28, 0, 0, 0,
171
+
172
+
173
+ 0, -61, 92, 0, -323, 861, -1361, 1317,
174
+ 0, -3885, 19741, 19741, -3885, 0, 1317, -1361,
175
+ 861, -323, 0, 92, -61, 0, 0, 0,
176
+
177
+ 0, -28, 0, 156, -457, 763, -752, 0,
178
+ 1873, -5289, 13068, 24506, 0, -2427, 2389, -1522,
179
+ 598, 0, -213, 180, -79, 0, 0, 0,
180
+
181
+
182
+ 0, 0, -61, 214, -398, 417, 0, -1052,
183
+ 2686, -4529, 5997, 26233, 5997, -4529, 2686, -1052,
184
+ 0, 417, -398, 214, -61, 0, 0, 0,
185
+
186
+
187
+ 0, 0, -79, 180, -213, 0, 598, -1522,
188
+ 2389, -2427, 0, 24506, 13068, -5289, 1873, 0,
189
+ -752, 763, -457, 156, 0, -28, 0, 0,
190
+
191
+
192
+ 0, 0, -61, 92, 0, -323, 861, -1361,
193
+ 1317, 0, -3885, 19741, 19741, -3885, 0, 1317,
194
+ -1361, 861, -323, 0, 92, -61, 0, 0,
195
+
196
+ 0, 0, -28, 0, 156, -457, 763, -752,
197
+ 0, 1873, -5289, 13068, 24506, 0, -2427, 2389,
198
+ -1522, 598, 0, -213, 180, -79, 0, 0,
199
+ };
200
+
201
+ arm_resample_x64k_12k8(
202
+ 4, (const int16x2_t *)h, hp50, (int16x2_t *)x, y, n);
203
+ }
204
+
205
+ #ifndef TEST_ARM
206
+ #define resample_16k_12k8 arm_resample_16k_12k8
207
+ #endif
208
+
209
+ #endif /* resample_16k_12k8 */
210
+
211
+ /**
212
+ * Resample from 32 Khz to 12.8 KHz
213
+ */
214
+ #ifndef resample_32k_12k8
215
+
216
+ static void arm_resample_32k_12k8(
217
+ struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n)
218
+ {
219
+ static const int16_t alignas(int32_t) h[2*2*48] = {
220
+
221
+ 0, -30, -31, 46, 107, 0, -199, -162,
222
+ 209, 430, 0, -681, -526, 658, 1343, 0,
223
+ -2264, -1943, 2999, 9871, 13116, 9871, 2999, -1943,
224
+ -2264, 0, 1343, 658, -526, -681, 0, 430,
225
+ 209, -162, -199, 0, 107, 46, -31, -30,
226
+ 0, 0, 0, 0, 0, 0, 0, 0,
227
+
228
+ 0, -14, -39, 0, 90, 78, -106, -229,
229
+ 0, 382, 299, -376, -761, 0, 1194, 937,
230
+ -1214, -2644, 0, 6534, 12253, 12253, 6534, 0,
231
+ -2644, -1214, 937, 1194, 0, -761, -376, 299,
232
+ 382, 0, -229, -106, 78, 90, 0, -39,
233
+ -14, 0, 0, 0, 0, 0, 0, 0,
234
+
235
+ 0, 0, -30, -31, 46, 107, 0, -199,
236
+ -162, 209, 430, 0, -681, -526, 658, 1343,
237
+ 0, -2264, -1943, 2999, 9871, 13116, 9871, 2999,
238
+ -1943, -2264, 0, 1343, 658, -526, -681, 0,
239
+ 430, 209, -162, -199, 0, 107, 46, -31,
240
+ -30, 0, 0, 0, 0, 0, 0, 0,
241
+
242
+ 0, 0, -14, -39, 0, 90, 78, -106,
243
+ -229, 0, 382, 299, -376, -761, 0, 1194,
244
+ 937, -1214, -2644, 0, 6534, 12253, 12253, 6534,
245
+ 0, -2644, -1214, 937, 1194, 0, -761, -376,
246
+ 299, 382, 0, -229, -106, 78, 90, 0,
247
+ -39, -14, 0, 0, 0, 0, 0, 0,
248
+ };
249
+
250
+ arm_resample_x64k_12k8(
251
+ 2, (const int16x2_t *)h, hp50, (int16x2_t *)x, y, n);
252
+ }
253
+
254
+ #ifndef TEST_ARM
255
+ #define resample_32k_12k8 arm_resample_32k_12k8
256
+ #endif
257
+
258
+ #endif /* resample_32k_12k8 */
259
+
260
+ /**
261
+ * Resample from 24 Khz to 12.8 KHz
262
+ */
263
+ #ifndef resample_24k_12k8
264
+
265
+ static void arm_resample_24k_12k8(
266
+ struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n)
267
+ {
268
+ static const int16_t alignas(int32_t) h[2*8*32] = {
269
+
270
+ 0, -50, 19, 143, -93, -290, 278, 485,
271
+ -658, -701, 1396, 901, -3019, -1042, 10276, 17488,
272
+ 10276, -1042, -3019, 901, 1396, -701, -658, 485,
273
+ 278, -290, -93, 143, 19, -50, 0, 0,
274
+
275
+ 0, -46, 0, 141, -45, -305, 185, 543,
276
+ -501, -854, 1153, 1249, -2619, -1908, 8712, 17358,
277
+ 11772, 0, -3319, 480, 1593, -504, -796, 399,
278
+ 367, -261, -142, 138, 40, -52, -5, 0,
279
+
280
+ 0, -41, -17, 133, 0, -304, 91, 574,
281
+ -334, -959, 878, 1516, -2143, -2590, 7118, 16971,
282
+ 13161, 1202, -3495, 0, 1731, -267, -908, 287,
283
+ 445, -215, -188, 125, 62, -52, -12, 0,
284
+
285
+ 0, -34, -30, 120, 41, -291, 0, 577,
286
+ -164, -1015, 585, 1697, -1618, -3084, 5534, 16337,
287
+ 14406, 2544, -3526, -523, 1800, 0, -985, 152,
288
+ 509, -156, -230, 104, 83, -48, -19, 0,
289
+
290
+ 0, -26, -41, 103, 76, -265, -83, 554,
291
+ 0, -1023, 288, 1791, -1070, -3393, 3998, 15474,
292
+ 15474, 3998, -3393, -1070, 1791, 288, -1023, 0,
293
+ 554, -83, -265, 76, 103, -41, -26, 0,
294
+
295
+ 0, -19, -48, 83, 104, -230, -156, 509,
296
+ 152, -985, 0, 1800, -523, -3526, 2544, 14406,
297
+ 16337, 5534, -3084, -1618, 1697, 585, -1015, -164,
298
+ 577, 0, -291, 41, 120, -30, -34, 0,
299
+
300
+ 0, -12, -52, 62, 125, -188, -215, 445,
301
+ 287, -908, -267, 1731, 0, -3495, 1202, 13161,
302
+ 16971, 7118, -2590, -2143, 1516, 878, -959, -334,
303
+ 574, 91, -304, 0, 133, -17, -41, 0,
304
+
305
+ 0, -5, -52, 40, 138, -142, -261, 367,
306
+ 399, -796, -504, 1593, 480, -3319, 0, 11772,
307
+ 17358, 8712, -1908, -2619, 1249, 1153, -854, -501,
308
+ 543, 185, -305, -45, 141, 0, -46, 0,
309
+
310
+ 0, 0, -50, 19, 143, -93, -290, 278,
311
+ 485, -658, -701, 1396, 901, -3019, -1042, 10276,
312
+ 17488, 10276, -1042, -3019, 901, 1396, -701, -658,
313
+ 485, 278, -290, -93, 143, 19, -50, 0,
314
+
315
+ 0, 0, -46, 0, 141, -45, -305, 185,
316
+ 543, -501, -854, 1153, 1249, -2619, -1908, 8712,
317
+ 17358, 11772, 0, -3319, 480, 1593, -504, -796,
318
+ 399, 367, -261, -142, 138, 40, -52, -5,
319
+
320
+ 0, 0, -41, -17, 133, 0, -304, 91,
321
+ 574, -334, -959, 878, 1516, -2143, -2590, 7118,
322
+ 16971, 13161, 1202, -3495, 0, 1731, -267, -908,
323
+ 287, 445, -215, -188, 125, 62, -52, -12,
324
+
325
+ 0, 0, -34, -30, 120, 41, -291, 0,
326
+ 577, -164, -1015, 585, 1697, -1618, -3084, 5534,
327
+ 16337, 14406, 2544, -3526, -523, 1800, 0, -985,
328
+ 152, 509, -156, -230, 104, 83, -48, -19,
329
+
330
+ 0, 0, -26, -41, 103, 76, -265, -83,
331
+ 554, 0, -1023, 288, 1791, -1070, -3393, 3998,
332
+ 15474, 15474, 3998, -3393, -1070, 1791, 288, -1023,
333
+ 0, 554, -83, -265, 76, 103, -41, -26,
334
+
335
+ 0, 0, -19, -48, 83, 104, -230, -156,
336
+ 509, 152, -985, 0, 1800, -523, -3526, 2544,
337
+ 14406, 16337, 5534, -3084, -1618, 1697, 585, -1015,
338
+ -164, 577, 0, -291, 41, 120, -30, -34,
339
+
340
+ 0, 0, -12, -52, 62, 125, -188, -215,
341
+ 445, 287, -908, -267, 1731, 0, -3495, 1202,
342
+ 13161, 16971, 7118, -2590, -2143, 1516, 878, -959,
343
+ -334, 574, 91, -304, 0, 133, -17, -41,
344
+
345
+ 0, 0, -5, -52, 40, 138, -142, -261,
346
+ 367, 399, -796, -504, 1593, 480, -3319, 0,
347
+ 11772, 17358, 8712, -1908, -2619, 1249, 1153, -854,
348
+ -501, 543, 185, -305, -45, 141, 0, -46,
349
+ };
350
+
351
+ arm_resample_x192k_12k8(
352
+ 8, (const int16x2_t *)h, hp50, (int16x2_t *)x, y, n);
353
+ }
354
+
355
+ #ifndef TEST_ARM
356
+ #define resample_24k_12k8 arm_resample_24k_12k8
357
+ #endif
358
+
359
+ #endif /* resample_24k_12k8 */
360
+
361
+ /**
362
+ * Resample from 48 Khz to 12.8 KHz
363
+ */
364
+ #ifndef resample_48k_12k8
365
+
366
+ static void arm_resample_48k_12k8(
367
+ struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n)
368
+ {
369
+ static const int16_t alignas(int32_t) h[2*4*64] = {
370
+
371
+ 0, -13, -25, -20, 10, 51, 71, 38,
372
+ -47, -133, -145, -42, 139, 277, 242, 0,
373
+ -329, -511, -351, 144, 698, 895, 450, -535,
374
+ -1510, -1697, -521, 1999, 5138, 7737, 8744, 7737,
375
+ 5138, 1999, -521, -1697, -1510, -535, 450, 895,
376
+ 698, 144, -351, -511, -329, 0, 242, 277,
377
+ 139, -42, -145, -133, -47, 38, 71, 51,
378
+ 10, -20, -25, -13, 0, 0, 0, 0,
379
+
380
+ 0, -9, -23, -24, 0, 41, 71, 52,
381
+ -23, -115, -152, -78, 92, 254, 272, 76,
382
+ -251, -493, -427, 0, 576, 900, 624, -262,
383
+ -1309, -1763, -954, 1272, 4356, 7203, 8679, 8169,
384
+ 5886, 2767, 0, -1542, -1660, -809, 240, 848,
385
+ 796, 292, -252, -507, -398, -82, 199, 288,
386
+ 183, 0, -130, -145, -71, 20, 69, 60,
387
+ 20, -15, -26, -17, -3, 0, 0, 0,
388
+
389
+ 0, -6, -20, -26, -8, 31, 67, 62,
390
+ 0, -94, -152, -108, 45, 223, 287, 143,
391
+ -167, -454, -480, -134, 439, 866, 758, 0,
392
+ -1071, -1748, -1295, 601, 3559, 6580, 8485, 8485,
393
+ 6580, 3559, 601, -1295, -1748, -1071, 0, 758,
394
+ 866, 439, -134, -480, -454, -167, 143, 287,
395
+ 223, 45, -108, -152, -94, 0, 62, 67,
396
+ 31, -8, -26, -20, -6, 0, 0, 0,
397
+
398
+ 0, -3, -17, -26, -15, 20, 60, 69,
399
+ 20, -71, -145, -130, 0, 183, 288, 199,
400
+ -82, -398, -507, -252, 292, 796, 848, 240,
401
+ -809, -1660, -1542, 0, 2767, 5886, 8169, 8679,
402
+ 7203, 4356, 1272, -954, -1763, -1309, -262, 624,
403
+ 900, 576, 0, -427, -493, -251, 76, 272,
404
+ 254, 92, -78, -152, -115, -23, 52, 71,
405
+ 41, 0, -24, -23, -9, 0, 0, 0,
406
+
407
+ 0, 0, -13, -25, -20, 10, 51, 71,
408
+ 38, -47, -133, -145, -42, 139, 277, 242,
409
+ 0, -329, -511, -351, 144, 698, 895, 450,
410
+ -535, -1510, -1697, -521, 1999, 5138, 7737, 8744,
411
+ 7737, 5138, 1999, -521, -1697, -1510, -535, 450,
412
+ 895, 698, 144, -351, -511, -329, 0, 242,
413
+ 277, 139, -42, -145, -133, -47, 38, 71,
414
+ 51, 10, -20, -25, -13, 0, 0, 0,
415
+
416
+ 0, 0, -9, -23, -24, 0, 41, 71,
417
+ 52, -23, -115, -152, -78, 92, 254, 272,
418
+ 76, -251, -493, -427, 0, 576, 900, 624,
419
+ -262, -1309, -1763, -954, 1272, 4356, 7203, 8679,
420
+ 8169, 5886, 2767, 0, -1542, -1660, -809, 240,
421
+ 848, 796, 292, -252, -507, -398, -82, 199,
422
+ 288, 183, 0, -130, -145, -71, 20, 69,
423
+ 60, 20, -15, -26, -17, -3, 0, 0,
424
+
425
+ 0, 0, -6, -20, -26, -8, 31, 67,
426
+ 62, 0, -94, -152, -108, 45, 223, 287,
427
+ 143, -167, -454, -480, -134, 439, 866, 758,
428
+ 0, -1071, -1748, -1295, 601, 3559, 6580, 8485,
429
+ 8485, 6580, 3559, 601, -1295, -1748, -1071, 0,
430
+ 758, 866, 439, -134, -480, -454, -167, 143,
431
+ 287, 223, 45, -108, -152, -94, 0, 62,
432
+ 67, 31, -8, -26, -20, -6, 0, 0,
433
+
434
+ 0, 0, -3, -17, -26, -15, 20, 60,
435
+ 69, 20, -71, -145, -130, 0, 183, 288,
436
+ 199, -82, -398, -507, -252, 292, 796, 848,
437
+ 240, -809, -1660, -1542, 0, 2767, 5886, 8169,
438
+ 8679, 7203, 4356, 1272, -954, -1763, -1309, -262,
439
+ 624, 900, 576, 0, -427, -493, -251, 76,
440
+ 272, 254, 92, -78, -152, -115, -23, 52,
441
+ 71, 41, 0, -24, -23, -9, 0, 0,
442
+ };
443
+
444
+ arm_resample_x192k_12k8(
445
+ 4, (const int16x2_t *)h, hp50, (int16x2_t *)x, y, n);
446
+ }
447
+
448
+ #ifndef TEST_ARM
449
+ #define resample_48k_12k8 arm_resample_48k_12k8
450
+ #endif
451
+
452
+ #endif /* resample_48k_12k8 */
453
+
454
+ /**
455
+ * Return vector of correlations
456
+ */
457
+ #ifndef correlate
458
+
459
+ static void arm_correlate(
460
+ const int16_t *a, const int16_t *b, int n, float *y, int nc)
461
+ {
462
+ /* --- Check alignment of `b` --- */
463
+
464
+ if ((uintptr_t)b & 3)
465
+ *(y++) = dot(a, b--, n), nc--;
466
+
467
+ /* --- Processing by pair --- */
468
+
469
+ for ( ; nc >= 2; nc -= 2) {
470
+ const int16x2_t *an = (const int16x2_t *)(a );
471
+ const int16x2_t *bn = (const int16x2_t *)(b--);
472
+
473
+ int16x2_t ax, b0, b1;
474
+ int64_t v0 = 0, v1 = 0;
475
+
476
+ b1 = (int16x2_t)*(b--) << 16;
477
+
478
+ for (int i = 0; i < (n >> 4); i++ )
479
+ for (int j = 0; j < 4; j++) {
480
+
481
+ ax = *(an++), b0 = *(bn++);
482
+ v0 = __smlald (ax, b0, v0);
483
+ v1 = __smlaldx(ax, __pkhbt(b0, b1), v1);
484
+
485
+ ax = *(an++), b1 = *(bn++);
486
+ v0 = __smlald (ax, b1, v0);
487
+ v1 = __smlaldx(ax, __pkhbt(b1, b0), v1);
488
+ }
489
+
490
+ *(y++) = (float)((int32_t)((v0 + (1 << 5)) >> 6));
491
+ *(y++) = (float)((int32_t)((v1 + (1 << 5)) >> 6));
492
+ }
493
+
494
+ /* --- Odd element count --- */
495
+
496
+ if (nc > 0)
497
+ *(y++) = dot(a, b, n);
498
+ }
499
+
500
+ #ifndef TEST_ARM
501
+ #define correlate arm_correlate
502
+ #endif
503
+
504
+ #endif /* correlate */
505
+
506
+ #endif /* __ARM_FEATURE_SIMD32 */