From 2efcf292750a1bc99ae65912ee6987995314c809 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 6 Jan 2010 22:40:52 +0000 Subject: [PATCH] Stop the approximation in bessel() once it does no longer improve. This is faster. Originally committed as revision 21038 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/resample2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/resample2.c b/libavcodec/resample2.c index 31d2be7ded..52769836e0 100644 --- a/libavcodec/resample2.c +++ b/libavcodec/resample2.c @@ -76,11 +76,13 @@ typedef struct AVResampleContext{ */ 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; }