@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.
- package/README.md +278 -0
- package/android/build.gradle +167 -0
- package/android/lc3Lib/CMakeLists.txt +6 -0
- package/android/lc3Lib/build.gradle +109 -0
- package/android/lc3Lib/proguard-rules.pro +33 -0
- package/android/lc3Lib/src/main/AndroidManifest.xml +2 -0
- package/android/lc3Lib/src/main/cpp/CMakeLists.txt +8 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/CMakeLists.txt +30 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/jni/CMakeLists.txt +7 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/jni/ogg_opus_encoder.cc +96 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/jni/ogg_opus_encoder.h +53 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/Makefile.am +6 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/config_types.h +26 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/config_types.h.in +26 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/ogg.h +209 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/os_types.h +158 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus.h +981 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_custom.h +342 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_defines.h +799 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_multistream.h +660 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_projection.h +568 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_types.h +166 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/ogg_opus_encoder.cc +268 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/ogg_opus_encoder.h +115 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/opus_tools/opus_header.h +59 -0
- package/android/lc3Lib/src/main/cpp/liblc3/CMakeLists.txt +38 -0
- package/android/lc3Lib/src/main/cpp/liblc3/include/lc3.h +309 -0
- package/android/lc3Lib/src/main/cpp/liblc3/include/lc3_private.h +162 -0
- package/android/lc3Lib/src/main/cpp/liblc3/include/rnnoise.h +114 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/CMakeLists.txt +19 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/attdet.c +92 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/attdet.h +44 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/bits.c +375 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/bits.h +315 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/bwdet.c +129 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/bwdet.h +69 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/common.h +148 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/energy.c +70 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/energy.h +43 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/fastmath.h +158 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/lc3.c +702 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/ltpf.c +893 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/ltpf.h +111 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/ltpf_arm.h +506 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/ltpf_neon.h +281 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/makefile.mk +35 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/mdct.c +452 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/mdct.h +57 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/mdct_neon.h +296 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/meson.build +46 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/plc.c +61 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/plc.h +57 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/sns.c +880 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/sns.h +103 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/spec.c +904 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/spec.h +119 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/tables.c +3457 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/tables.h +94 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/tns.c +457 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/tns.h +99 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3.cpp +159 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/_kiss_fft_guts.h +182 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/arch.h +261 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/celt_lpc.c +279 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/celt_lpc.h +59 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/common.h +48 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/compile.sh +3 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/denoise.c +646 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/kiss_fft.c +601 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/kiss_fft.h +203 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/opus_types.h +159 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/pitch.c +526 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/pitch.h +149 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn.c +178 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn.h +69 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn_data.c +11051 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn_data.h +34 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn_reader.c +168 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn_train.py +66 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/tansig_table.h +45 -0
- package/android/lc3Lib/src/main/java/com/mentra/lc3Lib/Lc3Cpp.java +38 -0
- package/android/lc3Lib/third_party/CMakeLists.txt +23 -0
- package/android/lc3Lib/third_party/CMakeLists_libogg.txt +18 -0
- package/android/lc3Lib/third_party/CMakeLists_libopus.txt +18 -0
- package/android/lc3Lib/third_party/CMakeLists_opus-tools.txt +23 -0
- package/android/lc3Lib/third_party/opus_tools/src/AUTHORS +5 -0
- package/android/lc3Lib/third_party/opus_tools/src/CMakeLists.txt +4 -0
- package/android/lc3Lib/third_party/opus_tools/src/COPYING +371 -0
- package/android/lc3Lib/third_party/opus_tools/src/ChangeLog +3 -0
- package/android/lc3Lib/third_party/opus_tools/src/Makefile.am +42 -0
- package/android/lc3Lib/third_party/opus_tools/src/Makefile.unix +23 -0
- package/android/lc3Lib/third_party/opus_tools/src/NEWS +0 -0
- package/android/lc3Lib/third_party/opus_tools/src/README +0 -0
- package/android/lc3Lib/third_party/opus_tools/src/autogen.sh +115 -0
- package/android/lc3Lib/third_party/opus_tools/src/configure.ac +293 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/arch.h +239 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/audio-in.c +1046 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/diag_range.c +245 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/diag_range.h +28 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/info_opus.c +320 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/info_opus.h +51 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/lpc.c +157 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/lpc.h +27 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/opus_header.c +286 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/opus_header.h +59 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/opusdec.c +884 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/opusenc.c +1021 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/opusenc.h +101 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/opusinfo.c +639 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/opusinfo.h +51 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/os_support.h +167 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/resample.c +1137 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/speex_resampler.h +344 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/stack_alloc.h +115 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/wav_io.c +125 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/wav_io.h +62 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/wave_out.c +223 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/wave_out.h +60 -0
- package/android/settings.gradle +1 -0
- package/android/src/main/AndroidManifest.xml +40 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/BluetoothSdkModule.kt +528 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/Bridge.kt +610 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/DeviceManager.kt +1616 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/DeviceStore.kt +314 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/MentraBluetoothModels.kt +1710 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/MentraBluetoothSdk.kt +554 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/ObservableStore.kt +68 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/controllers/ControllerManager.kt +158 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/controllers/R1.kt +934 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/services/Foreground.kt +175 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/services/PhoneMic.kt +1109 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/G1.java +3974 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/G2.kt +3551 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/Mach1.java +1327 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraLive.java +6959 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraNex.kt +1655 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraosBle.java +53675 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/SGCManager.kt +202 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/Simulated.kt +224 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/stt/STTTools.kt +340 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/stt/SherpaOnnxTranscriber.kt +465 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/stt/VadGateSpeechPolicy.kt +221 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/AES.java +106 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/AudioSessionMonitor.kt +189 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/BitmapJavaUtils.java +169 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/BlePhotoUploadService.java +179 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/Constants.kt +44 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/G1Text.kt +436 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/IncidentLogBleRelayNaming.java +29 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/IncidentLogBleUploadService.java +76 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/K900ProtocolUtils.java +791 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/MessageChunker.java +186 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/NexSGCUtils.kt +589 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/PhoneAudioMonitor.kt +303 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/SmartGlassesConnectionState.java +9 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/audio/ByteUtilAudioPlayer.java +655 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/audio/Lc3Player.java +441 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/audio/PCMAudioPlayer.java +431 -0
- package/android/src/main/res/values/strings.xml +4 -0
- package/app.plugin.js +1 -0
- package/build/BluetoothSdk.types.d.ts +498 -0
- package/build/BluetoothSdk.types.d.ts.map +1 -0
- package/build/BluetoothSdk.types.js +23 -0
- package/build/BluetoothSdk.types.js.map +1 -0
- package/build/BluetoothSdkModule.d.ts +71 -0
- package/build/BluetoothSdkModule.d.ts.map +1 -0
- package/build/BluetoothSdkModule.js +106 -0
- package/build/BluetoothSdkModule.js.map +1 -0
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +5 -0
- package/build/index.js.map +1 -0
- package/expo-module.config.json +9 -0
- package/ios/BluetoothSdkModule.swift +665 -0
- package/ios/MentraBluetoothSDK.podspec +77 -0
- package/ios/Packages/CoreObjC/CoreObjC.xcodeproj/project.pbxproj +213 -0
- package/ios/Packages/CoreObjC/PcmConverter.h +22 -0
- package/ios/Packages/CoreObjC/PcmConverter.m +266 -0
- package/ios/Packages/CoreObjC/attdet.c +92 -0
- package/ios/Packages/CoreObjC/attdet.h +44 -0
- package/ios/Packages/CoreObjC/bits.c +375 -0
- package/ios/Packages/CoreObjC/bits.h +315 -0
- package/ios/Packages/CoreObjC/bwdet.c +129 -0
- package/ios/Packages/CoreObjC/bwdet.h +69 -0
- package/ios/Packages/CoreObjC/common.h +151 -0
- package/ios/Packages/CoreObjC/energy.c +70 -0
- package/ios/Packages/CoreObjC/energy.h +43 -0
- package/ios/Packages/CoreObjC/fastmath.h +158 -0
- package/ios/Packages/CoreObjC/lc3.c +704 -0
- package/ios/Packages/CoreObjC/lc3.h +313 -0
- package/ios/Packages/CoreObjC/lc3_cpp.h +283 -0
- package/ios/Packages/CoreObjC/lc3_private.h +163 -0
- package/ios/Packages/CoreObjC/ltpf.c +905 -0
- package/ios/Packages/CoreObjC/ltpf.h +111 -0
- package/ios/Packages/CoreObjC/ltpf_arm.h +506 -0
- package/ios/Packages/CoreObjC/ltpf_neon.h +281 -0
- package/ios/Packages/CoreObjC/makefile.mk +35 -0
- package/ios/Packages/CoreObjC/mdct.c +469 -0
- package/ios/Packages/CoreObjC/mdct.h +57 -0
- package/ios/Packages/CoreObjC/mdct_neon.h +296 -0
- package/ios/Packages/CoreObjC/meson.build +61 -0
- package/ios/Packages/CoreObjC/plc.c +61 -0
- package/ios/Packages/CoreObjC/plc.h +57 -0
- package/ios/Packages/CoreObjC/rnnoise.h +114 -0
- package/ios/Packages/CoreObjC/sns.c +880 -0
- package/ios/Packages/CoreObjC/sns.h +103 -0
- package/ios/Packages/CoreObjC/spec.c +907 -0
- package/ios/Packages/CoreObjC/spec.h +119 -0
- package/ios/Packages/CoreObjC/tables.c +3457 -0
- package/ios/Packages/CoreObjC/tables.h +94 -0
- package/ios/Packages/CoreObjC/tns.c +457 -0
- package/ios/Packages/CoreObjC/tns.h +99 -0
- package/ios/Packages/SherpaOnnx/Model/joiner.onnx +0 -0
- package/ios/Packages/SherpaOnnx/Model/tokens.txt +502 -0
- package/ios/Packages/SherpaOnnx/SherpaOnnx.swift +1659 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/Headers/cargs.h +162 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/Headers/sherpa-onnx/c-api/c-api.h +1852 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/Headers/sherpa-onnx/c-api/cxx-api.h +674 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/Info.plist +44 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64/libsherpa-onnx.a +0 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64/sherpa-onnx.a +0 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64_x86_64-simulator/libsherpa-onnx.a +0 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64_x86_64-simulator/sherpa-onnx.a +0 -0
- package/ios/Packages/VAD/Common/VAD/VADQuality.swift +41 -0
- package/ios/Packages/VAD/Common/VAD/VADState.swift +26 -0
- package/ios/Packages/VAD/Common/VAD/VADStrategy.swift +29 -0
- package/ios/Packages/VAD/Common/VAD/VADType.swift +14 -0
- package/ios/Packages/VAD/Data/Configuration.swift +68 -0
- package/ios/Packages/VAD/Data/FrameSize.swift +39 -0
- package/ios/Packages/VAD/Data/Record.swift +13 -0
- package/ios/Packages/VAD/Data/Result.swift +22 -0
- package/ios/Packages/VAD/Data/SampleRate.swift +48 -0
- package/ios/Packages/VAD/Silero/Model/silero_vad.onnx +0 -0
- package/ios/Packages/VAD/Silero/SileroVAD.swift +284 -0
- package/ios/Packages/VAD/Silero/SileroVADStrategy.swift +64 -0
- package/ios/Packages/libbz2/module.modulemap +5 -0
- package/ios/Packages/libbz2/shim.h +1 -0
- package/ios/Source/Bridge.swift +353 -0
- package/ios/Source/Bridging-Header.h +16 -0
- package/ios/Source/DeviceManager.swift +1478 -0
- package/ios/Source/DeviceStore.swift +295 -0
- package/ios/Source/MentraBluetoothSDK.swift +2439 -0
- package/ios/Source/ObservableStore.swift +88 -0
- package/ios/Source/PrivacyInfo.xcprivacy +23 -0
- package/ios/Source/controllers/ControllerManager.swift +187 -0
- package/ios/Source/controllers/R1.swift +827 -0
- package/ios/Source/services/PhoneMic.swift +662 -0
- package/ios/Source/sgcs/Frame.swift +651 -0
- package/ios/Source/sgcs/G1.swift +2505 -0
- package/ios/Source/sgcs/G2.swift +3730 -0
- package/ios/Source/sgcs/Mach1.swift +543 -0
- package/ios/Source/sgcs/MentraLive.swift +4708 -0
- package/ios/Source/sgcs/MentraNex.swift +2479 -0
- package/ios/Source/sgcs/SGCManager.swift +243 -0
- package/ios/Source/sgcs/Simulated.swift +270 -0
- package/ios/Source/sgcs/mentraos_ble.pb.swift +3811 -0
- package/ios/Source/stt/STTTools.swift +154 -0
- package/ios/Source/stt/SherpaOnnxTranscriber.swift +401 -0
- package/ios/Source/utils/AudioSessionMonitor.swift +283 -0
- package/ios/Source/utils/Constants.swift +74 -0
- package/ios/Source/utils/Enums.swift +95 -0
- package/ios/Source/utils/G1Text.swift +2067 -0
- package/ios/Source/utils/JSCExperiment.swift +241 -0
- package/ios/Source/utils/MemoryMonitor.swift +44 -0
- package/ios/Source/utils/MessageChunker.swift +164 -0
- package/ios/Source/utils/Models.swift +135 -0
- package/ios/Source/utils/PhoneAudioMonitor.swift +226 -0
- package/ios/Source/utils/TarBz2Extractor.swift +206 -0
- package/package.json +78 -0
- package/plugin/build/index.d.ts +6 -0
- package/plugin/build/index.js +12 -0
- package/plugin/build/withAndroid.d.ts +4 -0
- package/plugin/build/withAndroid.js +80 -0
- package/plugin/build/withIos.d.ts +4 -0
- package/plugin/build/withIos.js +64 -0
- package/src/BluetoothSdk.types.ts +581 -0
- package/src/BluetoothSdkModule.ts +259 -0
- package/src/index.ts +4 -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 && !(__GNUC__ < 10) || 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 */
|