LCOV - code coverage report
Current view: top level - lib_lc3plus - lc3plus_fft.c (source / functions) Hit Total Coverage
Test: Coverage on main -- merged total coverage @ 0c62f5312a76f89f3e6d6ab9a8d50516c9ab4059 Lines: 43 48 89.6 %
Date: 2025-12-17 10:49:08 Functions: 6 7 85.7 %

          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       18215 : void fft_init(Fft* fft, int length)
      18             : {
      19       18215 :     HANDLE_IIS_FFT handle = NULL;
      20       18215 :     IIS_FFT_ERROR error = 0;
      21             :     
      22       18215 :     fft->length = length;
      23             :     
      24       18215 :     error = LC3_IIS_CFFT_Create(&handle, length, IIS_FFT_FWD);
      25             :     
      26       18215 :     assert(error == IIS_FFT_NO_ERROR);
      27             :     (void) error;
      28       18215 :     fft->handle = handle;
      29       18215 : }
      30             : 
      31       18215 : void fft_free(Fft* fft)
      32             : {
      33       18215 :     IIS_FFT_ERROR error = 0;
      34             :     
      35       18215 :     if (fft) {
      36       18215 :         error = LC3_IIS_CFFT_Destroy((HANDLE_IIS_FFT *) &fft->handle);
      37             :         
      38       18215 :         assert(error == IIS_FFT_NO_ERROR);
      39       18215 :         memset(fft, 0, sizeof(*fft));
      40             :     }
      41             : 
      42             :     (void) error;
      43       18215 : }
      44             : 
      45        6556 : void real_fft_free(Fft* fft)
      46             : {
      47        6556 :     IIS_FFT_ERROR error = 0;
      48             : 
      49        6556 :     if (fft) {
      50        6556 :         error = LC3_IIS_RFFT_Destroy((HANDLE_IIS_FFT *) &fft->handle);
      51             : 
      52        6556 :         assert(error == IIS_FFT_NO_ERROR);
      53        6556 :         memset(fft, 0, sizeof(*fft));
      54             :     }
      55             : 
      56             :     (void) error;
      57        6556 : }
      58             : 
      59        3278 : void real_fft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle)
      60             : {
      61        3278 :     IIS_FFT_ERROR error = IIS_FFT_NO_ERROR;
      62        3278 :     assert(length % 4 == 0); /* due to current limitation of core complex FFTs*/
      63             : 
      64        3278 :     fft->length = length;
      65             : 
      66        3278 :     error = LC3_IIS_RFFT_Create(handle, length, IIS_FFT_FWD);
      67        3278 :     assert(error == IIS_FFT_NO_ERROR);
      68        3278 :     fft->handle = *handle;
      69             : 
      70             :     (void) error;
      71        3278 : }
      72             : 
      73             : 
      74        3278 : void real_ifft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle)
      75             : {
      76        3278 :     IIS_FFT_ERROR error = IIS_FFT_NO_ERROR;
      77        3278 :     assert(length % 4 == 0); /* due to current limitation of core complex FFTs*/
      78             : 
      79        3278 :     fft->length = length;
      80             : 
      81        3278 :     error = LC3_IIS_RFFT_Create(handle, length, IIS_FFT_BWD);
      82             : 
      83        3278 :     assert(error == IIS_FFT_NO_ERROR);
      84        3278 :     fft->handle = *handle;
      85             : 
      86             :     (void) error;
      87        3278 : }
      88             : 
      89     5636013 : void fft_apply(Fft* fft, const Complex* input, Complex* output)
      90             : {
      91     5636013 :     IIS_FFT_ERROR error = 0;
      92     5636013 :     error = LC3_IIS_FFT_Apply_CFFT(fft->handle, input, output);
      93             :     
      94     5636013 :     assert(error == IIS_FFT_NO_ERROR);
      95             : 
      96             :     (void) error;
      97     5636013 : }
      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             : 

Generated by: LCOV version 1.14