changeset 10778:002cd0505064 libavcodec

Stop the approximation in bessel() once it does no longer improve. This is faster.
author michael
date Wed, 06 Jan 2010 22:40:52 +0000
parents c4e157b47af5
children 90f34aa8fe0a
files resample2.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/resample2.c	Wed Jan 06 21:51:20 2010 +0000
+++ b/resample2.c	Wed Jan 06 22:40:52 2010 +0000
@@ -76,11 +76,13 @@
  */
 static double bessel(double x){
     double v=1;
+    double lastv=0;
     double t=1;
     int i;
 
     x= x*x/4;
-    for(i=1; i<50; i++){
+    for(i=1; v != lastv; i++){
+        lastv=v;
         t *= x/(i*i);
         v += t;
     }