From 24cecb105d238e5629cecff60968b31d74e54c2a Mon Sep 17 00:00:00 2001 From: "Phil.Wang" Date: Mon, 2 Feb 2015 12:46:32 +0800 Subject: [PATCH] Add destroy functions for FFT. Using following functions instead of NE10_FREE to make sure memory allocated by Ne10 is also freed by Ne10: - Float/Fixed point Complex FFT Destroy functions: - ne10_fft_destroy_c2c_float32 - ne10_fft_destroy_c2c_int32 - ne10_fft_destroy_c2c_int16 - Float/Fixed point Real2Complex FFT Destroy functions: - ne10_fft_destroy_r2c_float32 - ne10_fft_destroy_r2c_int32 - ne10_fft_destroy_r2c_int16 Change-Id: Ia2eacb5faa8501cf3a8d7705ef732db400fc7013 --- inc/NE10_dsp.h | 9 ++++++++ modules/dsp/NE10_fft.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) diff --git a/inc/NE10_dsp.h b/inc/NE10_dsp.h index 9a4a47c..08f28fa 100644 --- a/inc/NE10_dsp.h +++ b/inc/NE10_dsp.h @@ -97,6 +97,15 @@ extern "C" { /* init functions*/ extern ne10_fft_cfg_int16_t ne10_fft_alloc_c2c_int16 (ne10_int32_t nfft); + /* destroy functions */ + extern void ne10_fft_destroy_c2c_float32 (ne10_fft_cfg_float32_t); + extern void ne10_fft_destroy_c2c_int32 (ne10_fft_cfg_int32_t); + extern void ne10_fft_destroy_c2c_int16 (ne10_fft_cfg_int16_t); + + extern void ne10_fft_destroy_r2c_float32 (ne10_fft_r2c_cfg_float32_t); + extern void ne10_fft_destroy_r2c_int32 (ne10_fft_r2c_cfg_int32_t); + extern void ne10_fft_destroy_r2c_int16 (ne10_fft_r2c_cfg_int16_t); + extern ne10_fft_r2c_cfg_float32_t ne10_fft_alloc_r2c_float32 (ne10_int32_t nfft); extern ne10_fft_r2c_cfg_int32_t ne10_fft_alloc_r2c_int32 (ne10_int32_t nfft); extern ne10_fft_r2c_cfg_int16_t ne10_fft_alloc_r2c_int16 (ne10_int32_t nfft); diff --git a/modules/dsp/NE10_fft.c b/modules/dsp/NE10_fft.c index 3fb9c89..9c492ad 100644 --- a/modules/dsp/NE10_fft.c +++ b/modules/dsp/NE10_fft.c @@ -446,5 +446,66 @@ ne10_fft_cfg_int32_t ne10_fft_alloc_c2c_int32_neon (ne10_int32_t nfft) } /** + * @defgroup C2C_FFT_IFFT_DESTROY Float/Fixed point Complex FFT Destroy functions + * @brief User-callable function to destroy all necessary storage space for the fft. + * @param[in] cfg point to the FFT config memory. This memory is allocaed with malloc by Ne10. + * @{ + */ + +void ne10_fft_destroy_c2c_float32 (ne10_fft_cfg_float32_t cfg) +{ + free(cfg); +} + +void ne10_fft_destroy_c2c_int32 (ne10_fft_cfg_int32_t cfg) +{ + free (cfg); +} + +void ne10_fft_destroy_c2c_int16 (ne10_fft_cfg_int16_t cfg) +{ + free (cfg); +} + +/** + * @} + */ //end of C2C_FFT_IFFT_DESTROY group + +/** * @} */ //end of C2C_FFT_IFFT group + +/** + * @addtogroup R2C_FFT_IFFT + * @{ + */ + +/** + * @defgroup R2C_FFT_IFFT_DESTROY Float/Fixed point Real2Complex FFT Destroy functions + * @brief User-callable function to destroy all necessary storage space for the fft. + * @param[in] cfg point to the FFT config memory. This memory is allocaed with malloc by Ne10. + * @{ + */ + +void ne10_fft_destroy_r2c_float32 (ne10_fft_r2c_cfg_float32_t cfg) +{ + free(cfg); +} + +void ne10_fft_destroy_r2c_int32 (ne10_fft_r2c_cfg_int32_t cfg) +{ + free (cfg); +} + +void ne10_fft_destroy_r2c_int16 (ne10_fft_r2c_cfg_int16_t cfg) +{ + free (cfg); +} + +/** + * @} + */ //end of R2C_FFT_IFFT_DESTROY group + +/** + * @} + */ //end of R2C_FFT_IFFT group -- 2.7.4