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

jm at svn.xiph.org jm at svn.xiph.org
Sat Jun 9 05:49:08 PDT 2007


Author: jm
Date: 2007-06-09 05:49:07 -0700 (Sat, 09 Jun 2007)
New Revision: 13120

Modified:
   trunk/speex/libspeex/resample.c
Log:
Fixed fraction simplification code


Modified: trunk/speex/libspeex/resample.c
===================================================================
--- trunk/speex/libspeex/resample.c	2007-06-09 12:48:57 UTC (rev 13119)
+++ trunk/speex/libspeex/resample.c	2007-06-09 12:49:07 UTC (rev 13120)
@@ -84,6 +84,7 @@
 #define OVERSAMPLE 8
 
 #define IMAX(a,b) ((a) > (b) ? (a) : (b))
+#define IMIN(a,b) ((a) < (b) ? (a) : (b))
 
 #ifndef NULL
 #define NULL 0
@@ -1006,7 +1007,7 @@
    st->num_rate = ratio_num;
    st->den_rate = ratio_den;
    /* FIXME: This is terribly inefficient, but who cares (at least for now)? */
-   for (fact=2;fact<=sqrt(IMAX(in_rate, out_rate));fact++)
+   for (fact=2;fact<=IMIN(st->num_rate, st->den_rate);fact++)
    {
       while ((st->num_rate % fact == 0) && (st->den_rate % fact == 0))
       {



More information about the commits mailing list