[FFmpeg-cvslog] vsrc_mandelbrot: factorize periodicity checking too.
Michael Niedermayer
git at videolan.org
Sat Nov 19 15:26:35 CET 2011
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Nov 19 13:55:51 2011 +0100| [fe2efc5264940d0561b50bcce65dc8a24f352d9e] | committer: Michael Niedermayer
vsrc_mandelbrot: factorize periodicity checking too.
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fe2efc5264940d0561b50bcce65dc8a24f352d9e
---
libavfilter/vsrc_mandelbrot.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/libavfilter/vsrc_mandelbrot.c b/libavfilter/vsrc_mandelbrot.c
index 833033e..5701094 100644
--- a/libavfilter/vsrc_mandelbrot.c
+++ b/libavfilter/vsrc_mandelbrot.c
@@ -237,6 +237,16 @@ static void draw_mandelbrot(AVFilterContext *ctx, uint32_t *color, int linesize,
outr= inr*inr - ini*ini + cr;\
outi= 2*inr*ini + ci;
+#define Z_Z2_C_ZYKLUS(outr,outi,inr,ini, Z)\
+ Z_Z2_C(outr,outi,inr,ini)\
+ if(use_zyklus){\
+ if(Z && mb->zyklus[i>>1][0]==outr && mb->zyklus[i>>1][1]==outi)\
+ break;\
+ mb->zyklus[i][0]= outr;\
+ mb->zyklus[i][1]= outi;\
+ }
+
+
for(i=0; i<mb->maxiter; i++){
double t;
if(zr*zr + zi*zi > mb->bailout){
@@ -247,19 +257,9 @@ 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;
break;
}
- Z_Z2_C(t, zi, zr, zi)
- if(use_zyklus){
- mb->zyklus[i][0]= t;
- mb->zyklus[i][1]= zi;
- }
+ Z_Z2_C_ZYKLUS(t, zi, zr, zi, 0)
i++;
- Z_Z2_C(zr, zi, t, zi)
- if(use_zyklus){
- if(mb->zyklus[i>>1][0]==zr && mb->zyklus[i>>1][1]==zi)
- break;
- mb->zyklus[i][0]= zr;
- mb->zyklus[i][1]= zi;
- }
+ Z_Z2_C_ZYKLUS(zr, zi, t, zi, 1)
}
if(!c){
if(mb->inner==PERIOD){
More information about the ffmpeg-cvslog
mailing list