From 7f8363b9d97e1f0395ac5716ac873d72cb1c5074 Mon Sep 17 00:00:00 2001 From: Antoine SOULIER Date: Wed, 1 Jun 2022 13:36:12 +0200 Subject: [PATCH] test: Fix broken arm/neon tests --- src/ltpf_arm.h | 42 ++++++++++++++++++++++++++++++++++++------ src/ltpf_neon.h | 34 +++++++++++++++++++++++++++++----- src/mdct_neon.h | 21 ++++++++++++++++++--- test/neon/neon.h | 1 + 4 files changed, 84 insertions(+), 14 deletions(-) diff --git a/src/ltpf_arm.h b/src/ltpf_arm.h index a812b3c..631bc12 100644 --- a/src/ltpf_arm.h +++ b/src/ltpf_arm.h @@ -117,7 +117,7 @@ static inline void arm_resample_x192k_12k8(const int p, const int16x2_t *h, * Resample from 8 Khz to 12.8 KHz */ #ifndef resample_8k_12k8 -#define resample_8k_12k8 arm_resample_8k_12k8 + static void arm_resample_8k_12k8( struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n) { @@ -143,13 +143,18 @@ static void arm_resample_8k_12k8( arm_resample_x64k_12k8( 8, (const int16x2_t *)h, hp50, (int16x2_t *)x, y, n); } + +#ifndef TEST_ARM +#define resample_8k_12k8 arm_resample_8k_12k8 +#endif + #endif /* resample_8k_12k8 */ /** * Resample from 16 Khz to 12.8 KHz */ #ifndef resample_16k_12k8 -#define resample_16k_12k8 arm_resample_16k_12k8 + static void arm_resample_16k_12k8( struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n) { @@ -196,13 +201,18 @@ static void arm_resample_16k_12k8( arm_resample_x64k_12k8( 4, (const int16x2_t *)h, hp50, (int16x2_t *)x, y, n); } + +#ifndef TEST_ARM +#define resample_16k_12k8 arm_resample_16k_12k8 +#endif + #endif /* resample_16k_12k8 */ /** * Resample from 32 Khz to 12.8 KHz */ #ifndef resample_32k_12k8 -#define resample_32k_12k8 arm_resample_32k_12k8 + static void arm_resample_32k_12k8( struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n) { @@ -240,13 +250,18 @@ static void arm_resample_32k_12k8( arm_resample_x64k_12k8( 2, (const int16x2_t *)h, hp50, (int16x2_t *)x, y, n); } + +#ifndef TEST_ARM +#define resample_32k_12k8 arm_resample_32k_12k8 +#endif + #endif /* resample_32k_12k8 */ /** * Resample from 24 Khz to 12.8 KHz */ #ifndef resample_24k_12k8 -#define resample_24k_12k8 arm_resample_24k_12k8 + static void arm_resample_24k_12k8( struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n) { @@ -336,13 +351,18 @@ static void arm_resample_24k_12k8( arm_resample_x192k_12k8( 8, (const int16x2_t *)h, hp50, (int16x2_t *)x, y, n); } + +#ifndef TEST_ARM +#define resample_24k_12k8 arm_resample_24k_12k8 +#endif + #endif /* resample_24k_12k8 */ /** * Resample from 48 Khz to 12.8 KHz */ #ifndef resample_48k_12k8 -#define resample_48k_12k8 arm_resample_48k_12k8 + static void arm_resample_48k_12k8( struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n) { @@ -424,13 +444,18 @@ static void arm_resample_48k_12k8( arm_resample_x192k_12k8( 4, (const int16x2_t *)h, hp50, (int16x2_t *)x, y, n); } + +#ifndef TEST_ARM +#define resample_48k_12k8 arm_resample_48k_12k8 +#endif + #endif /* resample_48k_12k8 */ /** * Return vector of correlations */ #ifndef correlate -#define correlate arm_correlate + static void arm_correlate( const int16_t *a, const int16_t *b, int n, float *y, int nc) { @@ -471,6 +496,11 @@ static void arm_correlate( if (nc > 0) *(y++) = dot(a, b, n); } + +#ifndef TEST_ARM +#define correlate arm_correlate +#endif + #endif /* correlate */ #endif /* __ARM_FEATURE_SIMD32 */ diff --git a/src/ltpf_neon.h b/src/ltpf_neon.h index 240b8c7..cd27c20 100644 --- a/src/ltpf_neon.h +++ b/src/ltpf_neon.h @@ -34,7 +34,7 @@ static inline int32_t filter_hp50(struct lc3_ltpf_hp50_state *, int32_t); * Resample from 16 Khz to 12.8 KHz */ #ifndef resample_16k_12k8 -#define resample_16k_12k8 neon_resample_16k_12k8 + LC3_HOT static void neon_resample_16k_12k8( struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n) { @@ -71,13 +71,18 @@ LC3_HOT static void neon_resample_16k_12k8( *(y++) = (yn + (1 << 15)) >> 16; } } + +#ifndef TEST_NEON +#define resample_16k_12k8 neon_resample_16k_12k8 +#endif + #endif /* resample_16k_12k8 */ /** * Resample from 32 Khz to 12.8 KHz */ #ifndef resample_32k_12k8 -#define resample_32k_12k8 neon_resample_32k_12k8 + LC3_HOT static void neon_resample_32k_12k8( struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n) { @@ -111,13 +116,18 @@ LC3_HOT static void neon_resample_32k_12k8( *(y++) = (yn + (1 << 15)) >> 16; } } + +#ifndef TEST_NEON +#define resample_32k_12k8 neon_resample_32k_12k8 +#endif + #endif /* resample_32k_12k8 */ /** * Resample from 48 Khz to 12.8 KHz */ #ifndef resample_48k_12k8 -#define resample_48k_12k8 neon_resample_48k_12k8 + LC3_HOT static void neon_resample_48k_12k8( struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n) { @@ -169,13 +179,18 @@ LC3_HOT static void neon_resample_48k_12k8( *(y++) = (yn + (1 << 15)) >> 16; } } + +#ifndef TEST_NEON +#define resample_48k_12k8 neon_resample_48k_12k8 +#endif + #endif /* resample_48k_12k8 */ /** * Return dot product of 2 vectors */ #ifndef dot -#define dot neon_dot + LC3_HOT static inline float neon_dot(const int16_t *a, const int16_t *b, int n) { int64x2_t v = vmovq_n_s64(0); @@ -195,13 +210,18 @@ LC3_HOT static inline float neon_dot(const int16_t *a, const int16_t *b, int n) int32_t v32 = (vaddvq_s64(v) + (1 << 5)) >> 6; return (float)v32; } + +#ifndef TEST_NEON +#define dot neon_dot +#endif + #endif /* dot */ /** * Return vector of correlations */ #ifndef correlate -#define correlate neon_correlate + LC3_HOT static void neon_correlate( const int16_t *a, const int16_t *b, int n, float *y, int nc) { @@ -253,4 +273,8 @@ LC3_HOT static void neon_correlate( } #endif /* correlate */ +#ifndef TEST_NEON +#define correlate neon_correlate +#endif + #endif /* __ARM_NEON && __ARM_ARCH_ISA_A64 */ diff --git a/src/mdct_neon.h b/src/mdct_neon.h index 950e750..4088212 100644 --- a/src/mdct_neon.h +++ b/src/mdct_neon.h @@ -28,7 +28,7 @@ * The number of interleaved transform `n` assumed to be even */ #ifndef fft_5 -#define fft_5 neon_fft_5 + LC3_HOT static inline void neon_fft_5( const struct lc3_complex *x, struct lc3_complex *y, int n) { @@ -97,13 +97,18 @@ LC3_HOT static inline void neon_fft_5( vst1_f32( (float *)(y + 9), vget_high_f32(y4) ); } } + +#ifndef TEST_NEON +#define fft_5 neon_fft_5 +#endif + #endif /* fft_5 */ /** * FFT Butterfly 3 Points */ #ifndef fft_bf3 -#define fft_bf3 neon_fft_bf3 + LC3_HOT static inline void neon_fft_bf3( const struct lc3_fft_bf3_twiddles *twiddles, const struct lc3_complex *x, struct lc3_complex *y, int n) @@ -206,13 +211,18 @@ LC3_HOT static inline void neon_fft_bf3( } } + +#ifndef TEST_NEON +#define fft_bf3 neon_fft_bf3 +#endif + #endif /* fft_bf3 */ /** * FFT Butterfly 2 Points */ #ifndef fft_bf2 -#define fft_bf2 neon_fft_bf2 + LC3_HOT static inline void neon_fft_bf2( const struct lc3_fft_bf2_twiddles *twiddles, const struct lc3_complex *x, struct lc3_complex *y, int n) @@ -275,6 +285,11 @@ LC3_HOT static inline void neon_fft_bf2( } } } + +#ifndef TEST_NEON +#define fft_bf2 neon_fft_bf2 +#endif + #endif /* fft_bf2 */ #endif /* __ARM_NEON && __ARM_ARCH_ISA_A64 */ diff --git a/test/neon/neon.h b/test/neon/neon.h index acd2392..4fbf2be 100644 --- a/test/neon/neon.h +++ b/test/neon/neon.h @@ -22,6 +22,7 @@ #else #define __ARM_NEON 1 +#define __ARM_ARCH_ISA_A64 1 #include