fixed-point: converted the forced_pitch_gain path, which still had a few
authorjm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800>
Thu, 8 Nov 2007 12:58:25 +0000 (12:58 +0000)
committerjm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800>
Thu, 8 Nov 2007 12:58:25 +0000 (12:58 +0000)
float operations left.

git-svn-id: http://svn.xiph.org/trunk/speex@14112 0101bb08-14d6-0310-b084-bc0e0c8e3800

TODO
libspeex/arch.h
libspeex/nb_celp.c

diff --git a/TODO b/TODO
index d4a9fa5..ce8f374 100644 (file)
--- a/TODO
+++ b/TODO
@@ -4,6 +4,9 @@ Control delay in new AEC API.
 packet dump
 make sure speex_alloc() and speex_free() are exported properly
 split misc.h into spx_types.h and spx_sys.h
+remove misc.h
+proper error reporting
+get rid of floats in initialisation (make the lag window a const array)
 
 
 Eventually:
index e2d731a..1e48e93 100644 (file)
@@ -68,6 +68,7 @@ typedef spx_word32_t spx_sig_t;
 #define LPC_SHIFT    13
 #define LSP_SHIFT    13
 #define SIG_SHIFT    14
+#define GAIN_SHIFT   6
 
 #define VERY_SMALL 0
 #define VERY_LARGE32 ((spx_word32_t)2147483647)
@@ -111,9 +112,6 @@ typedef float spx_word32_t;
 #define GAIN_SCALING 1.f
 #define GAIN_SCALING_1 1.f
 
-#define LPC_SHIFT    0
-#define LSP_SHIFT    0
-#define SIG_SHIFT    0
 
 #define VERY_SMALL 1e-15f
 #define VERY_LARGE32 1e15f
index c4bb81c..46c0027 100644 (file)
@@ -665,13 +665,17 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
    if (SUBMODE(forced_pitch_gain))
    {
       int quant;
+#ifdef FIXED_POINT
+      quant = PSHR16(MULT16_16_16(15, ol_pitch_coef),GAIN_SHIFT);
+#else
       quant = (int)floor(.5+15*ol_pitch_coef*GAIN_SCALING_1);
+#endif
       if (quant>15)
          quant=15;
       if (quant<0)
          quant=0;
       speex_bits_pack(bits, quant, 4);
-      ol_pitch_coef=GAIN_SCALING*0.066667*quant;
+      ol_pitch_coef=MULT16_16_P15(QCONST16(0.066667,15),SHL16(quant,GAIN_SHIFT));
    }
    
    
@@ -1401,7 +1405,7 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
    {
       int quant;
       quant = speex_bits_unpack_unsigned(bits, 4);
-      ol_pitch_coef=GAIN_SCALING*0.066667*quant;
+      ol_pitch_coef=MULT16_16_P15(QCONST16(0.066667,15),SHL16(quant,GAIN_SHIFT));
    }
    
    /* Get global excitation gain */