]> git.sesse.net Git - ffmpeg/blobdiff - libswresample/resample.c
lavf/matroskadec: drop indexes that appear broken
[ffmpeg] / libswresample / resample.c
index 554fd7b5f79c57893cab5b15e181279dab8d2787..036eff391fdf1b9686e1e3c42296e8a1fff7824a 100644 (file)
@@ -32,9 +32,8 @@
  * 0th order modified bessel function of the first kind.
  */
 static double bessel(double x){
-    double v=1;
     double lastv=0;
-    double t=1;
+    double t, v;
     int i;
     static const double inv[100]={
  1.0/( 1* 1), 1.0/( 2* 2), 1.0/( 3* 3), 1.0/( 4* 4), 1.0/( 5* 5), 1.0/( 6* 6), 1.0/( 7* 7), 1.0/( 8* 8), 1.0/( 9* 9), 1.0/(10*10),
@@ -50,11 +49,15 @@ static double bessel(double x){
     };
 
     x= x*x/4;
-    for(i=0; v != lastv; i++){
-        lastv=v;
+    t = x;
+    v = 1 + x;
+    for(i=1; v != lastv; i+=2){
         t *= x*inv[i];
         v += t;
-        av_assert2(i<99);
+        lastv=v;
+        t *= x*inv[i + 1];
+        v += t;
+        av_assert2(i<98);
     }
     return v;
 }