andrewm@379: /* andrewm@379: * Copyright 2012-15 ARM Limited and Contributors. andrewm@379: * All rights reserved. andrewm@379: * andrewm@379: * Redistribution and use in source and binary forms, with or without andrewm@379: * modification, are permitted provided that the following conditions are met: andrewm@379: * * Redistributions of source code must retain the above copyright andrewm@379: * notice, this list of conditions and the following disclaimer. andrewm@379: * * Redistributions in binary form must reproduce the above copyright andrewm@379: * notice, this list of conditions and the following disclaimer in the andrewm@379: * documentation and/or other materials provided with the distribution. andrewm@379: * * Neither the name of ARM Limited nor the andrewm@379: * names of its contributors may be used to endorse or promote products andrewm@379: * derived from this software without specific prior written permission. andrewm@379: * andrewm@379: * THIS SOFTWARE IS PROVIDED BY ARM LIMITED AND CONTRIBUTORS "AS IS" AND andrewm@379: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED andrewm@379: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE andrewm@379: * DISCLAIMED. IN NO EVENT SHALL ARM LIMITED AND CONTRIBUTORS BE LIABLE FOR ANY andrewm@379: * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES andrewm@379: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; andrewm@379: * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND andrewm@379: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT andrewm@379: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS andrewm@379: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. andrewm@379: */ andrewm@379: andrewm@379: /* andrewm@379: * NE10 Library : inc/NE10_dsp.h andrewm@379: */ andrewm@379: andrewm@379: andrewm@379: #include "NE10_types.h" andrewm@379: andrewm@379: #ifndef NE10_DSP_H andrewm@379: #define NE10_DSP_H andrewm@379: andrewm@379: #ifdef __cplusplus andrewm@379: extern "C" { andrewm@379: #endif andrewm@379: andrewm@379: /////////////////////////// andrewm@379: // function prototypes: andrewm@379: /////////////////////////// andrewm@379: andrewm@379: /* fft functions*/ andrewm@379: andrewm@379: /* function pointers*/ andrewm@379: extern ne10_fft_cfg_float32_t (*ne10_fft_alloc_c2c_float32) (ne10_int32_t nfft); andrewm@379: extern ne10_fft_cfg_int32_t (*ne10_fft_alloc_c2c_int32) (ne10_int32_t nfft); andrewm@379: andrewm@379: extern void (*ne10_fft_c2c_1d_float32) (ne10_fft_cpx_float32_t *fout, andrewm@379: ne10_fft_cpx_float32_t *fin, andrewm@379: ne10_fft_cfg_float32_t cfg, andrewm@379: ne10_int32_t inverse_fft); andrewm@379: andrewm@379: extern void (*ne10_fft_r2c_1d_float32) (ne10_fft_cpx_float32_t *fout, andrewm@379: ne10_float32_t *fin, andrewm@379: ne10_fft_r2c_cfg_float32_t cfg); andrewm@379: andrewm@379: extern void (*ne10_fft_c2r_1d_float32) (ne10_float32_t *fout, andrewm@379: ne10_fft_cpx_float32_t *fin, andrewm@379: ne10_fft_r2c_cfg_float32_t cfg); andrewm@379: andrewm@379: extern void (*ne10_fft_c2c_1d_int32) (ne10_fft_cpx_int32_t *fout, andrewm@379: ne10_fft_cpx_int32_t *fin, andrewm@379: ne10_fft_cfg_int32_t cfg, andrewm@379: ne10_int32_t inverse_fft, andrewm@379: ne10_int32_t scaled_flag); andrewm@379: andrewm@379: extern void (*ne10_fft_r2c_1d_int32) (ne10_fft_cpx_int32_t *fout, andrewm@379: ne10_int32_t *fin, andrewm@379: ne10_fft_r2c_cfg_int32_t cfg, andrewm@379: ne10_int32_t scaled_flag); andrewm@379: andrewm@379: extern void (*ne10_fft_c2r_1d_int32) (ne10_int32_t *fout, andrewm@379: ne10_fft_cpx_int32_t *fin, andrewm@379: ne10_fft_r2c_cfg_int32_t cfg, andrewm@379: ne10_int32_t scaled_flag); andrewm@379: andrewm@379: extern void (*ne10_fft_c2c_1d_int16) (ne10_fft_cpx_int16_t *fout, andrewm@379: ne10_fft_cpx_int16_t *fin, andrewm@379: ne10_fft_cfg_int16_t cfg, andrewm@379: ne10_int32_t inverse_fft, andrewm@379: ne10_int32_t scaled_flag); andrewm@379: andrewm@379: extern void (*ne10_fft_r2c_1d_int16) (ne10_fft_cpx_int16_t *fout, andrewm@379: ne10_int16_t *fin, andrewm@379: ne10_fft_r2c_cfg_int16_t cfg, andrewm@379: ne10_int32_t scaled_flag); andrewm@379: andrewm@379: extern void (*ne10_fft_c2r_1d_int16) (ne10_int16_t *fout, andrewm@379: ne10_fft_cpx_int16_t *fin, andrewm@379: ne10_fft_r2c_cfg_int16_t cfg, andrewm@379: ne10_int32_t scaled_flag); andrewm@379: andrewm@379: /* init functions*/ andrewm@379: extern ne10_fft_cfg_int16_t ne10_fft_alloc_c2c_int16 (ne10_int32_t nfft); andrewm@379: andrewm@379: /* destroy functions */ andrewm@379: extern void ne10_fft_destroy_c2c_float32 (ne10_fft_cfg_float32_t); andrewm@379: extern void ne10_fft_destroy_c2c_int32 (ne10_fft_cfg_int32_t); andrewm@379: extern void ne10_fft_destroy_c2c_int16 (ne10_fft_cfg_int16_t); andrewm@379: andrewm@379: extern void ne10_fft_destroy_r2c_float32 (ne10_fft_r2c_cfg_float32_t); andrewm@379: extern void ne10_fft_destroy_r2c_int32 (ne10_fft_r2c_cfg_int32_t); andrewm@379: extern void ne10_fft_destroy_r2c_int16 (ne10_fft_r2c_cfg_int16_t); andrewm@379: andrewm@379: extern ne10_fft_r2c_cfg_float32_t ne10_fft_alloc_r2c_float32 (ne10_int32_t nfft); andrewm@379: extern ne10_fft_r2c_cfg_int32_t ne10_fft_alloc_r2c_int32 (ne10_int32_t nfft); andrewm@379: extern ne10_fft_r2c_cfg_int16_t ne10_fft_alloc_r2c_int16 (ne10_int32_t nfft); andrewm@379: andrewm@379: /* C version*/ andrewm@379: extern ne10_fft_cfg_float32_t ne10_fft_alloc_c2c_float32_c (ne10_int32_t nfft); andrewm@379: extern ne10_fft_cfg_int32_t ne10_fft_alloc_c2c_int32_c (ne10_int32_t nfft); andrewm@379: andrewm@379: extern void ne10_fft_c2c_1d_float32_c (ne10_fft_cpx_float32_t *fout, andrewm@379: ne10_fft_cpx_float32_t *fin, andrewm@379: ne10_fft_cfg_float32_t cfg, andrewm@379: ne10_int32_t inverse_fft); andrewm@379: andrewm@379: extern void ne10_fft_r2c_1d_float32_c (ne10_fft_cpx_float32_t *fout, andrewm@379: ne10_float32_t *fin, andrewm@379: ne10_fft_r2c_cfg_float32_t cfg); andrewm@379: andrewm@379: extern void ne10_fft_c2r_1d_float32_c (ne10_float32_t *fout, andrewm@379: ne10_fft_cpx_float32_t *fin, andrewm@379: ne10_fft_r2c_cfg_float32_t cfg); andrewm@379: andrewm@379: extern void ne10_fft_c2c_1d_int32_c (ne10_fft_cpx_int32_t *fout, andrewm@379: ne10_fft_cpx_int32_t *fin, andrewm@379: ne10_fft_cfg_int32_t cfg, andrewm@379: ne10_int32_t inverse_fft, andrewm@379: ne10_int32_t scaled_flag); andrewm@379: andrewm@379: extern void ne10_fft_r2c_1d_int32_c (ne10_fft_cpx_int32_t *fout, andrewm@379: ne10_int32_t *fin, andrewm@379: ne10_fft_r2c_cfg_int32_t cfg, andrewm@379: ne10_int32_t scaled_flag); andrewm@379: andrewm@379: extern void ne10_fft_c2r_1d_int32_c (ne10_int32_t *fout, andrewm@379: ne10_fft_cpx_int32_t *fin, andrewm@379: ne10_fft_r2c_cfg_int32_t cfg, andrewm@379: ne10_int32_t scaled_flag); andrewm@379: andrewm@379: extern void ne10_fft_c2c_1d_int16_c (ne10_fft_cpx_int16_t *fout, andrewm@379: ne10_fft_cpx_int16_t *fin, andrewm@379: ne10_fft_cfg_int16_t cfg, andrewm@379: ne10_int32_t inverse_fft, andrewm@379: ne10_int32_t scaled_flag); andrewm@379: andrewm@379: extern void ne10_fft_r2c_1d_int16_c (ne10_fft_cpx_int16_t *fout, andrewm@379: ne10_int16_t *fin, andrewm@379: ne10_fft_r2c_cfg_int16_t cfg, andrewm@379: ne10_int32_t scaled_flag); andrewm@379: andrewm@379: extern void ne10_fft_c2r_1d_int16_c (ne10_int16_t *fout, andrewm@379: ne10_fft_cpx_int16_t *fin, andrewm@379: ne10_fft_r2c_cfg_int16_t cfg, andrewm@379: ne10_int32_t scaled_flag); andrewm@379: andrewm@379: andrewm@379: /* NEON version*/ andrewm@379: extern ne10_fft_cfg_float32_t ne10_fft_alloc_c2c_float32_neon (ne10_int32_t nfft); andrewm@379: extern ne10_fft_cfg_int32_t ne10_fft_alloc_c2c_int32_neon (ne10_int32_t nfft); andrewm@379: andrewm@379: extern void ne10_fft_c2c_1d_float32_neon (ne10_fft_cpx_float32_t *fout, andrewm@379: ne10_fft_cpx_float32_t *fin, andrewm@379: ne10_fft_cfg_float32_t cfg, andrewm@379: ne10_int32_t inverse_fft); andrewm@379: andrewm@379: extern void ne10_fft_r2c_1d_float32_neon (ne10_fft_cpx_float32_t *fout, andrewm@379: ne10_float32_t *fin, andrewm@379: ne10_fft_r2c_cfg_float32_t cfg); andrewm@379: andrewm@379: extern void ne10_fft_c2r_1d_float32_neon (ne10_float32_t *fout, andrewm@379: ne10_fft_cpx_float32_t *fin, andrewm@379: ne10_fft_r2c_cfg_float32_t cfg); andrewm@379: andrewm@379: extern void ne10_fft_c2c_1d_int32_neon (ne10_fft_cpx_int32_t *fout, andrewm@379: ne10_fft_cpx_int32_t *fin, andrewm@379: ne10_fft_cfg_int32_t cfg, andrewm@379: ne10_int32_t inverse_fft, andrewm@379: ne10_int32_t scaled_flag); andrewm@379: andrewm@379: extern void ne10_fft_r2c_1d_int32_neon (ne10_fft_cpx_int32_t *fout, andrewm@379: ne10_int32_t *fin, andrewm@379: ne10_fft_r2c_cfg_int32_t cfg, andrewm@379: ne10_int32_t scaled_flag); andrewm@379: andrewm@379: extern void ne10_fft_c2r_1d_int32_neon (ne10_int32_t *fout, andrewm@379: ne10_fft_cpx_int32_t *fin, andrewm@379: ne10_fft_r2c_cfg_int32_t cfg, andrewm@379: ne10_int32_t scaled_flag); andrewm@379: andrewm@379: extern void ne10_fft_c2c_1d_int16_neon (ne10_fft_cpx_int16_t *fout, andrewm@379: ne10_fft_cpx_int16_t *fin, andrewm@379: ne10_fft_cfg_int16_t cfg, andrewm@379: ne10_int32_t inverse_fft, andrewm@379: ne10_int32_t scaled_flag); andrewm@379: andrewm@379: extern void ne10_fft_r2c_1d_int16_neon (ne10_fft_cpx_int16_t *fout, andrewm@379: ne10_int16_t *fin, andrewm@379: ne10_fft_r2c_cfg_int16_t cfg, andrewm@379: ne10_int32_t scaled_flag); andrewm@379: andrewm@379: extern void ne10_fft_c2r_1d_int16_neon (ne10_int16_t *fout, andrewm@379: ne10_fft_cpx_int16_t *fin, andrewm@379: ne10_fft_r2c_cfg_int16_t cfg, andrewm@379: ne10_int32_t scaled_flag); andrewm@379: andrewm@379: /* fir functions*/ andrewm@379: andrewm@379: /* function pointers*/ andrewm@379: extern void (*ne10_fir_float) (const ne10_fir_instance_f32_t * S, andrewm@379: ne10_float32_t * pSrc, andrewm@379: ne10_float32_t * pDst, andrewm@379: ne10_uint32_t blockSize); andrewm@379: andrewm@379: extern void (*ne10_fir_decimate_float) (const ne10_fir_decimate_instance_f32_t * S, andrewm@379: ne10_float32_t * pSrc, andrewm@379: ne10_float32_t * pDst, andrewm@379: ne10_uint32_t blockSize); andrewm@379: andrewm@379: extern void (*ne10_fir_interpolate_float) (const ne10_fir_interpolate_instance_f32_t * S, andrewm@379: ne10_float32_t * pSrc, andrewm@379: ne10_float32_t * pDst, andrewm@379: ne10_uint32_t blockSize); andrewm@379: andrewm@379: extern void (*ne10_fir_lattice_float) (const ne10_fir_lattice_instance_f32_t * S, andrewm@379: ne10_float32_t * pSrc, andrewm@379: ne10_float32_t * pDst, andrewm@379: ne10_uint32_t blockSize); andrewm@379: andrewm@379: extern void (*ne10_fir_sparse_float) (ne10_fir_sparse_instance_f32_t * S, andrewm@379: ne10_float32_t * pSrc, andrewm@379: ne10_float32_t * pDst, andrewm@379: ne10_float32_t * pScratchIn, andrewm@379: ne10_uint32_t blockSize); andrewm@379: andrewm@379: andrewm@379: /* init functions*/ andrewm@379: extern ne10_result_t ne10_fir_init_float (ne10_fir_instance_f32_t * S, andrewm@379: ne10_uint16_t numTaps, andrewm@379: ne10_float32_t * pCoeffs, andrewm@379: ne10_float32_t * pState, andrewm@379: ne10_uint32_t blockSize); andrewm@379: andrewm@379: extern ne10_result_t ne10_fir_decimate_init_float (ne10_fir_decimate_instance_f32_t * S, andrewm@379: ne10_uint16_t numTaps, andrewm@379: ne10_uint8_t M, andrewm@379: ne10_float32_t * pCoeffs, andrewm@379: ne10_float32_t * pState, andrewm@379: ne10_uint32_t blockSize); andrewm@379: andrewm@379: extern ne10_result_t ne10_fir_interpolate_init_float (ne10_fir_interpolate_instance_f32_t * S, andrewm@379: ne10_uint8_t L, andrewm@379: ne10_uint16_t numTaps, andrewm@379: ne10_float32_t * pCoeffs, andrewm@379: ne10_float32_t * pState, andrewm@379: ne10_uint32_t blockSize); andrewm@379: andrewm@379: extern ne10_result_t ne10_fir_lattice_init_float (ne10_fir_lattice_instance_f32_t * S, andrewm@379: ne10_uint16_t numStages, andrewm@379: ne10_float32_t * pCoeffs, andrewm@379: ne10_float32_t * pState); andrewm@379: andrewm@379: extern ne10_result_t ne10_fir_sparse_init_float (ne10_fir_sparse_instance_f32_t * S, andrewm@379: ne10_uint16_t numTaps, andrewm@379: ne10_float32_t * pCoeffs, andrewm@379: ne10_float32_t * pState, andrewm@379: ne10_int32_t * pTapDelay, andrewm@379: ne10_uint16_t maxDelay, andrewm@379: ne10_uint32_t blockSize); andrewm@379: andrewm@379: /* C version*/ andrewm@379: extern void ne10_fir_float_c (const ne10_fir_instance_f32_t * S, andrewm@379: ne10_float32_t * pSrc, andrewm@379: ne10_float32_t * pDst, andrewm@379: ne10_uint32_t blockSize); andrewm@379: andrewm@379: extern void ne10_fir_decimate_float_c (const ne10_fir_decimate_instance_f32_t * S, andrewm@379: ne10_float32_t * pSrc, andrewm@379: ne10_float32_t * pDst, andrewm@379: ne10_uint32_t blockSize); andrewm@379: andrewm@379: extern void ne10_fir_interpolate_float_c (const ne10_fir_interpolate_instance_f32_t * S, andrewm@379: ne10_float32_t * pSrc, andrewm@379: ne10_float32_t * pDst, andrewm@379: ne10_uint32_t blockSize); andrewm@379: andrewm@379: extern void ne10_fir_lattice_float_c (const ne10_fir_lattice_instance_f32_t * S, andrewm@379: ne10_float32_t * pSrc, andrewm@379: ne10_float32_t * pDst, andrewm@379: ne10_uint32_t blockSize); andrewm@379: andrewm@379: extern void ne10_fir_sparse_float_c (ne10_fir_sparse_instance_f32_t * S, andrewm@379: ne10_float32_t * pSrc, andrewm@379: ne10_float32_t * pDst, andrewm@379: ne10_float32_t * pScratchIn, andrewm@379: ne10_uint32_t blockSize); andrewm@379: andrewm@379: andrewm@379: /* NEON version*/ andrewm@379: andrewm@379: /** andrewm@379: * @addtogroup FIR andrewm@379: * @{ andrewm@379: */ andrewm@379: #ifdef ENABLE_NE10_FIR_FLOAT_NEON andrewm@379: extern void ne10_fir_float_neon (const ne10_fir_instance_f32_t * S, andrewm@379: ne10_float32_t * pSrc, andrewm@379: ne10_float32_t * pDst, andrewm@379: ne10_uint32_t blockSize) andrewm@379: asm ("ne10_fir_float_neon"); andrewm@379: #endif // ENABLE_NE10_FIR_FLOAT_NEON andrewm@379: /** @} */ //end of FIR group andrewm@379: andrewm@379: /** andrewm@379: * @addtogroup FIR_Decimate andrewm@379: * @{ andrewm@379: */ andrewm@379: #ifdef ENABLE_NE10_FIR_DECIMATE_FLOAT_NEON andrewm@379: extern void ne10_fir_decimate_float_neon (const ne10_fir_decimate_instance_f32_t * S, andrewm@379: ne10_float32_t *pSrc, andrewm@379: ne10_float32_t *pDst, andrewm@379: ne10_uint32_t blockSize) asm ("ne10_fir_decimate_float_neon"); andrewm@379: andrewm@379: /** @} */ //end of FIR_decimate group andrewm@379: #endif // ENABLE_NE10_FIR_DECIMATE_FLOAT_NEON andrewm@379: /** andrewm@379: * @addtogroup FIR_Interpolate andrewm@379: * @{ andrewm@379: */ andrewm@379: #ifdef ENABLE_NE10_FIR_INTERPOLATE_FLOAT_NEON andrewm@379: extern void ne10_fir_interpolate_float_neon (const ne10_fir_interpolate_instance_f32_t * S, andrewm@379: ne10_float32_t *pSrc, andrewm@379: ne10_float32_t *pDst, andrewm@379: ne10_uint32_t blockSize) asm ("ne10_fir_interpolate_float_neon"); andrewm@379: #endif // ENABLE_NE10_FIR_INTERPOLATE_FLOAT_NEON andrewm@379: /** @} */ //end of FIR_interpolate group andrewm@379: andrewm@379: /** andrewm@379: * @addtogroup FIR_Lattice andrewm@379: * @{ andrewm@379: */ andrewm@379: #ifdef ENABLE_NE10_FIR_LATTICE_FLOAT_NEON andrewm@379: extern void ne10_fir_lattice_float_neon (const ne10_fir_lattice_instance_f32_t * S, andrewm@379: ne10_float32_t * pSrc, andrewm@379: ne10_float32_t * pDst, andrewm@379: ne10_uint32_t blockSize) asm ("ne10_fir_lattice_float_neon"); andrewm@379: #endif // ENABLE_NE10_FIR_LATTICE_FLOAT_NEON andrewm@379: /** @} */ //end of FIR_Lattice group andrewm@379: andrewm@379: /** andrewm@379: * @addtogroup FIR_Sparse andrewm@379: * @{ andrewm@379: */ andrewm@379: #ifdef ENABLE_NE10_FIR_SPARSE_FLOAT_NEON andrewm@379: extern void ne10_fir_sparse_float_neon (ne10_fir_sparse_instance_f32_t * S, andrewm@379: ne10_float32_t * pSrc, andrewm@379: ne10_float32_t * pDst, andrewm@379: ne10_float32_t * pScratch, andrewm@379: ne10_uint32_t blockSize) andrewm@379: asm ("ne10_fir_sparse_float_neon"); andrewm@379: #endif // ENABLE_NE10_FIR_SPARSE_FLOAT_NEON andrewm@379: /** @} */ //end of FIR_sparse group andrewm@379: andrewm@379: andrewm@379: /* iir functions*/ andrewm@379: andrewm@379: /* function pointers*/ andrewm@379: extern void (*ne10_iir_lattice_float) (const ne10_iir_lattice_instance_f32_t * S, andrewm@379: ne10_float32_t * pSrc, andrewm@379: ne10_float32_t * pDst, andrewm@379: ne10_uint32_t blockSize); andrewm@379: andrewm@379: /* init functions*/ andrewm@379: extern ne10_result_t ne10_iir_lattice_init_float (ne10_iir_lattice_instance_f32_t * S, andrewm@379: ne10_uint16_t numStages, andrewm@379: ne10_float32_t * pkCoeffs, andrewm@379: ne10_float32_t * pvCoeffs, andrewm@379: ne10_float32_t * pState, andrewm@379: ne10_uint32_t blockSize); andrewm@379: andrewm@379: andrewm@379: /* C version*/ andrewm@379: extern void ne10_iir_lattice_float_c (const ne10_iir_lattice_instance_f32_t * S, andrewm@379: ne10_float32_t * pSrc, andrewm@379: ne10_float32_t * pDst, andrewm@379: ne10_uint32_t blockSize); andrewm@379: andrewm@379: /* NEON version*/ andrewm@379: andrewm@379: /** andrewm@379: * @addtogroup IIR_Lattice andrewm@379: * @{ andrewm@379: */ andrewm@379: #ifdef ENABLE_NE10_IIR_LATTICE_FLOAT_NEON andrewm@379: extern void ne10_iir_lattice_float_neon (const ne10_iir_lattice_instance_f32_t * S, andrewm@379: ne10_float32_t * pSrc, andrewm@379: ne10_float32_t * pDst, andrewm@379: ne10_uint32_t blockSize) asm ("ne10_iir_lattice_float_neon"); andrewm@379: #endif // ENABLE_NE10_IIR_LATTICE_FLOAT_NEON andrewm@379: /** @} */ //end of IIR_Lattice group andrewm@379: andrewm@379: #ifdef __cplusplus andrewm@379: } andrewm@379: #endif andrewm@379: andrewm@379: #endif