[xiph-commits] r11322 - trunk/speex/libspeex

jm at svn.xiph.org jm at svn.xiph.org
Sun Apr 30 08:19:41 PDT 2006


Author: jm
Date: 2006-04-30 08:19:38 -0700 (Sun, 30 Apr 2006)
New Revision: 11322

Modified:
   trunk/speex/libspeex/filters.c
   trunk/speex/libspeex/nb_celp.c
Log:
Approximation for pitch search in new enhancer. Trying to fix PLC as well.


Modified: trunk/speex/libspeex/filters.c
===================================================================
--- trunk/speex/libspeex/filters.c	2006-04-30 11:23:26 UTC (rev 11321)
+++ trunk/speex/libspeex/filters.c	2006-04-30 15:19:38 UTC (rev 11322)
@@ -733,6 +733,8 @@
 #else
    exc = _exc;
 #endif
+
+#if 0 /* Set to 1 to enable full pitch search */
    open_loop_nbest_pitch(exc, 20, 120, nsf, 
                          nol_pitch, nol_pitch_coef, 6, stack);
    corr_pitch=nol_pitch[0];
@@ -751,13 +753,16 @@
          corr_pitch = nol_pitch[i];
       }
    }
+#else
+   corr_pitch = pitch;
+#endif
    interp_pitch(exc, iexc, corr_pitch, 80);
    if (corr_pitch>40)
       interp_pitch(exc, iexc+nsf, 2*corr_pitch, 80);
    else
       interp_pitch(exc, iexc+nsf, -corr_pitch, 80);
 
-   interp_pitch(exc, iexc+2*nsf, 2*corr_pitch, 80);
+   /*interp_pitch(exc, iexc+2*nsf, 2*corr_pitch, 80);*/
    
    /*printf ("%d %d %f\n", pitch, corr_pitch, max_corr*ener_1);*/
    iexc0_mag = spx_sqrt(1000+inner_prod(iexc,iexc,nsf));

Modified: trunk/speex/libspeex/nb_celp.c
===================================================================
--- trunk/speex/libspeex/nb_celp.c	2006-04-30 11:23:26 UTC (rev 11321)
+++ trunk/speex/libspeex/nb_celp.c	2006-04-30 15:19:38 UTC (rev 11322)
@@ -1231,10 +1231,13 @@
          exc[i]= MULT16_32_Q15(pitch_gain, (exc[i-pitch_val]+VERY_SMALL)) + 
                MULT16_32_Q15(fact, MULT16_32_Q15(SHL(Q15ONE,15)-SHL(MULT16_16(pitch_gain,pitch_gain),1),speex_rand(innov_gain, &st->seed)));
       }
-      
+#ifdef NEW_ENHANCER
       for (i=0;i<st->subframeSize;i++)
+         sp[i]=PSHR32(exc[i-st->subframeSize],SIG_SHIFT);
+#else
+      for (i=0;i<st->subframeSize;i++)
          sp[i]=PSHR32(exc[i],SIG_SHIFT);
-      
+#endif 
       /* Signal synthesis */
       if (st->lpc_enh_enabled)
       {
@@ -1592,10 +1595,13 @@
          tmp = gain_3tap_to_1tap(pitch_gain);
 
          pitch_average += tmp;
-         if (tmp>best_pitch_gain)
+         if ((tmp>best_pitch_gain&&ABS(2*best_pitch-pitch)>=3&&ABS(3*best_pitch-pitch)>=4&&ABS(4*best_pitch-pitch)>=5) 
+              || (tmp>MULT16_16_Q15(QCONST16(.6,15),best_pitch_gain)&&(ABS(best_pitch-2*pitch)<3||ABS(best_pitch-3*pitch)<4||ABS(best_pitch-4*pitch)<5)) 
+              || (MULT16_16_Q15(QCONST16(.67,15),tmp)>best_pitch_gain&&(ABS(2*best_pitch-pitch)<3||ABS(3*best_pitch-pitch)<4||ABS(4*best_pitch-pitch)<5)) )
          {
             best_pitch = pitch;
-	    best_pitch_gain = tmp;
+            if (tmp > best_pitch_gain)
+               best_pitch_gain = tmp;
          }
       } else {
          speex_error("No pitch prediction, what's wrong");



More information about the commits mailing list