[xiph-cvs] cvs commit: speex/libspeex cb_search.c cb_search.h modes.c sb_celp.c

Jean-Marc Valin jm at xiph.org
Tue Oct 22 23:03:17 PDT 2002



jm          02/10/23 02:03:16

  Modified:    libspeex cb_search.c cb_search.h modes.c sb_celp.c
  Log:
  Merged split_cb_search_nogain and split_cb_search_shape_sign so there's
  now only one search function with an option to search for a sign or not.

Revision  Changes    Path
1.71      +16 -561   speex/libspeex/cb_search.c

Index: cb_search.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/cb_search.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- cb_search.c	23 Oct 2002 05:18:29 -0000	1.70
+++ cb_search.c	23 Oct 2002 06:03:16 -0000	1.71
@@ -49,284 +49,8 @@
 #endif
 
 
-void split_cb_search_nogain(
-float target[],			/* target vector */
-float ak[],			/* LPCs for this subframe */
-float awk1[],			/* Weighted LPCs for this subframe */
-float awk2[],			/* Weighted LPCs for this subframe */
-void *par,                      /* Codebook/search parameters*/
-int   p,                        /* number of LPC coeffs */
-int   nsf,                      /* number of samples in subframe */
-float *exc,
-SpeexBits *bits,
-float *stack,
-int   complexity
-)
-{
-   int i,j,k,m,n,q;
-   float *resp;
-   float *t, *r, *e, *E;
-   /*FIXME: Should make this dynamic*/
-   float *tmp, *_ot[20], *_nt[20];
-   float *ndist, *odist;
-   int *itmp, *_nind[20], *_oind[20];
-   float **ot, **nt;
-   int **nind, **oind;
-   int *ind;
-   float *shape_cb;
-   int shape_cb_size, subvect_size, nb_subvect;
-   split_cb_params *params;
-   int N=2;
-   int *best_index;
-   float *best_dist;
-
-   ot=_ot;
-   nt=_nt;
-   oind=_oind;
-   nind=_nind;
-   N=complexity;
-   if (N<1)
-      N=1;
-   if (N>10)
-      N=10;
-
-   params = (split_cb_params *) par;
-   subvect_size = params->subvect_size;
-   nb_subvect = params->nb_subvect;
-   shape_cb_size = 1<<params->shape_bits;
-   shape_cb = params->shape_cb;
-   resp = PUSH(stack, shape_cb_size*subvect_size);
-   t = PUSH(stack, nsf);
-   r = PUSH(stack, nsf);
-   e = PUSH(stack, nsf);
-   E = PUSH(stack, shape_cb_size);
-   /*FIXME: This breaks if sizeof(int) != sizeof(float) */
-   ind = (int*)PUSH(stack, nb_subvect);
-
-   tmp = PUSH(stack, 2*N*nsf);
-   for (i=0;i<N;i++)
-   {
-      ot[i]=tmp;
-      tmp += nsf;
-      nt[i]=tmp;
-      tmp += nsf;
-   }
-
-   /*FIXME: This breaks if sizeof(int) != sizeof(float) */
-   best_index = (int*)PUSH(stack, N);
-   best_dist = PUSH(stack, N);
-   ndist = PUSH(stack, N);
-   odist = PUSH(stack, N);
-   
-   /*FIXME: This breaks if sizeof(int) != sizeof(float) */
-   itmp = (int*)PUSH(stack, 2*N*nb_subvect);
-   for (i=0;i<N;i++)
-   {
-      nind[i]=itmp;
-      itmp+=nb_subvect;
-      oind[i]=itmp;
-      itmp+=nb_subvect;
-      for (j=0;j<nb_subvect;j++)
-         nind[i][j]=oind[i][j]=-1;
-   }
-
-   for (j=0;j<N;j++)
-      for (i=0;i<nsf;i++)
-         ot[j][i]=target[i];
-
-   for (i=0;i<nsf;i++)
-      t[i]=target[i];
-
-   e[0]=1;
-   for (i=1;i<nsf;i++)
-      e[i]=0;
-   syn_percep_zero(e, ak, awk1, awk2, r, nsf,p, stack);
-
-   /* Pre-compute codewords response and energy */
-   for (i=0;i<shape_cb_size;i++)
-   {
-      float *res;
-      float *shape;
-      int k;
-      res = resp+i*subvect_size;
-      shape = shape_cb+i*subvect_size;
-      /* Compute codeword response */
-      k=0;
-#if 0
-      for(j=0;j<subvect_size;j++)
-         res[j]=0;
-      for(j=0;j<subvect_size;j++)
-      {
-#if 1
-         float s=shape[j];
-         float *rr;
-         int lim=subvect_size-j;
-         float *ress=res+j;
-         rr=r;
-         while(lim--)
-            *ress+++=s* *rr++;
-#else
-         for (k=j;k<subvect_size;k++)
-           res[k]+=shape_cb[i*subvect_size+j]*r[k-j];
-#endif
-      }
-#else
-      for(j=0;j<subvect_size;j++)
-      {
-         res[j]=0;
-         for (k=0;k<=j;k++)
-            res[j] += shape[k]*r[j-k];
-      }
-#endif
-      E[i]=0;
-      for(j=0;j<subvect_size;j++)
-         E[i]+=res[j]*res[j];
-   }
 
-   for (j=0;j<N;j++)
-      odist[j]=0;
-   /*For all subvectors*/
-   for (i=0;i<nb_subvect;i++)
-   {
-      /*"erase" nbest list*/
-      for (j=0;j<N;j++)
-         ndist[j]=-1;
-
-      /*For all n-bests of previous subvector*/
-      for (j=0;j<N;j++)
-      {
-         float *x=ot[j]+subvect_size*i;
-         /*Find new n-best based on previous n-best j*/
-         vq_nbest(x, resp, subvect_size, shape_cb_size, E, N, best_index, best_dist);
-
-         /*For all new n-bests*/
-         for (k=0;k<N;k++)
-         {
-            float *ct;
-            float err=0;
-            ct = ot[j];
-            /*update target*/
 
-#if 0
-            /*previous target*/
-            for (m=0;m<nsf;m++)
-               t[m]=ct[m];
-            /* Old code: update all target */
-            for (m=0;m<subvect_size;m++)
-            {
-               float g=shape_cb[best_index[k]*subvect_size+m];
-               for (n=subvect_size*i+m,q=0;n<nsf;n++,q++)
-                  t[n] -= g*r[q];
-            }
-            
-#else
-            /*previous target*/
-            for (m=i*subvect_size;m<(i+1)*subvect_size;m++)
-               t[m]=ct[m];
-            /* New code: update only enough to calculate error*/
-            {
-               float *res = resp+best_index[k]*subvect_size;
-               for (m=0;m<subvect_size;m++)
-                  t[subvect_size*i+m] -= res[m];
-            }
-#endif
-            
-            /*compute error (distance)*/
-            err=odist[j];
-            for (m=i*subvect_size;m<(i+1)*subvect_size;m++)
-               err += t[m]*t[m];
-            /*update n-best list*/
-            if (err<ndist[N-1] || ndist[N-1]<-.5)
-            {
-#if 1
-            /*previous target*/
-            for (m=0;m<nsf;m++)
-               t[m]=ct[m];
-               /* New code: update the rest of the target only if it's worth it */
-               for (m=0;m<subvect_size;m++)
-               {
-                  float g=shape_cb[best_index[k]*subvect_size+m];
-                  q=subvect_size-m;
-                  for (n=subvect_size*(i+1);n<nsf;n++,q++)
-                     t[n] -= g*r[q];
-               }
-#endif          
-
-               for (m=0;m<N;m++)
-               {
-                  if (err < ndist[m] || ndist[m]<-.5)
-                  {
-                     for (n=N-1;n>m;n--)
-                     {
-                        for (q=0;q<nsf;q++)
-                           nt[n][q]=nt[n-1][q];
-                        for (q=0;q<nb_subvect;q++)
-                           nind[n][q]=nind[n-1][q];
-                        ndist[n]=ndist[n-1];
-                     }
-                     for (q=0;q<nsf;q++)
-                        nt[m][q]=t[q];
-                     for (q=0;q<nb_subvect;q++)
-                        nind[m][q]=oind[j][q];
-                     nind[m][i]=best_index[k];
-                     ndist[m]=err;
-                     break;
-                  }
-               }
-            }
-         }
-         if (i==0)
-           break;
-      }
-
-      /*update old-new data*/
-#if 1
-      /* just swap pointers instead of a long copy */
-      {
-         float **tmp;
-         tmp=ot;
-         ot=nt;
-         nt=tmp;
-      }
-#else
-      for (j=0;j<N;j++)
-         for (m=0;m<nsf;m++)
-            ot[j][m]=nt[j][m];
-#endif
-      for (j=0;j<N;j++)
-         for (m=0;m<nb_subvect;m++)
-            oind[j][m]=nind[j][m];
-      for (j=0;j<N;j++)
-         odist[j]=ndist[j];
-   }
-
-   /*save indices*/
-   for (i=0;i<nb_subvect;i++)
-   {
-      ind[i]=nind[0][i];
-      speex_bits_pack(bits,ind[i],params->shape_bits);
-   }
-   
-   /* Put everything back together */
-   for (i=0;i<nb_subvect;i++)
-      for (j=0;j<subvect_size;j++)
-         e[subvect_size*i+j]=shape_cb[ind[i]*subvect_size+j];
-
-   /* Update excitation */
-   for (j=0;j<nsf;j++)
-      exc[j]+=e[j];
-   
-   /* Update target */
-   syn_percep_zero(e, ak, awk1, awk2, r, nsf,p, stack);
-   for (j=0;j<nsf;j++)
-      target[j]-=r[j];
-
-}
-
-
-
-
-#if 1
 void split_cb_search_shape_sign(
 float target[],			/* target vector */
 float ak[],			/* LPCs for this subframe */
@@ -357,6 +81,7 @@
    int N=2;
    int *best_index;
    float *best_dist;
+   int have_sign;
 
    ot=_ot;
    nt=_nt;
@@ -373,6 +98,7 @@
    nb_subvect = params->nb_subvect;
    shape_cb_size = 1<<params->shape_bits;
    shape_cb = params->shape_cb;
+   have_sign = params->have_sign;
    resp = PUSH(stack, shape_cb_size*subvect_size);
    t = PUSH(stack, nsf);
    r = PUSH(stack, nsf);
@@ -425,37 +151,17 @@
    {
       float *res;
       float *shape;
-      int k;
+
       res = resp+i*subvect_size;
       shape = shape_cb+i*subvect_size;
       /* Compute codeword response */
-      k=0;
-#if 0
-      for(j=0;j<subvect_size;j++)
-         res[j]=0;
-      for(j=0;j<subvect_size;j++)
-      {
-#if 1
-         float s=shape[j];
-         float *rr;
-         int lim=subvect_size-j;
-         float *ress=res+j;
-         rr=r;
-         while(lim--)
-            *ress+++=s* *rr++;
-#else
-         for (k=j;k<subvect_size;k++)
-           res[k]+=shape_cb[i*subvect_size+j]*r[k-j];
-#endif
-      }
-#else
+
       for(j=0;j<subvect_size;j++)
       {
          res[j]=0;
          for (k=0;k<=j;k++)
             res[j] += shape[k]*r[j-k];
       }
-#endif
       E[i]=0;
       for(j=0;j<subvect_size;j++)
          E[i]+=res[j]*res[j];
@@ -475,7 +181,10 @@
       {
          float *x=ot[j]+subvect_size*i;
          /*Find new n-best based on previous n-best j*/
-         vq_nbest_sign(x, resp, subvect_size, shape_cb_size, E, N, best_index, best_dist);
+         if (have_sign)
+            vq_nbest_sign(x, resp, subvect_size, shape_cb_size, E, N, best_index, best_dist);
+         else
+            vq_nbest(x, resp, subvect_size, shape_cb_size, E, N, best_index, best_dist);
 
          /*For all new n-bests*/
          for (k=0;k<N;k++)
@@ -568,7 +277,6 @@
       }
 
       /*update old-new data*/
-#if 1
       /* just swap pointers instead of a long copy */
       {
          float **tmp;
@@ -576,11 +284,6 @@
          ot=nt;
          nt=tmp;
       }
-#else
-      for (j=0;j<N;j++)
-         for (m=0;m<nsf;m++)
-            ot[j][m]=nt[j][m];
-#endif
       for (j=0;j<N;j++)
          for (m=0;m<nb_subvect;m++)
             oind[j][m]=nind[j][m];
@@ -592,7 +295,7 @@
    for (i=0;i<nb_subvect;i++)
    {
       ind[i]=nind[0][i];
-      speex_bits_pack(bits,ind[i],params->shape_bits+1);
+      speex_bits_pack(bits,ind[i],params->shape_bits+have_sign);
    }
    
    /* Put everything back together */
@@ -621,259 +324,6 @@
 
 }
 
-#else
-
-void split_cb_search_shape_sign(
-float target[],			/* target vector */
-float ak[],			/* LPCs for this subframe */
-float awk1[],			/* Weighted LPCs for this subframe */
-float awk2[],			/* Weighted LPCs for this subframe */
-void *par,                      /* Codebook/search parameters*/
-int   p,                        /* number of LPC coeffs */
-int   nsf,                      /* number of samples in subframe */
-float *exc,
-SpeexBits *bits,
-float *stack,
-int   complexity
-)
-{
-   int i,j;
-   float *resp;
-   float *t, *tt, *r, *e, *E;
-   int *ind, *signs;
-   float *shape_cb;
-   int shape_cb_size, subvect_size, nb_subvect;
-   split_cb_params *params;
-
-   params = (split_cb_params *) par;
-   subvect_size = params->subvect_size;
-   nb_subvect = params->nb_subvect;
-   shape_cb_size = 1<<params->shape_bits;
-   shape_cb = params->shape_cb;
-   resp = PUSH(stack, shape_cb_size*subvect_size);
-   t = PUSH(stack, nsf);
-   tt= PUSH(stack, nsf);
-   r = PUSH(stack, nsf);
-   e = PUSH(stack, nsf);
-   E = PUSH(stack, shape_cb_size);
-   /*FIXME: This breaks if sizeof(int) != sizeof(float) */
-   ind = (int*)PUSH(stack, nb_subvect);
-   signs = (int*)PUSH(stack, nb_subvect);
-
-   for (i=0;i<nsf;i++)
-      t[i]=target[i];
-
-   e[0]=1;
-   for (i=1;i<nsf;i++)
-      e[i]=0;
-   syn_percep_zero(e, ak, awk1, awk2, r, nsf,p, stack);
-
-   /* Pre-compute codewords response and energy */
-   for (i=0;i<shape_cb_size;i++)
-   {
-      float *res = resp+i*subvect_size;
-
-      /* Compute codeword response */
-      int k;
-      for(j=0;j<subvect_size;j++)
-         res[j]=0;
-      for(j=0;j<subvect_size;j++)
-      {
-         for (k=j;k<subvect_size;k++)
-            res[k]+=shape_cb[i*subvect_size+j]*r[k-j];
-      }
-      E[i]=0;
-      for(j=0;j<subvect_size;j++)
-         E[i]+=res[j]*res[j];
-   }
-
-   for (i=0;i<nb_subvect;i++)
-   {
-      int best_index[2]={0,0}, k, m;
-      float g, dist, best_dist[2]={-1,-1}, best_sign[2]={0,0};
-      float *a, *x;
-      float energy=0;
-      x=t+subvect_size*i;
-
-      for (k=0;k<subvect_size;k++)
-         energy+=x[k]*x[k];
-      /* Find best codeword for current sub-vector */
-      for (j=0;j<shape_cb_size;j++)
-      {
-         int sign;
-         dist=0;
-         a=resp+j*subvect_size;
-         dist=0;
-         for (k=0;k<subvect_size;k++)
-            dist -= 2*a[k]*x[k];
-         if (dist > 0)
-         {
-            sign=1;
-            dist =- dist;
-         } else
-            sign=0;
-         dist += energy+E[j];
-         if (dist<best_dist[0] || best_dist[0]<0)
-         {
-            best_dist[1]=best_dist[0];
-            best_index[1]=best_index[0];
-            best_sign[1]=best_sign[0];
-            best_dist[0]=dist;
-            best_index[0]=j;
-            best_sign[0]=sign;
-         } else if (dist<best_dist[1] || best_dist[1]<0)
-         {
-            best_dist[1]=dist;
-            best_index[1]=j;
-            best_sign[1]=sign;
-         }
-      }
-      if (i<nb_subvect-1)
-      {
-         int nbest;
-         float err[2];
-         float best_score[2];
-         for (nbest=0;nbest<2;nbest++)
-         {
-            float s=1;
-            if (best_sign[nbest])
-               s=-1;
-            for (j=0;j<nsf;j++)
-               tt[j]=t[j];
-            for (j=0;j<subvect_size;j++)
-            {
-               g=s*shape_cb[best_index[nbest]*subvect_size+j];
-               for (k=subvect_size*i+j,m=0;k<nsf;k++,m++)
-                  tt[k] -= g*r[m];
-            }
-            
-            {
-               int best_index2=0, best_sign2=0, sign2;
-               float  best_dist2=0;
-               x=t+subvect_size*(i+1);
-               for (j=0;j<shape_cb_size;j++)
-               {
-                  a=resp+j*subvect_size;
-                  dist = 0;
-                  for (k=0;k<subvect_size;k++)
-                     dist -= 2*a[k]*x[k];
-                  if (dist > 0)
-                  {
-                     sign2=1;
-                     dist =- dist;
-                  } else
-                     sign2=0;
-                  dist += energy+E[j];
-                  if (dist<best_dist2 || j==0)
-                  {
-                     best_dist2=dist;
-                     best_index2=j;
-                     best_sign2=sign2;
-                  }
-               }
-               s=1;
-               if (best_sign2)
-                  s=-1;
-               /*int i2=vq_index(&tt[subvect_size*(i+1)], resp, subvect_size, shape_cb_size);*/
-               
-               for (j=0;j<subvect_size;j++)
-               {
-                  g=s*shape_cb[best_index2*subvect_size+j];
-                  for (k=subvect_size*(i+1)+j,m=0;k<nsf;k++,m++)
-                     tt[k] -= g*r[m];
-               }
-            }
-
-            err[nbest]=0;
-            for (j=subvect_size*i;j<subvect_size*(i+2);j++)
-               err[nbest]-=tt[j]*tt[j];
-            
-            best_score[nbest]=err[nbest];
-         }
-
-         if (best_score[1]>best_score[0])
-         {
-            best_sign[0]=best_sign[1];
-            best_index[0]=best_index[1];
-            best_score[0]=best_score[1];
-         }
-      }
-
-      ind[i]=best_index[0];
-      signs[i] = best_sign[0];
-
-      /*printf ("best index: %d/%d\n", best_index, shape_cb_size);*/
-      speex_bits_pack(bits,signs[i],1);
-      speex_bits_pack(bits,ind[i],params->shape_bits);
-
-      /* Update target for next subvector */
-      for (j=0;j<subvect_size;j++)
-      {
-         g=shape_cb[ind[i]*subvect_size+j];
-         if (signs[i])
-            g=-g;
-         for (k=subvect_size*i+j,m=0;k<nsf;k++,m++)
-            t[k] -= g*r[m];
-      }
-   }
-   
-   /* Put everything back together */
-   for (i=0;i<nb_subvect;i++)
-   {
-      float s=1;
-      if (signs[i])
-         s=-1;
-      for (j=0;j<subvect_size;j++)
-         e[subvect_size*i+j]=s*shape_cb[ind[i]*subvect_size+j];
-   }
-   /* Update excitation */
-   for (j=0;j<nsf;j++)
-      exc[j]+=e[j];
-   
-   /* Update target */
-   syn_percep_zero(e, ak, awk1, awk2, r, nsf,p, stack);
-
-   for (j=0;j<nsf;j++)
-      target[j]-=r[j];
-
-   
-}
-#endif
-
-void split_cb_nogain_unquant(
-float *exc,
-void *par,                      /* non-overlapping codebook */
-int   nsf,                      /* number of samples in subframe */
-SpeexBits *bits,
-float *stack
-)
-{
-   int i,j;
-   int *ind;
-   float *shape_cb;
-   int shape_cb_size, subvect_size, nb_subvect;
-   split_cb_params *params;
-
-   params = (split_cb_params *) par;
-   subvect_size = params->subvect_size;
-   nb_subvect = params->nb_subvect;
-   shape_cb_size = 1<<params->shape_bits;
-   shape_cb = params->shape_cb;
-   
-   /*FIXME: This breaks if sizeof(int) != sizeof(float) */
-   ind = (int*)PUSH(stack, nb_subvect);
-
-   /* Decode codewords and gains */
-   for (i=0;i<nb_subvect;i++)
-   {
-      ind[i] = speex_bits_unpack_unsigned(bits, params->shape_bits);
-   }
-   /* Compute decoded excitation */
-   for (i=0;i<nb_subvect;i++)
-      for (j=0;j<subvect_size;j++)
-         exc[subvect_size*i+j]+=shape_cb[ind[i]*subvect_size+j];
-
-}
 
 void split_cb_shape_sign_unquant(
 float *exc,
@@ -888,13 +338,15 @@
    float *shape_cb;
    int shape_cb_size, subvect_size, nb_subvect;
    split_cb_params *params;
+   int have_sign;
 
    params = (split_cb_params *) par;
    subvect_size = params->subvect_size;
    nb_subvect = params->nb_subvect;
    shape_cb_size = 1<<params->shape_bits;
    shape_cb = params->shape_cb;
-   
+   have_sign = params->have_sign;
+
    /*FIXME: This breaks if sizeof(int) != sizeof(float) */
    ind = (int*)PUSH(stack, nb_subvect);
    signs = (int*)PUSH(stack, nb_subvect);
@@ -902,7 +354,10 @@
    /* Decode codewords and gains */
    for (i=0;i<nb_subvect;i++)
    {
-      signs[i] = speex_bits_unpack_unsigned(bits, 1);
+      if (have_sign)
+         signs[i] = speex_bits_unpack_unsigned(bits, 1);
+      else
+         signs[i] = 0;
       ind[i] = speex_bits_unpack_unsigned(bits, params->shape_bits);
    }
    /* Compute decoded excitation */

<p><p>1.24      +1 -22     speex/libspeex/cb_search.h

Index: cb_search.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/cb_search.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- cb_search.h	11 Oct 2002 03:39:34 -0000	1.23
+++ cb_search.h	23 Oct 2002 06:03:16 -0000	1.24
@@ -40,23 +40,10 @@
    int     nb_subvect;
    float  *shape_cb;
    int     shape_bits;
+   int     have_sign;
 } split_cb_params;
 
 
-void split_cb_search_nogain(
-float target[],			/* target vector */
-float ak[],			/* LPCs for this subframe */
-float awk1[],			/* Weighted LPCs for this subframe */
-float awk2[],			/* Weighted LPCs for this subframe */
-void *par,                      /* Codebook/search parameters*/
-int   p,                        /* number of LPC coeffs */
-int   nsf,                      /* number of samples in subframe */
-float *exc,
-SpeexBits *bits,
-float *stack,
-int   complexity
-);
-
 void split_cb_search_shape_sign(
 float target[],			/* target vector */
 float ak[],			/* LPCs for this subframe */
@@ -72,14 +59,6 @@
 );
 
 void split_cb_shape_sign_unquant(
-float *exc,
-void *par,                      /* non-overlapping codebook */
-int   nsf,                      /* number of samples in subframe */
-SpeexBits *bits,
-float *stack
-);
-
-void split_cb_nogain_unquant(
 float *exc,
 void *par,                      /* non-overlapping codebook */
 int   nsf,                      /* number of samples in subframe */

<p><p>1.82      +21 -14    speex/libspeex/modes.c

Index: modes.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/modes.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- modes.c	11 Oct 2002 03:39:34 -0000	1.81
+++ modes.c	23 Oct 2002 06:03:16 -0000	1.82
@@ -91,6 +91,7 @@
    4,               /*nb_subvect*/
    exc_10_16_table, /*shape_cb*/
    4,               /*shape_bits*/
+   0,
 };
 
 /* Split-VQ innovation parameters for low bit-rate narrowband */
@@ -99,6 +100,7 @@
    4,               /*nb_subvect*/
    exc_10_32_table, /*shape_cb*/
    5,               /*shape_bits*/
+   0,
 };
 
 
@@ -108,6 +110,7 @@
    8,               /*nb_subvect*/
    exc_5_64_table, /*shape_cb*/
    6,               /*shape_bits*/
+   0,
 };
 
 /* Split-VQ innovation parameters narrowband */
@@ -116,6 +119,7 @@
    5,               /*nb_subvect*/
    exc_8_128_table, /*shape_cb*/
    7,               /*shape_bits*/
+   0,
 };
 
 /* Split-VQ innovation for low-band wideband */
@@ -124,6 +128,7 @@
    8,              /*nb_subvect*/
    exc_5_256_table,    /*shape_cb*/
    8,               /*shape_bits*/
+   0,
 };
 
 /* Split-VQ innovation for high-band wideband */
@@ -132,6 +137,7 @@
    5,               /*nb_subvect*/
    hexc_table,       /*shape_cb*/
    7,               /*shape_bits*/
+   1,
 };
 
 
@@ -141,6 +147,7 @@
    4,               /*nb_subvect*/
    hexc_10_32_table,       /*shape_cb*/
    5,               /*shape_bits*/
+   0,
 };
 
 /* 2150 bps "vocoder-like" mode for comfort noise */
@@ -178,8 +185,8 @@
    pitch_unquant_3tap,
    &ltp_params_vlbr,
    /*Innovation quantization*/
-   split_cb_search_nogain,
-   split_cb_nogain_unquant,
+   split_cb_search_shape_sign,
+   split_cb_shape_sign_unquant,
    &split_cb_nb_vlbr,
 
    0.75, 0.6, .6,
@@ -200,8 +207,8 @@
    pitch_unquant_3tap,
    &ltp_params_lbr,
    /*Innovation quantization*/
-   split_cb_search_nogain,
-   split_cb_nogain_unquant,
+   split_cb_search_shape_sign,
+   split_cb_shape_sign_unquant,
    &split_cb_nb_lbr,
 
    0.75, 0.6, .5,
@@ -222,8 +229,8 @@
    pitch_unquant_3tap,
    &ltp_params_med,
    /*Innovation quantization*/
-   split_cb_search_nogain,
-   split_cb_nogain_unquant,
+   split_cb_search_shape_sign,
+   split_cb_shape_sign_unquant,
    &split_cb_nb_med,
 
    0.72, 0.65, .3,
@@ -244,8 +251,8 @@
    pitch_unquant_3tap,
    &ltp_params_nb,
    /*Innovation quantization*/
-   split_cb_search_nogain,
-   split_cb_nogain_unquant,
+   split_cb_search_shape_sign,
+   split_cb_shape_sign_unquant,
    &split_cb_nb,
 
    0.7, 0.65, .2,
@@ -266,8 +273,8 @@
    pitch_unquant_3tap,
    &ltp_params_nb,
    /*Innovation quantization*/
-   split_cb_search_nogain,
-   split_cb_nogain_unquant,
+   split_cb_search_shape_sign,
+   split_cb_shape_sign_unquant,
    &split_cb_sb,
 
    0.68, 0.65, .1,
@@ -288,8 +295,8 @@
    pitch_unquant_3tap,
    &ltp_params_nb,
    /*Innovation quantization*/
-   split_cb_search_nogain,
-   split_cb_nogain_unquant,
+   split_cb_search_shape_sign,
+   split_cb_shape_sign_unquant,
    &split_cb_nb,
 
    0.65, 0.65, 0,
@@ -367,8 +374,8 @@
    NULL,
    NULL,
    /*Innovation quantization*/
-   split_cb_search_nogain,
-   split_cb_nogain_unquant,
+   split_cb_search_shape_sign,
+   split_cb_shape_sign_unquant,
    &split_cb_high_lbr,
 
    0, 0, -1,

<p><p>1.77      +3 -3      speex/libspeex/sb_celp.c

Index: sb_celp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/sb_celp.c,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -r1.76 -r1.77
--- sb_celp.c	23 Oct 2002 02:56:46 -0000	1.76
+++ sb_celp.c	23 Oct 2002 06:03:16 -0000	1.77
@@ -568,8 +568,8 @@
 
          /*print_vec(target, st->subframeSize, "\ntarget");*/
          SUBMODE(innovation_quant)(target, st->interp_qlpc, st->bw_lpc1, st->bw_lpc2, 
-                                SUBMODE(innovation_params), st->lpcSize, st->subframeSize, 
-                                innov, bits, stack, st->complexity);
+                                   SUBMODE(innovation_params), st->lpcSize, st->subframeSize, 
+                                   innov, bits, stack, (st->complexity+1)>>1);
          /*print_vec(target, st->subframeSize, "after");*/
 
          for (i=0;i<st->subframeSize;i++)
@@ -584,7 +584,7 @@
                target[i]*=2.5;
             SUBMODE(innovation_quant)(target, st->interp_qlpc, st->bw_lpc1, st->bw_lpc2, 
                                       SUBMODE(innovation_params), st->lpcSize, st->subframeSize, 
-                                      innov2, bits, tmp_stack, st->complexity);
+                                      innov2, bits, tmp_stack, (st->complexity+1)>>1);
             for (i=0;i<st->subframeSize;i++)
                innov2[i]*=scale*(1/2.5);
             for (i=0;i<st->subframeSize;i++)

<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