[FFmpeg-cvslog] mandelbrot: allow visualizing the period of converged points.

Michael Niedermayer git at videolan.org
Sun Nov 13 19:33:49 CET 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Nov 13 19:28:24 2011 +0100| [08dadd331f171800424c862acc1ed86180d41a4c] | committer: Michael Niedermayer

mandelbrot: allow visualizing the period of converged points.

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

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

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

diff --git a/libavfilter/vsrc_mandelbrot.c b/libavfilter/vsrc_mandelbrot.c
index 59a0345..cab372d 100644
--- a/libavfilter/vsrc_mandelbrot.c
+++ b/libavfilter/vsrc_mandelbrot.c
@@ -39,6 +39,7 @@ enum Outer{
 
 enum Inner{
     BLACK,
+    PERIOD,
 };
 
 typedef struct Point {
@@ -185,7 +186,7 @@ static void draw_mandelbrot(AVFilterContext *ctx, uint32_t *color, int linesize,
             if(color[x + y*linesize] & 0xFF000000)
                 continue;
 
-            use_zyklus= (x==0 || color[x-1 + y*linesize] == 0xFF000000);
+            use_zyklus= (x==0 || mb->inner!=BLACK ||color[x-1 + y*linesize] == 0xFF000000);
 
             for(i=0; i<mb->maxiter; i++){
                 double t;
@@ -213,6 +214,16 @@ static void draw_mandelbrot(AVFilterContext *ctx, uint32_t *color, int linesize,
                     mb->zyklus[i][1]= zi;
                 }
             }
+            if(!c && mb->inner==PERIOD){
+                int j;
+                for(j=i-1; j; j--)
+                    if(SQR(mb->zyklus[j][0]-zr) + SQR(mb->zyklus[j][1]-zi) < 0.0000000000000001)
+                        break;
+                if(j){
+                    c= i-j;
+                    c= ((c<<5)&0xE0) + ((c<<16)&0xE000) + ((c<<27)&0xE00000);
+                }
+            }
             c |= 0xFF000000;
             color[x + y*linesize]= c;
             if(next_cidx < mb->cache_allocated){



More information about the ffmpeg-cvslog mailing list