mirror of https://git.ffmpeg.org/ffmpeg.git
vsrc_mandelbrot: factorize main calculation out into a macro.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
0af8d20755
commit
cf670fbc96
|
@ -233,6 +233,10 @@ static void draw_mandelbrot(AVFilterContext *ctx, uint32_t *color, int linesize,
|
||||||
|
|
||||||
use_zyklus= (x==0 || mb->inner!=BLACK ||color[x-1 + y*linesize] == 0xFF000000);
|
use_zyklus= (x==0 || mb->inner!=BLACK ||color[x-1 + y*linesize] == 0xFF000000);
|
||||||
|
|
||||||
|
#define Z_Z2_C(outr,outi,inr,ini)\
|
||||||
|
outr= inr*inr - ini*ini + cr;\
|
||||||
|
outi= 2*inr*ini + ci;
|
||||||
|
|
||||||
for(i=0; i<mb->maxiter; i++){
|
for(i=0; i<mb->maxiter; i++){
|
||||||
double t;
|
double t;
|
||||||
if(zr*zr + zi*zi > mb->bailout){
|
if(zr*zr + zi*zi > mb->bailout){
|
||||||
|
@ -243,15 +247,13 @@ static void draw_mandelbrot(AVFilterContext *ctx, uint32_t *color, int linesize,
|
||||||
c= lrintf((sin(zr)+1)*127) + lrintf((sin(zr/1.234)+1)*127)*256*256 + lrintf((sin(zr/100)+1)*127)*256;
|
c= lrintf((sin(zr)+1)*127) + lrintf((sin(zr/1.234)+1)*127)*256*256 + lrintf((sin(zr/100)+1)*127)*256;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
t= zr*zr - zi*zi + cr;
|
Z_Z2_C(t, zi, zr, zi)
|
||||||
zi= 2*zr*zi + ci;
|
|
||||||
if(use_zyklus){
|
if(use_zyklus){
|
||||||
mb->zyklus[i][0]= t;
|
mb->zyklus[i][0]= t;
|
||||||
mb->zyklus[i][1]= zi;
|
mb->zyklus[i][1]= zi;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
zr= t*t - zi*zi+cr;
|
Z_Z2_C(zr, zi, t, zi)
|
||||||
zi= 2*t*zi + ci;
|
|
||||||
if(use_zyklus){
|
if(use_zyklus){
|
||||||
if(mb->zyklus[i>>1][0]==zr && mb->zyklus[i>>1][1]==zi)
|
if(mb->zyklus[i>>1][0]==zr && mb->zyklus[i>>1][1]==zi)
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue