Add destroy functions for FFT.
authorPhil.Wang <phil.wang@arm.com>
Mon, 2 Feb 2015 04:46:32 +0000 (12:46 +0800)
committerPhil Wang <phil.wang@arm.com>
Tue, 3 Feb 2015 03:23:45 +0000 (03:23 +0000)
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
modules/dsp/NE10_fft.c

index 9a4a47c..08f28fa 100644 (file)
@@ -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);
index 3fb9c89..9c492ad 100644 (file)
@@ -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