From f5b0587bd2768a22735fd28b66da20e45e11616b Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin Date: Fri, 21 Mar 2008 10:46:17 +1100 Subject: [PATCH] s/ROUND/ROUND16/ --- libcelt/arch.h | 2 +- libcelt/fixed_debug.h | 2 +- libcelt/fixed_generic.h | 2 +- libcelt/pitch.c | 2 +- libcelt/quant_bands.c | 2 +- libcelt/vq.c | 26 +++++++++++++------------- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/libcelt/arch.h b/libcelt/arch.h index 3a03b0ae..f0c95b99 100644 --- a/libcelt/arch.h +++ b/libcelt/arch.h @@ -170,7 +170,7 @@ typedef float celt_mask_t; #define SHL(a,shift) (a) #define SATURATE(x,a) (x) -#define ROUND(a,shift) (a) +#define ROUND16(a,shift) (a) #define HALF32(x) (.5f*(x)) #define ADD16(a,b) ((a)+(b)) diff --git a/libcelt/fixed_debug.h b/libcelt/fixed_debug.h index 136f4d79..bffad156 100644 --- a/libcelt/fixed_debug.h +++ b/libcelt/fixed_debug.h @@ -174,7 +174,7 @@ static inline int SHL32(long long a, int shift) #define SATURATE16(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x))) #define SATURATE32(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x))) -#define ROUND(x,a) (EXTRACT16(PSHR32((x),(a)))) +#define ROUND16(x,a) (EXTRACT16(PSHR32((x),(a)))) #define HALF32(x) (SHR32(x,1)) //#define SHR(a,shift) ((a) >> (shift)) diff --git a/libcelt/fixed_generic.h b/libcelt/fixed_generic.h index 364b3c2e..1ed88f7e 100644 --- a/libcelt/fixed_generic.h +++ b/libcelt/fixed_generic.h @@ -90,7 +90,7 @@ #define SATURATE(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x))) /** Shift by a and round-to-neareast 32-bit value. Result is a 16-bit value */ -#define ROUND(x,a) (EXTRACT16(PSHR32((x),(a)))) +#define ROUND16(x,a) (EXTRACT16(PSHR32((x),(a)))) /** Divide by two */ #define HALF32(x) (SHR32(x,1)) diff --git a/libcelt/pitch.c b/libcelt/pitch.c index 73aaaae8..86a3cdb4 100644 --- a/libcelt/pitch.c +++ b/libcelt/pitch.c @@ -166,7 +166,7 @@ void find_spectral_pitch(kiss_fftr_cfg fft, const struct PsyDecay *decay, const celt_word32_t tmp; /*printf ("%d %d ", X[2*i]*X[2*i]+X[2*i+1]*X[2*i+1], Y[2*i]*Y[2*i]+Y[2*i+1]*Y[2*i+1]);*/ /*n = DIV32_16(Q15ONE,celt_sqrt(EPSILON+curve[i]));*/ - n = ROUND(celt_rcp(celt_sqrt(EPSILON+curve[i])),16); + n = ROUND16(celt_rcp(celt_sqrt(EPSILON+curve[i])),16); /*printf ("%f ", n);*/ tmp = X[2*i]; X[2*i] = MULT16_32_Q15(n, ADD32(MULT16_16(X[2*i ],Y[2*i ]), MULT16_16(X[2*i+1],Y[2*i+1]))); diff --git a/libcelt/quant_bands.c b/libcelt/quant_bands.c index cc757d19..8ce22988 100644 --- a/libcelt/quant_bands.c +++ b/libcelt/quant_bands.c @@ -64,7 +64,7 @@ static inline celt_ener_t dB2Amp(celt_ener_t dB) static inline celt_word16_t amp2dB(celt_ener_t amp) { /* equivalent to return 6.0207*log2(.3+amp) */ - return ROUND(MULT16_16(24661,celt_log2(ADD32(QCONST32(.3f,14),amp))),12); + return ROUND16(MULT16_16(24661,celt_log2(ADD32(QCONST32(.3f,14),amp))),12); /* return DB_SCALING*20*log10(.3+ENER_SCALING_1*amp); */ } #else diff --git a/libcelt/vq.c b/libcelt/vq.c index 4c7f1b19..f630e1db 100644 --- a/libcelt/vq.c +++ b/libcelt/vq.c @@ -71,7 +71,7 @@ static void mix_pitch_and_residual(int *iy, celt_norm_t *X, int N, int K, const the encoded (int) one */ for (i=0;inbest[Lupdate-1]->score) { @@ -378,7 +378,7 @@ void intra_prediction(celt_norm_t *x, celt_mask_t *W, int N, int K, celt_norm_t xy = MAC16_16(xy, x[j], Y[i+N-j-1]); yy = MAC16_16(yy, Y[i+N-j-1], Y[i+N-j-1]); } - score = DIV32(MULT16_16(ROUND(xy,14),ROUND(xy,14)), ROUND(yy,14)); + score = DIV32(MULT16_16(ROUND16(xy,14),ROUND16(xy,14)), ROUND16(yy,14)); if (score > best_score) { best_score = score;