[xiph-cvs] cvs commit: speex/src speexdec.c

Jean-Marc Valin jm at xiph.org
Thu Jan 9 23:27:54 PST 2003



jm          03/01/10 02:27:54

  Modified:    doc      manual.lyx
               libspeex modes.c modes.h sb_celp.c vbr.c
               src      speexdec.c
  Log:
  mostly wideband tuning...

Revision  Changes    Path
1.45      +7 -0      speex/doc/manual.lyx

Index: manual.lyx
===================================================================
RCS file: /usr/local/cvsroot/speex/doc/manual.lyx,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- manual.lyx	6 Jan 2003 20:43:48 -0000	1.44
+++ manual.lyx	10 Jan 2003 07:27:53 -0000	1.45
@@ -3162,6 +3162,13 @@
 \layout Subsection*
 
 Quality
+\layout Standard
+
+Speex encoding is controlled most of the time by a quality parameter that
+ range from 0 to 10.
+  In constant bit-rate (CBR) operation, the quality parameter is an integer,
+ while for variable bit-rate (VBR), the parameter is a float.
+ 
 \layout Subsection*
 
 Complexity (variable)

<p><p>1.97      +2 -0      speex/libspeex/modes.c

Index: modes.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/modes.c,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -r1.96 -r1.97
--- modes.c	8 Jan 2003 21:58:59 -0000	1.96
+++ modes.c	10 Jan 2003 07:27:54 -0000	1.97
@@ -447,6 +447,7 @@
    .002,   /*lag_factor*/
    1.0001, /*lpc_floor*/
    0.0,    /*preemph*/
+   0.7,
    {NULL, &wb_submode1, &wb_submode2, &wb_submode3, &wb_submode4, NULL, NULL, NULL},
    3,
    {1, 1, 2, 3, 4, 5, 5, 6, 6, 7, 7},
@@ -490,6 +491,7 @@
    .002,   /*lag_factor*/
    1.0001, /*lpc_floor*/
    0.0,    /*preemph*/
+   0.5,
    {NULL, &wb_submode1, NULL, NULL, NULL, NULL, NULL, NULL},
    1,
    {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},

<p><p>1.42      +1 -0      speex/libspeex/modes.h

Index: modes.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/modes.h,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- modes.h	6 Jan 2003 05:56:56 -0000	1.41
+++ modes.h	10 Jan 2003 07:27:54 -0000	1.42
@@ -132,6 +132,7 @@
    float   lag_factor;    /**< Lag-windowing parameter */
    float   lpc_floor;     /**< Noise floor for LPC analysis */
    float   preemph;       /**< Pre-emphasis */
+   float   folding_gain;
 
    SpeexSubmode *submodes[SB_SUBMODES]; /**< Sub-mode data for the mode */
    int     defaultSubmode; /**< Default sub-mode to use when encoding */

<p><p>1.116     +9 -5      speex/libspeex/sb_celp.c

Index: sb_celp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/sb_celp.c,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -r1.115 -r1.116
--- sb_celp.c	8 Jan 2003 21:58:59 -0000	1.115
+++ sb_celp.c	10 Jan 2003 07:27:54 -0000	1.116
@@ -514,10 +514,11 @@
          g=sqrt(g);
 
          g *= filter_ratio;
-
+         /*print_vec(&g, 1, "gain factor");*/
          /* Gain quantization */
          {
-            int quant = (int) floor(.5 + 27 + 8.0 * log((g+.0001)));
+            int quant = (int) floor(.5 + 10 + 8.0 * log((g+.0001)));
+            /*speex_warning_int("tata", quant);*/
             if (quant<0)
                quant=0;
             if (quant>31)
@@ -808,9 +809,11 @@
    float *low_pi_gain, *low_exc, *low_innov;
    float *awk1, *awk2, *awk3;
    float dtx;
+   SpeexSBMode *mode;
 
    st = (SBDecState*)state;
    stack=st->stack;
+   mode = (SpeexSBMode*)(st->mode->mode);
 
    /* Decode the low-band */
    ret = speex_decode(st->st_low, bits, st->x0d);
@@ -972,14 +975,15 @@
          for (i=0;i<st->subframeSize;i++)
             el+=sqr(low_innov[offset+i]);
          quant = speex_bits_unpack_unsigned(bits, 5);
-         g= exp(((float)quant-27)/8.0);
+         g= exp(((float)quant-10)/8.0);
          
          /*printf ("unquant folding gain: %f\n", g);*/
          g /= filter_ratio;
          
          /* High-band excitation using the low-band excitation and a gain */
          for (i=0;i<st->subframeSize;i++)
-            exc[i]=.8*g*low_innov[offset+i];
+            exc[i]=mode->folding_gain*g*low_innov[offset+i];
+         /*speex_rand_vec(mode->folding_gain*g*sqrt(el/st->subframeSize), exc, st->subframeSize);*/
       } else {
          float gc, scale;
          int qgc = speex_bits_unpack_unsigned(bits, 4);
@@ -1091,7 +1095,7 @@
    case SPEEX_SET_VBR_QUALITY:
       {
          int q;
-         float qual = (*(float*)ptr)+.5;
+         float qual = (*(float*)ptr)+.6;
          st->vbr_quality = (*(float*)ptr);
          if (qual>10)
             qual=10;

<p><p>1.18      +4 -4      speex/libspeex/vbr.c

Index: vbr.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/vbr.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- vbr.c	20 Dec 2002 17:45:36 -0000	1.17
+++ vbr.c	10 Jan 2003 07:27:54 -0000	1.18
@@ -44,7 +44,7 @@
 
 float vbr_nb_thresh[8][11]={
    {-1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0}, /*   CNG   */
-   { 3.0,  2.5,  1.5,  0.5, -0.1, -0.3, -0.5, -0.7, -0.8, -0.9, -1.0}, /*  2 kbps */
+   { 3.5,  2.5,  2.0,  1.2,  0.5,  0.0, -0.5, -0.7, -0.8, -0.9, -1.0}, /*  2 kbps */
    { 8.5,  5.6,  4.7,  4.2,  3.9,  3.5,  3.0,  2.5,  2.0,  1.0,  0.0}, /*  6 kbps */
    {11.0,  8.5,  7.5,  6.5,  5.0,  3.9,  3.9,  3.9,  3.5,  3.0,  1.0}, /*  8 kbps */
    {11.0, 11.0,  9.9,  9.0,  8.0,  7.0,  6.5,  6.0,  5.0,  4.0,  2.0}, /* 11 kbps */
@@ -56,9 +56,9 @@
 
 float vbr_hb_thresh[5][11]={
    {-1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0}, /* silence */
-   { 3.9,  2.5,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0, -1.0}, /*  2 kbps */
-   {11.0, 11.0,  9.5,  8.5,  7.5,  6.5,  6.0,  5.0,  4.0,  3.0,  1.0}, /*  6 kbps */
-   {11.0, 11.0, 11.0, 11.0, 11.0,  9.5,  8.7,  8.0,  7.0,  6.5,  4.0}, /* 10 kbps */
+   {-1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0}, /*  2 kbps */
+   {11.0, 11.0,  9.5,  8.5,  7.5,  6.0,  5.0,  3.9,  3.0,  2.0,  1.0}, /*  6 kbps */
+   {11.0, 11.0, 11.0, 11.0, 11.0,  9.5,  8.7,  7.8,  7.0,  6.5,  4.0}, /* 10 kbps */
    {11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0,  9.8,  7.5,  5.5}  /* 18 kbps */ 
 };
 

<p><p>1.71      +5 -0      speex/src/speexdec.c

Index: speexdec.c
===================================================================
RCS file: /usr/local/cvsroot/speex/src/speexdec.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- speexdec.c	8 Jan 2003 21:59:00 -0000	1.70
+++ speexdec.c	10 Jan 2003 07:27:54 -0000	1.71
@@ -294,6 +294,11 @@
    }
    
    st = speex_decoder_init(mode);
+   if (!st)
+   {
+      fprintf (stderr, "Decoder initialization failed.\n");
+      return NULL;
+   }
    speex_decoder_ctl(st, SPEEX_SET_ENH, &enh_enabled);
    speex_decoder_ctl(st, SPEEX_GET_FRAME_SIZE, frame_size);
 

<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