Code cleanup

defining HALF16() too
This commit is contained in:
Jean-Marc Valin 2011-05-13 17:41:33 -04:00
parent f54a0a39e5
commit 21b1134aa2
4 changed files with 4 additions and 2 deletions

View file

@ -199,6 +199,7 @@ typedef float celt_mask;
#define SATURATE(x,a) (x) #define SATURATE(x,a) (x)
#define ROUND16(a,shift) (a) #define ROUND16(a,shift) (a)
#define HALF16(x) (.5f*(x))
#define HALF32(x) (.5f*(x)) #define HALF32(x) (.5f*(x))
#define ADD16(a,b) ((a)+(b)) #define ADD16(a,b) ((a)+(b))

View file

@ -180,6 +180,7 @@ static inline int SHL32(long long a, int shift)
#define SATURATE32(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x))) #define SATURATE32(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
#define ROUND16(x,a) (celt_mips--,EXTRACT16(PSHR32((x),(a)))) #define ROUND16(x,a) (celt_mips--,EXTRACT16(PSHR32((x),(a))))
#define HALF16(x) (SHR16(x,1))
#define HALF32(x) (SHR32(x,1)) #define HALF32(x) (SHR32(x,1))
//#define SHR(a,shift) ((a) >> (shift)) //#define SHR(a,shift) ((a) >> (shift))

View file

@ -93,6 +93,7 @@
/** Shift by a and round-to-neareast 32-bit value. Result is a 16-bit value */ /** Shift by a and round-to-neareast 32-bit value. Result is a 16-bit value */
#define ROUND16(x,a) (EXTRACT16(PSHR32((x),(a)))) #define ROUND16(x,a) (EXTRACT16(PSHR32((x),(a))))
/** Divide by two */ /** Divide by two */
#define HALF16(x) (SHR16(x,1))
#define HALF32(x) (SHR32(x,1)) #define HALF32(x) (SHR32(x,1))
/** Add two 16-bit values */ /** Add two 16-bit values */

View file

@ -87,8 +87,7 @@ static void exp_rotation(celt_norm *X, int len, int dir, int stride, int K, int
factor = SPREAD_FACTOR[spread-1]; factor = SPREAD_FACTOR[spread-1];
gain = celt_div((celt_word32)MULT16_16(Q15_ONE,len),(celt_word32)(len+factor*K)); gain = celt_div((celt_word32)MULT16_16(Q15_ONE,len),(celt_word32)(len+factor*K));
/* FIXME: Make that HALF16 instead of HALF32 */ theta = HALF16(MULT16_16_Q15(gain,gain));
theta = HALF32(MULT16_16_Q15(gain,gain));
c = celt_cos_norm(EXTEND32(theta)); c = celt_cos_norm(EXTEND32(theta));
s = celt_cos_norm(EXTEND32(SUB16(Q15ONE,theta))); /* sin(theta) */ s = celt_cos_norm(EXTEND32(SUB16(Q15ONE,theta))); /* sin(theta) */