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

jm at svn.xiph.org jm at svn.xiph.org
Thu May 4 08:19:35 PDT 2006


Author: jm
Date: 2006-05-04 08:19:28 -0700 (Thu, 04 May 2006)
New Revision: 11342

Modified:
   trunk/speex/TODO
   trunk/speex/libspeex/nb_celp.c
   trunk/speex/libspeex/sb_celp.c
   trunk/speex/libspeex/testenc.c
   trunk/speex/libspeex/testenc_uwb.c
   trunk/speex/libspeex/testenc_wb.c
   trunk/speex/src/speexdec.c
Log:
Gapless works again (I think). Bit of cleaning up as well.


Modified: trunk/speex/TODO
===================================================================
--- trunk/speex/TODO	2006-05-04 14:23:56 UTC (rev 11341)
+++ trunk/speex/TODO	2006-05-04 15:19:28 UTC (rev 11342)
@@ -1,11 +1,12 @@
 For 1.1.13:
 Input buffer in new enhancer
-make pseudofloat.h more portable
-convert rest of enhancer to fixed-point
-add win32 stuff to the distribution
+(remove the if's in loops in interp_pitch())
+Fix --force-nb
+Fix wideband PLC
+change filter structure in vorbis-psy (use the numerator=LPC version)
+Fix overflow in mdf
 
 Later:
-reduce pitch search complexity in new enhancer
 use 16-bit version of the filters in ltp.c
 get rid of crap that shouldn't be exposed in speex.h
 

Modified: trunk/speex/libspeex/nb_celp.c
===================================================================
--- trunk/speex/libspeex/nb_celp.c	2006-05-04 14:23:56 UTC (rev 11341)
+++ trunk/speex/libspeex/nb_celp.c	2006-05-04 15:19:28 UTC (rev 11342)
@@ -1732,11 +1732,11 @@
 #ifdef NEW_ENHANCER
    if (st->lpc_enh_enabled && SUBMODE(comb_gain)>0 && !st->count_lost)
    {
-      multicomb(st->exc-40, out, st->interp_qlpc, st->lpcSize, 2*st->subframeSize, best_pitch, pitch_gain, SUBMODE(comb_gain), stack);
-      multicomb(st->exc+40, out+80, st->interp_qlpc, st->lpcSize, 2*st->subframeSize, best_pitch, pitch_gain, SUBMODE(comb_gain), stack);
+      multicomb(st->exc-st->subframeSize, out, st->interp_qlpc, st->lpcSize, 2*st->subframeSize, best_pitch, pitch_gain, SUBMODE(comb_gain), stack);
+      multicomb(st->exc+st->subframeSize, out+2*st->subframeSize, st->interp_qlpc, st->lpcSize, 2*st->subframeSize, best_pitch, pitch_gain, SUBMODE(comb_gain), stack);
    } else {
       for (i=0;i<st->frameSize;i++)
-         out[i]=PSHR32(st->exc[i-40],SIG_SHIFT);
+         out[i]=PSHR32(st->exc[i-st->subframeSize],SIG_SHIFT);
    }
 #endif
    
@@ -2106,7 +2106,7 @@
       (*(int*)ptr)=0;
 #endif
       break;
-      case SPEEX_GET_PI_GAIN:
+   case SPEEX_GET_PI_GAIN:
       {
          int i;
          spx_word32_t *g = (spx_word32_t*)ptr;

Modified: trunk/speex/libspeex/sb_celp.c
===================================================================
--- trunk/speex/libspeex/sb_celp.c	2006-05-04 14:23:56 UTC (rev 11341)
+++ trunk/speex/libspeex/sb_celp.c	2006-05-04 15:19:28 UTC (rev 11342)
@@ -1610,6 +1610,10 @@
    case SPEEX_GET_SUBMODE_ENCODING:
       (*(int*)ptr) = st->encode_submode;
       break;
+   case SPEEX_GET_LOOKAHEAD:
+      speex_decoder_ctl(st->st_low, SPEEX_GET_LOOKAHEAD, ptr);
+      (*(int*)ptr) = 2*(*(int*)ptr);
+      break;
    case SPEEX_GET_PI_GAIN:
       {
          int i;

Modified: trunk/speex/libspeex/testenc.c
===================================================================
--- trunk/speex/libspeex/testenc.c	2006-05-04 14:23:56 UTC (rev 11341)
+++ trunk/speex/libspeex/testenc.c	2006-05-04 15:19:28 UTC (rev 11342)
@@ -57,9 +57,9 @@
    tmp=1;
    speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &tmp);
 
-   speex_mode_query(&speex_nb_mode, SPEEX_MODE_FRAME_SIZE, &tmp);
-   fprintf (stderr, "frame size: %d\n", tmp);
-   skip_group_delay = tmp / 4;
+   speex_encoder_ctl(st, SPEEX_GET_LOOKAHEAD, &skip_group_delay);
+   speex_decoder_ctl(dec, SPEEX_GET_LOOKAHEAD, &tmp);
+   skip_group_delay += tmp;
 
    if (argc != 4 && argc != 3)
    {

Modified: trunk/speex/libspeex/testenc_uwb.c
===================================================================
--- trunk/speex/libspeex/testenc_uwb.c	2006-05-04 14:23:56 UTC (rev 11341)
+++ trunk/speex/libspeex/testenc_uwb.c	2006-05-04 15:19:28 UTC (rev 11342)
@@ -58,10 +58,11 @@
    tmp=1;
    speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &tmp);
 
-   speex_mode_query(&speex_nb_mode, SPEEX_MODE_FRAME_SIZE, &tmp);
-   fprintf (stderr, "frame size: %d\n", tmp);
-   skip_group_delay = 509;
+   speex_encoder_ctl(st, SPEEX_GET_LOOKAHEAD, &skip_group_delay);
+   speex_decoder_ctl(dec, SPEEX_GET_LOOKAHEAD, &tmp);
+   skip_group_delay += tmp;
 
+
    if (argc != 4 && argc != 3)
    {
       fprintf (stderr, "Usage: encode [in file] [out file] [bits file]\nargc = %d", argc);

Modified: trunk/speex/libspeex/testenc_wb.c
===================================================================
--- trunk/speex/libspeex/testenc_wb.c	2006-05-04 14:23:56 UTC (rev 11341)
+++ trunk/speex/libspeex/testenc_wb.c	2006-05-04 15:19:28 UTC (rev 11342)
@@ -63,10 +63,11 @@
    speex_encoder_ctl(st, SPEEX_SET_LOW_MODE, &tmp);
 */
 
-   speex_mode_query(&speex_wb_mode, SPEEX_MODE_FRAME_SIZE, &tmp);
-   fprintf (stderr, "frame size: %d\n", tmp);
-   skip_group_delay = 223-80;
+   speex_encoder_ctl(st, SPEEX_GET_LOOKAHEAD, &skip_group_delay);
+   speex_decoder_ctl(dec, SPEEX_GET_LOOKAHEAD, &tmp);
+   skip_group_delay += tmp;
 
+
    if (argc != 4 && argc != 3)
    {
       fprintf (stderr, "Usage: encode [in file] [out file] [bits file]\nargc = %d", argc);

Modified: trunk/speex/src/speexdec.c
===================================================================
--- trunk/speex/src/speexdec.c	2006-05-04 14:23:56 UTC (rev 11341)
+++ trunk/speex/src/speexdec.c	2006-05-04 15:19:28 UTC (rev 11342)
@@ -453,6 +453,7 @@
    int rate=0;
    int extra_headers;
    int wav_format=0;
+   int lookahead;
 
    enh_enabled = 1;
 
@@ -618,6 +619,7 @@
             if (packet_count==0)
             {
                st = process_header(&op, enh_enabled, &frame_size, &rate, &nframes, forceMode, &channels, &stereo, &extra_headers, quiet);
+               speex_decoder_ctl(st, SPEEX_GET_LOOKAHEAD, &lookahead);
                if (!nframes)
                   nframes=1;
                if (!st)
@@ -690,15 +692,16 @@
                      int frame_offset = 0;
                      int new_frame_size = frame_size;
                      /*printf ("packet %d %d\n", packet_no, skip_samples);*/
+                     /*fprintf (stderr, "packet %d %d %d\n", packet_no, skip_samples, lookahead);*/
                      if (packet_no == 1 && j==0 && skip_samples > 0)
                      {
                         /*printf ("chopping first packet\n");*/
-                        new_frame_size -= skip_samples;
-                        frame_offset = skip_samples;
+                        new_frame_size -= skip_samples+lookahead;
+                        frame_offset = skip_samples+lookahead;
                      }
                      if (packet_no == page_nb_packets && skip_samples < 0)
                      {
-                        int packet_length = nframes*frame_size+skip_samples;
+                        int packet_length = nframes*frame_size+skip_samples+lookahead;
                         new_frame_size = packet_length - j*frame_size;
                         if (new_frame_size<0)
                            new_frame_size = 0;



More information about the commits mailing list