ref: f81a60ca56f3b179c9433900e9cf5bf28e6f2ac8
parent: bc272de74be78be9ca9e5c2f93126d08b8f2d0dd
author: Jean-Marc Valin <[email protected]>
date: Tue Aug 3 11:47:54 EDT 2010
DOUBLE_PRECISION and MIXED_PRECISION no longer need to be defined
--- a/configure.ac
+++ b/configure.ac
@@ -105,8 +105,6 @@
[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],
--- a/libcelt/_kiss_fft_guts.h
+++ b/libcelt/_kiss_fft_guts.h
@@ -53,18 +53,15 @@
#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 @@
# 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 @@
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 */
--- a/libcelt/kiss_fft.c
+++ b/libcelt/kiss_fft.c
@@ -569,7 +569,7 @@
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));
--- a/libcelt/kiss_fft.h
+++ b/libcelt/kiss_fft.h
@@ -51,6 +51,8 @@
#ifdef FIXED_POINT
#include "arch.h"
+#define DOUBLE_PRECISION
+
#ifdef DOUBLE_PRECISION
# define kiss_fft_scalar celt_int32
# define kiss_twiddle_scalar celt_int32
--- a/libcelt/mdct.c
+++ b/libcelt/mdct.c
@@ -83,13 +83,8 @@
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);