[xiph-commits] r14112 - in trunk/speex: . libspeex

jm at svn.xiph.org jm at svn.xiph.org
Thu Nov 8 04:58:25 PST 2007


Author: jm
Date: 2007-11-08 04:58:25 -0800 (Thu, 08 Nov 2007)
New Revision: 14112

Modified:
   trunk/speex/TODO
   trunk/speex/libspeex/arch.h
   trunk/speex/libspeex/nb_celp.c
Log:
fixed-point: converted the forced_pitch_gain path, which still had a few
float operations left.


Modified: trunk/speex/TODO
===================================================================
--- trunk/speex/TODO	2007-11-08 08:54:04 UTC (rev 14111)
+++ trunk/speex/TODO	2007-11-08 12:58:25 UTC (rev 14112)
@@ -4,6 +4,9 @@
 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:

Modified: trunk/speex/libspeex/arch.h
===================================================================
--- trunk/speex/libspeex/arch.h	2007-11-08 08:54:04 UTC (rev 14111)
+++ trunk/speex/libspeex/arch.h	2007-11-08 12:58:25 UTC (rev 14112)
@@ -68,6 +68,7 @@
 #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 @@
 #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

Modified: trunk/speex/libspeex/nb_celp.c
===================================================================
--- trunk/speex/libspeex/nb_celp.c	2007-11-08 08:54:04 UTC (rev 14111)
+++ trunk/speex/libspeex/nb_celp.c	2007-11-08 12:58:25 UTC (rev 14112)
@@ -665,13 +665,17 @@
    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 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 */



More information about the commits mailing list