From a0db0699780f44f2c00826cd522ed1146f04601f Mon Sep 17 00:00:00 2001 From: Siyuan Cheng Date: Mon, 16 Jan 2023 15:37:46 +0800 Subject: [PATCH] zdsp: Introduce attribute marco for third-party backend Introduce DSP_DATA and DSP_STATIC_DATA attribute marco to support third-party backend Signed-off-by: Siyuan Cheng --- include/zephyr/dsp/basicmath.h | 192 +++++++++++++------------ include/zephyr/dsp/dsp.h | 4 + tests/subsys/dsp/basicmath/src/f32.c | 97 ++++++------- tests/subsys/dsp/basicmath/src/f32.pat | 6 +- tests/subsys/dsp/basicmath/src/q15.c | 84 +++++------ tests/subsys/dsp/basicmath/src/q15.pat | 18 +-- tests/subsys/dsp/basicmath/src/q31.c | 108 +++++++------- tests/subsys/dsp/basicmath/src/q31.pat | 23 ++- tests/subsys/dsp/basicmath/src/q7.c | 109 +++++++------- tests/subsys/dsp/basicmath/src/q7.pat | 18 +-- 10 files changed, 329 insertions(+), 330 deletions(-) diff --git a/include/zephyr/dsp/basicmath.h b/include/zephyr/dsp/basicmath.h index 0128b3c727..0c85ca6210 100644 --- a/include/zephyr/dsp/basicmath.h +++ b/include/zephyr/dsp/basicmath.h @@ -46,8 +46,8 @@ extern "C" { * @param[out] dst points to the output vector * @param[in] block_size number of samples in each vector */ -DSP_FUNC_SCOPE void zdsp_mult_q7(const q7_t *src_a, const q7_t *src_b, q7_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_mult_q7(const DSP_DATA q7_t *src_a, const DSP_DATA q7_t *src_b, + DSP_DATA q7_t *dst, uint32_t block_size); /** * @brief Q15 vector multiplication. @@ -61,8 +61,8 @@ DSP_FUNC_SCOPE void zdsp_mult_q7(const q7_t *src_a, const q7_t *src_b, q7_t *dst * @param[out] dst points to the output vector * @param[in] block_size number of samples in each vector */ -DSP_FUNC_SCOPE void zdsp_mult_q15(const q15_t *src_a, const q15_t *src_b, q15_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_mult_q15(const DSP_DATA q15_t *src_a, const DSP_DATA q15_t *src_b, + DSP_DATA q15_t *dst, uint32_t block_size); /** * @brief Q31 vector multiplication. @@ -76,8 +76,8 @@ DSP_FUNC_SCOPE void zdsp_mult_q15(const q15_t *src_a, const q15_t *src_b, q15_t * @param[out] dst points to the output vector * @param[in] block_size number of samples in each vector */ -DSP_FUNC_SCOPE void zdsp_mult_q31(const q31_t *src_a, const q31_t *src_b, q31_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_mult_q31(const DSP_DATA q31_t *src_a, const DSP_DATA q31_t *src_b, + DSP_DATA q31_t *dst, uint32_t block_size); /** * @brief Floating-point vector multiplication. @@ -86,8 +86,8 @@ DSP_FUNC_SCOPE void zdsp_mult_q31(const q31_t *src_a, const q31_t *src_b, q31_t * @param[out] dst points to the output vector * @param[in] block_size number of samples in each vector */ -DSP_FUNC_SCOPE void zdsp_mult_f32(const float32_t *src_a, const float32_t *src_b, float32_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_mult_f32(const DSP_DATA float32_t *src_a, const DSP_DATA float32_t *src_b, + DSP_DATA float32_t *dst, uint32_t block_size); /** * @} @@ -112,8 +112,8 @@ DSP_FUNC_SCOPE void zdsp_mult_f32(const float32_t *src_a, const float32_t *src_b * @param[out] dst points to the output vector * @param[in] block_size number of samples in each vector */ -DSP_FUNC_SCOPE void zdsp_add_f32(const float32_t *src_a, const float32_t *src_b, float32_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_add_f32(const DSP_DATA float32_t *src_a, const DSP_DATA float32_t *src_b, + DSP_DATA float32_t *dst, uint32_t block_size); /** * @brief Q7 vector addition. @@ -127,8 +127,8 @@ DSP_FUNC_SCOPE void zdsp_add_f32(const float32_t *src_a, const float32_t *src_b, * @param[out] dst points to the output vector * @param[in] block_size number of samples in each vector */ -DSP_FUNC_SCOPE void zdsp_add_q7(const q7_t *src_a, const q7_t *src_b, q7_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_add_q7(const DSP_DATA q7_t *src_a, const DSP_DATA q7_t *src_b, + DSP_DATA q7_t *dst, uint32_t block_size); /** * @brief Q15 vector addition. @@ -142,8 +142,8 @@ DSP_FUNC_SCOPE void zdsp_add_q7(const q7_t *src_a, const q7_t *src_b, q7_t *dst, * @param[out] dst points to the output vector * @param[in] block_size number of samples in each vector */ -DSP_FUNC_SCOPE void zdsp_add_q15(const q15_t *src_a, const q15_t *src_b, q15_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_add_q15(const DSP_DATA q15_t *src_a, const DSP_DATA q15_t *src_b, + DSP_DATA q15_t *dst, uint32_t block_size); /** * @brief Q31 vector addition. @@ -157,8 +157,8 @@ DSP_FUNC_SCOPE void zdsp_add_q15(const q15_t *src_a, const q15_t *src_b, q15_t * * @param[out] dst points to the output vector * @param[in] block_size number of samples in each vector */ -DSP_FUNC_SCOPE void zdsp_add_q31(const q31_t *src_a, const q31_t *src_b, q31_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_add_q31(const DSP_DATA q31_t *src_a, const DSP_DATA q31_t *src_b, + DSP_DATA q31_t *dst, uint32_t block_size); /** * @} @@ -183,8 +183,8 @@ DSP_FUNC_SCOPE void zdsp_add_q31(const q31_t *src_a, const q31_t *src_b, q31_t * * @param[out] dst points to the output vector * @param[in] block_size number of samples in each vector */ -DSP_FUNC_SCOPE void zdsp_sub_f32(const float32_t *src_a, const float32_t *src_b, float32_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_sub_f32(const DSP_DATA float32_t *src_a, const DSP_DATA float32_t *src_b, + DSP_DATA float32_t *dst, uint32_t block_size); /** * @brief Q7 vector subtraction. @@ -198,8 +198,8 @@ DSP_FUNC_SCOPE void zdsp_sub_f32(const float32_t *src_a, const float32_t *src_b, * @param[out] dst points to the output vector * @param[in] block_size number of samples in each vector */ -DSP_FUNC_SCOPE void zdsp_sub_q7(const q7_t *src_a, const q7_t *src_b, q7_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_sub_q7(const DSP_DATA q7_t *src_a, const DSP_DATA q7_t *src_b, + DSP_DATA q7_t *dst, uint32_t block_size); /** * @brief Q15 vector subtraction. @@ -213,8 +213,8 @@ DSP_FUNC_SCOPE void zdsp_sub_q7(const q7_t *src_a, const q7_t *src_b, q7_t *dst, * @param[out] dst points to the output vector * @param[in] block_size number of samples in each vector */ -DSP_FUNC_SCOPE void zdsp_sub_q15(const q15_t *src_a, const q15_t *src_b, q15_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_sub_q15(const DSP_DATA q15_t *src_a, const DSP_DATA q15_t *src_b, + DSP_DATA q15_t *dst, uint32_t block_size); /** * @brief Q31 vector subtraction. @@ -228,8 +228,8 @@ DSP_FUNC_SCOPE void zdsp_sub_q15(const q15_t *src_a, const q15_t *src_b, q15_t * * @param[out] dst points to the output vector * @param[in] block_size number of samples in each vector */ -DSP_FUNC_SCOPE void zdsp_sub_q31(const q31_t *src_a, const q31_t *src_b, q31_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_sub_q31(const DSP_DATA q31_t *src_a, const DSP_DATA q31_t *src_b, + DSP_DATA q31_t *dst, uint32_t block_size); /** * @} @@ -268,8 +268,8 @@ DSP_FUNC_SCOPE void zdsp_sub_q31(const q31_t *src_a, const q31_t *src_b, q31_t * * @param[out] dst points to the output vector * @param[in] block_size number of samples in the vector */ -DSP_FUNC_SCOPE void zdsp_scale_f32(const float32_t *src, float32_t scale, float32_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_scale_f32(const DSP_DATA float32_t *src, float32_t scale, + DSP_DATA float32_t *dst, uint32_t block_size); /** * @brief Multiplies a Q7 vector by a scalar. @@ -285,8 +285,8 @@ DSP_FUNC_SCOPE void zdsp_scale_f32(const float32_t *src, float32_t scale, float3 * @param[out] dst points to the output vector * @param[in] block_size number of samples in the vector */ -DSP_FUNC_SCOPE void zdsp_scale_q7(const q7_t *src, q7_t scale_fract, int8_t shift, q7_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_scale_q7(const DSP_DATA q7_t *src, q7_t scale_fract, int8_t shift, + DSP_DATA q7_t *dst, uint32_t block_size); /** * @brief Multiplies a Q15 vector by a scalar. @@ -302,8 +302,8 @@ DSP_FUNC_SCOPE void zdsp_scale_q7(const q7_t *src, q7_t scale_fract, int8_t shif * @param[out] dst points to the output vector * @param[in] block_size number of samples in the vector */ -DSP_FUNC_SCOPE void zdsp_scale_q15(const q15_t *src, q15_t scale_fract, int8_t shift, q15_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_scale_q15(const DSP_DATA q15_t *src, q15_t scale_fract, int8_t shift, + DSP_DATA q15_t *dst, uint32_t block_size); /** * @brief Multiplies a Q31 vector by a scalar. @@ -319,8 +319,8 @@ DSP_FUNC_SCOPE void zdsp_scale_q15(const q15_t *src, q15_t scale_fract, int8_t s * @param[out] dst points to the output vector * @param[in] block_size number of samples in the vector */ -DSP_FUNC_SCOPE void zdsp_scale_q31(const q31_t *src, q31_t scale_fract, int8_t shift, q31_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_scale_q31(const DSP_DATA q31_t *src, q31_t scale_fract, int8_t shift, + DSP_DATA q31_t *dst, uint32_t block_size); /** * @} @@ -346,7 +346,8 @@ DSP_FUNC_SCOPE void zdsp_scale_q31(const q31_t *src, q31_t scale_fract, int8_t s * @param[out] dst points to the output buffer * @param[in] block_size number of samples in each vector */ -DSP_FUNC_SCOPE void zdsp_abs_f32(const float32_t *src, float32_t *dst, uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_abs_f32(const DSP_DATA float32_t *src, DSP_DATA float32_t *dst, + uint32_t block_size); /** * @brief Q7 vector absolute value. @@ -359,7 +360,7 @@ DSP_FUNC_SCOPE void zdsp_abs_f32(const float32_t *src, float32_t *dst, uint32_t * @param[out] dst points to the output buffer * @param[in] block_size number of samples in each vector */ -DSP_FUNC_SCOPE void zdsp_abs_q7(const q7_t *src, q7_t *dst, uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_abs_q7(const DSP_DATA q7_t *src, DSP_DATA q7_t *dst, uint32_t block_size); /** * @brief Q15 vector absolute value. @@ -372,7 +373,8 @@ DSP_FUNC_SCOPE void zdsp_abs_q7(const q7_t *src, q7_t *dst, uint32_t block_size) * @param[out] dst points to the output buffer * @param[in] block_size number of samples in each vector */ -DSP_FUNC_SCOPE void zdsp_abs_q15(const q15_t *src, q15_t *dst, uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_abs_q15(const DSP_DATA q15_t *src, DSP_DATA q15_t *dst, + uint32_t block_size); /** * @brief Q31 vector absolute value. @@ -386,7 +388,8 @@ DSP_FUNC_SCOPE void zdsp_abs_q15(const q15_t *src, q15_t *dst, uint32_t block_si * @param[out] dst points to the output buffer * @param[in] block_size number of samples in each vector */ -DSP_FUNC_SCOPE void zdsp_abs_q31(const q31_t *src, q31_t *dst, uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_abs_q31(const DSP_DATA q31_t *src, DSP_DATA q31_t *dst, + uint32_t block_size); /** * @} @@ -412,8 +415,9 @@ DSP_FUNC_SCOPE void zdsp_abs_q31(const q31_t *src, q31_t *dst, uint32_t block_si * @param[in] block_size number of samples in each vector * @param[out] result output result returned here */ -DSP_FUNC_SCOPE void zdsp_dot_prod_f32(const float32_t *src_a, const float32_t *src_b, - uint32_t block_size, float32_t *result); +DSP_FUNC_SCOPE void zdsp_dot_prod_f32(const DSP_DATA float32_t *src_a, + const DSP_DATA float32_t *src_b, uint32_t block_size, + DSP_DATA float32_t *result); /** * @brief Dot product of Q7 vectors. @@ -429,8 +433,8 @@ DSP_FUNC_SCOPE void zdsp_dot_prod_f32(const float32_t *src_a, const float32_t *s * @param[in] block_size number of samples in each vector * @param[out] result output result returned here */ -DSP_FUNC_SCOPE void zdsp_dot_prod_q7(const q7_t *src_a, const q7_t *src_b, uint32_t block_size, - q31_t *result); +DSP_FUNC_SCOPE void zdsp_dot_prod_q7(const DSP_DATA q7_t *src_a, const DSP_DATA q7_t *src_b, + uint32_t block_size, DSP_DATA q31_t *result); /** * @brief Dot product of Q15 vectors. @@ -446,8 +450,8 @@ DSP_FUNC_SCOPE void zdsp_dot_prod_q7(const q7_t *src_a, const q7_t *src_b, uint3 * @param[in] block_size number of samples in each vector * @param[out] result output result returned here */ -DSP_FUNC_SCOPE void zdsp_dot_prod_q15(const q15_t *src_a, const q15_t *src_b, uint32_t block_size, - q63_t *result); +DSP_FUNC_SCOPE void zdsp_dot_prod_q15(const DSP_DATA q15_t *src_a, const DSP_DATA q15_t *src_b, + uint32_t block_size, DSP_DATA q63_t *result); /** * @brief Dot product of Q31 vectors. @@ -464,8 +468,8 @@ DSP_FUNC_SCOPE void zdsp_dot_prod_q15(const q15_t *src_a, const q15_t *src_b, ui * @param[in] block_size number of samples in each vector * @param[out] result output result returned here */ -DSP_FUNC_SCOPE void zdsp_dot_prod_q31(const q31_t *src_a, const q31_t *src_b, uint32_t block_size, - q63_t *result); +DSP_FUNC_SCOPE void zdsp_dot_prod_q31(const DSP_DATA q31_t *src_a, const DSP_DATA q31_t *src_b, + uint32_t block_size, DSP_DATA q63_t *result); /** * @} @@ -501,8 +505,8 @@ DSP_FUNC_SCOPE void zdsp_dot_prod_q31(const q31_t *src_a, const q31_t *src_b, ui * @param[out] dst points to the output vector * @param[in] block_size number of samples in the vector */ -DSP_FUNC_SCOPE void zdsp_shift_q7(const q7_t *src, int8_t shift_bits, q7_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_shift_q7(const DSP_DATA q7_t *src, int8_t shift_bits, DSP_DATA q7_t *dst, + uint32_t block_size); /** * @brief Shifts the elements of a Q15 vector a specified number of bits. @@ -517,8 +521,8 @@ DSP_FUNC_SCOPE void zdsp_shift_q7(const q7_t *src, int8_t shift_bits, q7_t *dst, * @param[out] dst points to the output vector * @param[in] block_size number of samples in the vector */ -DSP_FUNC_SCOPE void zdsp_shift_q15(const q15_t *src, int8_t shift_bits, q15_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_shift_q15(const DSP_DATA q15_t *src, int8_t shift_bits, + DSP_DATA q15_t *dst, uint32_t block_size); /** * @brief Shifts the elements of a Q31 vector a specified number of bits. @@ -533,8 +537,8 @@ DSP_FUNC_SCOPE void zdsp_shift_q15(const q15_t *src, int8_t shift_bits, q15_t *d * @param[out] dst points to the output vector * @param[in] block_size number of samples in the vector */ -DSP_FUNC_SCOPE void zdsp_shift_q31(const q31_t *src, int8_t shift_bits, q31_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_shift_q31(const DSP_DATA q31_t *src, int8_t shift_bits, + DSP_DATA q31_t *dst, uint32_t block_size); /** * @} @@ -562,8 +566,8 @@ DSP_FUNC_SCOPE void zdsp_shift_q31(const q31_t *src, int8_t shift_bits, q31_t *d * @param[out] dst points to the output vector * @param[in] block_size number of samples in the vector */ -DSP_FUNC_SCOPE void zdsp_offset_f32(const float32_t *src, float32_t offset, float32_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_offset_f32(const DSP_DATA float32_t *src, float32_t offset, + DSP_DATA float32_t *dst, uint32_t block_size); /** * @brief Adds a constant offset to a Q7 vector. @@ -577,7 +581,8 @@ DSP_FUNC_SCOPE void zdsp_offset_f32(const float32_t *src, float32_t offset, floa * @param[out] dst points to the output vector * @param[in] block_size number of samples in the vector */ -DSP_FUNC_SCOPE void zdsp_offset_q7(const q7_t *src, q7_t offset, q7_t *dst, uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_offset_q7(const DSP_DATA q7_t *src, q7_t offset, DSP_DATA q7_t *dst, + uint32_t block_size); /** * @brief Adds a constant offset to a Q15 vector. @@ -591,8 +596,8 @@ DSP_FUNC_SCOPE void zdsp_offset_q7(const q7_t *src, q7_t offset, q7_t *dst, uint * @param[out] dst points to the output vector * @param[in] block_size number of samples in the vector */ -DSP_FUNC_SCOPE void zdsp_offset_q15(const q15_t *src, q15_t offset, q15_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_offset_q15(const DSP_DATA q15_t *src, q15_t offset, DSP_DATA q15_t *dst, + uint32_t block_size); /** * @brief Adds a constant offset to a Q31 vector. @@ -606,8 +611,8 @@ DSP_FUNC_SCOPE void zdsp_offset_q15(const q15_t *src, q15_t offset, q15_t *dst, * @param[out] dst points to the output vector * @param[in] block_size number of samples in the vector */ -DSP_FUNC_SCOPE void zdsp_offset_q31(const q31_t *src, q31_t offset, q31_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_offset_q31(const DSP_DATA q31_t *src, q31_t offset, DSP_DATA q31_t *dst, + uint32_t block_size); /** * @} @@ -634,7 +639,8 @@ DSP_FUNC_SCOPE void zdsp_offset_q31(const q31_t *src, q31_t offset, q31_t *dst, * @param[out] dst points to the output vector * @param[in] block_size number of samples in the vector */ -DSP_FUNC_SCOPE void zdsp_negate_f32(const float32_t *src, float32_t *dst, uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_negate_f32(const DSP_DATA float32_t *src, DSP_DATA float32_t *dst, + uint32_t block_size); /** * @brief Negates the elements of a Q7 vector. @@ -647,7 +653,8 @@ DSP_FUNC_SCOPE void zdsp_negate_f32(const float32_t *src, float32_t *dst, uint32 * @param[out] dst points to the output vector * @param[in] block_size number of samples in the vector */ -DSP_FUNC_SCOPE void zdsp_negate_q7(const q7_t *src, q7_t *dst, uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_negate_q7(const DSP_DATA q7_t *src, DSP_DATA q7_t *dst, + uint32_t block_size); /** * @brief Negates the elements of a Q15 vector. @@ -660,7 +667,8 @@ DSP_FUNC_SCOPE void zdsp_negate_q7(const q7_t *src, q7_t *dst, uint32_t block_si * @param[out] dst points to the output vector * @param[in] block_size number of samples in the vector */ -DSP_FUNC_SCOPE void zdsp_negate_q15(const q15_t *src, q15_t *dst, uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_negate_q15(const DSP_DATA q15_t *src, DSP_DATA q15_t *dst, + uint32_t block_size); /** * @brief Negates the elements of a Q31 vector. @@ -673,7 +681,8 @@ DSP_FUNC_SCOPE void zdsp_negate_q15(const q15_t *src, q15_t *dst, uint32_t block * @param[out] dst points to the output vector * @param[in] block_size number of samples in the vector */ -DSP_FUNC_SCOPE void zdsp_negate_q31(const q31_t *src, q31_t *dst, uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_negate_q31(const DSP_DATA q31_t *src, DSP_DATA q31_t *dst, + uint32_t block_size); /** * @} @@ -696,8 +705,8 @@ DSP_FUNC_SCOPE void zdsp_negate_q31(const q31_t *src, q31_t *dst, uint32_t block * @param[out] dst points to output vector * @param[in] block_size number of samples in each vector */ -DSP_FUNC_SCOPE void zdsp_and_u8(const uint8_t *src_a, const uint8_t *src_b, uint8_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_and_u8(const DSP_DATA uint8_t *src_a, const DSP_DATA uint8_t *src_b, + DSP_DATA uint8_t *dst, uint32_t block_size); /** * @brief Compute the logical bitwise AND of two fixed-point vectors. @@ -706,8 +715,8 @@ DSP_FUNC_SCOPE void zdsp_and_u8(const uint8_t *src_a, const uint8_t *src_b, uint * @param[out] dst points to output vector * @param[in] block_size number of samples in each vector */ -DSP_FUNC_SCOPE void zdsp_and_u16(const uint16_t *src_a, const uint16_t *src_b, uint16_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_and_u16(const DSP_DATA uint16_t *src_a, const DSP_DATA uint16_t *src_b, + DSP_DATA uint16_t *dst, uint32_t block_size); /** * @brief Compute the logical bitwise AND of two fixed-point vectors. @@ -716,8 +725,8 @@ DSP_FUNC_SCOPE void zdsp_and_u16(const uint16_t *src_a, const uint16_t *src_b, u * @param[out] dst points to output vector * @param[in] block_size number of samples in each vector */ -DSP_FUNC_SCOPE void zdsp_and_u32(const uint32_t *src_a, const uint32_t *src_b, uint32_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_and_u32(const DSP_DATA uint32_t *src_a, const DSP_DATA uint32_t *src_b, + DSP_DATA uint32_t *dst, uint32_t block_size); /** * @} @@ -740,8 +749,8 @@ DSP_FUNC_SCOPE void zdsp_and_u32(const uint32_t *src_a, const uint32_t *src_b, u * @param[out] dst points to output vector * @param[in] block_size number of samples in each vector */ -DSP_FUNC_SCOPE void zdsp_or_u8(const uint8_t *src_a, const uint8_t *src_b, uint8_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_or_u8(const DSP_DATA uint8_t *src_a, const DSP_DATA uint8_t *src_b, + DSP_DATA uint8_t *dst, uint32_t block_size); /** * @brief Compute the logical bitwise OR of two fixed-point vectors. @@ -750,8 +759,8 @@ DSP_FUNC_SCOPE void zdsp_or_u8(const uint8_t *src_a, const uint8_t *src_b, uint8 * @param[out] dst points to output vector * @param[in] block_size number of samples in each vector */ -DSP_FUNC_SCOPE void zdsp_or_u16(const uint16_t *src_a, const uint16_t *src_b, uint16_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_or_u16(const DSP_DATA uint16_t *src_a, const DSP_DATA uint16_t *src_b, + DSP_DATA uint16_t *dst, uint32_t block_size); /** * @brief Compute the logical bitwise OR of two fixed-point vectors. @@ -760,8 +769,8 @@ DSP_FUNC_SCOPE void zdsp_or_u16(const uint16_t *src_a, const uint16_t *src_b, ui * @param[out] dst points to output vector * @param[in] block_size number of samples in each vector */ -DSP_FUNC_SCOPE void zdsp_or_u32(const uint32_t *src_a, const uint32_t *src_b, uint32_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_or_u32(const DSP_DATA uint32_t *src_a, const DSP_DATA uint32_t *src_b, + DSP_DATA uint32_t *dst, uint32_t block_size); /** * @} @@ -783,7 +792,8 @@ DSP_FUNC_SCOPE void zdsp_or_u32(const uint32_t *src_a, const uint32_t *src_b, ui * @param[out] dst points to output vector * @param[in] block_size number of samples in each vector */ -DSP_FUNC_SCOPE void zdsp_not_u8(const uint8_t *src, uint8_t *dst, uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_not_u8(const DSP_DATA uint8_t *src, DSP_DATA uint8_t *dst, + uint32_t block_size); /** * @brief Compute the logical bitwise NOT of a fixed-point vector. @@ -791,7 +801,8 @@ DSP_FUNC_SCOPE void zdsp_not_u8(const uint8_t *src, uint8_t *dst, uint32_t block * @param[out] dst points to output vector * @param[in] block_size number of samples in each vector */ -DSP_FUNC_SCOPE void zdsp_not_u16(const uint16_t *src, uint16_t *dst, uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_not_u16(const DSP_DATA uint16_t *src, DSP_DATA uint16_t *dst, + uint32_t block_size); /** * @brief Compute the logical bitwise NOT of a fixed-point vector. @@ -799,7 +810,8 @@ DSP_FUNC_SCOPE void zdsp_not_u16(const uint16_t *src, uint16_t *dst, uint32_t bl * @param[out] dst points to output vector * @param[in] block_size number of samples in each vector */ -DSP_FUNC_SCOPE void zdsp_not_u32(const uint32_t *src, uint32_t *dst, uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_not_u32(const DSP_DATA uint32_t *src, DSP_DATA uint32_t *dst, + uint32_t block_size); /** * @} @@ -822,8 +834,8 @@ DSP_FUNC_SCOPE void zdsp_not_u32(const uint32_t *src, uint32_t *dst, uint32_t bl * @param[out] dst points to output vector * @param[in] block_size number of samples in each vector */ -DSP_FUNC_SCOPE void zdsp_xor_u8(const uint8_t *src_a, const uint8_t *src_b, uint8_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_xor_u8(const DSP_DATA uint8_t *src_a, const DSP_DATA uint8_t *src_b, + DSP_DATA uint8_t *dst, uint32_t block_size); /** * @brief Compute the logical bitwise XOR of two fixed-point vectors. @@ -832,8 +844,8 @@ DSP_FUNC_SCOPE void zdsp_xor_u8(const uint8_t *src_a, const uint8_t *src_b, uint * @param[out] dst points to output vector * @param[in] block_size number of samples in each vector */ -DSP_FUNC_SCOPE void zdsp_xor_u16(const uint16_t *src_a, const uint16_t *src_b, uint16_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_xor_u16(const DSP_DATA uint16_t *src_a, const DSP_DATA uint16_t *src_b, + DSP_DATA uint16_t *dst, uint32_t block_size); /** * @brief Compute the logical bitwise XOR of two fixed-point vectors. @@ -842,8 +854,8 @@ DSP_FUNC_SCOPE void zdsp_xor_u16(const uint16_t *src_a, const uint16_t *src_b, u * @param[out] dst points to output vector * @param[in] block_size number of samples in each vector */ -DSP_FUNC_SCOPE void zdsp_xor_u32(const uint32_t *src_a, const uint32_t *src_b, uint32_t *dst, - uint32_t block_size); +DSP_FUNC_SCOPE void zdsp_xor_u32(const DSP_DATA uint32_t *src_a, const DSP_DATA uint32_t *src_b, + DSP_DATA uint32_t *dst, uint32_t block_size); /** * @} @@ -869,8 +881,8 @@ DSP_FUNC_SCOPE void zdsp_xor_u32(const uint32_t *src_a, const uint32_t *src_b, u * @param[in] high higher bound * @param[in] num_samples number of samples to clip */ -DSP_FUNC_SCOPE void zdsp_clip_f32(const float32_t *src, float32_t *dst, float32_t low, - float32_t high, uint32_t num_samples); +DSP_FUNC_SCOPE void zdsp_clip_f32(const DSP_DATA float32_t *src, DSP_DATA float32_t *dst, + float32_t low, float32_t high, uint32_t num_samples); /** * @brief Elementwise fixed-point clipping @@ -880,8 +892,8 @@ DSP_FUNC_SCOPE void zdsp_clip_f32(const float32_t *src, float32_t *dst, float32_ * @param[in] high higher bound * @param[in] num_samples number of samples to clip */ -DSP_FUNC_SCOPE void zdsp_clip_q31(const q31_t *src, q31_t *dst, q31_t low, q31_t high, - uint32_t num_samples); +DSP_FUNC_SCOPE void zdsp_clip_q31(const DSP_DATA q31_t *src, DSP_DATA q31_t *dst, q31_t low, + q31_t high, uint32_t num_samples); /** * @brief Elementwise fixed-point clipping @@ -891,8 +903,8 @@ DSP_FUNC_SCOPE void zdsp_clip_q31(const q31_t *src, q31_t *dst, q31_t low, q31_t * @param[in] high higher bound * @param[in] num_samples number of samples to clip */ -DSP_FUNC_SCOPE void zdsp_clip_q15(const q15_t *src, q15_t *dst, q15_t low, q15_t high, - uint32_t num_samples); +DSP_FUNC_SCOPE void zdsp_clip_q15(const DSP_DATA q15_t *src, DSP_DATA q15_t *dst, q15_t low, + q15_t high, uint32_t num_samples); /** * @brief Elementwise fixed-point clipping @@ -902,8 +914,8 @@ DSP_FUNC_SCOPE void zdsp_clip_q15(const q15_t *src, q15_t *dst, q15_t low, q15_t * @param[in] high higher bound * @param[in] num_samples number of samples to clip */ -DSP_FUNC_SCOPE void zdsp_clip_q7(const q7_t *src, q7_t *dst, q7_t low, q7_t high, - uint32_t num_samples); +DSP_FUNC_SCOPE void zdsp_clip_q7(const DSP_DATA q7_t *src, DSP_DATA q7_t *dst, q7_t low, q7_t high, + uint32_t num_samples); /** * @} diff --git a/include/zephyr/dsp/dsp.h b/include/zephyr/dsp/dsp.h index 09c757216b..9c720962c0 100644 --- a/include/zephyr/dsp/dsp.h +++ b/include/zephyr/dsp/dsp.h @@ -17,6 +17,10 @@ #define DSP_FUNC_SCOPE #endif +#define DSP_DATA + +#define DSP_STATIC_DATA DSP_DATA + /** * @brief DSP Interface * @defgroup math_dsp DSP Interface diff --git a/tests/subsys/dsp/basicmath/src/f32.c b/tests/subsys/dsp/basicmath/src/f32.c index 05b3d22200..5b9d36d440 100644 --- a/tests/subsys/dsp/basicmath/src/f32.c +++ b/tests/subsys/dsp/basicmath/src/f32.c @@ -16,18 +16,17 @@ #define SNR_ERROR_THRESH ((float32_t)120) #define REL_ERROR_THRESH (5.0e-5) -static void test_zdsp_add_f32( - const uint32_t *input1, const uint32_t *input2, const uint32_t *ref, - size_t length) +static void test_zdsp_add_f32(const DSP_DATA uint32_t *input1, const DSP_DATA uint32_t *input2, + const uint32_t *ref, size_t length) { - float32_t *output; + DSP_DATA float32_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(float32_t)); + output = (DSP_DATA float32_t *)malloc(length * sizeof(float32_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ - zdsp_add_f32((float32_t *)input1, (float32_t *)input2, output, length); + zdsp_add_f32((DSP_DATA float32_t *)input1, (DSP_DATA float32_t *)input2, output, length); /* Validate output */ zassert_true( @@ -50,18 +49,17 @@ DEFINE_TEST_VARIANT4(basic_math_f32, zdsp_add_f32, 11, in_com1, in_com2, ref_add DEFINE_TEST_VARIANT4(basic_math_f32, zdsp_add_f32, long, in_com1, in_com2, ref_add, ARRAY_SIZE(in_com1)); -static void test_zdsp_sub_f32( - const uint32_t *input1, const uint32_t *input2, const uint32_t *ref, - size_t length) +static void test_zdsp_sub_f32(const DSP_DATA uint32_t *input1, const DSP_DATA uint32_t *input2, + const uint32_t *ref, size_t length) { - float32_t *output; + DSP_DATA float32_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(float32_t)); + output = (DSP_DATA float32_t *)malloc(length * sizeof(float32_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ - zdsp_sub_f32((float32_t *)input1, (float32_t *)input2, output, length); + zdsp_sub_f32((DSP_DATA float32_t *)input1, (DSP_DATA float32_t *)input2, output, length); /* Validate output */ zassert_true( @@ -84,18 +82,17 @@ DEFINE_TEST_VARIANT4(basic_math_f32, zdsp_sub_f32, 11, in_com1, in_com2, ref_sub DEFINE_TEST_VARIANT4(basic_math_f32, zdsp_sub_f32, long, in_com1, in_com2, ref_sub, ARRAY_SIZE(in_com1)); -static void test_zdsp_mult_f32( - const uint32_t *input1, const uint32_t *input2, const uint32_t *ref, - size_t length) +static void test_zdsp_mult_f32(const DSP_DATA uint32_t *input1, const DSP_DATA uint32_t *input2, + const uint32_t *ref, size_t length) { - float32_t *output; + DSP_DATA float32_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(float32_t)); + output = (DSP_DATA float32_t *)malloc(length * sizeof(float32_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ - zdsp_mult_f32((float32_t *)input1, (float32_t *)input2, output, length); + zdsp_mult_f32((DSP_DATA float32_t *)input1, (DSP_DATA float32_t *)input2, output, length); /* Validate output */ zassert_true( @@ -118,17 +115,17 @@ DEFINE_TEST_VARIANT4(basic_math_f32, zdsp_mult_f32, 11, in_com1, in_com2, ref_mu DEFINE_TEST_VARIANT4(basic_math_f32, zdsp_mult_f32, long, in_com1, in_com2, ref_mult, ARRAY_SIZE(in_com1)); -static void test_zdsp_negate_f32( - const uint32_t *input1, const uint32_t *ref, size_t length) +static void test_zdsp_negate_f32(const DSP_DATA uint32_t *input1, const uint32_t *ref, + size_t length) { - float32_t *output; + DSP_DATA float32_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(float32_t)); + output = (DSP_DATA float32_t *)malloc(length * sizeof(float32_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ - zdsp_negate_f32((float32_t *)input1, output, length); + zdsp_negate_f32((DSP_DATA float32_t *)input1, output, length); /* Validate output */ zassert_true( @@ -151,18 +148,17 @@ DEFINE_TEST_VARIANT3(basic_math_f32, zdsp_negate_f32, 11, in_com1, ref_negate, 1 DEFINE_TEST_VARIANT3(basic_math_f32, zdsp_negate_f32, long, in_com1, ref_negate, ARRAY_SIZE(in_com1)); -static void test_zdsp_offset_f32( - const uint32_t *input1, float32_t scalar, const uint32_t *ref, - size_t length) +static void test_zdsp_offset_f32(const DSP_DATA uint32_t *input1, float32_t scalar, + const uint32_t *ref, size_t length) { - float32_t *output; + DSP_DATA float32_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(float32_t)); + output = (DSP_DATA float32_t *)malloc(length * sizeof(float32_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ - zdsp_offset_f32((float32_t *)input1, scalar, output, length); + zdsp_offset_f32((DSP_DATA float32_t *)input1, scalar, output, length); /* Validate output */ zassert_true( @@ -185,18 +181,17 @@ DEFINE_TEST_VARIANT4(basic_math_f32, zdsp_offset_f32, 0p5_11, in_com1, 0.5f, ref DEFINE_TEST_VARIANT4(basic_math_f32, zdsp_offset_f32, long, in_com1, 0.5f, ref_offset, ARRAY_SIZE(in_com1)); -static void test_zdsp_scale_f32( - const uint32_t *input1, float32_t scalar, const uint32_t *ref, - size_t length) +static void test_zdsp_scale_f32(const DSP_DATA uint32_t *input1, float32_t scalar, + const uint32_t *ref, size_t length) { - float32_t *output; + DSP_DATA float32_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(float32_t)); + output = (DSP_DATA float32_t *)malloc(length * sizeof(float32_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ - zdsp_scale_f32((float32_t *)input1, scalar, output, length); + zdsp_scale_f32((DSP_DATA float32_t *)input1, scalar, output, length); /* Validate output */ zassert_true( @@ -219,19 +214,18 @@ DEFINE_TEST_VARIANT4(basic_math_f32, zdsp_scale_f32, 0p5_11, in_com1, 0.5f, ref_ DEFINE_TEST_VARIANT4(basic_math_f32, zdsp_scale_f32, long, in_com1, 0.5f, ref_scale, ARRAY_SIZE(in_com1)); -static void test_zdsp_dot_prod_f32( - const uint32_t *input1, const uint32_t *input2, const uint32_t *ref, - size_t length) +static void test_zdsp_dot_prod_f32(const DSP_DATA uint32_t *input1, const DSP_DATA uint32_t *input2, + const uint32_t *ref, size_t length) { - float32_t *output; + DSP_DATA float32_t *output; /* Allocate output buffer */ - output = malloc(1 * sizeof(float32_t)); + output = (DSP_DATA float32_t *)malloc(1 * sizeof(float32_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ - zdsp_dot_prod_f32( - (float32_t *)input1, (float32_t *)input2, length, &output[0]); + zdsp_dot_prod_f32((DSP_DATA float32_t *)input1, (DSP_DATA float32_t *)input2, length, + &output[0]); /* Validate output */ zassert_true( @@ -254,17 +248,16 @@ DEFINE_TEST_VARIANT4(basic_math_f32, zdsp_dot_prod_f32, 11, in_com1, in_com2, re DEFINE_TEST_VARIANT4(basic_math_f32, zdsp_dot_prod_f32, long, in_com1, in_com2, ref_dot_prod_long, ARRAY_SIZE(in_com1)); -static void test_zdsp_abs_f32( - const uint32_t *input1, const uint32_t *ref, size_t length) +static void test_zdsp_abs_f32(const DSP_DATA uint32_t *input1, const uint32_t *ref, size_t length) { - float32_t *output; + DSP_DATA float32_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(float32_t)); + output = (DSP_DATA float32_t *)malloc(length * sizeof(float32_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ - zdsp_abs_f32((float32_t *)input1, output, length); + zdsp_abs_f32((DSP_DATA float32_t *)input1, output, length); /* Validate output */ zassert_true( @@ -286,17 +279,17 @@ DEFINE_TEST_VARIANT3(basic_math_f32, zdsp_abs_f32, 8, in_com1, ref_abs, 8); DEFINE_TEST_VARIANT3(basic_math_f32, zdsp_abs_f32, 11, in_com1, ref_abs, 11); DEFINE_TEST_VARIANT3(basic_math_f32, zdsp_abs_f32, long, in_com1, ref_abs, ARRAY_SIZE(in_com1)); -static void test_zdsp_clip_f32( - const uint32_t *input, const uint32_t *ref, float32_t min, float32_t max, size_t length) +static void test_zdsp_clip_f32(const DSP_DATA uint32_t *input, const uint32_t *ref, float32_t min, + float32_t max, size_t length) { - float32_t *output; + DSP_DATA float32_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(float32_t)); + output = (DSP_DATA float32_t *)malloc(length * sizeof(float32_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ - zdsp_clip_f32((float32_t *)input, output, min, max, length); + zdsp_clip_f32((DSP_DATA float32_t *)input, output, min, max, length); /* Validate output */ zassert_true( diff --git a/tests/subsys/dsp/basicmath/src/f32.pat b/tests/subsys/dsp/basicmath/src/f32.pat index 7c1b0fa1dd..a7a46866a8 100644 --- a/tests/subsys/dsp/basicmath/src/f32.pat +++ b/tests/subsys/dsp/basicmath/src/f32.pat @@ -1,4 +1,4 @@ -static const uint32_t in_com1[256] = { +static DSP_STATIC_DATA const uint32_t in_com1[256] = { 0x3ef42097, 0x3e86ad95, 0xbe3ea847, 0x3e18687c, 0x3e0167c4, 0xbeed738c, 0xbe9bf9d4, 0xbb730272, 0xbe012b5c, 0xbd8bd341, 0xbe56c288, 0x3e2b7752, @@ -65,7 +65,7 @@ static const uint32_t in_com1[256] = { 0xbdf916a0, 0xbefd280f, 0xbf18cbae, 0xbe7fd3b8 }; -static const uint32_t in_com2[256] = { +static DSP_STATIC_DATA const uint32_t in_com2[256] = { 0xbf06178f, 0xbcf81646, 0x3dfd56f1, 0x3d8b675e, 0x3e3b9e60, 0xbe581221, 0xbe9b2bdf, 0x3e27456a, 0x3e267c7c, 0x3e4a739e, 0x3e46f38e, 0x3ead0034, @@ -132,7 +132,7 @@ static const uint32_t in_com2[256] = { 0xbe3bc140, 0xbd27973c, 0xbce5af1b, 0xbe943efb }; -static const uint32_t in_clip[267] = { +static DSP_STATIC_DATA const uint32_t in_clip[267] = { 0xbf666666, 0xbf64aaec, 0xbf62ef72, 0xbf6133f8, 0xbf5f787e, 0xbf5dbd04, 0xbf5c018a, 0xbf5a4610, 0xbf588a96, 0xbf56cf1c, 0xbf5513a2, 0xbf535828, diff --git a/tests/subsys/dsp/basicmath/src/q15.c b/tests/subsys/dsp/basicmath/src/q15.c index 3e2b979136..73bd8d0760 100644 --- a/tests/subsys/dsp/basicmath/src/q15.c +++ b/tests/subsys/dsp/basicmath/src/q15.c @@ -19,13 +19,13 @@ #define ABS_ERROR_THRESH_Q63 ((q63_t)(1 << 17)) static void test_zdsp_add_q15( - const q15_t *input1, const q15_t *input2, const q15_t *ref, + const DSP_DATA q15_t *input1, const DSP_DATA q15_t *input2, const q15_t *ref, size_t length) { - q15_t *output; + DSP_DATA q15_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(q15_t)); + output = (DSP_DATA q15_t *)malloc(length * sizeof(q15_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -55,13 +55,13 @@ DEFINE_TEST_VARIANT4(basic_math_q15, zdsp_add_q15, long, in_com1, in_com2, ref_a ARRAY_SIZE(in_com1)); static void test_zdsp_sub_q15( - const q15_t *input1, const q15_t *input2, const q15_t *ref, + const DSP_DATA q15_t *input1, const DSP_DATA q15_t *input2, const q15_t *ref, size_t length) { - q15_t *output; + DSP_DATA q15_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(q15_t)); + output = (DSP_DATA q15_t *)malloc(length * sizeof(q15_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -91,13 +91,13 @@ DEFINE_TEST_VARIANT4(basic_math_q15, zdsp_sub_q15, long, in_com1, in_com2, ref_s ARRAY_SIZE(in_com1)); static void test_zdsp_mult_q15( - const q15_t *input1, const q15_t *input2, const q15_t *ref, + const DSP_DATA q15_t *input1, const DSP_DATA q15_t *input2, const q15_t *ref, size_t length) { - q15_t *output; + DSP_DATA q15_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(q15_t)); + output = (DSP_DATA q15_t *)malloc(length * sizeof(q15_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -125,12 +125,12 @@ DEFINE_TEST_VARIANT4(basic_math_q15, zdsp_mult_q15, long, in_com1, in_com2, ref_ ARRAY_SIZE(in_com1)); static void test_zdsp_negate_q15( - const q15_t *input1, const q15_t *ref, size_t length) + const DSP_DATA q15_t *input1, const q15_t *ref, size_t length) { - q15_t *output; + DSP_DATA q15_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(q15_t)); + output = (DSP_DATA q15_t *)malloc(length * sizeof(q15_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -157,12 +157,12 @@ DEFINE_TEST_VARIANT3(basic_math_q15, zdsp_negate_q15, long, in_com1, ref_negate, ARRAY_SIZE(in_com1)); static void test_zdsp_offset_q15( - const q15_t *input1, q15_t scalar, const q15_t *ref, size_t length) + const DSP_DATA q15_t *input1, q15_t scalar, const q15_t *ref, size_t length) { - q15_t *output; + DSP_DATA q15_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(q15_t)); + output = (DSP_DATA q15_t *)malloc(length * sizeof(q15_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -192,12 +192,12 @@ DEFINE_TEST_VARIANT4(basic_math_q15, zdsp_offset_q15, long, in_com1, 0x4000, ref ARRAY_SIZE(in_com1)); static void test_zdsp_scale_q15( - const q15_t *input1, q15_t scalar, const q15_t *ref, size_t length) + const DSP_DATA q15_t *input1, q15_t scalar, const q15_t *ref, size_t length) { - q15_t *output; + DSP_DATA q15_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(q15_t)); + output = (DSP_DATA q15_t *)malloc(length * sizeof(q15_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -225,13 +225,13 @@ DEFINE_TEST_VARIANT4(basic_math_q15, zdsp_scale_q15, long, in_com1, 0x4000, ref_ ARRAY_SIZE(in_com1)); static void test_zdsp_dot_prod_q15( - const q15_t *input1, const q15_t *input2, const q63_t *ref, + const DSP_DATA q15_t *input1, const DSP_DATA q15_t *input2, const q63_t *ref, size_t length) { - q63_t *output; + DSP_DATA q63_t *output; /* Allocate output buffer */ - output = malloc(1 * sizeof(q63_t)); + output = (DSP_DATA q63_t *)malloc(1 * sizeof(q63_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -257,12 +257,12 @@ DEFINE_TEST_VARIANT4(basic_math_q15, zdsp_dot_prod_q15, long, in_com1, in_com2, ARRAY_SIZE(in_com1)); static void test_zdsp_abs_q15( - const q15_t *input1, const q15_t *ref, size_t length) + const DSP_DATA q15_t *input1, const q15_t *ref, size_t length) { - q15_t *output; + DSP_DATA q15_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(q15_t)); + output = (DSP_DATA q15_t *)malloc(length * sizeof(q15_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -287,12 +287,12 @@ DEFINE_TEST_VARIANT3(basic_math_q15, zdsp_abs_q15, 23, in_com1, ref_abs, 23); DEFINE_TEST_VARIANT3(basic_math_q15, zdsp_abs_q15, long, in_com1, ref_abs, ARRAY_SIZE(in_com1)); static void test_zdsp_shift_q15( - const q15_t *input1, const q15_t *ref, size_t length) + const DSP_DATA q15_t *input1, const q15_t *ref, size_t length) { - q15_t *output; + DSP_DATA q15_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(q15_t)); + output = (DSP_DATA q15_t *)malloc(length * sizeof(q15_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -316,13 +316,13 @@ DEFINE_TEST_VARIANT3(basic_math_q15, zdsp_shift_q15, possat, in_maxpos, ref_shif DEFINE_TEST_VARIANT3(basic_math_q15, zdsp_shift_q15, negsat, in_maxneg, ref_shift_negsat, 17); static void test_zdsp_and_u16( - const uint16_t *input1, const uint16_t *input2, const uint16_t *ref, + const DSP_DATA uint16_t *input1, const DSP_DATA uint16_t *input2, const uint16_t *ref, size_t length) { - uint16_t *output; + DSP_DATA uint16_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(uint16_t)); + output = (DSP_DATA q15_t *)malloc(length * sizeof(uint16_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -342,13 +342,13 @@ DEFINE_TEST_VARIANT4(basic_math_q15, zdsp_and_u16, 16, in_bitwise1, in_bitwise2, DEFINE_TEST_VARIANT4(basic_math_q15, zdsp_and_u16, 23, in_bitwise1, in_bitwise2, ref_and, 23); static void test_zdsp_or_u16( - const uint16_t *input1, const uint16_t *input2, const uint16_t *ref, + const DSP_DATA uint16_t *input1, const DSP_DATA uint16_t *input2, const uint16_t *ref, size_t length) { - uint16_t *output; + DSP_DATA uint16_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(uint16_t)); + output = (DSP_DATA q15_t *)malloc(length * sizeof(uint16_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -368,12 +368,12 @@ DEFINE_TEST_VARIANT4(basic_math_q15, zdsp_or_u16, 16, in_bitwise1, in_bitwise2, DEFINE_TEST_VARIANT4(basic_math_q15, zdsp_or_u16, 23, in_bitwise1, in_bitwise2, ref_or, 23); static void test_zdsp_not_u16( - const uint16_t *input1, const uint16_t *ref, size_t length) + const DSP_DATA uint16_t *input1, const uint16_t *ref, size_t length) { - uint16_t *output; + DSP_DATA uint16_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(uint16_t)); + output = (DSP_DATA q15_t *)malloc(length * sizeof(uint16_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -393,13 +393,13 @@ DEFINE_TEST_VARIANT3(basic_math_q15, zdsp_not_u16, 16, in_bitwise1, ref_not, 16) DEFINE_TEST_VARIANT3(basic_math_q15, zdsp_not_u16, 23, in_bitwise1, ref_not, 23); static void test_zdsp_xor_u16( - const uint16_t *input1, const uint16_t *input2, const uint16_t *ref, + const DSP_DATA uint16_t *input1, const DSP_DATA uint16_t *input2, const uint16_t *ref, size_t length) { - uint16_t *output; + DSP_DATA uint16_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(uint16_t)); + output = (DSP_DATA q15_t *)malloc(length * sizeof(uint16_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -419,12 +419,12 @@ DEFINE_TEST_VARIANT4(basic_math_q15, zdsp_xor_u16, 16, in_bitwise1, in_bitwise2, DEFINE_TEST_VARIANT4(basic_math_q15, zdsp_xor_u16, 23, in_bitwise1, in_bitwise2, ref_xor, 23); static void test_zdsp_clip_q15( - const q15_t *input, const q15_t *ref, q15_t min, q15_t max, size_t length) + const DSP_DATA q15_t *input, const q15_t *ref, q15_t min, q15_t max, size_t length) { - q15_t *output; + DSP_DATA q15_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(q15_t)); + output = (DSP_DATA q15_t *)malloc(length * sizeof(q15_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ diff --git a/tests/subsys/dsp/basicmath/src/q15.pat b/tests/subsys/dsp/basicmath/src/q15.pat index efe5007b5c..fe213c1ba1 100644 --- a/tests/subsys/dsp/basicmath/src/q15.pat +++ b/tests/subsys/dsp/basicmath/src/q15.pat @@ -1,4 +1,4 @@ -static const q15_t in_com1[256] = { +static DSP_STATIC_DATA const q15_t in_com1[256] = { 0x0EB1, 0xD7DA, 0xDFC2, 0x2DDA, 0xAEB8, 0x1A8C, 0x34D0, 0xC949, 0x19FF, 0x1AFC, 0xD67E, 0x2639, 0x1546, 0xF32D, 0x2A82, 0xB79E, 0x1317, 0xEAF2, 0xCBD9, 0xC454, 0x42FD, 0xBB89, 0x9B4F, 0xCE5C, @@ -33,7 +33,7 @@ static const q15_t in_com1[256] = { 0x112A, 0x8F09, 0x00B9, 0xB234, 0xA386, 0xD619, 0x20AA, 0x5063 }; -static const q15_t in_com2[256] = { +static DSP_STATIC_DATA const q15_t in_com2[256] = { 0xF977, 0xF484, 0xB38D, 0xC049, 0x127F, 0xEE0D, 0x5183, 0x1CFF, 0x2EC8, 0x7FFF, 0x44B4, 0xD9AD, 0x4410, 0x27AA, 0x0313, 0xC597, 0xA23C, 0xFCF7, 0xF6CA, 0x0540, 0x3DD7, 0x4BA0, 0xCB04, 0x4650, @@ -68,43 +68,43 @@ static const q15_t in_com2[256] = { 0x678D, 0xEECA, 0xCAF7, 0xE0AD, 0x15EB, 0x9059, 0xCAB6, 0xFE6E }; -static const q15_t in_bitwise1[23] = { +static DSP_STATIC_DATA const q15_t in_bitwise1[23] = { 0xF97D, 0x7E98, 0xE83E, 0x9006, 0x8ECF, 0x82B2, 0x873C, 0xE6D0, 0x42C6, 0xA110, 0x7D1E, 0x0CDC, 0xB6CC, 0xB5A5, 0xB245, 0xC19A, 0x7B95, 0xB857, 0x3E23, 0xECC1, 0x8AC4, 0xA9A0, 0x7CFF }; -static const q15_t in_bitwise2[23] = { +static DSP_STATIC_DATA const q15_t in_bitwise2[23] = { 0xABDB, 0x927F, 0x5D5D, 0xF0CC, 0x90C8, 0xE1A9, 0xCACF, 0x2B30, 0xEDC4, 0x5AB6, 0x7E72, 0x7867, 0x0B8A, 0x0E28, 0x6421, 0x5673, 0x8AE7, 0xF8DC, 0x45A3, 0xF95D, 0x4B42, 0xB9A3, 0x7FE6 }; -static const q15_t in_rand[17] = { +static DSP_STATIC_DATA const q15_t in_rand[17] = { 0x271B, 0xDA32, 0x1348, 0xF2FB, 0x2AAB, 0x011B, 0x04BE, 0xEDA1, 0xF82B, 0xF5EC, 0x201A, 0xE56E, 0xE8B7, 0x09B3, 0x1889, 0x15E1, 0x00F3 }; -static const q15_t in_maxpos[17] = { +static DSP_STATIC_DATA const q15_t in_maxpos[17] = { 0x7FFE, 0x0001, 0x7FFE, 0x0001, 0x7FFE, 0x0001, 0x7FFE, 0x0001, 0x7FFE, 0x0001, 0x7FFE, 0x0001, 0x7FFE, 0x0001, 0x7FFE, 0x0001, 0x7FFE }; -static const q15_t in_maxneg[17] = { +static DSP_STATIC_DATA const q15_t in_maxneg[17] = { 0x8001, 0xFFFF, 0x8001, 0xFFFF, 0x8001, 0xFFFF, 0x8001, 0xFFFF, 0x8001, 0xFFFF, 0x8001, 0xFFFF, 0x8001, 0xFFFF, 0x8001, 0xFFFF, 0x8001 }; -static const q15_t in_maxneg2[17] = { +static DSP_STATIC_DATA const q15_t in_maxneg2[17] = { 0x8000, 0xFFFE, 0x8000, 0xFFFE, 0x8000, 0xFFFE, 0x8000, 0xFFFE, 0x8000, 0xFFFE, 0x8000, 0xFFFE, 0x8000, 0xFFFE, 0x8000, 0xFFFE, 0x8000 }; -static const q15_t in_clip[279] = { +static DSP_STATIC_DATA const q15_t in_clip[279] = { 0x8CCD, 0x8DA1, 0x8E75, 0x8F49, 0x901D, 0x90F2, 0x91C6, 0x929A, 0x936E, 0x9442, 0x9516, 0x95EB, 0x96BF, 0x9793, 0x9867, 0x993B, 0x9A0F, 0x9AE4, 0x9BB8, 0x9C8C, 0x9D60, 0x9E34, 0x9F08, 0x9FDD, diff --git a/tests/subsys/dsp/basicmath/src/q31.c b/tests/subsys/dsp/basicmath/src/q31.c index 7027d8c194..8f34528104 100644 --- a/tests/subsys/dsp/basicmath/src/q31.c +++ b/tests/subsys/dsp/basicmath/src/q31.c @@ -17,13 +17,13 @@ #define ABS_ERROR_THRESH_Q31 ((q31_t)4) #define ABS_ERROR_THRESH_Q63 ((q63_t)(1 << 17)) -static void test_zdsp_add_q31( - const q31_t *input1, const q31_t *input2, const q31_t *ref, size_t length) +static void test_zdsp_add_q31(const DSP_DATA q31_t *input1, const DSP_DATA q31_t *input2, + const q31_t *ref, size_t length) { - q31_t *output; + DSP_DATA q31_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(q31_t)); + output = (DSP_DATA q31_t *)malloc(length * sizeof(q31_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -50,13 +50,13 @@ DEFINE_TEST_VARIANT4(basic_math_q31, zdsp_add_q31, negsat, in_maxneg, in_maxneg, DEFINE_TEST_VARIANT4(basic_math_q31, zdsp_add_q31, long, in_com1, in_com2, ref_add, ARRAY_SIZE(in_com1)); -static void test_zdsp_sub_q31( - const q31_t *input1, const q31_t *input2, const q31_t *ref, size_t length) +static void test_zdsp_sub_q31(const DSP_DATA q31_t *input1, const DSP_DATA q31_t *input2, + const q31_t *ref, size_t length) { - q31_t *output; + DSP_DATA q31_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(q31_t)); + output = (DSP_DATA q31_t *)malloc(length * sizeof(q31_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -83,13 +83,13 @@ DEFINE_TEST_VARIANT4(basic_math_q31, zdsp_sub_q31, negsat, in_maxneg, in_maxpos, DEFINE_TEST_VARIANT4(basic_math_q31, zdsp_sub_q31, long, in_com1, in_com2, ref_sub, ARRAY_SIZE(in_com1)); -static void test_zdsp_mult_q31( - const q31_t *input1, const q31_t *input2, const q31_t *ref, size_t length) +static void test_zdsp_mult_q31(const DSP_DATA q31_t *input1, const DSP_DATA q31_t *input2, + const q31_t *ref, size_t length) { - q31_t *output; + DSP_DATA q31_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(q31_t)); + output = (DSP_DATA q31_t *)malloc(length * sizeof(q31_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -116,13 +116,12 @@ DEFINE_TEST_VARIANT4(basic_math_q31, zdsp_mult_q31, possat, in_maxneg2, in_maxne DEFINE_TEST_VARIANT4(basic_math_q31, zdsp_mult_q31, long, in_com1, in_com2, ref_mult, ARRAY_SIZE(in_com1)); -static void test_zdsp_negate_q31( - const q31_t *input1, const q31_t *ref, size_t length) +static void test_zdsp_negate_q31(const DSP_DATA q31_t *input1, const q31_t *ref, size_t length) { - q31_t *output; + DSP_DATA q31_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(q31_t)); + output = (DSP_DATA q31_t *)malloc(length * sizeof(q31_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -148,13 +147,13 @@ DEFINE_TEST_VARIANT3(basic_math_q31, zdsp_negate_q31, possat, in_maxneg2, ref_ne DEFINE_TEST_VARIANT3(basic_math_q31, zdsp_negate_q31, long, in_com1, ref_negate, ARRAY_SIZE(in_com1)); -static void test_zdsp_offset_q31( - const q31_t *input1, q31_t scalar, const q31_t *ref, size_t length) +static void test_zdsp_offset_q31(const DSP_DATA q31_t *input1, q31_t scalar, const q31_t *ref, + size_t length) { - q31_t *output; + DSP_DATA q31_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(q31_t)); + output = (DSP_DATA q31_t *)malloc(length * sizeof(q31_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -183,13 +182,13 @@ DEFINE_TEST_VARIANT4(basic_math_q31, zdsp_offset_q31, negsat, in_maxneg, 0x8cccc DEFINE_TEST_VARIANT4(basic_math_q31, zdsp_offset_q31, long, in_com1, 0x40000000, ref_offset, ARRAY_SIZE(in_com1)); -static void test_zdsp_scale_q31( - const q31_t *input1, q31_t scalar, const q31_t *ref, size_t length) +static void test_zdsp_scale_q31(const DSP_DATA q31_t *input1, q31_t scalar, const q31_t *ref, + size_t length) { - q31_t *output; + DSP_DATA q31_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(q31_t)); + output = (DSP_DATA q31_t *)malloc(length * sizeof(q31_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -216,13 +215,13 @@ DEFINE_TEST_VARIANT4(basic_math_q31, zdsp_scale_q31, possat, in_maxneg2, 0x80000 DEFINE_TEST_VARIANT4(basic_math_q31, zdsp_scale_q31, long, in_com1, 0x40000000, ref_scale, ARRAY_SIZE(in_com1)); -static void test_zdsp_dot_prod_q31( - const q31_t *input1, const q31_t *input2, const q63_t *ref, size_t length) +static void test_zdsp_dot_prod_q31(const DSP_DATA q31_t *input1, const DSP_DATA q31_t *input2, + const q63_t *ref, size_t length) { - q63_t *output; + DSP_DATA q63_t *output; /* Allocate output buffer */ - output = malloc(1 * sizeof(q63_t)); + output = (DSP_DATA q63_t *)malloc(length * sizeof(q63_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -247,13 +246,12 @@ DEFINE_TEST_VARIANT4(basic_math_q31, zdsp_dot_prod_q31, 11, in_com1, in_com2, re DEFINE_TEST_VARIANT4(basic_math_q31, zdsp_dot_prod_q31, long, in_com1, in_com2, ref_dot_prod_long, ARRAY_SIZE(in_com1)); -static void test_zdsp_abs_q31( - const q31_t *input1, const q31_t *ref, size_t length) +static void test_zdsp_abs_q31(const DSP_DATA q31_t *input1, const q31_t *ref, size_t length) { - q31_t *output; + DSP_DATA q31_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(q31_t)); + output = (DSP_DATA q31_t *)malloc(length * sizeof(q31_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -277,13 +275,12 @@ DEFINE_TEST_VARIANT3(basic_math_q31, zdsp_abs_q31, 8, in_com1, ref_abs, 8); DEFINE_TEST_VARIANT3(basic_math_q31, zdsp_abs_q31, 11, in_com1, ref_abs, 11); DEFINE_TEST_VARIANT3(basic_math_q31, zdsp_abs_q31, long, in_com1, ref_abs, ARRAY_SIZE(in_com1)); -static void test_zdsp_shift_q31( - const q31_t *input1, const q31_t *ref, size_t length) +static void test_zdsp_shift_q31(const DSP_DATA q31_t *input1, const q31_t *ref, size_t length) { - q31_t *output; + DSP_DATA q31_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(q31_t)); + output = (DSP_DATA q31_t *)malloc(length * sizeof(q31_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -306,13 +303,13 @@ DEFINE_TEST_VARIANT3(basic_math_q31, zdsp_shift_q31, rand, in_rand, ref_shift, 9 DEFINE_TEST_VARIANT3(basic_math_q31, zdsp_shift_q31, possat, in_maxpos, ref_shift_possat, 9); DEFINE_TEST_VARIANT3(basic_math_q31, zdsp_shift_q31, negsat, in_maxneg, ref_shift_negsat, 9); -static void test_zdsp_and_u32( - const uint32_t *input1, const uint32_t *input2, const uint32_t *ref, size_t length) +static void test_zdsp_and_u32(const DSP_DATA uint32_t *input1, const DSP_DATA uint32_t *input2, + const uint32_t *ref, size_t length) { - uint32_t *output; + DSP_DATA uint32_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(uint32_t)); + output = (DSP_DATA uint32_t *)malloc(length * sizeof(uint32_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -331,13 +328,13 @@ DEFINE_TEST_VARIANT4(basic_math_q31, zdsp_and_u32, 3, in_bitwise1, in_bitwise2, DEFINE_TEST_VARIANT4(basic_math_q31, zdsp_and_u32, 8, in_bitwise1, in_bitwise2, ref_and, 8); DEFINE_TEST_VARIANT4(basic_math_q31, zdsp_and_u32, 11, in_bitwise1, in_bitwise2, ref_and, 11); -static void test_zdsp_or_u32( - const uint32_t *input1, const uint32_t *input2, const uint32_t *ref, size_t length) +static void test_zdsp_or_u32(const DSP_DATA uint32_t *input1, const DSP_DATA uint32_t *input2, + const uint32_t *ref, size_t length) { - uint32_t *output; + DSP_DATA uint32_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(uint32_t)); + output = (DSP_DATA uint32_t *)malloc(length * sizeof(uint32_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -356,13 +353,12 @@ DEFINE_TEST_VARIANT4(basic_math_q31, zdsp_or_u32, 3, in_bitwise1, in_bitwise2, r DEFINE_TEST_VARIANT4(basic_math_q31, zdsp_or_u32, 8, in_bitwise1, in_bitwise2, ref_or, 8); DEFINE_TEST_VARIANT4(basic_math_q31, zdsp_or_u32, 11, in_bitwise1, in_bitwise2, ref_or, 11); -static void test_zdsp_not_u32( - const uint32_t *input1, const uint32_t *ref, size_t length) +static void test_zdsp_not_u32(const DSP_DATA uint32_t *input1, const uint32_t *ref, size_t length) { - uint32_t *output; + DSP_DATA uint32_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(uint32_t)); + output = (DSP_DATA uint32_t *)malloc(length * sizeof(uint32_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -381,13 +377,13 @@ DEFINE_TEST_VARIANT3(basic_math_q31, zdsp_not_u32, 3, in_bitwise1, ref_not, 3); DEFINE_TEST_VARIANT3(basic_math_q31, zdsp_not_u32, 8, in_bitwise1, ref_not, 8); DEFINE_TEST_VARIANT3(basic_math_q31, zdsp_not_u32, 11, in_bitwise1, ref_not, 11); -static void test_zdsp_xor_u32( - const uint32_t *input1, const uint32_t *input2, const uint32_t *ref, size_t length) +static void test_zdsp_xor_u32(const DSP_DATA uint32_t *input1, const DSP_DATA uint32_t *input2, + const uint32_t *ref, size_t length) { - uint32_t *output; + DSP_DATA uint32_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(uint32_t)); + output = (DSP_DATA uint32_t *)malloc(length * sizeof(uint32_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -406,13 +402,13 @@ DEFINE_TEST_VARIANT4(basic_math_q31, zdsp_xor_u32, 3, in_bitwise1, in_bitwise2, DEFINE_TEST_VARIANT4(basic_math_q31, zdsp_xor_u32, 8, in_bitwise1, in_bitwise2, ref_xor, 8); DEFINE_TEST_VARIANT4(basic_math_q31, zdsp_xor_u32, 11, in_bitwise1, in_bitwise2, ref_xor, 11); -static void test_zdsp_clip_q31( - const q31_t *input, const q31_t *ref, q31_t min, q31_t max, size_t length) +static void test_zdsp_clip_q31(const DSP_DATA q31_t *input, const q31_t *ref, q31_t min, q31_t max, + size_t length) { - q31_t *output; + DSP_DATA q31_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(q31_t)); + output = (DSP_DATA q31_t *)malloc(length * sizeof(q31_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ diff --git a/tests/subsys/dsp/basicmath/src/q31.pat b/tests/subsys/dsp/basicmath/src/q31.pat index 4283fe111a..551a53182c 100644 --- a/tests/subsys/dsp/basicmath/src/q31.pat +++ b/tests/subsys/dsp/basicmath/src/q31.pat @@ -1,4 +1,4 @@ -static const q31_t in_com1[256] = { +static DSP_STATIC_DATA const q31_t in_com1[256] = { 0xFAB7BE89, 0xD0A53F53, 0x1A111E21, 0x49953816, 0x039D1FD3, 0xD15A0327, 0x1A0C9993, 0xC11799B2, 0x5FF34F43, 0x2F1AAAD3, 0xC253CA7B, 0xE07AE872, @@ -65,7 +65,7 @@ static const q31_t in_com1[256] = { 0xE4F9F063, 0xE5FCB076, 0xD10265D4, 0xFAB3D758 }; -static const q31_t in_com2[256] = { +static DSP_STATIC_DATA const q31_t in_com2[256] = { 0x3228AB4A, 0x08D12D9B, 0x036CDE01, 0xFBD88CAE, 0xD5CA97A9, 0x8FAB3853, 0x26C60070, 0x101D4A07, 0xF224215E, 0xFAE412EC, 0xD011C445, 0xE50A01DB, @@ -132,43 +132,43 @@ static const q31_t in_com2[256] = { 0x26915EEC, 0x01A04B4F, 0x32F6444F, 0xFEADB99A }; -static const q31_t in_bitwise1[11] = { +static DSP_STATIC_DATA const q31_t in_bitwise1[11] = { 0x4BCE8F92, 0xFF14D182, 0x434E2DD4, 0xB7FC2F59, 0x048FA4A9, 0x038DCC83, 0x4ABEA434, 0xCF338938, 0x0DC0A132, 0x12A999EF, 0x9E357213 }; -static const q31_t in_bitwise2[11] = { +static DSP_STATIC_DATA const q31_t in_bitwise2[11] = { 0xA8B8FCB8, 0xEDCB517D, 0x434011BD, 0x40705DDA, 0xF95571D7, 0xD4678EDB, 0x234AE04F, 0x0939EF27, 0xBDF4A6FE, 0xEC99DE65, 0x8735465D }; -static const q31_t in_rand[9] = { +static DSP_STATIC_DATA const q31_t in_rand[9] = { 0x229D1A17, 0x1B4B61EA, 0x07281F85, 0x2AAAAAAB, 0x08255585, 0xEE55B1DD, 0xECDA8C68, 0x16EC051D, 0x050B7554 }; -static const q31_t in_maxpos[9] = { +static DSP_STATIC_DATA const q31_t in_maxpos[9] = { 0x7FFFFFFE, 0x00000001, 0x7FFFFFFE, 0x00000001, 0x7FFFFFFE, 0x00000001, 0x7FFFFFFE, 0x00000001, 0x7FFFFFFE }; -static const q31_t in_maxneg[9] = { +static DSP_STATIC_DATA const q31_t in_maxneg[9] = { 0x80000001, 0xFFFFFFFF, 0x80000001, 0xFFFFFFFF, 0x80000001, 0xFFFFFFFF, 0x80000001, 0xFFFFFFFF, 0x80000001 }; -static const q31_t in_maxneg2[9] = { +static DSP_STATIC_DATA const q31_t in_maxneg2[9] = { 0x80000000, 0xFFFFFFFE, 0x80000000, 0xFFFFFFFE, 0x80000000, 0xFFFFFFFE, 0x80000000, 0xFFFFFFFE, 0x80000000 }; -static const q31_t in_clip[267] = { +static DSP_STATIC_DATA const q31_t in_clip[267] = { 0x8CCCCCCD, 0x8DAA89D1, 0x8E8846D5, 0x8F6603DA, 0x9043C0DE, 0x91217DE2, 0x91FF3AE6, 0x92DCF7EA, 0x93BAB4EF, 0x949871F3, 0x95762EF7, 0x9653EBFB, @@ -536,7 +536,7 @@ static const q31_t ref_negate[256] = { 0x1B060F9D, 0x1A034F8A, 0x2EFD9A2C, 0x054C28A8 }; -static const q31_t ref_negate_possat[9] = { +static const q31_t ref_negate_possat[9] = { 0x7FFFFFFF, 0x00000002, 0x7FFFFFFF, 0x00000002, 0x7FFFFFFF, 0x00000002, 0x7FFFFFFF, 0x00000002, 0x7FFFFFFF @@ -702,7 +702,7 @@ static const q63_t ref_dot_prod_4[1] = { 0x00004163DCBEB118 }; -static const q63_t ref_dot_prod_4n1[1] = { +static const q63_t ref_dot_prod_4n1[1] = { 0x0000570A3477CBC0 }; @@ -1025,4 +1025,3 @@ static const q31_t ref_clip3[267] = { 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000 }; - diff --git a/tests/subsys/dsp/basicmath/src/q7.c b/tests/subsys/dsp/basicmath/src/q7.c index 1193903810..d41eb0e58f 100644 --- a/tests/subsys/dsp/basicmath/src/q7.c +++ b/tests/subsys/dsp/basicmath/src/q7.c @@ -17,13 +17,13 @@ #define ABS_ERROR_THRESH_Q7 ((q7_t)2) #define ABS_ERROR_THRESH_Q31 ((q31_t)(1 << 15)) -static void test_zdsp_add_q7( - const q7_t *input1, const q7_t *input2, const q7_t *ref, size_t length) +static void test_zdsp_add_q7(const DSP_DATA q7_t *input1, const DSP_DATA q7_t *input2, + const q7_t *ref, size_t length) { - q7_t *output; + DSP_DATA q7_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(q7_t)); + output = (DSP_DATA q7_t *)(DSP_DATA q7_t *)malloc(length * sizeof(q7_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -50,13 +50,13 @@ DEFINE_TEST_VARIANT4(basic_math_q7, zdsp_add_q7, negsat, in_maxneg, in_maxneg, r DEFINE_TEST_VARIANT4(basic_math_q7, zdsp_add_q7, long, in_com1, in_com2, ref_add, ARRAY_SIZE(in_com1)); -static void test_zdsp_sub_q7( - const q7_t *input1, const q7_t *input2, const q7_t *ref, size_t length) +static void test_zdsp_sub_q7(const DSP_DATA q7_t *input1, const DSP_DATA q7_t *input2, + const q7_t *ref, size_t length) { - q7_t *output; + DSP_DATA q7_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(q7_t)); + output = (DSP_DATA q7_t *)(DSP_DATA q7_t *)malloc(length * sizeof(q7_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -83,13 +83,13 @@ DEFINE_TEST_VARIANT4(basic_math_q7, zdsp_sub_q7, negsat, in_maxneg, in_maxpos, r DEFINE_TEST_VARIANT4(basic_math_q7, zdsp_sub_q7, long, in_com1, in_com2, ref_sub, ARRAY_SIZE(in_com1)); -static void test_zdsp_mult_q7( - const q7_t *input1, const q7_t *input2, const q7_t *ref, size_t length) +static void test_zdsp_mult_q7(const DSP_DATA q7_t *input1, const DSP_DATA q7_t *input2, + const q7_t *ref, size_t length) { - q7_t *output; + DSP_DATA q7_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(q7_t)); + output = (DSP_DATA q7_t *)malloc(length * sizeof(q7_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -116,13 +116,12 @@ DEFINE_TEST_VARIANT4(basic_math_q7, zdsp_mult_q7, possat, in_maxneg2, in_maxneg2 DEFINE_TEST_VARIANT4(basic_math_q7, zdsp_mult_q7, long, in_com1, in_com2, ref_mult, ARRAY_SIZE(in_com1)); -static void test_zdsp_negate_q7( - const q7_t *input1, const q7_t *ref, size_t length) +static void test_zdsp_negate_q7(const DSP_DATA q7_t *input1, const q7_t *ref, size_t length) { - q7_t *output; + DSP_DATA q7_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(q7_t)); + output = (DSP_DATA q7_t *)malloc(length * sizeof(q7_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -147,13 +146,13 @@ DEFINE_TEST_VARIANT3(basic_math_q7, zdsp_negate_q7, 47, in_com1, ref_negate, 47) DEFINE_TEST_VARIANT3(basic_math_q7, zdsp_negate_q7, possat, in_maxneg2, ref_negate_possat, 33); DEFINE_TEST_VARIANT3(basic_math_q7, zdsp_negate_q7, long, in_com1, ref_negate, ARRAY_SIZE(in_com1)); -static void test_zdsp_offset_q7( - const q7_t *input1, q7_t scalar, const q7_t *ref, size_t length) +static void test_zdsp_offset_q7(const DSP_DATA q7_t *input1, q7_t scalar, const q7_t *ref, + size_t length) { - q7_t *output; + DSP_DATA q7_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(q7_t)); + output = (DSP_DATA q7_t *)malloc(length * sizeof(q7_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -180,13 +179,13 @@ DEFINE_TEST_VARIANT4(basic_math_q7, zdsp_offset_q7, negsat, in_maxneg, 0x8d, ref DEFINE_TEST_VARIANT4(basic_math_q7, zdsp_offset_q7, long, in_com1, 0x40, ref_offset, ARRAY_SIZE(in_com1)); -static void test_zdsp_scale_q7( - const q7_t *input1, q7_t scalar, const q7_t *ref, size_t length) +static void test_zdsp_scale_q7(const DSP_DATA q7_t *input1, q7_t scalar, const q7_t *ref, + size_t length) { - q7_t *output; + DSP_DATA q7_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(q7_t)); + output = (DSP_DATA q7_t *)malloc(length * sizeof(q7_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -212,14 +211,13 @@ DEFINE_TEST_VARIANT4(basic_math_q7, zdsp_scale_q7, possat, in_maxneg2, 0x80, ref DEFINE_TEST_VARIANT4(basic_math_q7, zdsp_scale_q7, long, in_com1, 0x40, ref_scale, ARRAY_SIZE(in_com1)); -static void test_zdsp_dot_prod_q7( - const q7_t *input1, const q7_t *input2, const q31_t *ref, - size_t length) +static void test_zdsp_dot_prod_q7(const DSP_DATA q7_t *input1, const DSP_DATA q7_t *input2, + const q31_t *ref, size_t length) { - q31_t *output; + DSP_DATA q31_t *output; /* Allocate output buffer */ - output = malloc(1 * sizeof(q31_t)); + output = (DSP_DATA q31_t *)malloc(1 * sizeof(q31_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -244,13 +242,12 @@ DEFINE_TEST_VARIANT4(basic_math_q7, zdsp_dot_prod_q7, 47, in_com1, in_com2, ref_ DEFINE_TEST_VARIANT4(basic_math_q7, zdsp_dot_prod_q7, long, in_com1, in_com2, ref_dot_prod_long, ARRAY_SIZE(in_com1)); -static void test_zdsp_abs_q7( - const q7_t *input1, const q7_t *ref, size_t length) +static void test_zdsp_abs_q7(const DSP_DATA q7_t *input1, const q7_t *ref, size_t length) { - q7_t *output; + DSP_DATA q7_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(q7_t)); + output = (DSP_DATA q7_t *)malloc(length * sizeof(q7_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -274,13 +271,12 @@ DEFINE_TEST_VARIANT3(basic_math_q7, zdsp_abs_q7, 32, in_com1, ref_abs, 32); DEFINE_TEST_VARIANT3(basic_math_q7, zdsp_abs_q7, 47, in_com1, ref_abs, 47); DEFINE_TEST_VARIANT3(basic_math_q7, zdsp_abs_q7, long, in_com1, ref_abs, ARRAY_SIZE(ref_abs)); -static void test_zdsp_shift_q7( - const q7_t *input1, const q7_t *ref, size_t length) +static void test_zdsp_shift_q7(const DSP_DATA q7_t *input1, const q7_t *ref, size_t length) { - q7_t *output; + DSP_DATA q7_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(q7_t)); + output = (DSP_DATA q7_t *)malloc(length * sizeof(q7_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -303,13 +299,13 @@ DEFINE_TEST_VARIANT3(basic_math_q7, zdsp_shift_q7, rand, in_rand, ref_shift, 33) DEFINE_TEST_VARIANT3(basic_math_q7, zdsp_shift_q7, possat, in_maxpos, ref_shift_possat, 33); DEFINE_TEST_VARIANT3(basic_math_q7, zdsp_shift_q7, negsat, in_maxneg, ref_shift_negsat, 33); -static void test_zdsp_and_u8( - const uint8_t *input1, const uint8_t *input2, const uint8_t *ref, size_t length) +static void test_zdsp_and_u8(const DSP_DATA uint8_t *input1, const DSP_DATA uint8_t *input2, + const uint8_t *ref, size_t length) { - uint8_t *output; + DSP_DATA uint8_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(uint8_t)); + output = (DSP_DATA q7_t *)malloc(length * sizeof(uint8_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -328,13 +324,13 @@ DEFINE_TEST_VARIANT4(basic_math_q7, zdsp_and_u8, 15, in_bitwise1, in_bitwise2, r DEFINE_TEST_VARIANT4(basic_math_q7, zdsp_and_u8, 32, in_bitwise1, in_bitwise2, ref_and, 32); DEFINE_TEST_VARIANT4(basic_math_q7, zdsp_and_u8, 47, in_bitwise1, in_bitwise2, ref_and, 47); -static void test_zdsp_or_u8( - const uint8_t *input1, const uint8_t *input2, const uint8_t *ref, size_t length) +static void test_zdsp_or_u8(const DSP_DATA uint8_t *input1, const DSP_DATA uint8_t *input2, + const uint8_t *ref, size_t length) { - uint8_t *output; + DSP_DATA uint8_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(uint8_t)); + output = (DSP_DATA q7_t *)malloc(length * sizeof(uint8_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -353,13 +349,12 @@ DEFINE_TEST_VARIANT4(basic_math_q7, zdsp_or_u8, 15, in_bitwise1, in_bitwise2, re DEFINE_TEST_VARIANT4(basic_math_q7, zdsp_or_u8, 32, in_bitwise1, in_bitwise2, ref_or, 32); DEFINE_TEST_VARIANT4(basic_math_q7, zdsp_or_u8, 47, in_bitwise1, in_bitwise2, ref_or, 47); -static void test_zdsp_not_u8( - const uint8_t *input1, const uint8_t *ref, size_t length) +static void test_zdsp_not_u8(const DSP_DATA uint8_t *input1, const uint8_t *ref, size_t length) { - uint8_t *output; + DSP_DATA uint8_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(uint8_t)); + output = (DSP_DATA q7_t *)malloc(length * sizeof(uint8_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -378,13 +373,13 @@ DEFINE_TEST_VARIANT3(basic_math_q7, zdsp_not_u8, 15, in_bitwise1, ref_not, 15); DEFINE_TEST_VARIANT3(basic_math_q7, zdsp_not_u8, 32, in_bitwise1, ref_not, 32); DEFINE_TEST_VARIANT3(basic_math_q7, zdsp_not_u8, 47, in_bitwise1, ref_not, 47); -static void test_zdsp_xor_u8( - const uint8_t *input1, const uint8_t *input2, const uint8_t *ref, size_t length) +static void test_zdsp_xor_u8(const DSP_DATA uint8_t *input1, const DSP_DATA uint8_t *input2, + const uint8_t *ref, size_t length) { - uint8_t *output; + DSP_DATA uint8_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(uint8_t)); + output = (DSP_DATA q7_t *)malloc(length * sizeof(uint8_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ @@ -403,13 +398,13 @@ DEFINE_TEST_VARIANT4(basic_math_q7, zdsp_xor_u8, 15, in_bitwise1, in_bitwise2, r DEFINE_TEST_VARIANT4(basic_math_q7, zdsp_xor_u8, 32, in_bitwise1, in_bitwise2, ref_xor, 32); DEFINE_TEST_VARIANT4(basic_math_q7, zdsp_xor_u8, 47, in_bitwise1, in_bitwise2, ref_xor, 47); -static void test_zdsp_clip_q7( - const q7_t *input, const q7_t *ref, q7_t min, q7_t max, size_t length) +static void test_zdsp_clip_q7(const DSP_DATA q7_t *input, const q7_t *ref, q7_t min, q7_t max, + size_t length) { - q7_t *output; + DSP_DATA q7_t *output; /* Allocate output buffer */ - output = malloc(length * sizeof(q7_t)); + output = (DSP_DATA q7_t *)(DSP_DATA q7_t *)malloc(length * sizeof(q7_t)); zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); /* Run test function */ diff --git a/tests/subsys/dsp/basicmath/src/q7.pat b/tests/subsys/dsp/basicmath/src/q7.pat index 69c2c742ec..d71bf31ea8 100644 --- a/tests/subsys/dsp/basicmath/src/q7.pat +++ b/tests/subsys/dsp/basicmath/src/q7.pat @@ -1,4 +1,4 @@ -static const q7_t in_com1[256] = { +static DSP_STATIC_DATA const q7_t in_com1[256] = { 0x52, 0x01, 0x47, 0x20, 0xA5, 0xFD, 0xFC, 0x44, 0xF5, 0xCB, 0x2A, 0xE7, 0x1E, 0x28, 0xFF, 0xEF, 0x3E, 0x2C, 0x05, 0x32, 0xAE, 0x09, 0xBE, 0xF5, @@ -33,7 +33,7 @@ static const q7_t in_com1[256] = { 0xCB, 0xDE, 0xE5, 0xF3, 0x0F, 0xDE, 0x35, 0x09 }; -static const q7_t in_com2[256] = { +static DSP_STATIC_DATA const q7_t in_com2[256] = { 0x1E, 0xDE, 0x10, 0xF2, 0x91, 0xDC, 0x37, 0x02, 0xDE, 0x08, 0x28, 0xC3, 0x00, 0xFD, 0x14, 0x14, 0xFC, 0x1E, 0x25, 0xF2, 0xEC, 0xD7, 0x5B, 0x66, @@ -68,7 +68,7 @@ static const q7_t in_com2[256] = { 0x2A, 0x0E, 0xD5, 0xE2, 0x0E, 0xDC, 0x09, 0xC1 }; -static const q7_t in_bitwise1[47] = { +static DSP_STATIC_DATA const q7_t in_bitwise1[47] = { 0xFB, 0xD4, 0xF1, 0xD8, 0x8A, 0x8F, 0x00, 0xF8, 0xD2, 0xD0, 0xE3, 0x46, 0xC4, 0x64, 0x5E, 0xB8, 0x45, 0x14, 0x1C, 0x71, 0x9D, 0x9A, 0x5F, 0x42, @@ -77,7 +77,7 @@ static const q7_t in_bitwise1[47] = { 0xA2, 0x05, 0xA4, 0x41, 0x87, 0xE0, 0x79 }; -static const q7_t in_bitwise2[47] = { +static DSP_STATIC_DATA const q7_t in_bitwise2[47] = { 0xA7, 0xE3, 0x1B, 0xCA, 0x5D, 0x6A, 0x31, 0x4C, 0xB2, 0x00, 0xB9, 0xA2, 0x09, 0xEE, 0xA0, 0x4E, 0xC2, 0x21, 0x65, 0x98, 0xD6, 0xCC, 0x50, 0xD6, @@ -86,7 +86,7 @@ static const q7_t in_bitwise2[47] = { 0x88, 0x8A, 0xC7, 0xBA, 0x91, 0x45, 0xB9 }; -static const q7_t in_rand[33] = { +static DSP_STATIC_DATA const q7_t in_rand[33] = { 0xF6, 0xFE, 0xF5, 0x1B, 0x0D, 0x13, 0xF9, 0x10, 0xF6, 0x02, 0xE4, 0xD5, 0xF5, 0xF7, 0x14, 0xDF, 0xFB, 0xE6, 0xF0, 0xEE, 0x02, 0x18, 0x0E, 0x0E, @@ -94,7 +94,7 @@ static const q7_t in_rand[33] = { 0x1C }; -static const q7_t in_maxpos[33] = { +static DSP_STATIC_DATA const q7_t in_maxpos[33] = { 0x7E, 0x01, 0x7E, 0x01, 0x7E, 0x01, 0x7E, 0x01, 0x7E, 0x01, 0x7E, 0x01, 0x7E, 0x01, 0x7E, 0x01, 0x7E, 0x01, 0x7E, 0x01, 0x7E, 0x01, 0x7E, 0x01, @@ -102,7 +102,7 @@ static const q7_t in_maxpos[33] = { 0x7E }; -static const q7_t in_maxneg[33] = { +static DSP_STATIC_DATA const q7_t in_maxneg[33] = { 0x81, 0xFF, 0x81, 0xFF, 0x81, 0xFF, 0x81, 0xFF, 0x81, 0xFF, 0x81, 0xFF, 0x81, 0xFF, 0x81, 0xFF, 0x81, 0xFF, 0x81, 0xFF, 0x81, 0xFF, 0x81, 0xFF, @@ -110,7 +110,7 @@ static const q7_t in_maxneg[33] = { 0x81 }; -static const q7_t in_maxneg2[33] = { +static DSP_STATIC_DATA const q7_t in_maxneg2[33] = { 0x80, 0xFE, 0x80, 0xFE, 0x80, 0xFE, 0x80, 0xFE, 0x80, 0xFE, 0x80, 0xFE, 0x80, 0xFE, 0x80, 0xFE, 0x80, 0xFE, 0x80, 0xFE, 0x80, 0xFE, 0x80, 0xFE, @@ -118,7 +118,7 @@ static const q7_t in_maxneg2[33] = { 0x80 }; -static const q7_t in_clip[303] = { +static DSP_STATIC_DATA const q7_t in_clip[303] = { 0x8D, 0x8E, 0x8E, 0x8F, 0x90, 0x91, 0x91, 0x92, 0x93, 0x94, 0x94, 0x95, 0x96, 0x97, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9B, 0x9C, 0x9D, 0x9E, 0x9E,