[FFmpeg-cvslog] mandelbrot: add a end_scale and pts so we can zoom in.

Michael Niedermayer git at videolan.org
Sat Nov 12 00:08:39 CET 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Nov 11 23:58:08 2011 +0100| [ddeb194b14029b8e4c3138ea92fd1c539f4ea26a] | committer: Michael Niedermayer

mandelbrot: add a end_scale and pts so we can zoom in.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ddeb194b14029b8e4c3138ea92fd1c539f4ea26a
---

 libavfilter/vsrc_mandelbrot.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vsrc_mandelbrot.c b/libavfilter/vsrc_mandelbrot.c
index 1fb518c..16a2e10 100644
--- a/libavfilter/vsrc_mandelbrot.c
+++ b/libavfilter/vsrc_mandelbrot.c
@@ -43,6 +43,8 @@ typedef struct {
     double start_x;
     double start_y;
     double start_scale;
+    double end_scale;
+    double end_pts;
     double bailout;
     enum Outer outer;
 } MBContext;
@@ -57,8 +59,10 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
 
     mb->maxiter=256;
     mb->start_x=0;
-    mb->start_y=0;
+    mb->start_y=1;
     mb->start_scale=3.0;
+    mb->end_scale=0.3;
+    mb->end_pts=200;
     mb->bailout=100;
     mb->outer= NORMALIZED_ITERATION_COUNT;
     if (args)
@@ -69,6 +73,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
         return AVERROR(EINVAL);
     }
     mb->start_scale /=mb->h;
+    mb->end_scale /=mb->h;
 
     if (av_parse_video_rate(&frame_rate_q, frame_rate) < 0 ||
         frame_rate_q.den <= 0 || frame_rate_q.num <= 0) {
@@ -119,10 +124,12 @@ static void draw_mandelbrot(AVFilterContext *ctx, uint32_t *color, int linesize,
     MBContext *mb = ctx->priv;
     int x,y,i;
 
+    double scale= mb->start_scale*pow(mb->end_scale/mb->start_scale, pts/mb->end_pts);
+
     for(y=0; y<mb->h; y++){
         for(x=0; x<mb->w; x++){
-            const double cr=mb->start_x+mb->start_scale*(x-mb->w/2);
-            const double ci=mb->start_y+mb->start_scale*(y-mb->h/2);
+            const double cr=mb->start_x+scale*(x-mb->w/2);
+            const double ci=mb->start_y+scale*(y-mb->h/2);
             double zr=cr;
             double zi=ci;
             uint32_t c=0;



More information about the ffmpeg-cvslog mailing list