summaryrefslogtreecommitdiff
path: root/libavcodec/resample2.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2010-01-06 22:40:52 +0000
committerMichael Niedermayer <michaelni@gmx.at>2010-01-06 22:40:52 +0000
commit2efcf292750a1bc99ae65912ee6987995314c809 (patch)
tree4032bc190b08fff3aa9a564f40d7b2ad2eb0fc04 /libavcodec/resample2.c
parent9df9b810c58829d147cfabe7f6f2e469025ca29a (diff)
downloadffmpeg-2efcf292750a1bc99ae65912ee6987995314c809.tar.gz
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
Diffstat (limited to 'libavcodec/resample2.c')
-rw-r--r--libavcodec/resample2.c4
1 files changed, 3 insertions, 1 deletions
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;
}