FFmpeg  4.3
Data Structures | Macros | Enumerations | Functions | Variables
vsrc_mandelbrot.c File Reference
#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>

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)
 

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 *s, 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 ff_vsrc_mandelbrot
 

Detailed Description

Mandelbrot fractal renderer

Definition in file vsrc_mandelbrot.c.

Macro Definition Documentation

◆ SQR

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

Definition at line 39 of file vsrc_mandelbrot.c.

◆ OFFSET

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

Definition at line 86 of file vsrc_mandelbrot.c.

◆ FLAGS

Definition at line 87 of file vsrc_mandelbrot.c.

◆ Z_Z2_C

#define Z_Z2_C (   outr,
  outi,
  inr,
  ini 
)
Value:
outr= inr*inr - ini*ini + cr;\
outi= 2*inr*ini + ci;

◆ Z_Z2_C_ZYKLUS

#define Z_Z2_C_ZYKLUS (   outr,
  outi,
  inr,
  ini,
 
)
Value:
Z_Z2_C(outr,outi,inr,ini)\
if(use_zyklus){\
if(Z && fabs(s->zyklus[i>>1][0]-outr)+fabs(s->zyklus[i>>1][1]-outi) <= epsilon)\
break;\
}\
s->zyklus[i][0]= outr;\
s->zyklus[i][1]= outi;\

Enumeration Type Documentation

◆ Outer

enum Outer
Enumerator
ITERATION_COUNT 
NORMALIZED_ITERATION_COUNT 
WHITE 
OUTZ 

Definition at line 41 of file vsrc_mandelbrot.c.

◆ Inner

enum Inner
Enumerator
BLACK 
PERIOD 
CONVTIME 
MINCOL 

Definition at line 48 of file vsrc_mandelbrot.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( mandelbrot  )

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 122 of file vsrc_mandelbrot.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 140 of file vsrc_mandelbrot.c.

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 149 of file vsrc_mandelbrot.c.

◆ config_props()

static int config_props ( AVFilterLink inlink)
static

Definition at line 162 of file vsrc_mandelbrot.c.

◆ fill_from_cache()

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

Definition at line 177 of file vsrc_mandelbrot.c.

Referenced by draw_mandelbrot().

◆ interpol()

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

◆ draw_mandelbrot()

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

Definition at line 249 of file vsrc_mandelbrot.c.

Referenced by request_frame().

◆ request_frame()

static int request_frame ( AVFilterLink link)
static

Definition at line 398 of file vsrc_mandelbrot.c.

Variable Documentation

◆ mandelbrot_options

const AVOption mandelbrot_options[]
static
Initial value:
= {
{"size", "set frame size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="640x480"}, 0, 0, FLAGS },
{"s", "set frame size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="640x480"}, 0, 0, FLAGS },
{"rate", "set frame rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, 0, INT_MAX, FLAGS },
{"r", "set frame rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, 0, INT_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},
}

Definition at line 89 of file vsrc_mandelbrot.c.

◆ mandelbrot_outputs

const AVFilterPad mandelbrot_outputs[]
static
Initial value:
= {
{
.name = "default",
.request_frame = request_frame,
.config_props = config_props,
},
{ NULL }
}

Definition at line 412 of file vsrc_mandelbrot.c.

◆ ff_vsrc_mandelbrot

AVFilter ff_vsrc_mandelbrot
Initial value:
= {
.name = "mandelbrot",
.description = NULL_IF_CONFIG_SMALL("Render a Mandelbrot fractal."),
.priv_size = sizeof(MBContext),
.priv_class = &mandelbrot_class,
.init = init,
}

Definition at line 422 of file vsrc_mandelbrot.c.

init
static av_cold int init(AVFilterContext *ctx)
Definition: vsrc_mandelbrot.c:122
NORMALIZED_ITERATION_COUNT
@ NORMALIZED_ITERATION_COUNT
Definition: vsrc_mandelbrot.c:43
AV_OPT_TYPE_VIDEO_RATE
@ AV_OPT_TYPE_VIDEO_RATE
offset must point to AVRational
Definition: opt.h:236
FLAGS
#define FLAGS
Definition: vsrc_mandelbrot.c:87
MBContext
Definition: vsrc_mandelbrot.c:60
PERIOD
@ PERIOD
Definition: vsrc_mandelbrot.c:50
mandelbrot_outputs
static const AVFilterPad mandelbrot_outputs[]
Definition: vsrc_mandelbrot.c:412
config_props
static int config_props(AVFilterLink *inlink)
Definition: vsrc_mandelbrot.c:162
Z_Z2_C
#define Z_Z2_C(outr, outi, inr, ini)
BLACK
@ BLACK
Definition: vsrc_mandelbrot.c:49
s
#define s(width, name)
Definition: cbs_vp9.c:257
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Definition: opt.h:225
CONVTIME
@ CONVTIME
Definition: vsrc_mandelbrot.c:51
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
request_frame
static int request_frame(AVFilterLink *link)
Definition: vsrc_mandelbrot.c:398
NULL
#define NULL
Definition: coverity.c:32
ITERATION_COUNT
@ ITERATION_COUNT
Definition: vsrc_mandelbrot.c:42
AV_OPT_TYPE_IMAGE_SIZE
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to two consecutive integers
Definition: opt.h:233
inputs
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: filter_design.txt:243
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:186
MINCOL
@ MINCOL
Definition: vsrc_mandelbrot.c:52
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vsrc_mandelbrot.c:140
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
w
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo ug o o w
Definition: fate.txt:150
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vsrc_mandelbrot.c:149
OUTZ
@ OUTZ
Definition: vsrc_mandelbrot.c:45
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
OFFSET
#define OFFSET(x)
Definition: vsrc_mandelbrot.c:86
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
cr
static double cr(void *priv, double x, double y)
Definition: vf_geq.c:216
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:232
WHITE
@ WHITE
Definition: vsrc_mandelbrot.c:44