mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2024-11-25 04:30:02 +00:00
mandelbrot: unroll the innermost loop once.
This allows us to remove a if() and a variable assignment. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
1d06608732
commit
88166fc579
@ -190,11 +190,25 @@ 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;
|
t= zr*zr - zi*zi + cr;
|
||||||
zi= 2*zr*zi + ci;
|
zi= 2*zr*zi + ci;
|
||||||
zr= t + cr;
|
|
||||||
if(use_zyklus){
|
if(use_zyklus){
|
||||||
if((i&1) && mb->zyklus[i>>1][0]==zr && mb->zyklus[i>>1][1]==zi)
|
mb->zyklus[i][0]= t;
|
||||||
|
mb->zyklus[i][1]= zi;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
if(t*t + zi*zi > mb->bailout){
|
||||||
|
switch(mb->outer){
|
||||||
|
case ITERATION_COUNT: zr= i; break;
|
||||||
|
case NORMALIZED_ITERATION_COUNT: zr= i + (log(log(mb->bailout)) - log(log(sqrt(t*t + zi*zi))))/log(2); break;
|
||||||
|
}
|
||||||
|
c= lrintf((sin(zr)+1)*127) + lrintf((sin(zr/1.234)+1)*127)*256*256 + lrintf((sin(zr/100)+1)*127)*256;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
zr= t*t - zi*zi+cr;
|
||||||
|
zi= 2*t*zi + ci;
|
||||||
|
if(use_zyklus){
|
||||||
|
if(mb->zyklus[i>>1][0]==zr && mb->zyklus[i>>1][1]==zi)
|
||||||
break;
|
break;
|
||||||
mb->zyklus[i][0]= zr;
|
mb->zyklus[i][0]= zr;
|
||||||
mb->zyklus[i][1]= zi;
|
mb->zyklus[i][1]= zi;
|
||||||
|
Loading…
Reference in New Issue
Block a user