FFmpeg
Data Structures | Macros | Functions | Variables
vsrc_sierpinski.c File Reference
#include "avfilter.h"
#include "filters.h"
#include "video.h"
#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "libavutil/lfg.h"
#include "libavutil/random_seed.h"
#include <float.h>
#include <math.h>

Go to the source code of this file.

Data Structures

struct  SierpinskiContext
 

Macros

#define OFFSET(x)   offsetof(SierpinskiContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 

Functions

 AVFILTER_DEFINE_CLASS (sierpinski)
 
static int fill_sierpinski (SierpinskiContext *s, int x, int y)
 
static int draw_triangle_slice (AVFilterContext *ctx, void *arg, int job, int nb_jobs)
 
static int draw_carpet_slice (AVFilterContext *ctx, void *arg, int job, int nb_jobs)
 
static int config_output (AVFilterLink *outlink)
 
static void draw_sierpinski (AVFilterContext *ctx, AVFrame *frame)
 
static int sierpinski_request_frame (AVFilterLink *link)
 

Variables

static const AVOption sierpinski_options []
 
static const AVFilterPad sierpinski_outputs []
 
const AVFilter ff_vsrc_sierpinski
 

Detailed Description

Sierpinski carpet fractal renderer

Definition in file vsrc_sierpinski.c.

Macro Definition Documentation

◆ OFFSET

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

Definition at line 54 of file vsrc_sierpinski.c.

◆ FLAGS

Definition at line 55 of file vsrc_sierpinski.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( sierpinski  )

◆ fill_sierpinski()

static int fill_sierpinski ( SierpinskiContext s,
int  x,
int  y 
)
static

Definition at line 72 of file vsrc_sierpinski.c.

Referenced by draw_carpet_slice().

◆ draw_triangle_slice()

static int draw_triangle_slice ( AVFilterContext ctx,
void *  arg,
int  job,
int  nb_jobs 
)
static

Definition at line 88 of file vsrc_sierpinski.c.

Referenced by config_output().

◆ draw_carpet_slice()

static int draw_carpet_slice ( AVFilterContext ctx,
void *  arg,
int  job,
int  nb_jobs 
)
static

Definition at line 113 of file vsrc_sierpinski.c.

Referenced by config_output().

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 138 of file vsrc_sierpinski.c.

◆ draw_sierpinski()

static void draw_sierpinski ( AVFilterContext ctx,
AVFrame frame 
)
static

Definition at line 161 of file vsrc_sierpinski.c.

Referenced by sierpinski_request_frame().

◆ sierpinski_request_frame()

static int sierpinski_request_frame ( AVFilterLink link)
static

Definition at line 188 of file vsrc_sierpinski.c.

Variable Documentation

◆ sierpinski_options

const AVOption sierpinski_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 },
{"seed", "set the seed", OFFSET(seed), AV_OPT_TYPE_INT64, {.i64=-1}, -1, UINT32_MAX, FLAGS },
{"jump", "set the jump", OFFSET(jump), AV_OPT_TYPE_INT, {.i64=100}, 1, 10000, FLAGS },
{"type","set fractal type",OFFSET(type), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, .unit = "type" },
{"carpet", "sierpinski carpet", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, .unit = "type" },
{"triangle", "sierpinski triangle", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, .unit = "type" },
{NULL},
}

Definition at line 57 of file vsrc_sierpinski.c.

◆ sierpinski_outputs

const AVFilterPad sierpinski_outputs[]
static
Initial value:
= {
{
.name = "default",
.request_frame = sierpinski_request_frame,
.config_props = config_output,
},
}

Definition at line 205 of file vsrc_sierpinski.c.

◆ ff_vsrc_sierpinski

const AVFilter ff_vsrc_sierpinski
Initial value:
= {
.name = "sierpinski",
.description = NULL_IF_CONFIG_SMALL("Render a Sierpinski fractal."),
.priv_size = sizeof(SierpinskiContext),
.priv_class = &sierpinski_class,
}

Definition at line 214 of file vsrc_sierpinski.c.

AV_OPT_TYPE_VIDEO_RATE
@ AV_OPT_TYPE_VIDEO_RATE
Underlying C type is AVRational.
Definition: opt.h:315
w
uint8_t w
Definition: llviddspenc.c:38
config_output
static int config_output(AVFilterLink *outlink)
Definition: vsrc_sierpinski.c:138
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
AV_PIX_FMT_0BGR32
#define AV_PIX_FMT_0BGR32
Definition: pixfmt.h:480
AV_OPT_TYPE_INT64
@ AV_OPT_TYPE_INT64
Underlying C type is int64_t.
Definition: opt.h:263
FLAGS
#define FLAGS
Definition: vsrc_sierpinski.c:55
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
NULL
#define NULL
Definition: coverity.c:32
AV_OPT_TYPE_IMAGE_SIZE
@ AV_OPT_TYPE_IMAGE_SIZE
Underlying C type is two consecutive integers.
Definition: opt.h:303
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
seed
static unsigned int seed
Definition: videogen.c:78
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:94
sierpinski_outputs
static const AVFilterPad sierpinski_outputs[]
Definition: vsrc_sierpinski.c:205
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
AVFILTER_FLAG_SLICE_THREADS
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:152
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
FILTER_SINGLE_PIXFMT
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition: filters.h:252
sierpinski_request_frame
static int sierpinski_request_frame(AVFilterLink *link)
Definition: vsrc_sierpinski.c:188
SierpinskiContext
Definition: vsrc_sierpinski.c:37
OFFSET
#define OFFSET(x)
Definition: vsrc_sierpinski.c:54