vsrc_cellauto.c File Reference

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

#include "libavutil/file.h"
#include "libavutil/lfg.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include "libavutil/random_seed.h"
#include "libavutil/avstring.h"
#include "avfilter.h"
#include "internal.h"
#include "formats.h"
#include "video.h"
Include dependency graph for vsrc_cellauto.c:

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 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)
 
static int query_formats (AVFilterContext *ctx)
 

Variables

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

Detailed Description

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

Definition in file vsrc_cellauto.c.

Macro Definition Documentation

Definition at line 60 of file vsrc_cellauto.c.

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

Definition at line 59 of file vsrc_cellauto.c.

Function Documentation

AVFILTER_DEFINE_CLASS ( cellauto  )
static int config_props ( AVFilterLink outlink)
static

Definition at line 217 of file vsrc_cellauto.c.

static void evolve ( AVFilterContext ctx)
static

Definition at line 228 of file vsrc_cellauto.c.

Referenced by request_frame().

static void fill_picture ( AVFilterContext ctx,
AVFrame picref 
)
static

Definition at line 259 of file vsrc_cellauto.c.

Referenced by request_frame().

static int init ( AVFilterContext ctx)
static

Definition at line 162 of file vsrc_cellauto.c.

static int init_pattern_from_file ( AVFilterContext ctx)
static

Definition at line 142 of file vsrc_cellauto.c.

Referenced by init().

static int init_pattern_from_string ( AVFilterContext ctx)
static

Definition at line 103 of file vsrc_cellauto.c.

Referenced by init(), and init_pattern_from_file().

static int query_formats ( AVFilterContext ctx)
static

Definition at line 310 of file vsrc_cellauto.c.

static int request_frame ( AVFilterLink outlink)
static

Definition at line 287 of file vsrc_cellauto.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 208 of file vsrc_cellauto.c.

Variable Documentation

AVFilter avfilter_vsrc_cellauto
Initial value:
= {
.name = "cellauto",
.description = NULL_IF_CONFIG_SMALL("Create pattern generated by an elementary cellular automaton."),
.priv_size = sizeof(CellAutoContext),
.init = init,
.priv_class = &cellauto_class,
}
static const AVFilterPad outputs[]
Definition: af_ashowinfo.c:117
static const AVFilterPad cellauto_outputs[]
static int init(AVFilterContext *ctx)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
NULL
Definition: eval.c:55
static int query_formats(AVFilterContext *ctx)
static av_cold void uninit(AVFilterContext *ctx)
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 327 of file vsrc_cellauto.c.

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, 0, FLAGS },
{ "r", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, 0, 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_INT, {.i64 = -1}, -1, UINT32_MAX, FLAGS },
{ "seed", "set the seed for filling the initial grid randomly", OFFSET(random_seed), AV_OPT_TYPE_INT, {.i64 = -1}, -1, UINT32_MAX, FLAGS },
{ "scroll", "scroll pattern downward", OFFSET(scroll), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, FLAGS },
{ "start_full", "start filling the whole video", OFFSET(start_full), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, FLAGS },
{ "full", "start filling the whole video", OFFSET(start_full), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, FLAGS },
{ "stitch", "stitch boundaries", OFFSET(stitch), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, FLAGS },
{ NULL },
}
#define OFFSET(x)
Definition: vsrc_cellauto.c:59
output residual component w
NULL
Definition: eval.c:55
#define FLAGS
Definition: vsrc_cellauto.c:60
#define M_PHI
Definition: mathematics.h:43
offset must point to AVRational
Definition: opt.h:233
offset must point to two consecutive integers
Definition: opt.h:230

Definition at line 62 of file vsrc_cellauto.c.

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

Definition at line 317 of file vsrc_cellauto.c.