[xiph-cvs] cvs commit: speex/libspeex sb_celp.c nb_celp.c

Jean-Marc Valin jm at xiph.org
Fri Nov 14 10:46:29 PST 2003



jm          03/11/14 13:46:29

  Modified:    libspeex sb_celp.c nb_celp.c
  Log:
  fixed-point: sb_celp gain quantization, fixed missing entry in nb_celp gain

Revision  Changes    Path
1.154     +6 -6      speex/libspeex/sb_celp.c

Index: sb_celp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/sb_celp.c,v
retrieving revision 1.153
retrieving revision 1.154
diff -u -r1.153 -r1.154
--- sb_celp.c	14 Nov 2003 18:28:45 -0000	1.153
+++ sb_celp.c	14 Nov 2003 18:46:29 -0000	1.154
@@ -53,6 +53,10 @@
 
 #define SUBMODE(x) st->submodes[st->submodeID]->x
 
+#ifdef FIXED_POINT
+spx_word16_t gc_quant_bound[16] = {125, 164, 215, 282, 370, 484, 635, 832, 1090, 1428, 1871, 2452, 3213, 4210, 5516, 7228};
+#endif
+
 #define QMF_ORDER 64
 
 #ifdef FIXED_POINT
@@ -580,13 +584,9 @@
          /*printf ("%f %f %f %f\n", el, eh, filter_ratio, gc);*/
 #ifdef FIXED_POINT
          {
-            int qgc = (int)floor(.5+3.7*(log(gc/128.)+0.15556));
-            if (qgc<0)
-               qgc=0;
-            if (qgc>15)
-               qgc=15;
+            int qgc = scal_quant(gc, gc_quant_bound, 16);
             speex_bits_pack(bits, qgc, 4);
-            gc = 128*exp((1/3.7)*qgc-0.15556);
+            gc = MULT16_32_Q15(28626,gc_quant_bound[qgc]);
          }
 #else
          {

<p><p>1.152     +2 -2      speex/libspeex/nb_celp.c

Index: nb_celp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/nb_celp.c,v
retrieving revision 1.151
retrieving revision 1.152
diff -u -r1.151 -r1.152
--- nb_celp.c	13 Nov 2003 20:39:06 -0000	1.151
+++ nb_celp.c	14 Nov 2003 18:46:29 -0000	1.152
@@ -57,7 +57,7 @@
 #define SUBMODE(x) st->submodes[st->submodeID]->x
 
 #ifdef FIXED_POINT
-spx_word32_t ol_gain_table[31]={18900, 25150, 33468, 44536, 59265, 78865, 104946, 139653, 185838, 247297, 329081, 437913, 582736, 775454, 1031906, 1373169, 1827293, 2431601, 3235761, 4305867, 5729870, 7624808, 10146425, 13501971, 17967238, 23909222, 31816294, 42338330, 56340132, 74972501, 99766822};
+spx_word32_t ol_gain_table[32]={18900, 25150, 33468, 44536, 59265, 78865, 104946, 139653, 185838, 247297, 329081, 437913, 582736, 775454, 1031906, 1373169, 1827293, 2431601, 3235761, 4305867, 5729870, 7624808, 10146425, 13501971, 17967238, 23909222, 31816294, 42338330, 56340132, 74972501, 99766822, 132760927};
 #endif
 
 #ifdef FIXED_POINT
@@ -579,7 +579,7 @@
       int qe = scal_quant32(ol_gain, ol_gain_table, 32);
       /*ol_gain = exp(qe/3.5)*SIG_SCALING;*/
       ol_gain = MULT16_32_Q15(28406,ol_gain_table[qe]);
-      speex_bits_pack(bits, qe, 5);      
+      speex_bits_pack(bits, qe, 5);
    }
 #else
    {

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list