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

jm at svn.xiph.org jm at svn.xiph.org
Thu Feb 1 14:44:54 PST 2007


Author: jm
Date: 2007-02-01 14:44:51 -0800 (Thu, 01 Feb 2007)
New Revision: 12412

Modified:
   trunk/speex/libspeex/resample.c
Log:
more variable quality stuff


Modified: trunk/speex/libspeex/resample.c
===================================================================
--- trunk/speex/libspeex/resample.c	2007-02-01 14:02:40 UTC (rev 12411)
+++ trunk/speex/libspeex/resample.c	2007-02-01 22:44:51 UTC (rev 12412)
@@ -142,9 +142,20 @@
    int i;
    
    st->oversample = OVERSAMPLE;
-
+   if (st->quality > 7)
+      st->oversample *= 2;
    st->filt_len = 8 + 12*st->quality;
    
+   if (st->num_rate > st->den_rate)
+   {
+      /* down-sampling */
+      st->cutoff = .92f * st->den_rate / st->num_rate;
+      st->filt_len *= st->num_rate / st->den_rate;
+   } else {
+      /* up-sampling */
+      st->cutoff = .97f;
+   }
+
    /* Choose the resampling type that requires the least amount of memory */
    if (st->den_rate <= st->oversample)
    {
@@ -390,16 +401,7 @@
          st->den_rate /= fact;
       }
    }
-   
-   if (ratio_num > ratio_den)
-   {
-      /* down-sampling */
-      st->cutoff = .92f * ratio_den / ratio_num;
-   } else {
-      /* up-sampling */
-      st->cutoff = .97f;
-   }
-   
+      
    if (st->initialised)
       update_filter(st);
 }



More information about the commits mailing list