Commit 21b1134a authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

Code cleanup

defining HALF16() too
parent f54a0a39
......@@ -199,6 +199,7 @@ typedef float celt_mask;
#define SATURATE(x,a) (x)
#define ROUND16(a,shift) (a)
#define HALF16(x) (.5f*(x))
#define HALF32(x) (.5f*(x))
#define ADD16(a,b) ((a)+(b))
......
......@@ -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 ROUND16(x,a) (celt_mips--,EXTRACT16(PSHR32((x),(a))))
#define HALF16(x) (SHR16(x,1))
#define HALF32(x) (SHR32(x,1))
//#define SHR(a,shift) ((a) >> (shift))
......
......@@ -93,6 +93,7 @@
/** Shift by a and round-to-neareast 32-bit value. Result is a 16-bit value */
#define ROUND16(x,a) (EXTRACT16(PSHR32((x),(a))))
/** Divide by two */
#define HALF16(x) (SHR16(x,1))
#define HALF32(x) (SHR32(x,1))
/** Add two 16-bit values */
......
......@@ -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];
gain = celt_div((celt_word32)MULT16_16(Q15_ONE,len),(celt_word32)(len+factor*K));
/* FIXME: Make that HALF16 instead of HALF32 */
theta = HALF32(MULT16_16_Q15(gain,gain));
theta = HALF16(MULT16_16_Q15(gain,gain));
c = celt_cos_norm(EXTEND32(theta));
s = celt_cos_norm(EXTEND32(SUB16(Q15ONE,theta))); /* sin(theta) */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment