[FFmpeg-cvslog] mandelbrot: only check bailout once every 2 iterations.
Michael Niedermayer
git at videolan.org
Sun Nov 13 18:24:02 CET 2011
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Nov 13 18:14:40 2011 +0100| [3cbe9afba530991b4b8708fc47831453656e2fca] | committer: Michael Niedermayer
mandelbrot: only check bailout once every 2 iterations.
Once we bailed out we calculate the exact iteration in which it would have happened if needed.
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3cbe9afba530991b4b8708fc47831453656e2fca
---
libavfilter/vsrc_mandelbrot.c | 10 +---------
1 files changed, 1 insertions(+), 9 deletions(-)
diff --git a/libavfilter/vsrc_mandelbrot.c b/libavfilter/vsrc_mandelbrot.c
index 0e53291..d2c6cf1 100644
--- a/libavfilter/vsrc_mandelbrot.c
+++ b/libavfilter/vsrc_mandelbrot.c
@@ -186,7 +186,7 @@ static void draw_mandelbrot(AVFilterContext *ctx, uint32_t *color, int linesize,
double t;
if(zr*zr + zi*zi > mb->bailout){
switch(mb->outer){
- case ITERATION_COUNT: zr= i; break;
+ case ITERATION_COUNT: zr = i - (SQR(zr-cr)+SQR(zi-ci) > SQR(mb->bailout)); break;
case NORMALIZED_ITERATION_COUNT: zr= i + log2(log(mb->bailout) / log(zr*zr + zi*zi)); break;
}
c= lrintf((sin(zr)+1)*127) + lrintf((sin(zr/1.234)+1)*127)*256*256 + lrintf((sin(zr/100)+1)*127)*256;
@@ -199,14 +199,6 @@ static void draw_mandelbrot(AVFilterContext *ctx, uint32_t *color, int linesize,
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 + log2(log(mb->bailout) / log(t*t + zi*zi)); 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){
More information about the ffmpeg-cvslog
mailing list