Line data Source code
1 : /****************************************************************************** 2 : * ETSI TS 103 634 V1.6.1 * 3 : * Low Complexity Communication Codec Plus (LC3plus) * 4 : * * 5 : * Copyright licence is solely granted through ETSI Intellectual Property * 6 : * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * 7 : * estoppel or otherwise. * 8 : ******************************************************************************/ 9 : 10 : #include "options.h" 11 : #include "wmc_auto.h" 12 : #include "functions.h" 13 : #include "fft/iis_fft.c" 14 : #include "fft/iisfft.c" 15 : #include "fft/cfft.c" 16 : 17 4296 : void fft_init(Fft* fft, int length) 18 : { 19 4296 : HANDLE_IIS_FFT handle = NULL; 20 4296 : IIS_FFT_ERROR error = 0; 21 : 22 4296 : fft->length = length; 23 : 24 4296 : error = LC3_IIS_CFFT_Create(&handle, length, IIS_FFT_FWD); 25 : 26 4296 : assert(error == IIS_FFT_NO_ERROR); 27 : (void) error; 28 4296 : fft->handle = handle; 29 4296 : } 30 : 31 4296 : void fft_free(Fft* fft) 32 : { 33 4296 : IIS_FFT_ERROR error = 0; 34 : 35 4296 : if (fft) { 36 4296 : error = LC3_IIS_CFFT_Destroy((HANDLE_IIS_FFT *) &fft->handle); 37 : 38 4296 : assert(error == IIS_FFT_NO_ERROR); 39 4296 : memset(fft, 0, sizeof(*fft)); 40 : } 41 : 42 : (void) error; 43 4296 : } 44 : 45 1432 : void real_fft_free(Fft* fft) 46 : { 47 1432 : IIS_FFT_ERROR error = 0; 48 : 49 1432 : if (fft) { 50 1432 : error = LC3_IIS_RFFT_Destroy((HANDLE_IIS_FFT *) &fft->handle); 51 : 52 1432 : assert(error == IIS_FFT_NO_ERROR); 53 1432 : memset(fft, 0, sizeof(*fft)); 54 : } 55 : 56 : (void) error; 57 1432 : } 58 : 59 716 : void real_fft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle) 60 : { 61 716 : IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; 62 716 : assert(length % 4 == 0); /* due to current limitation of core complex FFTs*/ 63 : 64 716 : fft->length = length; 65 : 66 716 : error = LC3_IIS_RFFT_Create(handle, length, IIS_FFT_FWD); 67 716 : assert(error == IIS_FFT_NO_ERROR); 68 716 : fft->handle = *handle; 69 : 70 : (void) error; 71 716 : } 72 : 73 : 74 716 : void real_ifft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle) 75 : { 76 716 : IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; 77 716 : assert(length % 4 == 0); /* due to current limitation of core complex FFTs*/ 78 : 79 716 : fft->length = length; 80 : 81 716 : error = LC3_IIS_RFFT_Create(handle, length, IIS_FFT_BWD); 82 : 83 716 : assert(error == IIS_FFT_NO_ERROR); 84 716 : fft->handle = *handle; 85 : 86 : (void) error; 87 716 : } 88 : 89 1771518 : void fft_apply(Fft* fft, const Complex* input, Complex* output) 90 : { 91 1771518 : IIS_FFT_ERROR error = 0; 92 1771518 : error = LC3_IIS_FFT_Apply_CFFT(fft->handle, input, output); 93 : 94 1771518 : assert(error == IIS_FFT_NO_ERROR); 95 : 96 : (void) error; 97 1771518 : } 98 : 99 : 100 0 : void real_fft_apply(Fft* fft, const LC3_FLOAT* input, LC3_FLOAT* output) 101 : { 102 0 : IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; 103 : 104 : UNUSED(error); 105 : 106 0 : error = LC3_IIS_FFT_Apply_RFFT(fft->handle, input, output); 107 : 108 0 : assert(error == IIS_FFT_NO_ERROR); 109 : 110 : (void) error; 111 0 : } 112 :