Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Michael Niedermayer authored on 2011/11/12 07:22:04... | ... |
@@ -30,6 +30,11 @@ |
30 | 30 |
#include "libavutil/imgutils.h" |
31 | 31 |
#include "libavutil/parseutils.h" |
32 | 32 |
|
33 |
+enum Outer{ |
|
34 |
+ ITERATION_COUNT, |
|
35 |
+ NORMALIZED_ITERATION_COUNT, |
|
36 |
+}; |
|
37 |
+ |
|
33 | 38 |
typedef struct { |
34 | 39 |
int w, h; |
35 | 40 |
AVRational time_base; |
... | ... |
@@ -39,6 +44,7 @@ typedef struct { |
39 | 39 |
double start_y; |
40 | 40 |
double start_scale; |
41 | 41 |
double bailout; |
42 |
+ enum Outer outer; |
|
42 | 43 |
} MBContext; |
43 | 44 |
|
44 | 45 |
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) |
... | ... |
@@ -54,6 +60,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) |
54 | 54 |
mb->start_y=-1.5; |
55 | 55 |
mb->start_scale=3.0; |
56 | 56 |
mb->bailout=100; |
57 |
+ mb->outer= NORMALIZED_ITERATION_COUNT; |
|
57 | 58 |
if (args) |
58 | 59 |
sscanf(args, "%127[^:]:%127[^:]:%d,%lf:%lf:%lf", frame_size, frame_rate, &mb->maxiter, &mb->start_x, &mb->start_y, &mb->start_scale); |
59 | 60 |
|
... | ... |
@@ -123,7 +130,10 @@ static void draw_mandelbrot(AVFilterContext *ctx, uint32_t *color, int linesize, |
123 | 123 |
for(i=0; i<256; i++){ |
124 | 124 |
double t; |
125 | 125 |
if(zr*zr + zi*zi > mb->bailout){ |
126 |
- zr= i + (log(log(mb->bailout)) - log(log(sqrt(zr*zr + zi*zi))))/log(2); break; |
|
126 |
+ switch(mb->outer){ |
|
127 |
+ case ITERATION_COUNT: zr= i; break; |
|
128 |
+ case NORMALIZED_ITERATION_COUNT: zr= i + (log(log(mb->bailout)) - log(log(sqrt(zr*zr + zi*zi))))/log(2); break; |
|
129 |
+ } |
|
127 | 130 |
c= lrintf((sin(zr)+1)*127) + lrintf((sin(zr/1.234)+1)*127)*256*256 + lrintf((sin(zr/100)+1)*127)*256; |
128 | 131 |
break; |
129 | 132 |
} |