FFmpeg
Data Structures | Macros | Functions | Variables
vsrc_cellauto.c File Reference
#include "libavutil/file.h"
#include "libavutil/internal.h"
#include "libavutil/lfg.h"
#include "libavutil/opt.h"
#include "libavutil/random_seed.h"
#include "libavutil/avstring.h"
#include "avfilter.h"
#include "internal.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  CellAutoContext
 

Macros

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

Functions

 AVFILTER_DEFINE_CLASS (cellauto)
 
static int init_pattern_from_string (AVFilterContext *ctx)
 
static int init_pattern_from_file (AVFilterContext *ctx)
 
static av_cold int init (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int config_props (AVFilterLink *outlink)
 
static void evolve (AVFilterContext *ctx)
 
static void fill_picture (AVFilterContext *ctx, AVFrame *picref)
 
static int request_frame (AVFilterLink *outlink)
 

Variables

static const AVOption cellauto_options []
 
static const AVFilterPad cellauto_outputs []
 
const AVFilter ff_vsrc_cellauto
 

Detailed Description

cellular automaton video source, based on Stephen Wolfram "experimentus crucis"

Definition in file vsrc_cellauto.c.

Macro Definition Documentation

◆ OFFSET

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

Definition at line 58 of file vsrc_cellauto.c.

◆ FLAGS

Definition at line 59 of file vsrc_cellauto.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( cellauto  )

◆ init_pattern_from_string()

static int init_pattern_from_string ( AVFilterContext ctx)
static

Definition at line 102 of file vsrc_cellauto.c.

Referenced by init(), and init_pattern_from_file().

◆ init_pattern_from_file()

static int init_pattern_from_file ( AVFilterContext ctx)
static

Definition at line 141 of file vsrc_cellauto.c.

Referenced by init().

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 161 of file vsrc_cellauto.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 207 of file vsrc_cellauto.c.

◆ config_props()

static int config_props ( AVFilterLink outlink)
static

Definition at line 216 of file vsrc_cellauto.c.

◆ evolve()

static void evolve ( AVFilterContext ctx)
static

Definition at line 228 of file vsrc_cellauto.c.

Referenced by request_frame().

◆ fill_picture()

static void fill_picture ( AVFilterContext ctx,
AVFrame picref 
)
static

Definition at line 259 of file vsrc_cellauto.c.

Referenced by request_frame().

◆ request_frame()

static int request_frame ( AVFilterLink outlink)
static

Definition at line 287 of file vsrc_cellauto.c.

Variable Documentation

◆ cellauto_options

const AVOption cellauto_options[]
static
Initial value:
= {
{ "filename", "read initial pattern from file", OFFSET(filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
{ "f", "read initial pattern from file", OFFSET(filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
{ "pattern", "set initial pattern", OFFSET(pattern), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
{ "p", "set initial pattern", OFFSET(pattern), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
{ "rate", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, FLAGS },
{ "r", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, FLAGS },
{ "size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0, FLAGS },
{ "s", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0, FLAGS },
{ "rule", "set rule", OFFSET(rule), AV_OPT_TYPE_INT, {.i64 = 110}, 0, 255, FLAGS },
{ "random_fill_ratio", "set fill ratio for filling initial grid randomly", OFFSET(random_fill_ratio), AV_OPT_TYPE_DOUBLE, {.dbl = 1/M_PHI}, 0, 1, FLAGS },
{ "ratio", "set fill ratio for filling initial grid randomly", OFFSET(random_fill_ratio), AV_OPT_TYPE_DOUBLE, {.dbl = 1/M_PHI}, 0, 1, FLAGS },
{ "random_seed", "set the seed for filling the initial grid randomly", OFFSET(random_seed), AV_OPT_TYPE_INT64, {.i64 = -1}, -1, UINT32_MAX, FLAGS },
{ "seed", "set the seed for filling the initial grid randomly", OFFSET(random_seed), AV_OPT_TYPE_INT64, {.i64 = -1}, -1, UINT32_MAX, FLAGS },
{ "scroll", "scroll pattern downward", OFFSET(scroll), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, FLAGS },
{ "start_full", "start filling the whole video", OFFSET(start_full), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS },
{ "full", "start filling the whole video", OFFSET(start_full), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, FLAGS },
{ "stitch", "stitch boundaries", OFFSET(stitch), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, FLAGS },
{ NULL }
}

Definition at line 61 of file vsrc_cellauto.c.

◆ cellauto_outputs

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

Definition at line 311 of file vsrc_cellauto.c.

◆ ff_vsrc_cellauto

const AVFilter ff_vsrc_cellauto
Initial value:
= {
.name = "cellauto",
.description = NULL_IF_CONFIG_SMALL("Create pattern generated by an elementary cellular automaton."),
.priv_size = sizeof(CellAutoContext),
.priv_class = &cellauto_class,
.init = init,
}

Definition at line 320 of file vsrc_cellauto.c.

OFFSET
#define OFFSET(x)
Definition: vsrc_cellauto.c:58
M_PHI
#define M_PHI
Definition: mathematics.h:61
FLAGS
#define FLAGS
Definition: vsrc_cellauto.c:59
AV_OPT_TYPE_VIDEO_RATE
@ AV_OPT_TYPE_VIDEO_RATE
offset must point to AVRational
Definition: opt.h:248
w
uint8_t w
Definition: llviddspenc.c:38
init
static av_cold int init(AVFilterContext *ctx)
Definition: vsrc_cellauto.c:161
CellAutoContext
Definition: vsrc_cellauto.c:38
config_props
static int config_props(AVFilterLink *outlink)
Definition: vsrc_cellauto.c:216
request_frame
static int request_frame(AVFilterLink *outlink)
Definition: vsrc_cellauto.c:287
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Definition: opt.h:237
AV_OPT_TYPE_INT64
@ AV_OPT_TYPE_INT64
Definition: opt.h:236
NULL
#define NULL
Definition: coverity.c:32
AV_PIX_FMT_MONOBLACK
@ AV_PIX_FMT_MONOBLACK
Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb.
Definition: pixfmt.h:83
AV_OPT_TYPE_IMAGE_SIZE
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to two consecutive integers
Definition: opt.h:245
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
cellauto_outputs
static const AVFilterPad cellauto_outputs[]
Definition: vsrc_cellauto.c:311
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:106
scroll
static void scroll(AVFilterContext *ctx, AVFrame *in, AVFrame *out)
Definition: vf_scroll.c:103
FILTER_SINGLE_PIXFMT
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition: internal.h:172
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vsrc_cellauto.c:207
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:251
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:239