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

fixed-point: defined HALF32() and used it for the forward mdct.

parent 957a4fae
......@@ -153,12 +153,13 @@ typedef float celt_mask_t;
#define SATURATE16(x,a) (x)
#define SATURATE32(x,a) (x)
#define PSHR(a,shift) (a)
#define SHR(a,shift) (a)
#define SHL(a,shift) (a)
#define SATURATE(x,a) (x)
#define PSHR(a,shift) (a)
#define SHR(a,shift) (a)
#define SHL(a,shift) (a)
#define SATURATE(x,a) (x)
#define ROUND(a,shift) (a)
#define ROUND(a,shift) (a)
#define HALF32(x) (.5f*(x))
#define ADD16(a,b) ((a)+(b))
#define SUB16(a,b) ((a)-(b))
......
......@@ -172,6 +172,7 @@ static inline int SHL32(long long a, int shift)
#define SATURATE32(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
#define ROUND(x,a) (EXTRACT16(PSHR32((x),(a))))
#define HALF32(x) (SHR32(x,1))
//#define SHR(a,shift) ((a) >> (shift))
//#define SHL(a,shift) ((a) << (shift))
......
......@@ -58,6 +58,7 @@
#define SATURATE(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
#define ROUND(x,a) (EXTRACT16(PSHR32((x),(a))))
#define HALF32(x) (SHR32(x,1))
#define ADD16(a,b) ((celt_word16_t)((celt_word16_t)(a)+(celt_word16_t)(b)))
#define SUB16(a,b) ((celt_word16_t)(a)-(celt_word16_t)(b))
......
......@@ -104,8 +104,8 @@ void mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar *ou
{
kiss_fft_scalar re, im;
/* Real part arranged as -d-cR, Imag part arranged as -b+aR*/
re = -.5*(in[N2+N4+2*i] + in[N2+N4-2*i-1]);
im = -.5*(in[N4+2*i] - in[N4-2*i-1]);
re = -HALF32(in[N2+N4+2*i] + in[N2+N4-2*i-1]);
im = -HALF32(in[N4+2*i] - in[N4-2*i-1]);
out[2*i] = S_MUL(re,l->trig[i]) - S_MUL(im,l->trig[i+N4]);
out[2*i+1] = S_MUL(im,l->trig[i]) + S_MUL(re,l->trig[i+N4]);
}
......@@ -113,8 +113,8 @@ void mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar *ou
{
kiss_fft_scalar re, im;
/* Real part arranged as a-bR, Imag part arranged as -c-dR */
re = .5*(in[2*i-N4] - in[N2+N4-2*i-1]);
im = -.5*(in[N4+2*i] + in[N+N4-2*i-1]);
re = HALF32(in[2*i-N4] - in[N2+N4-2*i-1]);
im = -HALF32(in[N4+2*i] + in[N+N4-2*i-1]);
out[2*i] = S_MUL(re,l->trig[i]) - S_MUL(im,l->trig[i+N4]);
out[2*i+1] = S_MUL(im,l->trig[i]) + S_MUL(re,l->trig[i+N4]);
}
......
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