[FFmpeg-cvslog] swresample/resample: merge first iteration into init in bessel()

Michael Niedermayer git at videolan.org
Wed Oct 7 18:14:02 CEST 2015


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Wed Oct  7 17:33:00 2015 +0200| [6024c865ef13253b99d585a0b7fa6e21e34fb1b7] | committer: Michael Niedermayer

swresample/resample: merge first iteration into init in bessel()

speedup of about 1%

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6024c865ef13253b99d585a0b7fa6e21e34fb1b7
---

 libswresample/resample.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libswresample/resample.c b/libswresample/resample.c
index 554fd7b..d6737d9 100644
--- a/libswresample/resample.c
+++ b/libswresample/resample.c
@@ -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,7 +49,9 @@ static double bessel(double x){
     };
 
     x= x*x/4;
-    for(i=0; v != lastv; i++){
+    t = x;
+    v = 1 + x;
+    for(i=1; v != lastv; i++){
         lastv=v;
         t *= x*inv[i];
         v += t;



More information about the ffmpeg-cvslog mailing list