diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-11-15 17:25:16 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-11-15 17:26:51 +0100 |
commit | 5a68b1ac3bc21d7f42ce931b5601836d273745f1 (patch) | |
tree | 610b952cd54419bf22565aa7cf5a59146f1262f2 | |
parent | 5582e557e6447aae4fed37a6a25c0653c54a9568 (diff) | |
download | ffmpeg-5a68b1ac3bc21d7f42ce931b5601836d273745f1.tar.gz |
mandelbrot: add inner drawing method to show converence time
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavfilter/vsrc_mandelbrot.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libavfilter/vsrc_mandelbrot.c b/libavfilter/vsrc_mandelbrot.c index b77b6d7a54..8f3a0d26ab 100644 --- a/libavfilter/vsrc_mandelbrot.c +++ b/libavfilter/vsrc_mandelbrot.c @@ -43,6 +43,7 @@ enum Outer{ enum Inner{ BLACK, PERIOD, + CONVTIME, }; typedef struct Point { @@ -94,6 +95,7 @@ static const AVOption mandelbrot_options[] = { {"inner", "set inner coloring mode", OFFSET(inner), AV_OPT_TYPE_INT, {.dbl=BLACK}, 0, INT_MAX, 0, "inner"}, {"black", "set black mode", 0, AV_OPT_TYPE_CONST, {.dbl=BLACK}, INT_MIN, INT_MAX, 0, "inner" }, {"period", "set period mode", 0, AV_OPT_TYPE_CONST, {.dbl=PERIOD}, INT_MIN, INT_MAX, 0, "inner" }, + {"convergence", "show time until convergence", 0, AV_OPT_TYPE_CONST, {.dbl=CONVTIME}, INT_MIN, INT_MAX, 0, "inner" }, {NULL}, }; @@ -252,7 +254,8 @@ static void draw_mandelbrot(AVFilterContext *ctx, uint32_t *color, int linesize, mb->zyklus[i][1]= zi; } } - if(!c && mb->inner==PERIOD){ + if(!c){ + if(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) @@ -261,6 +264,9 @@ static void draw_mandelbrot(AVFilterContext *ctx, uint32_t *color, int linesize, c= i-j; c= ((c<<5)&0xE0) + ((c<<16)&0xE000) + ((c<<27)&0xE00000); } + }else if(mb->inner==CONVTIME){ + c= (i*255/mb->maxiter)*0x010101; + } } c |= 0xFF000000; color[x + y*linesize]= c; |