vsrc_mandelbrot.c File Reference

Mandelbrot fraktal renderer. More...

#include "avfilter.h"
#include "formats.h"
#include "video.h"
#include "internal.h"
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include <float.h>
#include <math.h>
Include dependency graph for vsrc_mandelbrot.c:

Go to the source code of this file.

Data Structures

struct  Point
 
struct  MBContext
 

Macros

#define SQR(a)   ((a)*(a))
 
#define OFFSET(x)   offsetof(MBContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 
#define Z_Z2_C(outr, outi, inr, ini)
 
#define Z_Z2_C_ZYKLUS(outr, outi, inr, ini, Z)
 

Typedefs

typedef struct Point Point
 

Enumerations

enum  Outer { ITERATION_COUNT, NORMALIZED_ITERATION_COUNT, WHITE, OUTZ }
 
enum  Inner { BLACK, PERIOD, CONVTIME, MINCOL }
 

Functions

 AVFILTER_DEFINE_CLASS (mandelbrot)
 
static av_cold int init (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_props (AVFilterLink *inlink)
 
static void fill_from_cache (AVFilterContext *ctx, uint32_t *color, int *in_cidx, int *out_cidx, double py, double scale)
 
static int interpol (MBContext *mb, uint32_t *color, int x, int y, int linesize)
 
static void draw_mandelbrot (AVFilterContext *ctx, uint32_t *color, int linesize, int64_t pts)
 
static int request_frame (AVFilterLink *link)
 

Variables

static const AVOption mandelbrot_options []
 
static const AVFilterPad mandelbrot_outputs []
 
AVFilter avfilter_vsrc_mandelbrot
 

Detailed Description

Mandelbrot fraktal renderer.

Definition in file vsrc_mandelbrot.c.

Macro Definition Documentation

Definition at line 87 of file vsrc_mandelbrot.c.

#define OFFSET (   x)    offsetof(MBContext, x)

Definition at line 86 of file vsrc_mandelbrot.c.

#define SQR (   a)    ((a)*(a))

Definition at line 39 of file vsrc_mandelbrot.c.

Referenced by draw_mandelbrot().

#define Z_Z2_C (   outr,
  outi,
  inr,
  ini 
)
Value:
outr= inr*inr - ini*ini + cr;\
outi= 2*inr*ini + ci;
static double cr(void *priv, double x, double y)
Definition: vf_geq.c:85
#define Z_Z2_C_ZYKLUS (   outr,
  outi,
  inr,
  ini,
 
)
Value:
Z_Z2_C(outr,outi,inr,ini)\
if(use_zyklus){\
if(Z && fabs(mb->zyklus[i>>1][0]-outr)+fabs(mb->zyklus[i>>1][1]-outi) <= epsilon)\
break;\
}\
mb->zyklus[i][0]= outr;\
mb->zyklus[i][1]= outi;\
initialize output if(nPeaks >3)%at least 3 peaks in spectrum for trying to find f0 nf0peaks
#define Z_Z2_C(outr, outi, inr, ini)
#define mb
synthesis window for stochastic i

Referenced by draw_mandelbrot().

Typedef Documentation

typedef struct Point Point

Enumeration Type Documentation

enum Inner
Enumerator
BLACK 
PERIOD 
CONVTIME 
MINCOL 

Definition at line 48 of file vsrc_mandelbrot.c.

enum Outer
Enumerator
ITERATION_COUNT 
NORMALIZED_ITERATION_COUNT 
WHITE 
OUTZ 

Definition at line 41 of file vsrc_mandelbrot.c.

Function Documentation

AVFILTER_DEFINE_CLASS ( mandelbrot  )
static int config_props ( AVFilterLink inlink)
static

Definition at line 160 of file vsrc_mandelbrot.c.

static void draw_mandelbrot ( AVFilterContext ctx,
uint32_t *  color,
int  linesize,
int64_t  pts 
)
static

Definition at line 247 of file vsrc_mandelbrot.c.

Referenced by request_frame().

static void fill_from_cache ( AVFilterContext ctx,
uint32_t *  color,
int *  in_cidx,
int *  out_cidx,
double  py,
double  scale 
)
static

Definition at line 175 of file vsrc_mandelbrot.c.

Referenced by draw_mandelbrot().

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 122 of file vsrc_mandelbrot.c.

static int interpol ( MBContext mb,
uint32_t *  color,
int  x,
int  y,
int  linesize 
)
static

Definition at line 193 of file vsrc_mandelbrot.c.

Referenced by dequant_lsp10r(), dequant_lsp16r(), and draw_mandelbrot().

static int query_formats ( AVFilterContext ctx)
static

Definition at line 149 of file vsrc_mandelbrot.c.

static int request_frame ( AVFilterLink link)
static

Definition at line 396 of file vsrc_mandelbrot.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 140 of file vsrc_mandelbrot.c.

Variable Documentation

AVFilter avfilter_vsrc_mandelbrot
Initial value:
= {
.name = "mandelbrot",
.description = NULL_IF_CONFIG_SMALL("Render a Mandelbrot fractal."),
.priv_size = sizeof(MBContext),
.init = init,
.priv_class = &mandelbrot_class,
}
static int query_formats(AVFilterContext *ctx)
static av_cold int init(AVFilterContext *ctx)
static const AVFilterPad outputs[]
Definition: af_ashowinfo.c:117
static av_cold void uninit(AVFilterContext *ctx)
static const AVFilterPad mandelbrot_outputs[]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
NULL
Definition: eval.c:55
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs

Definition at line 420 of file vsrc_mandelbrot.c.

const AVOption mandelbrot_options[]
static
Initial value:
= {
{"size", "set frame size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="640x480"}, CHAR_MIN, CHAR_MAX, FLAGS },
{"s", "set frame size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="640x480"}, CHAR_MIN, CHAR_MAX, FLAGS },
{"rate", "set frame rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, CHAR_MIN, CHAR_MAX, FLAGS },
{"r", "set frame rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, CHAR_MIN, CHAR_MAX, FLAGS },
{"maxiter", "set max iterations number", OFFSET(maxiter), AV_OPT_TYPE_INT, {.i64=7189}, 1, INT_MAX, FLAGS },
{"start_x", "set the initial x position", OFFSET(start_x), AV_OPT_TYPE_DOUBLE, {.dbl=-0.743643887037158704752191506114774}, -100, 100, FLAGS },
{"start_y", "set the initial y position", OFFSET(start_y), AV_OPT_TYPE_DOUBLE, {.dbl=-0.131825904205311970493132056385139}, -100, 100, FLAGS },
{"start_scale", "set the initial scale value", OFFSET(start_scale), AV_OPT_TYPE_DOUBLE, {.dbl=3.0}, 0, FLT_MAX, FLAGS },
{"end_scale", "set the terminal scale value", OFFSET(end_scale), AV_OPT_TYPE_DOUBLE, {.dbl=0.3}, 0, FLT_MAX, FLAGS },
{"end_pts", "set the terminal pts value", OFFSET(end_pts), AV_OPT_TYPE_DOUBLE, {.dbl=400}, 0, INT64_MAX, FLAGS },
{"bailout", "set the bailout value", OFFSET(bailout), AV_OPT_TYPE_DOUBLE, {.dbl=10}, 0, FLT_MAX, FLAGS },
{"morphxf", "set morph x frequency", OFFSET(morphxf), AV_OPT_TYPE_DOUBLE, {.dbl=0.01}, -FLT_MAX, FLT_MAX, FLAGS },
{"morphyf", "set morph y frequency", OFFSET(morphyf), AV_OPT_TYPE_DOUBLE, {.dbl=0.0123}, -FLT_MAX, FLT_MAX, FLAGS },
{"morphamp", "set morph amplitude", OFFSET(morphamp), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -FLT_MAX, FLT_MAX, FLAGS },
{"outer", "set outer coloring mode", OFFSET(outer), AV_OPT_TYPE_INT, {.i64=NORMALIZED_ITERATION_COUNT}, 0, INT_MAX, FLAGS, "outer" },
{"iteration_count", "set iteration count mode", 0, AV_OPT_TYPE_CONST, {.i64=ITERATION_COUNT}, INT_MIN, INT_MAX, FLAGS, "outer" },
{"normalized_iteration_count", "set normalized iteration count mode", 0, AV_OPT_TYPE_CONST, {.i64=NORMALIZED_ITERATION_COUNT}, INT_MIN, INT_MAX, FLAGS, "outer" },
{"white", "set white mode", 0, AV_OPT_TYPE_CONST, {.i64=WHITE}, INT_MIN, INT_MAX, FLAGS, "outer" },
{"outz", "set outz mode", 0, AV_OPT_TYPE_CONST, {.i64=OUTZ}, INT_MIN, INT_MAX, FLAGS, "outer" },
{"inner", "set inner coloring mode", OFFSET(inner), AV_OPT_TYPE_INT, {.i64=MINCOL}, 0, INT_MAX, FLAGS, "inner" },
{"black", "set black mode", 0, AV_OPT_TYPE_CONST, {.i64=BLACK}, INT_MIN, INT_MAX, FLAGS, "inner"},
{"period", "set period mode", 0, AV_OPT_TYPE_CONST, {.i64=PERIOD}, INT_MIN, INT_MAX, FLAGS, "inner"},
{"convergence", "show time until convergence", 0, AV_OPT_TYPE_CONST, {.i64=CONVTIME}, INT_MIN, INT_MAX, FLAGS, "inner"},
{"mincol", "color based on point closest to the origin of the iterations", 0, AV_OPT_TYPE_CONST, {.i64=MINCOL}, INT_MIN, INT_MAX, FLAGS, "inner"},
{NULL},
}
#define FLAGS
output residual component w
#define OFFSET(x)
NULL
Definition: eval.c:55
offset must point to AVRational
Definition: opt.h:233
offset must point to two consecutive integers
Definition: opt.h:230

Definition at line 89 of file vsrc_mandelbrot.c.

const AVFilterPad mandelbrot_outputs[]
static
Initial value:
= {
{
.name = "default",
.request_frame = request_frame,
.config_props = config_props,
},
{ NULL },
}
static int request_frame(AVFilterLink *link)
NULL
Definition: eval.c:55
static int config_props(AVFilterLink *inlink)

Definition at line 410 of file vsrc_mandelbrot.c.