1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

mandelbrot: add inner drawing method to show converence time

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2011-11-15 17:25:16 +01:00
parent 5582e557e6
commit 5a68b1ac3b

View File

@ -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;