[FFmpeg-cvslog] vsrc_mandelbrot: check bailout only once every 8 iterations, this is around 10% faster.

Michael Niedermayer git at videolan.org
Sat Nov 19 15:26:35 CET 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Nov 19 14:15:56 2011 +0100| [649d3932db83763a49073a185189d338adbb3b9d] | committer: Michael Niedermayer

vsrc_mandelbrot: check bailout only once every 8 iterations, this is around 10% faster.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavfilter/vsrc_mandelbrot.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/libavfilter/vsrc_mandelbrot.c b/libavfilter/vsrc_mandelbrot.c
index 5701094..9aea384 100644
--- a/libavfilter/vsrc_mandelbrot.c
+++ b/libavfilter/vsrc_mandelbrot.c
@@ -247,7 +247,30 @@ static void draw_mandelbrot(AVFilterContext *ctx, uint32_t *color, int linesize,
             }
 
 
-            for(i=0; i<mb->maxiter; i++){
+            for(i=0; i<mb->maxiter-8; i++){
+                double t;
+                Z_Z2_C_ZYKLUS(t, zi, zr, zi, 0)
+                i++;
+                Z_Z2_C_ZYKLUS(zr, zi, t, zi, 1)
+                i++;
+                Z_Z2_C_ZYKLUS(t, zi, zr, zi, 0)
+                i++;
+                Z_Z2_C_ZYKLUS(zr, zi, t, zi, 1)
+                i++;
+                Z_Z2_C_ZYKLUS(t, zi, zr, zi, 0)
+                i++;
+                Z_Z2_C_ZYKLUS(zr, zi, t, zi, 1)
+                i++;
+                Z_Z2_C_ZYKLUS(t, zi, zr, zi, 0)
+                i++;
+                Z_Z2_C_ZYKLUS(zr, zi, t, zi, 1)
+                if(zr*zr + zi*zi > mb->bailout)
+                    break;
+            }
+            i-= FFMIN(7, i);
+            zr= mb->zyklus[i][0];
+            zi= mb->zyklus[i][1];
+            for(; i<mb->maxiter; i++){
                 double t;
                 if(zr*zr + zi*zi > mb->bailout){
                     switch(mb->outer){



More information about the ffmpeg-cvslog mailing list