@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.
- package/README.md +563 -0
- package/android/build.gradle +450 -0
- package/android/gradle.properties.example +9 -0
- package/android/lc3Lib/CMakeLists.txt +6 -0
- package/android/lc3Lib/build.gradle +212 -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/glassly/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 +4 -0
- package/android/silero/LICENSE.md +17 -0
- package/android/silero/build.gradle +50 -0
- package/android/silero/proguard-rules.pro +24 -0
- package/android/silero/src/androidTest/assets/hello.wav +0 -0
- package/android/silero/src/androidTest/java/com/konovalov/vad/silero/VadSileroTest.kt +79 -0
- package/android/silero/src/main/assets/LICENSE +21 -0
- package/android/silero/src/main/assets/silero_vad.onnx +0 -0
- package/android/silero/src/main/java/com/konovalov/vad/silero/Vad.kt +160 -0
- package/android/silero/src/main/java/com/konovalov/vad/silero/VadSilero.kt +449 -0
- package/android/silero/src/main/java/com/konovalov/vad/silero/config/FrameSize.kt +15 -0
- package/android/silero/src/main/java/com/konovalov/vad/silero/config/Mode.kt +14 -0
- package/android/silero/src/main/java/com/konovalov/vad/silero/config/SampleRate.kt +12 -0
- package/android/silero/src/main/java/com/konovalov/vad/silero/utils/AudioUtils.kt +47 -0
- package/android/silero/src/main/java/com/konovalov/vad/silero/utils/TensorMap.kt +41 -0
- package/android/silero/src/test/java/com/konovalov/vad/silero/utils/AudioUtilsTest.kt +44 -0
- package/android/src/main/AndroidManifest.xml +42 -0
- package/android/src/main/assets/G2Firmware/README.md +11 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/BluetoothSdk.kt +2325 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/BluetoothSdkAnalytics.kt +216 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/BluetoothSdkDebug.kt +14 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/BluetoothSdkDefaults.kt +7 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/BluetoothSdkModule.kt +1088 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/Bridge.kt +953 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/DeviceManager.kt +2528 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/DeviceStore.kt +360 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/GeneratedChangelogCatalog.kt +8 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/GeneratedReleaseMetadata.kt +11 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/LocalNetworkModule.kt +414 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/ObservableStore.kt +88 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/OtaManifest.kt +191 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/ReleaseChangelog.kt +61 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/ScopedNetworkReadiness.kt +17 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/audio/AudioModels.kt +144 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/camera/CameraModels.kt +486 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/connection/ConnectionModels.kt +78 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/controllers/ControllerManager.kt +158 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/controllers/R1.kt +937 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/debug/BleTraceLogger.kt +165 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/events/BluetoothEvents.kt +178 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/internal/MapParsing.kt +140 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/net/LocalIpv4.kt +57 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/otaserver/LocalOtaServer.kt +304 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/otaserver/OtaServerModule.kt +120 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/photoreceiver/LocalPhotoReceiverRegistry.java +108 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/photoreceiver/LocalPhotoUploadServer.kt +622 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/photoreceiver/PhotoReceiverModule.kt +156 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/requests/DisplayRequests.kt +56 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/services/Foreground.kt +272 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/services/PhoneMic.kt +1195 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/Ar99.java +2653 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/BesOtaHeartbeatGuard.kt +49 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/BesOtaProgressMapper.kt +27 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G1.kt +3878 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G1TextSanitizer.kt +38 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2.kt +6428 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2CfwClassification.kt +49 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2CfwRenderer.kt +1241 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2CfwTextureCache.kt +270 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2FlashProtocol.kt +291 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2Flasher.kt +411 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/GlasslyBle.java +43189 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/Mach1.kt +1280 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/MentraLive.kt +10817 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/MentraLiveL2capChannel.kt +274 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/MentraLivePairingAdvertisement.kt +54 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/MentraNex.kt +2011 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/Nimo.kt +2532 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/SGCManager.kt +470 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/Simulated.kt +228 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/ar99/ota/Ar99OtaManager.java +566 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/ar99/ota/OtaByteUtils.java +18 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/ar99/ota/OtaCommandConstants.java +35 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/ar99/ota/OtaCrc32Util.java +13 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/ar99/ota/OtaGattTransport.java +11 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/ar99/ota/OtaProtocol.java +92 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/speakerid/SpeakerIdEngine.kt +525 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/status/DeviceStatus.kt +669 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/status/RuntimeState.kt +201 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/status/WifiHotspotStatus.kt +189 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/streaming/StreamModels.kt +518 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/stt/STTTools.kt +391 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/stt/SherpaOnnxTranscriber.kt +518 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/stt/VadGateSpeechPolicy.kt +229 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/tts/TTSTools.kt +248 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/types/DeviceModels.kt +96 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/AES.java +106 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/AudioSessionMonitor.kt +189 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/AvifExifStripper.java +573 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/BitmapJavaUtils.java +169 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/BleJsonCompact.java +496 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/BlePhotoUploadService.java +677 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/BleWireProtocol.java +108 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/Constants.kt +46 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/G1Text.kt +436 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/HeifExifTagReader.java +199 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/IncidentLogBleRelayNaming.java +29 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/IncidentLogBleUploadService.java +77 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/K900LengthCodec.java +115 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/K900ProtocolUtils.java +827 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/MessageChunkReassembler.java +228 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/MessageChunker.java +325 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/NexSGCUtils.kt +698 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/PhoneAudioMonitor.kt +348 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/SmartGlassesConnectionState.java +9 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/audio/Ar99OpusPcmDecoder.java +398 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/audio/ByteUtilAudioPlayer.java +655 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/audio/Lc3Player.java +441 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/audio/PCMAudioPlayer.java +431 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/audio/PcmStreamPlayer.kt +328 -0
- package/android/src/main/res/values/strings.xml +4 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/BluetoothSdkExceptionTest.kt +18 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/OtaManifestDowngradeTest.kt +86 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/OtaStartResponsePolicyTest.kt +30 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/ReleaseChangelogTest.kt +13 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/ScopedNetworkReadinessTest.kt +39 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/StreamStatusEventTest.kt +29 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/camera/PhotoRequestTest.kt +141 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/otaserver/LocalOtaServerTest.kt +82 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/photoreceiver/LocalPhotoReceiverRegistryTest.java +75 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/services/ForegroundServiceTypeTest.kt +69 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/Ar99AdvertisementMatcherTest.java +22 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/BesOtaHeartbeatGuardTest.kt +73 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/BesOtaProgressMapperTest.kt +67 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/EvenRleTest.kt +63 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/G1TextSanitizerTest.kt +31 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/G2CfwClassificationTest.kt +89 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/G2CfwRendererTest.kt +344 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/G2CfwTextureCacheTest.kt +200 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/G2FlashProtocolTest.kt +131 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/MentraLiveGattCharacteristicsTest.kt +39 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/MentraLivePairingAdvertisementParserTest.kt +133 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/NimoProtocolTest.kt +333 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/utils/AvifExifStripperTest.java +46 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/utils/BinaryMessageChunkerTest.java +84 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/utils/BleJsonCompactTest.java +319 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/utils/BlePhotoUploadServiceTest.java +107 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/utils/K900ProtocolUtilsEndiannessTest.java +172 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/utils/K900ProtocolUtilsTest.java +24 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/utils/PhoneAudioMonitorTest.kt +45 -0
- package/android/src/test/resources/avif_with_exif.avif +0 -0
- package/app.plugin.js +3 -0
- package/build/BluetoothSdk.types.d.ts +1354 -0
- package/build/BluetoothSdk.types.d.ts.map +1 -0
- package/build/BluetoothSdk.types.js +41 -0
- package/build/BluetoothSdk.types.js.map +1 -0
- package/build/_internal.d.ts +17 -0
- package/build/_internal.d.ts.map +1 -0
- package/build/_internal.js +16 -0
- package/build/_internal.js.map +1 -0
- package/build/_private/BluetoothSdkModule.d.ts +172 -0
- package/build/_private/BluetoothSdkModule.d.ts.map +1 -0
- package/build/_private/BluetoothSdkModule.js +300 -0
- package/build/_private/BluetoothSdkModule.js.map +1 -0
- package/build/_private/LocalNetworkModule.d.ts +38 -0
- package/build/_private/LocalNetworkModule.d.ts.map +1 -0
- package/build/_private/LocalNetworkModule.js +3 -0
- package/build/_private/LocalNetworkModule.js.map +1 -0
- package/build/_private/cameraRequestPayload.d.ts +4 -0
- package/build/_private/cameraRequestPayload.d.ts.map +1 -0
- package/build/_private/cameraRequestPayload.js +32 -0
- package/build/_private/cameraRequestPayload.js.map +1 -0
- package/build/_private/photoRequestPayload.d.ts +6 -0
- package/build/_private/photoRequestPayload.d.ts.map +1 -0
- package/build/_private/photoRequestPayload.js +86 -0
- package/build/_private/photoRequestPayload.js.map +1 -0
- package/build/_private/sdkOtaManifest.d.ts +11 -0
- package/build/_private/sdkOtaManifest.d.ts.map +1 -0
- package/build/_private/sdkOtaManifest.js +15 -0
- package/build/_private/sdkOtaManifest.js.map +1 -0
- package/build/changelogs.d.ts +7 -0
- package/build/changelogs.d.ts.map +1 -0
- package/build/changelogs.js +46 -0
- package/build/changelogs.js.map +1 -0
- package/build/debug.d.ts +3 -0
- package/build/debug.d.ts.map +1 -0
- package/build/debug.js +8 -0
- package/build/debug.js.map +1 -0
- package/build/generated/changelogCatalog.d.ts +9 -0
- package/build/generated/changelogCatalog.d.ts.map +1 -0
- package/build/generated/changelogCatalog.js +12 -0
- package/build/generated/changelogCatalog.js.map +1 -0
- package/build/generated/releaseMetadata.d.ts +12 -0
- package/build/generated/releaseMetadata.d.ts.map +1 -0
- package/build/generated/releaseMetadata.js +10 -0
- package/build/generated/releaseMetadata.js.map +1 -0
- package/build/index.d.ts +6 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +171 -0
- package/build/index.js.map +1 -0
- package/build/ota-server/OtaServer.types.d.ts +14 -0
- package/build/ota-server/OtaServer.types.d.ts.map +1 -0
- package/build/ota-server/OtaServer.types.js +2 -0
- package/build/ota-server/OtaServer.types.js.map +1 -0
- package/build/ota-server/OtaServerModule.d.ts +21 -0
- package/build/ota-server/OtaServerModule.d.ts.map +1 -0
- package/build/ota-server/OtaServerModule.js +3 -0
- package/build/ota-server/OtaServerModule.js.map +1 -0
- package/build/ota-server/OtaServerModule.web.d.ts +10 -0
- package/build/ota-server/OtaServerModule.web.d.ts.map +1 -0
- package/build/ota-server/OtaServerModule.web.js +12 -0
- package/build/ota-server/OtaServerModule.web.js.map +1 -0
- package/build/ota-server/index.d.ts +3 -0
- package/build/ota-server/index.d.ts.map +1 -0
- package/build/ota-server/index.js +3 -0
- package/build/ota-server/index.js.map +1 -0
- package/build/ota-transport/index.d.ts +67 -0
- package/build/ota-transport/index.d.ts.map +1 -0
- package/build/ota-transport/index.js +58 -0
- package/build/ota-transport/index.js.map +1 -0
- package/build/photo-receiver/PhotoReceiver.types.d.ts +18 -0
- package/build/photo-receiver/PhotoReceiver.types.d.ts.map +1 -0
- package/build/photo-receiver/PhotoReceiver.types.js +2 -0
- package/build/photo-receiver/PhotoReceiver.types.js.map +1 -0
- package/build/photo-receiver/PhotoReceiverModule.d.ts +10 -0
- package/build/photo-receiver/PhotoReceiverModule.d.ts.map +1 -0
- package/build/photo-receiver/PhotoReceiverModule.js +3 -0
- package/build/photo-receiver/PhotoReceiverModule.js.map +1 -0
- package/build/photo-receiver/PhotoReceiverModule.web.d.ts +10 -0
- package/build/photo-receiver/PhotoReceiverModule.web.d.ts.map +1 -0
- package/build/photo-receiver/PhotoReceiverModule.web.js +12 -0
- package/build/photo-receiver/PhotoReceiverModule.web.js.map +1 -0
- package/build/photo-receiver/index.d.ts +3 -0
- package/build/photo-receiver/index.d.ts.map +1 -0
- package/build/photo-receiver/index.js +3 -0
- package/build/photo-receiver/index.js.map +1 -0
- package/build/react/index.d.ts +5 -0
- package/build/react/index.d.ts.map +1 -0
- package/build/react/index.js +4 -0
- package/build/react/index.js.map +1 -0
- package/build/react/useBluetooth.d.ts +100 -0
- package/build/react/useBluetooth.d.ts.map +1 -0
- package/build/react/useBluetooth.js +167 -0
- package/build/react/useBluetooth.js.map +1 -0
- package/build/react/useBluetoothEvent.d.ts +6 -0
- package/build/react/useBluetoothEvent.d.ts.map +1 -0
- package/build/react/useBluetoothEvent.js +21 -0
- package/build/react/useBluetoothEvent.js.map +1 -0
- package/build/react/useBluetoothScan.d.ts +22 -0
- package/build/react/useBluetoothScan.d.ts.map +1 -0
- package/build/react/useBluetoothScan.js +135 -0
- package/build/react/useBluetoothScan.js.map +1 -0
- package/build/react/useBluetoothStatus.d.ts +16 -0
- package/build/react/useBluetoothStatus.d.ts.map +1 -0
- package/build/react/useBluetoothStatus.js +137 -0
- package/build/react/useBluetoothStatus.js.map +1 -0
- package/build/react/useGlassesConnection.d.ts +29 -0
- package/build/react/useGlassesConnection.d.ts.map +1 -0
- package/build/react/useGlassesConnection.js +153 -0
- package/build/react/useGlassesConnection.js.map +1 -0
- package/build/types/index.d.ts +3 -0
- package/build/types/index.d.ts.map +1 -0
- package/build/types/index.js +2 -0
- package/build/types/index.js.map +1 -0
- package/expo-module.config.json +14 -0
- package/ios/BackgroundOtaArtifactDownloader.swift +125 -0
- package/ios/BluetoothSdkModule.swift +1034 -0
- package/ios/GlasslyBluetoothSDK.podspec +106 -0
- package/ios/LocalIPv4.swift +150 -0
- package/ios/LocalOtaServer.swift +309 -0
- package/ios/LocalPhotoUploadServer.swift +754 -0
- package/ios/OtaServerModule.swift +147 -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/include/PcmConverter.h +22 -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 +2383 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/Info.plist +48 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64/Headers/sherpa-onnx/c-api/c-api.h +4689 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64/Headers/sherpa-onnx/c-api/cxx-api.h +2036 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64/libsherpa-onnx.a +0 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64_x86_64-simulator/Headers/sherpa-onnx/c-api/c-api.h +4689 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64_x86_64-simulator/Headers/sherpa-onnx/c-api/cxx-api.h +2036 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64_x86_64-simulator/libsherpa-onnx.a +0 -0
- package/ios/Packages/libbz2/module.modulemap +5 -0
- package/ios/Packages/libbz2/shim.h +1 -0
- package/ios/PhotoReceiverModule.swift +129 -0
- package/ios/Source/BluetoothSDK.swift +2303 -0
- package/ios/Source/BluetoothSDKDebug.swift +12 -0
- package/ios/Source/BluetoothSdkDefaults.swift +29 -0
- package/ios/Source/Bridge.swift +708 -0
- package/ios/Source/Bridging-Header.h +16 -0
- package/ios/Source/DeviceManager.swift +2109 -0
- package/ios/Source/DeviceStore.swift +336 -0
- package/ios/Source/GeneratedChangelogCatalog.swift +7 -0
- package/ios/Source/GeneratedReleaseMetadata.swift +11 -0
- package/ios/Source/ObservableStore.swift +118 -0
- package/ios/Source/OtaManifest.swift +211 -0
- package/ios/Source/PrivacyInfo.xcprivacy +23 -0
- package/ios/Source/ReleaseChangelog.swift +65 -0
- package/ios/Source/Resources/G2Firmware/README.md +10 -0
- package/ios/Source/audio/AudioModels.swift +178 -0
- package/ios/Source/audio/PcmStreamPlayer.swift +410 -0
- package/ios/Source/camera/CameraModels.swift +866 -0
- package/ios/Source/connection/ScanSession.swift +27 -0
- package/ios/Source/controllers/ControllerManager.swift +184 -0
- package/ios/Source/controllers/R1.swift +829 -0
- package/ios/Source/errors/BluetoothSdkError.swift +19 -0
- package/ios/Source/events/BluetoothEvents.swift +342 -0
- package/ios/Source/internal/BleTraceLogger.swift +192 -0
- package/ios/Source/internal/BluetoothAvailability.swift +78 -0
- package/ios/Source/internal/BluetoothSdkAnalytics.swift +199 -0
- package/ios/Source/internal/ValueParsing.swift +99 -0
- package/ios/Source/requests/DisplayRequests.swift +82 -0
- package/ios/Source/services/PhoneMic.swift +662 -0
- package/ios/Source/sgcs/Ar99.swift +2451 -0
- package/ios/Source/sgcs/Frame.swift +649 -0
- package/ios/Source/sgcs/G1.swift +2554 -0
- package/ios/Source/sgcs/G2.swift +6887 -0
- package/ios/Source/sgcs/G2CfwClassification.swift +43 -0
- package/ios/Source/sgcs/G2CfwRenderer.swift +1279 -0
- package/ios/Source/sgcs/G2CfwTextureCache.swift +233 -0
- package/ios/Source/sgcs/G2FlashProtocol.swift +312 -0
- package/ios/Source/sgcs/G2Flasher.swift +773 -0
- package/ios/Source/sgcs/Mach1.swift +541 -0
- package/ios/Source/sgcs/MentraLive.swift +7011 -0
- package/ios/Source/sgcs/MentraLiveL2capChannel.swift +183 -0
- package/ios/Source/sgcs/MentraLivePairingAdvertisement.swift +64 -0
- package/ios/Source/sgcs/MentraNex.swift +3221 -0
- package/ios/Source/sgcs/Nimo.swift +1886 -0
- package/ios/Source/sgcs/SGCManager.swift +608 -0
- package/ios/Source/sgcs/Simulated.swift +274 -0
- package/ios/Source/sgcs/ar99/ota/Ar99OtaManager.swift +637 -0
- package/ios/Source/sgcs/glassly_ble.pb.swift +4354 -0
- package/ios/Source/speakerid/SpeakerIdEngine.swift +573 -0
- package/ios/Source/status/DeviceStatus.swift +981 -0
- package/ios/Source/status/RuntimeState.swift +359 -0
- package/ios/Source/status/WifiHotspotStatus.swift +345 -0
- package/ios/Source/streaming/StreamModels.swift +693 -0
- package/ios/Source/stt/STTTools.swift +191 -0
- package/ios/Source/stt/SherpaOnnxTranscriber.swift +466 -0
- package/ios/Source/tts/TTSTools.swift +171 -0
- package/ios/Source/types/DeviceModels.swift +177 -0
- package/ios/Source/utils/AudioSessionMonitor.swift +283 -0
- package/ios/Source/utils/BinaryCodec.swift +61 -0
- package/ios/Source/utils/BleJsonCompact.swift +405 -0
- package/ios/Source/utils/BleWireProtocol.swift +92 -0
- package/ios/Source/utils/Constants.swift +78 -0
- package/ios/Source/utils/Enums.swift +95 -0
- package/ios/Source/utils/G1Text.swift +2096 -0
- package/ios/Source/utils/JSCExperiment.swift +241 -0
- package/ios/Source/utils/MemoryMonitor.swift +44 -0
- package/ios/Source/utils/MessageChunkReassembler.swift +190 -0
- package/ios/Source/utils/MessageChunker.swift +294 -0
- package/ios/Source/utils/Models.swift +135 -0
- package/ios/Source/utils/PhoneAudioMonitor.swift +230 -0
- package/ios/Source/utils/TarBz2Extractor.swift +257 -0
- package/ios/Tests/BluetoothSDKTests/G2CfwClassificationTests.swift +78 -0
- package/ios/Tests/BluetoothSDKTests/G2CfwRendererTests.swift +372 -0
- package/ios/Tests/BluetoothSDKTests/G2CfwTextureCacheTests.swift +162 -0
- package/ios/Tests/BluetoothSDKTests/G2FlashProtocolTests.swift +182 -0
- package/ios/Tests/MentraLivePairingAdvertisementTests.swift +160 -0
- package/ios/Tests/ReleaseChangelogTests.swift +13 -0
- package/package.json +129 -0
- package/plugin/build/index.d.ts +10 -0
- package/plugin/build/index.js +12 -0
- package/plugin/build/withAndroid.d.ts +3 -0
- package/plugin/build/withAndroid.js +190 -0
- package/plugin/build/withIos.d.ts +5 -0
- package/plugin/build/withIos.js +108 -0
- package/scripts/inject-ios-sdk-version.mjs +65 -0
- package/scripts/public-ota-api.test.mjs +37 -0
- package/scripts/verify-release-package.mjs +45 -0
- package/scripts/write-release-metadata.mjs +152 -0
- package/scripts/write-release-metadata.test.mjs +37 -0
- package/src/BluetoothSdk.types.ts +1623 -0
- package/src/_internal.ts +16 -0
- package/src/_private/BluetoothSdkModule.ts +684 -0
- package/src/_private/LocalNetworkModule.ts +50 -0
- package/src/_private/cameraRequestPayload.ts +34 -0
- package/src/_private/photoRequestPayload.ts +90 -0
- package/src/_private/sdkOtaManifest.ts +18 -0
- package/src/changelogs.ts +46 -0
- package/src/debug.ts +9 -0
- package/src/generated/changelogCatalog.ts +13 -0
- package/src/generated/releaseMetadata.ts +20 -0
- package/src/index.ts +321 -0
- package/src/ota-server/OtaServer.types.ts +10 -0
- package/src/ota-server/OtaServerModule.ts +23 -0
- package/src/ota-server/OtaServerModule.web.ts +17 -0
- package/src/ota-server/index.ts +2 -0
- package/src/ota-transport/index.ts +116 -0
- package/src/photo-receiver/PhotoReceiver.types.ts +20 -0
- package/src/photo-receiver/PhotoReceiverModule.ts +11 -0
- package/src/photo-receiver/PhotoReceiverModule.web.ts +17 -0
- package/src/photo-receiver/index.ts +2 -0
- package/src/react/index.ts +21 -0
- package/src/react/useBluetooth.ts +309 -0
- package/src/react/useBluetoothEvent.ts +35 -0
- package/src/react/useBluetoothScan.ts +173 -0
- package/src/react/useBluetoothStatus.ts +180 -0
- package/src/react/useGlassesConnection.ts +202 -0
- package/src/types/index.ts +12 -0
|
@@ -0,0 +1,601 @@
|
|
|
1
|
+
/*Copyright (c) 2003-2004, Mark Borgerding
|
|
2
|
+
Lots of modifications by Jean-Marc Valin
|
|
3
|
+
Copyright (c) 2005-2007, Xiph.Org Foundation
|
|
4
|
+
Copyright (c) 2008, Xiph.Org Foundation, CSIRO
|
|
5
|
+
|
|
6
|
+
All rights reserved.
|
|
7
|
+
|
|
8
|
+
Redistribution and use in source and binary forms, with or without
|
|
9
|
+
modification, are permitted provided that the following conditions are met:
|
|
10
|
+
|
|
11
|
+
* Redistributions of source code must retain the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer.
|
|
13
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
14
|
+
this list of conditions and the following disclaimer in the
|
|
15
|
+
documentation and/or other materials provided with the distribution.
|
|
16
|
+
|
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
18
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
19
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
20
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
21
|
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
22
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
23
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
24
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
25
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
26
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
27
|
+
POSSIBILITY OF SUCH DAMAGE.*/
|
|
28
|
+
|
|
29
|
+
/* This code is originally from Mark Borgerding's KISS-FFT but has been
|
|
30
|
+
heavily modified to better suit Opus */
|
|
31
|
+
|
|
32
|
+
#ifndef SKIP_CONFIG_H
|
|
33
|
+
# ifdef HAVE_CONFIG_H
|
|
34
|
+
# include "config.h"
|
|
35
|
+
# endif
|
|
36
|
+
#endif
|
|
37
|
+
|
|
38
|
+
#include "_kiss_fft_guts.h"
|
|
39
|
+
#define CUSTOM_MODES
|
|
40
|
+
|
|
41
|
+
/* The guts header contains all the multiplication and addition macros that are defined for
|
|
42
|
+
complex numbers. It also declares the kf_ internal functions.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
static void kf_bfly2(
|
|
46
|
+
kiss_fft_cpx * Fout,
|
|
47
|
+
int m,
|
|
48
|
+
int N
|
|
49
|
+
)
|
|
50
|
+
{
|
|
51
|
+
kiss_fft_cpx * Fout2;
|
|
52
|
+
int i;
|
|
53
|
+
(void)m;
|
|
54
|
+
#ifdef CUSTOM_MODES
|
|
55
|
+
if (m==1)
|
|
56
|
+
{
|
|
57
|
+
celt_assert(m==1);
|
|
58
|
+
for (i=0;i<N;i++)
|
|
59
|
+
{
|
|
60
|
+
kiss_fft_cpx t;
|
|
61
|
+
Fout2 = Fout + 1;
|
|
62
|
+
t = *Fout2;
|
|
63
|
+
C_SUB( *Fout2 , *Fout , t );
|
|
64
|
+
C_ADDTO( *Fout , t );
|
|
65
|
+
Fout += 2;
|
|
66
|
+
}
|
|
67
|
+
} else
|
|
68
|
+
#endif
|
|
69
|
+
{
|
|
70
|
+
opus_val16 tw;
|
|
71
|
+
tw = QCONST16(0.7071067812f, 15);
|
|
72
|
+
/* We know that m==4 here because the radix-2 is just after a radix-4 */
|
|
73
|
+
celt_assert(m==4);
|
|
74
|
+
for (i=0;i<N;i++)
|
|
75
|
+
{
|
|
76
|
+
kiss_fft_cpx t;
|
|
77
|
+
Fout2 = Fout + 4;
|
|
78
|
+
t = Fout2[0];
|
|
79
|
+
C_SUB( Fout2[0] , Fout[0] , t );
|
|
80
|
+
C_ADDTO( Fout[0] , t );
|
|
81
|
+
|
|
82
|
+
t.r = S_MUL(ADD32_ovflw(Fout2[1].r, Fout2[1].i), tw);
|
|
83
|
+
t.i = S_MUL(SUB32_ovflw(Fout2[1].i, Fout2[1].r), tw);
|
|
84
|
+
C_SUB( Fout2[1] , Fout[1] , t );
|
|
85
|
+
C_ADDTO( Fout[1] , t );
|
|
86
|
+
|
|
87
|
+
t.r = Fout2[2].i;
|
|
88
|
+
t.i = -Fout2[2].r;
|
|
89
|
+
C_SUB( Fout2[2] , Fout[2] , t );
|
|
90
|
+
C_ADDTO( Fout[2] , t );
|
|
91
|
+
|
|
92
|
+
t.r = S_MUL(SUB32_ovflw(Fout2[3].i, Fout2[3].r), tw);
|
|
93
|
+
t.i = S_MUL(NEG32_ovflw(ADD32_ovflw(Fout2[3].i, Fout2[3].r)), tw);
|
|
94
|
+
C_SUB( Fout2[3] , Fout[3] , t );
|
|
95
|
+
C_ADDTO( Fout[3] , t );
|
|
96
|
+
Fout += 8;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
static void kf_bfly4(
|
|
102
|
+
kiss_fft_cpx * Fout,
|
|
103
|
+
const size_t fstride,
|
|
104
|
+
const kiss_fft_state *st,
|
|
105
|
+
int m,
|
|
106
|
+
int N,
|
|
107
|
+
int mm
|
|
108
|
+
)
|
|
109
|
+
{
|
|
110
|
+
int i;
|
|
111
|
+
|
|
112
|
+
if (m==1)
|
|
113
|
+
{
|
|
114
|
+
/* Degenerate case where all the twiddles are 1. */
|
|
115
|
+
for (i=0;i<N;i++)
|
|
116
|
+
{
|
|
117
|
+
kiss_fft_cpx scratch0, scratch1;
|
|
118
|
+
|
|
119
|
+
C_SUB( scratch0 , *Fout, Fout[2] );
|
|
120
|
+
C_ADDTO(*Fout, Fout[2]);
|
|
121
|
+
C_ADD( scratch1 , Fout[1] , Fout[3] );
|
|
122
|
+
C_SUB( Fout[2], *Fout, scratch1 );
|
|
123
|
+
C_ADDTO( *Fout , scratch1 );
|
|
124
|
+
C_SUB( scratch1 , Fout[1] , Fout[3] );
|
|
125
|
+
|
|
126
|
+
Fout[1].r = ADD32_ovflw(scratch0.r, scratch1.i);
|
|
127
|
+
Fout[1].i = SUB32_ovflw(scratch0.i, scratch1.r);
|
|
128
|
+
Fout[3].r = SUB32_ovflw(scratch0.r, scratch1.i);
|
|
129
|
+
Fout[3].i = ADD32_ovflw(scratch0.i, scratch1.r);
|
|
130
|
+
Fout+=4;
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
int j;
|
|
134
|
+
kiss_fft_cpx scratch[6];
|
|
135
|
+
const kiss_twiddle_cpx *tw1,*tw2,*tw3;
|
|
136
|
+
const int m2=2*m;
|
|
137
|
+
const int m3=3*m;
|
|
138
|
+
kiss_fft_cpx * Fout_beg = Fout;
|
|
139
|
+
for (i=0;i<N;i++)
|
|
140
|
+
{
|
|
141
|
+
Fout = Fout_beg + i*mm;
|
|
142
|
+
tw3 = tw2 = tw1 = st->twiddles;
|
|
143
|
+
/* m is guaranteed to be a multiple of 4. */
|
|
144
|
+
for (j=0;j<m;j++)
|
|
145
|
+
{
|
|
146
|
+
C_MUL(scratch[0],Fout[m] , *tw1 );
|
|
147
|
+
C_MUL(scratch[1],Fout[m2] , *tw2 );
|
|
148
|
+
C_MUL(scratch[2],Fout[m3] , *tw3 );
|
|
149
|
+
|
|
150
|
+
C_SUB( scratch[5] , *Fout, scratch[1] );
|
|
151
|
+
C_ADDTO(*Fout, scratch[1]);
|
|
152
|
+
C_ADD( scratch[3] , scratch[0] , scratch[2] );
|
|
153
|
+
C_SUB( scratch[4] , scratch[0] , scratch[2] );
|
|
154
|
+
C_SUB( Fout[m2], *Fout, scratch[3] );
|
|
155
|
+
tw1 += fstride;
|
|
156
|
+
tw2 += fstride*2;
|
|
157
|
+
tw3 += fstride*3;
|
|
158
|
+
C_ADDTO( *Fout , scratch[3] );
|
|
159
|
+
|
|
160
|
+
Fout[m].r = ADD32_ovflw(scratch[5].r, scratch[4].i);
|
|
161
|
+
Fout[m].i = SUB32_ovflw(scratch[5].i, scratch[4].r);
|
|
162
|
+
Fout[m3].r = SUB32_ovflw(scratch[5].r, scratch[4].i);
|
|
163
|
+
Fout[m3].i = ADD32_ovflw(scratch[5].i, scratch[4].r);
|
|
164
|
+
++Fout;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
#ifndef RADIX_TWO_ONLY
|
|
172
|
+
|
|
173
|
+
static void kf_bfly3(
|
|
174
|
+
kiss_fft_cpx * Fout,
|
|
175
|
+
const size_t fstride,
|
|
176
|
+
const kiss_fft_state *st,
|
|
177
|
+
int m,
|
|
178
|
+
int N,
|
|
179
|
+
int mm
|
|
180
|
+
)
|
|
181
|
+
{
|
|
182
|
+
int i;
|
|
183
|
+
size_t k;
|
|
184
|
+
const size_t m2 = 2*m;
|
|
185
|
+
const kiss_twiddle_cpx *tw1,*tw2;
|
|
186
|
+
kiss_fft_cpx scratch[5];
|
|
187
|
+
kiss_twiddle_cpx epi3;
|
|
188
|
+
|
|
189
|
+
kiss_fft_cpx * Fout_beg = Fout;
|
|
190
|
+
#ifdef FIXED_POINT
|
|
191
|
+
/*epi3.r = -16384;*/ /* Unused */
|
|
192
|
+
epi3.i = -28378;
|
|
193
|
+
#else
|
|
194
|
+
epi3 = st->twiddles[fstride*m];
|
|
195
|
+
#endif
|
|
196
|
+
for (i=0;i<N;i++)
|
|
197
|
+
{
|
|
198
|
+
Fout = Fout_beg + i*mm;
|
|
199
|
+
tw1=tw2=st->twiddles;
|
|
200
|
+
/* For non-custom modes, m is guaranteed to be a multiple of 4. */
|
|
201
|
+
k=m;
|
|
202
|
+
do {
|
|
203
|
+
|
|
204
|
+
C_MUL(scratch[1],Fout[m] , *tw1);
|
|
205
|
+
C_MUL(scratch[2],Fout[m2] , *tw2);
|
|
206
|
+
|
|
207
|
+
C_ADD(scratch[3],scratch[1],scratch[2]);
|
|
208
|
+
C_SUB(scratch[0],scratch[1],scratch[2]);
|
|
209
|
+
tw1 += fstride;
|
|
210
|
+
tw2 += fstride*2;
|
|
211
|
+
|
|
212
|
+
Fout[m].r = SUB32_ovflw(Fout->r, HALF_OF(scratch[3].r));
|
|
213
|
+
Fout[m].i = SUB32_ovflw(Fout->i, HALF_OF(scratch[3].i));
|
|
214
|
+
|
|
215
|
+
C_MULBYSCALAR( scratch[0] , epi3.i );
|
|
216
|
+
|
|
217
|
+
C_ADDTO(*Fout,scratch[3]);
|
|
218
|
+
|
|
219
|
+
Fout[m2].r = ADD32_ovflw(Fout[m].r, scratch[0].i);
|
|
220
|
+
Fout[m2].i = SUB32_ovflw(Fout[m].i, scratch[0].r);
|
|
221
|
+
|
|
222
|
+
Fout[m].r = SUB32_ovflw(Fout[m].r, scratch[0].i);
|
|
223
|
+
Fout[m].i = ADD32_ovflw(Fout[m].i, scratch[0].r);
|
|
224
|
+
|
|
225
|
+
++Fout;
|
|
226
|
+
} while(--k);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
#ifndef OVERRIDE_kf_bfly5
|
|
232
|
+
static void kf_bfly5(
|
|
233
|
+
kiss_fft_cpx * Fout,
|
|
234
|
+
const size_t fstride,
|
|
235
|
+
const kiss_fft_state *st,
|
|
236
|
+
int m,
|
|
237
|
+
int N,
|
|
238
|
+
int mm
|
|
239
|
+
)
|
|
240
|
+
{
|
|
241
|
+
kiss_fft_cpx *Fout0,*Fout1,*Fout2,*Fout3,*Fout4;
|
|
242
|
+
int i, u;
|
|
243
|
+
kiss_fft_cpx scratch[13];
|
|
244
|
+
const kiss_twiddle_cpx *tw;
|
|
245
|
+
kiss_twiddle_cpx ya,yb;
|
|
246
|
+
kiss_fft_cpx * Fout_beg = Fout;
|
|
247
|
+
|
|
248
|
+
#ifdef FIXED_POINT
|
|
249
|
+
ya.r = 10126;
|
|
250
|
+
ya.i = -31164;
|
|
251
|
+
yb.r = -26510;
|
|
252
|
+
yb.i = -19261;
|
|
253
|
+
#else
|
|
254
|
+
ya = st->twiddles[fstride*m];
|
|
255
|
+
yb = st->twiddles[fstride*2*m];
|
|
256
|
+
#endif
|
|
257
|
+
tw=st->twiddles;
|
|
258
|
+
|
|
259
|
+
for (i=0;i<N;i++)
|
|
260
|
+
{
|
|
261
|
+
Fout = Fout_beg + i*mm;
|
|
262
|
+
Fout0=Fout;
|
|
263
|
+
Fout1=Fout0+m;
|
|
264
|
+
Fout2=Fout0+2*m;
|
|
265
|
+
Fout3=Fout0+3*m;
|
|
266
|
+
Fout4=Fout0+4*m;
|
|
267
|
+
|
|
268
|
+
/* For non-custom modes, m is guaranteed to be a multiple of 4. */
|
|
269
|
+
for ( u=0; u<m; ++u ) {
|
|
270
|
+
scratch[0] = *Fout0;
|
|
271
|
+
|
|
272
|
+
C_MUL(scratch[1] ,*Fout1, tw[u*fstride]);
|
|
273
|
+
C_MUL(scratch[2] ,*Fout2, tw[2*u*fstride]);
|
|
274
|
+
C_MUL(scratch[3] ,*Fout3, tw[3*u*fstride]);
|
|
275
|
+
C_MUL(scratch[4] ,*Fout4, tw[4*u*fstride]);
|
|
276
|
+
|
|
277
|
+
C_ADD( scratch[7],scratch[1],scratch[4]);
|
|
278
|
+
C_SUB( scratch[10],scratch[1],scratch[4]);
|
|
279
|
+
C_ADD( scratch[8],scratch[2],scratch[3]);
|
|
280
|
+
C_SUB( scratch[9],scratch[2],scratch[3]);
|
|
281
|
+
|
|
282
|
+
Fout0->r = ADD32_ovflw(Fout0->r, ADD32_ovflw(scratch[7].r, scratch[8].r));
|
|
283
|
+
Fout0->i = ADD32_ovflw(Fout0->i, ADD32_ovflw(scratch[7].i, scratch[8].i));
|
|
284
|
+
|
|
285
|
+
scratch[5].r = ADD32_ovflw(scratch[0].r, ADD32_ovflw(S_MUL(scratch[7].r,ya.r), S_MUL(scratch[8].r,yb.r)));
|
|
286
|
+
scratch[5].i = ADD32_ovflw(scratch[0].i, ADD32_ovflw(S_MUL(scratch[7].i,ya.r), S_MUL(scratch[8].i,yb.r)));
|
|
287
|
+
|
|
288
|
+
scratch[6].r = ADD32_ovflw(S_MUL(scratch[10].i,ya.i), S_MUL(scratch[9].i,yb.i));
|
|
289
|
+
scratch[6].i = NEG32_ovflw(ADD32_ovflw(S_MUL(scratch[10].r,ya.i), S_MUL(scratch[9].r,yb.i)));
|
|
290
|
+
|
|
291
|
+
C_SUB(*Fout1,scratch[5],scratch[6]);
|
|
292
|
+
C_ADD(*Fout4,scratch[5],scratch[6]);
|
|
293
|
+
|
|
294
|
+
scratch[11].r = ADD32_ovflw(scratch[0].r, ADD32_ovflw(S_MUL(scratch[7].r,yb.r), S_MUL(scratch[8].r,ya.r)));
|
|
295
|
+
scratch[11].i = ADD32_ovflw(scratch[0].i, ADD32_ovflw(S_MUL(scratch[7].i,yb.r), S_MUL(scratch[8].i,ya.r)));
|
|
296
|
+
scratch[12].r = SUB32_ovflw(S_MUL(scratch[9].i,ya.i), S_MUL(scratch[10].i,yb.i));
|
|
297
|
+
scratch[12].i = SUB32_ovflw(S_MUL(scratch[10].r,yb.i), S_MUL(scratch[9].r,ya.i));
|
|
298
|
+
|
|
299
|
+
C_ADD(*Fout2,scratch[11],scratch[12]);
|
|
300
|
+
C_SUB(*Fout3,scratch[11],scratch[12]);
|
|
301
|
+
|
|
302
|
+
++Fout0;++Fout1;++Fout2;++Fout3;++Fout4;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
#endif /* OVERRIDE_kf_bfly5 */
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
#endif
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
#ifdef CUSTOM_MODES
|
|
313
|
+
|
|
314
|
+
static
|
|
315
|
+
void compute_bitrev_table(
|
|
316
|
+
int Fout,
|
|
317
|
+
opus_int16 *f,
|
|
318
|
+
const size_t fstride,
|
|
319
|
+
int in_stride,
|
|
320
|
+
opus_int16 * factors,
|
|
321
|
+
const kiss_fft_state *st
|
|
322
|
+
)
|
|
323
|
+
{
|
|
324
|
+
const int p=*factors++; /* the radix */
|
|
325
|
+
const int m=*factors++; /* stage's fft length/p */
|
|
326
|
+
|
|
327
|
+
/*printf ("fft %d %d %d %d %d %d\n", p*m, m, p, s2, fstride*in_stride, N);*/
|
|
328
|
+
if (m==1)
|
|
329
|
+
{
|
|
330
|
+
int j;
|
|
331
|
+
for (j=0;j<p;j++)
|
|
332
|
+
{
|
|
333
|
+
*f = Fout+j;
|
|
334
|
+
f += fstride*in_stride;
|
|
335
|
+
}
|
|
336
|
+
} else {
|
|
337
|
+
int j;
|
|
338
|
+
for (j=0;j<p;j++)
|
|
339
|
+
{
|
|
340
|
+
compute_bitrev_table( Fout , f, fstride*p, in_stride, factors,st);
|
|
341
|
+
f += fstride*in_stride;
|
|
342
|
+
Fout += m;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/* facbuf is populated by p1,m1,p2,m2, ...
|
|
348
|
+
where
|
|
349
|
+
p[i] * m[i] = m[i-1]
|
|
350
|
+
m0 = n */
|
|
351
|
+
static
|
|
352
|
+
int kf_factor(int n,opus_int16 * facbuf)
|
|
353
|
+
{
|
|
354
|
+
int p=4;
|
|
355
|
+
int i;
|
|
356
|
+
int stages=0;
|
|
357
|
+
int nbak = n;
|
|
358
|
+
|
|
359
|
+
/*factor out powers of 4, powers of 2, then any remaining primes */
|
|
360
|
+
do {
|
|
361
|
+
while (n % p) {
|
|
362
|
+
switch (p) {
|
|
363
|
+
case 4: p = 2; break;
|
|
364
|
+
case 2: p = 3; break;
|
|
365
|
+
default: p += 2; break;
|
|
366
|
+
}
|
|
367
|
+
if (p>32000 || (opus_int32)p*(opus_int32)p > n)
|
|
368
|
+
p = n; /* no more factors, skip to end */
|
|
369
|
+
}
|
|
370
|
+
n /= p;
|
|
371
|
+
#ifdef RADIX_TWO_ONLY
|
|
372
|
+
if (p!=2 && p != 4)
|
|
373
|
+
#else
|
|
374
|
+
if (p>5)
|
|
375
|
+
#endif
|
|
376
|
+
{
|
|
377
|
+
return 0;
|
|
378
|
+
}
|
|
379
|
+
facbuf[2*stages] = p;
|
|
380
|
+
if (p==2 && stages > 1)
|
|
381
|
+
{
|
|
382
|
+
facbuf[2*stages] = 4;
|
|
383
|
+
facbuf[2] = 2;
|
|
384
|
+
}
|
|
385
|
+
stages++;
|
|
386
|
+
} while (n > 1);
|
|
387
|
+
n = nbak;
|
|
388
|
+
/* Reverse the order to get the radix 4 at the end, so we can use the
|
|
389
|
+
fast degenerate case. It turns out that reversing the order also
|
|
390
|
+
improves the noise behaviour. */
|
|
391
|
+
for (i=0;i<stages/2;i++)
|
|
392
|
+
{
|
|
393
|
+
int tmp;
|
|
394
|
+
tmp = facbuf[2*i];
|
|
395
|
+
facbuf[2*i] = facbuf[2*(stages-i-1)];
|
|
396
|
+
facbuf[2*(stages-i-1)] = tmp;
|
|
397
|
+
}
|
|
398
|
+
for (i=0;i<stages;i++)
|
|
399
|
+
{
|
|
400
|
+
n /= facbuf[2*i];
|
|
401
|
+
facbuf[2*i+1] = n;
|
|
402
|
+
}
|
|
403
|
+
return 1;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
static void compute_twiddles(kiss_twiddle_cpx *twiddles, int nfft)
|
|
407
|
+
{
|
|
408
|
+
int i;
|
|
409
|
+
#ifdef FIXED_POINT
|
|
410
|
+
for (i=0;i<nfft;++i) {
|
|
411
|
+
opus_val32 phase = -i;
|
|
412
|
+
kf_cexp2(twiddles+i, DIV32(SHL32(phase,17),nfft));
|
|
413
|
+
}
|
|
414
|
+
#else
|
|
415
|
+
for (i=0;i<nfft;++i) {
|
|
416
|
+
const double pi=3.14159265358979323846264338327;
|
|
417
|
+
double phase = ( -2*pi /nfft ) * i;
|
|
418
|
+
kf_cexp(twiddles+i, phase );
|
|
419
|
+
}
|
|
420
|
+
#endif
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
int opus_fft_alloc_arch_c(kiss_fft_state *st) {
|
|
424
|
+
(void)st;
|
|
425
|
+
return 0;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/*
|
|
429
|
+
*
|
|
430
|
+
* Allocates all necessary storage space for the fft and ifft.
|
|
431
|
+
* The return value is a contiguous block of memory. As such,
|
|
432
|
+
* It can be freed with free().
|
|
433
|
+
* */
|
|
434
|
+
kiss_fft_state *opus_fft_alloc_twiddles(int nfft,void * mem,size_t * lenmem,
|
|
435
|
+
const kiss_fft_state *base, int arch)
|
|
436
|
+
{
|
|
437
|
+
kiss_fft_state *st=NULL;
|
|
438
|
+
size_t memneeded = sizeof(struct kiss_fft_state); /* twiddle factors*/
|
|
439
|
+
|
|
440
|
+
if ( lenmem==NULL ) {
|
|
441
|
+
st = ( kiss_fft_state*)KISS_FFT_MALLOC( memneeded );
|
|
442
|
+
}else{
|
|
443
|
+
if (mem != NULL && *lenmem >= memneeded)
|
|
444
|
+
st = (kiss_fft_state*)mem;
|
|
445
|
+
*lenmem = memneeded;
|
|
446
|
+
}
|
|
447
|
+
if (st) {
|
|
448
|
+
opus_int16 *bitrev;
|
|
449
|
+
kiss_twiddle_cpx *twiddles;
|
|
450
|
+
|
|
451
|
+
st->nfft=nfft;
|
|
452
|
+
#ifdef FIXED_POINT
|
|
453
|
+
st->scale_shift = celt_ilog2(st->nfft);
|
|
454
|
+
if (st->nfft == 1<<st->scale_shift)
|
|
455
|
+
st->scale = Q15ONE;
|
|
456
|
+
else
|
|
457
|
+
st->scale = (1073741824+st->nfft/2)/st->nfft>>(15-st->scale_shift);
|
|
458
|
+
#else
|
|
459
|
+
st->scale = 1.f/nfft;
|
|
460
|
+
#endif
|
|
461
|
+
if (base != NULL)
|
|
462
|
+
{
|
|
463
|
+
st->twiddles = base->twiddles;
|
|
464
|
+
st->shift = 0;
|
|
465
|
+
while (st->shift < 32 && nfft<<st->shift != base->nfft)
|
|
466
|
+
st->shift++;
|
|
467
|
+
if (st->shift>=32)
|
|
468
|
+
goto fail;
|
|
469
|
+
} else {
|
|
470
|
+
st->twiddles = twiddles = (kiss_twiddle_cpx*)KISS_FFT_MALLOC(sizeof(kiss_twiddle_cpx)*nfft);
|
|
471
|
+
compute_twiddles(twiddles, nfft);
|
|
472
|
+
st->shift = -1;
|
|
473
|
+
}
|
|
474
|
+
if (!kf_factor(nfft,st->factors))
|
|
475
|
+
{
|
|
476
|
+
goto fail;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/* bitrev */
|
|
480
|
+
st->bitrev = bitrev = (opus_int16*)KISS_FFT_MALLOC(sizeof(opus_int16)*nfft);
|
|
481
|
+
if (st->bitrev==NULL)
|
|
482
|
+
goto fail;
|
|
483
|
+
compute_bitrev_table(0, bitrev, 1,1, st->factors,st);
|
|
484
|
+
|
|
485
|
+
/* Initialize architecture specific fft parameters */
|
|
486
|
+
if (opus_fft_alloc_arch(st, arch))
|
|
487
|
+
goto fail;
|
|
488
|
+
}
|
|
489
|
+
return st;
|
|
490
|
+
fail:
|
|
491
|
+
opus_fft_free(st, arch);
|
|
492
|
+
return NULL;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
kiss_fft_state *opus_fft_alloc(int nfft,void * mem,size_t * lenmem, int arch)
|
|
496
|
+
{
|
|
497
|
+
return opus_fft_alloc_twiddles(nfft, mem, lenmem, NULL, arch);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
void opus_fft_free_arch_c(kiss_fft_state *st) {
|
|
501
|
+
(void)st;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
void opus_fft_free(const kiss_fft_state *cfg, int arch)
|
|
505
|
+
{
|
|
506
|
+
if (cfg)
|
|
507
|
+
{
|
|
508
|
+
opus_fft_free_arch((kiss_fft_state *)cfg, arch);
|
|
509
|
+
opus_free((opus_int16*)cfg->bitrev);
|
|
510
|
+
if (cfg->shift < 0)
|
|
511
|
+
opus_free((kiss_twiddle_cpx*)cfg->twiddles);
|
|
512
|
+
opus_free((kiss_fft_state*)cfg);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
#endif /* CUSTOM_MODES */
|
|
517
|
+
|
|
518
|
+
void opus_fft_impl(const kiss_fft_state *st,kiss_fft_cpx *fout)
|
|
519
|
+
{
|
|
520
|
+
int m2, m;
|
|
521
|
+
int p;
|
|
522
|
+
int L;
|
|
523
|
+
int fstride[MAXFACTORS];
|
|
524
|
+
int i;
|
|
525
|
+
int shift;
|
|
526
|
+
|
|
527
|
+
/* st->shift can be -1 */
|
|
528
|
+
shift = st->shift>0 ? st->shift : 0;
|
|
529
|
+
|
|
530
|
+
fstride[0] = 1;
|
|
531
|
+
L=0;
|
|
532
|
+
do {
|
|
533
|
+
p = st->factors[2*L];
|
|
534
|
+
m = st->factors[2*L+1];
|
|
535
|
+
fstride[L+1] = fstride[L]*p;
|
|
536
|
+
L++;
|
|
537
|
+
} while(m!=1);
|
|
538
|
+
m = st->factors[2*L-1];
|
|
539
|
+
for (i=L-1;i>=0;i--)
|
|
540
|
+
{
|
|
541
|
+
if (i!=0)
|
|
542
|
+
m2 = st->factors[2*i-1];
|
|
543
|
+
else
|
|
544
|
+
m2 = 1;
|
|
545
|
+
switch (st->factors[2*i])
|
|
546
|
+
{
|
|
547
|
+
case 2:
|
|
548
|
+
kf_bfly2(fout, m, fstride[i]);
|
|
549
|
+
break;
|
|
550
|
+
case 4:
|
|
551
|
+
kf_bfly4(fout,fstride[i]<<shift,st,m, fstride[i], m2);
|
|
552
|
+
break;
|
|
553
|
+
#ifndef RADIX_TWO_ONLY
|
|
554
|
+
case 3:
|
|
555
|
+
kf_bfly3(fout,fstride[i]<<shift,st,m, fstride[i], m2);
|
|
556
|
+
break;
|
|
557
|
+
case 5:
|
|
558
|
+
kf_bfly5(fout,fstride[i]<<shift,st,m, fstride[i], m2);
|
|
559
|
+
break;
|
|
560
|
+
#endif
|
|
561
|
+
}
|
|
562
|
+
m = m2;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
void opus_fft_c(const kiss_fft_state *st,const kiss_fft_cpx *fin,kiss_fft_cpx *fout)
|
|
567
|
+
{
|
|
568
|
+
int i;
|
|
569
|
+
opus_val16 scale;
|
|
570
|
+
#ifdef FIXED_POINT
|
|
571
|
+
/* Allows us to scale with MULT16_32_Q16(), which is faster than
|
|
572
|
+
MULT16_32_Q15() on ARM. */
|
|
573
|
+
int scale_shift = st->scale_shift-1;
|
|
574
|
+
#endif
|
|
575
|
+
scale = st->scale;
|
|
576
|
+
|
|
577
|
+
celt_assert2 (fin != fout, "In-place FFT not supported");
|
|
578
|
+
/* Bit-reverse the input */
|
|
579
|
+
for (i=0;i<st->nfft;i++)
|
|
580
|
+
{
|
|
581
|
+
kiss_fft_cpx x = fin[i];
|
|
582
|
+
fout[st->bitrev[i]].r = SHR32(MULT16_32_Q16(scale, x.r), scale_shift);
|
|
583
|
+
fout[st->bitrev[i]].i = SHR32(MULT16_32_Q16(scale, x.i), scale_shift);
|
|
584
|
+
}
|
|
585
|
+
opus_fft_impl(st, fout);
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
void opus_ifft_c(const kiss_fft_state *st,const kiss_fft_cpx *fin,kiss_fft_cpx *fout)
|
|
590
|
+
{
|
|
591
|
+
int i;
|
|
592
|
+
celt_assert2 (fin != fout, "In-place FFT not supported");
|
|
593
|
+
/* Bit-reverse the input */
|
|
594
|
+
for (i=0;i<st->nfft;i++)
|
|
595
|
+
fout[st->bitrev[i]] = fin[i];
|
|
596
|
+
for (i=0;i<st->nfft;i++)
|
|
597
|
+
fout[i].i = -fout[i].i;
|
|
598
|
+
opus_fft_impl(st, fout);
|
|
599
|
+
for (i=0;i<st->nfft;i++)
|
|
600
|
+
fout[i].i = -fout[i].i;
|
|
601
|
+
}
|