Decoding of pitch (still untested)
authorjmvalin <jmvalin@0101bb08-14d6-0310-b084-bc0e0c8e3800>
Wed, 13 Mar 2002 05:08:23 +0000 (05:08 +0000)
committerjmvalin <jmvalin@0101bb08-14d6-0310-b084-bc0e0c8e3800>
Wed, 13 Mar 2002 05:08:23 +0000 (05:08 +0000)
git-svn-id: http://svn.xiph.org/trunk/speex@3137 0101bb08-14d6-0310-b084-bc0e0c8e3800

libspeex/ltp.c
libspeex/ltp.h
libspeex/speex.c

index f358c86..4b127d4 100644 (file)
@@ -414,3 +414,32 @@ float *stack
       printf ("prediction gain = %f\n",tmp1/(tmp2+1));
    }
 }
+
+
+void pitch_unquant_3tap(
+float exc[],                    /* Excitation */
+int   start,                    /* Smallest pitch value allowed */
+int   end,                      /* Largest pitch value allowed */
+int   nsf,                      /* Number of samples in subframe */
+FrameBits *bits,
+float *stack
+)
+{
+   int i;
+   int pitch;
+   int gain_index;
+   float gain[3];
+   pitch = frame_bits_unpack_unsigned(bits, 7);
+   pitch += start;
+   gain_index = frame_bits_unpack_unsigned(bits, 7);
+   gain[0] = gain_cdbk_nb[gain_index*12];
+   gain[1] = gain_cdbk_nb[gain_index*12+1];
+   gain[2] = gain_cdbk_nb[gain_index*12+2];
+   printf ("unquantized pitch: %d %f %f %f\n", pitch, gain[0], gain[1], gain[2]);
+
+   /*Go backward in case pitch < nsf*/
+   for(i=nsf-1;i>=0;i--)
+   {
+      exc[i]=gain[0]*exc[i-pitch+1] + gain[1]*exc[i-pitch] + gain[2]*exc[i-pitch-1];
+   }
+}
index 123a352..b064ca7 100644 (file)
@@ -75,3 +75,13 @@ int   p,                        /* Number of LPC coeffs */
 int   nsf,                      /* Number of samples in subframe */
 float *stack
 );
+
+/*Unquantize adaptive codebook and update pitch contribution*/
+void pitch_unquant_3tap(
+float exc[],                    /* Excitation */
+int   start,                    /* Smallest pitch value allowed */
+int   end,                      /* Largest pitch value allowed */
+int   nsf,                      /* Number of samples in subframe */
+FrameBits *bits,
+float *stack
+);
index 8c0742c..7a996cc 100644 (file)
@@ -545,8 +545,10 @@ void decode(DecState *st, FrameBits *bits, float *out)
          exc[i]=0;
 
       /*Adaptive codebook contribution*/
+      pitch_unquant_3tap(exc, st->min_pitch, st->max_pitch, st->subframeSize, bits, st->stack);
 
       /*Fixed codebook contribution*/
+      frame_bits_unpack_unsigned(bits, 51);
 
       /*Compute decoded signal*/
       syn_filt_mem(exc, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, st->mem_sp);