DOUBLE_PRECISION and MIXED_PRECISION no longer need to be defined

This commit is contained in:
Jean-Marc Valin 2010-08-03 15:47:54 -04:00
parent bc272de74b
commit f81a60ca56
5 changed files with 5 additions and 42 deletions

View file

@ -105,8 +105,6 @@ AC_ARG_ENABLE(fixed-point, [ --enable-fixed-point compile as fixed-point],
[if test "$enableval" = yes; then
ac_enable_fixed="yes";
AC_DEFINE([FIXED_POINT], , [Compile as fixed-point])
AC_DEFINE([DOUBLE_PRECISION], , [Compile as fixed-point])
AC_DEFINE([MIXED_PRECISION], , [Compile as fixed-point])
else
AC_DEFINE([FLOATING_POINT], , [Compile as floating-point])
fi],

View file

@ -53,18 +53,15 @@ struct kiss_fft_state{
#ifdef FIXED_POINT
#include "arch.h"
#define DOUBLE_PRECISION
#ifdef DOUBLE_PRECISION
# define FRACBITS 31
# define SAMPPROD long long
#define SAMP_MAX 2147483647
#ifdef MIXED_PRECISION
#define TWID_MAX 32767
#define TRIG_UPSCALE 1
#else
#define TRIG_UPSCALE 65536
#define TWID_MAX 2147483647
#endif
#define EXT32(a) (a)
#else /* DOUBLE_PRECISION */
@ -88,7 +85,6 @@ struct kiss_fft_state{
# define smul(a,b) ( (SAMPPROD)(a)*(b) )
# define sround( x ) (kiss_fft_scalar)( ( (x) + ((SAMPPROD)1<<(FRACBITS-1)) ) >> FRACBITS )
#ifdef MIXED_PRECISION
# define S_MUL(a,b) MULT16_32_Q15(b, a)
@ -129,34 +125,6 @@ struct kiss_fft_state{
do {(res).r = ADD32((res).r,(a).r); (res).i = SUB32((res).i,(a).i); \
}while(0)
#else /* MIXED_PRECISION */
# define sround4( x ) (kiss_fft_scalar)( ( (x) + ((SAMPPROD)1<<(FRACBITS-1)) ) >> (FRACBITS+2) )
# define S_MUL(a,b) sround( smul(a,b) )
# define C_MUL(m,a,b) \
do{ (m).r = sround( smul((a).r,(b).r) - smul((a).i,(b).i) ); \
(m).i = sround( smul((a).r,(b).i) + smul((a).i,(b).r) ); }while(0)
# define C_MULC(m,a,b) \
do{ (m).r = sround( smul((a).r,(b).r) + smul((a).i,(b).i) ); \
(m).i = sround( smul((a).i,(b).r) - smul((a).r,(b).i) ); }while(0)
# define C_MUL4(m,a,b) \
do{ (m).r = sround4( smul((a).r,(b).r) - smul((a).i,(b).i) ); \
(m).i = sround4( smul((a).r,(b).i) + smul((a).i,(b).r) ); }while(0)
# define C_MULBYSCALAR( c, s ) \
do{ (c).r = sround( smul( (c).r , s ) ) ;\
(c).i = sround( smul( (c).i , s ) ) ; }while(0)
# define DIVSCALAR(x,k) \
(x) = sround( smul( x, SAMP_MAX/k ) )
# define C_FIXDIV(c,div) \
do { DIVSCALAR( (c).r , div); \
DIVSCALAR( (c).i , div); }while (0)
#endif /* !MIXED_PRECISION */

View file

@ -569,7 +569,7 @@ int kf_factor(int n,int * facbuf)
static void compute_twiddles(kiss_twiddle_cpx *twiddles, int nfft)
{
int i;
#if defined(FIXED_POINT) && (!defined(DOUBLE_PRECISION) || defined(MIXED_PRECISION))
#ifdef FIXED_POINT
for (i=0;i<nfft;++i) {
celt_word32 phase = -i;
kf_cexp2(twiddles+i, DIV32(SHL32(phase,17),nfft));

View file

@ -51,6 +51,8 @@ extern "C" {
#ifdef FIXED_POINT
#include "arch.h"
#define DOUBLE_PRECISION
#ifdef DOUBLE_PRECISION
# define kiss_fft_scalar celt_int32
# define kiss_twiddle_scalar celt_int32

View file

@ -83,13 +83,8 @@ void clt_mdct_init(mdct_lookup *l,int N, int maxshift)
return;
/* We have enough points that sine isn't necessary */
#if defined(FIXED_POINT)
#if defined(DOUBLE_PRECISION) & !defined(MIXED_PRECISION)
for (i=0;i<=N4;i++)
l->trig[i] = SAMP_MAX*cos(2*M_PI*i/N);
#else
for (i=0;i<=N4;i++)
l->trig[i] = TRIG_UPSCALE*celt_cos_norm(DIV32(ADD32(SHL32(EXTEND32(i),17),N2),N));
#endif
#else
for (i=0;i<=N4;i++)
l->trig[i] = cos(2*M_PI*i/N);