From c9c2035355b8e028d1b62992b277b0c376634cf3 Mon Sep 17 00:00:00 2001 From: Rhishikesh Agashe Date: Wed, 7 Oct 2015 13:55:12 -0400 Subject: [PATCH] Fixes compile problems for MIPS Brings MIPS in sync with the ARM/SSE optimizations that added "arch" parameters. Signed-off-by: Jean-Marc Valin --- celt/mips/celt_mipsr1.h | 2 ++ celt/mips/pitch_mipsr1.h | 5 ++++- celt/mips/vq_mipsr1.h | 14 ++++++-------- celt/vq.c | 4 ---- celt/vq.h | 5 +++++ silk/fixed/mips/prefilter_FIX_mipsr1.h | 7 +++++-- silk/fixed/prefilter_FIX.c | 5 +++++ silk/main.h | 19 ------------------- 8 files changed, 27 insertions(+), 34 deletions(-) diff --git a/celt/mips/celt_mipsr1.h b/celt/mips/celt_mipsr1.h index 7915d596..e85661a6 100644 --- a/celt/mips/celt_mipsr1.h +++ b/celt/mips/celt_mipsr1.h @@ -61,6 +61,8 @@ void comb_filter(opus_val32 *y, opus_val32 *x, int T0, int T1, int N, int i; opus_val32 x0, x1, x2, x3, x4; + (void)arch; + /* printf ("%d %d %f %f\n", T0, T1, g0, g1); */ opus_val16 g00, g01, g02, g10, g11, g12; static const opus_val16 gains[3][3] = { diff --git a/celt/mips/pitch_mipsr1.h b/celt/mips/pitch_mipsr1.h index e2f017e9..a9500aff 100644 --- a/celt/mips/pitch_mipsr1.h +++ b/celt/mips/pitch_mipsr1.h @@ -36,11 +36,14 @@ #define OVERRIDE_DUAL_INNER_PROD static inline void dual_inner_prod(const opus_val16 *x, const opus_val16 *y01, const opus_val16 *y02, - int N, opus_val32 *xy1, opus_val32 *xy2) + int N, opus_val32 *xy1, opus_val32 *xy2, int arch) { int j; opus_val32 xy01=0; opus_val32 xy02=0; + + (void)arch; + asm volatile("MULT $ac1, $0, $0"); asm volatile("MULT $ac2, $0, $0"); /* Compute the norm of X+Y and X-Y as |X|^2 + |Y|^2 +/- sum(xy) */ diff --git a/celt/mips/vq_mipsr1.h b/celt/mips/vq_mipsr1.h index 0affae01..54cef861 100644 --- a/celt/mips/vq_mipsr1.h +++ b/celt/mips/vq_mipsr1.h @@ -34,16 +34,12 @@ #endif #include "mathops.h" -#include "cwrs.h" -#include "vq.h" #include "arch.h" -#include "os_support.h" -#include "bands.h" -#include "rate.h" static unsigned extract_collapse_mask(int *iy, int N, int B); static void normalise_residual(int * OPUS_RESTRICT iy, celt_norm * OPUS_RESTRICT X, int N, opus_val32 Ryy, opus_val16 gain); static void exp_rotation(celt_norm *X, int len, int dir, int stride, int K, int spread); +static void renormalise_vector_mips(celt_norm *X, int N, opus_val16 gain, int arch); #define OVERRIDE_vq_exp_rotation1 static void exp_rotation1(celt_norm *X, int len, int stride, opus_val16 c, opus_val16 s) @@ -75,9 +71,9 @@ static void exp_rotation1(celt_norm *X, int len, int stride, opus_val16 c, opus_ #define OVERRIDE_renormalise_vector #define renormalise_vector(X, N, gain, arch) \ - ((void)(arch), renormalize_vector_mips(x, N, gain)) + (renormalise_vector_mips(X, N, gain, arch)) -void renormalise_vector_mips(celt_norm *X, int N, opus_val16 gain) +void renormalise_vector_mips(celt_norm *X, int N, opus_val16 gain, int arch) { int i; #ifdef FIXED_POINT @@ -87,8 +83,10 @@ void renormalise_vector_mips(celt_norm *X, int N, opus_val16 gain) opus_val16 g; opus_val32 t; celt_norm *xptr = X; + int X0, X1; + + (void)arch; - int X0, X2, X3, X1; asm volatile("mult $ac1, $0, $0"); asm volatile("MTLO %0, $ac1" : :"r" (E)); /*if(N %4) diff --git a/celt/vq.c b/celt/vq.c index 0c58cdd4..f3583960 100644 --- a/celt/vq.c +++ b/celt/vq.c @@ -39,10 +39,6 @@ #include "rate.h" #include "pitch.h" -#if defined(MIPSr1_ASM) -#include "mips/vq_mipsr1.h" -#endif - #ifndef OVERRIDE_vq_exp_rotation1 static void exp_rotation1(celt_norm *X, int len, int stride, opus_val16 c, opus_val16 s) { diff --git a/celt/vq.h b/celt/vq.h index f8958206..5cfcbe50 100644 --- a/celt/vq.h +++ b/celt/vq.h @@ -37,6 +37,11 @@ #include "entdec.h" #include "modes.h" +#if defined(MIPSr1_ASM) +#include "mips/vq_mipsr1.h" +#endif + + /** Algebraic pulse-vector quantiser. The signal x is replaced by the sum of * the pitch and a combination of pulses such that its norm is still equal * to 1. This is the function that will typically require the most CPU. diff --git a/silk/fixed/mips/prefilter_FIX_mipsr1.h b/silk/fixed/mips/prefilter_FIX_mipsr1.h index faf9b48d..21b25688 100644 --- a/silk/fixed/mips/prefilter_FIX_mipsr1.h +++ b/silk/fixed/mips/prefilter_FIX_mipsr1.h @@ -43,15 +43,18 @@ void silk_warped_LPC_analysis_filter_FIX( const opus_int16 input[], /* I Input signal [length] */ const opus_int16 lambda_Q16, /* I Warping factor */ const opus_int length, /* I Length of input signal */ - const opus_int order /* I Filter order (even) */ + const opus_int order, /* I Filter order (even) */ + int arch ) { opus_int n, i; opus_int32 acc_Q11, acc_Q22, tmp1, tmp2, tmp3, tmp4; opus_int32 state_cur, state_next; + (void)arch; + /* Order must be even */ - /*Length must be even */ + /* Length must be even */ silk_assert( ( order & 1 ) == 0 ); silk_assert( ( length & 1 ) == 0 ); diff --git a/silk/fixed/prefilter_FIX.c b/silk/fixed/prefilter_FIX.c index c945dd35..6a8e3515 100644 --- a/silk/fixed/prefilter_FIX.c +++ b/silk/fixed/prefilter_FIX.c @@ -38,6 +38,11 @@ POSSIBILITY OF SUCH DAMAGE. #endif +#if !defined(OVERRIDE_silk_warped_LPC_analysis_filter_FIX) +#define silk_warped_LPC_analysis_filter_FIX(state, res_Q2, coef_Q13, input, lambda_Q16, length, order, arch) \ + ((void)(arch),silk_warped_LPC_analysis_filter_FIX_c(state, res_Q2, coef_Q13, input, lambda_Q16, length, order)) +#endif + /* Prefilter for finding Quantizer input signal */ static OPUS_INLINE void silk_prefilt_FIX( silk_prefilter_state_FIX *P, /* I/O state */ diff --git a/silk/main.h b/silk/main.h index 24d7e66c..2f90d68f 100644 --- a/silk/main.h +++ b/silk/main.h @@ -468,23 +468,4 @@ void silk_encode_indices( opus_int condCoding /* I The type of conditional coding to use */ ); -void silk_warped_LPC_analysis_filter_FIX_c( - opus_int32 state[], /* I/O State [order + 1] */ - opus_int32 res_Q2[], /* O Residual signal [length] */ - const opus_int16 coef_Q13[], /* I Coefficients [order] */ - const opus_int16 input[], /* I Input signal [length] */ - const opus_int16 lambda_Q16, /* I Warping factor */ - const opus_int length, /* I Length of input signal */ - const opus_int order /* I Filter order (even) */ -); - -#if !defined(OVERRIDE_silk_warped_LPC_analysis_filter_FIX) -#define silk_warped_LPC_analysis_filter_FIX(state, res_Q2, coef_Q13, input, lambda_Q16, length, order, arch) \ - ((void)(arch),silk_warped_LPC_analysis_filter_FIX_c(state, res_Q2, coef_Q13, input, lambda_Q16, length, order)) -#endif - -#if !defined(OPUS_X86_MAY_HAVE_SSE4_1) - -#endif - #endif