FFmpeg
Data Structures | Macros | Functions | Variables
vsrc_perlin.c File Reference
#include <float.h>
#include "perlin.h"
#include "libavutil/lfg.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "filters.h"
#include "formats.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  PerlinContext
 

Macros

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

Functions

 AVFILTER_DEFINE_CLASS (perlin)
 
static av_cold int init (AVFilterContext *ctx)
 
static int config_props (AVFilterLink *outlink)
 
static int request_frame (AVFilterLink *outlink)
 
static int query_formats (const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
 

Variables

static const AVOption perlin_options []
 
static const AVFilterPad perlin_outputs []
 
const AVFilter ff_vsrc_perlin
 

Detailed Description

Perlin noise generator

Definition in file vsrc_perlin.c.

Macro Definition Documentation

◆ OFFSET

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

Definition at line 50 of file vsrc_perlin.c.

◆ FLAGS

Definition at line 51 of file vsrc_perlin.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( perlin  )

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 77 of file vsrc_perlin.c.

◆ config_props()

static int config_props ( AVFilterLink outlink)
static

Definition at line 95 of file vsrc_perlin.c.

◆ request_frame()

static int request_frame ( AVFilterLink outlink)
static

Definition at line 108 of file vsrc_perlin.c.

◆ query_formats()

static int query_formats ( const AVFilterContext ctx,
AVFilterFormatsConfig **  cfg_in,
AVFilterFormatsConfig **  cfg_out 
)
static

Definition at line 145 of file vsrc_perlin.c.

Variable Documentation

◆ perlin_options

const AVOption perlin_options[]
static
Initial value:
= {
{ "size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="320x240"}, 0, 0, FLAGS },
{ "s", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="320x240"}, 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 },
{ "octaves", "set the number of components to use to generate the noise", OFFSET(octaves), AV_OPT_TYPE_INT, {.i64=1}, 1, INT_MAX, FLAGS },
{ "persistence", "set the octaves persistence", OFFSET(persistence), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.0, DBL_MAX, FLAGS },
{ "xscale", "set x-scale factor", OFFSET(xscale), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.0, DBL_MAX, FLAGS },
{ "yscale", "set y-scale factor", OFFSET(yscale), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.0, DBL_MAX, FLAGS },
{ "tscale", "set t-scale factor", OFFSET(tscale), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.0, DBL_MAX, FLAGS },
{ "random_mode", "set random mode used to compute initial pattern", OFFSET(random_mode), AV_OPT_TYPE_INT, {.i64=FF_PERLIN_RANDOM_MODE_RANDOM}, 0, FF_PERLIN_RANDOM_MODE_NB-1, FLAGS, .unit = "random_mode" },
{ "random", "compute and use random seed", 0, AV_OPT_TYPE_CONST, {.i64=FF_PERLIN_RANDOM_MODE_RANDOM}, 0, 0, FLAGS, .unit = "random_mode" },
{ "ken", "use the predefined initial pattern defined by Ken Perlin in the original article", 0, AV_OPT_TYPE_CONST, {.i64=FF_PERLIN_RANDOM_MODE_KEN}, 0, 0, FLAGS, .unit = "random_mode" },
{ "seed", "use the value specified by random_seed", 0, AV_OPT_TYPE_CONST, {.i64=FF_PERLIN_RANDOM_MODE_SEED}, 0, 0, FLAGS, .unit="random_mode" },
{ "random_seed", "set the seed for filling the initial pattern", OFFSET(random_seed), AV_OPT_TYPE_UINT, {.i64=0}, 0, UINT_MAX, FLAGS },
{ "seed", "set the seed for filling the initial pattern", OFFSET(random_seed), AV_OPT_TYPE_UINT, {.i64=0}, 0, UINT_MAX, FLAGS },
{ NULL }
}

Definition at line 53 of file vsrc_perlin.c.

◆ perlin_outputs

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

Definition at line 154 of file vsrc_perlin.c.

◆ ff_vsrc_perlin

const AVFilter ff_vsrc_perlin
Initial value:
= {
.name = "perlin",
.description = NULL_IF_CONFIG_SMALL("Generate Perlin noise"),
.priv_size = sizeof(PerlinContext),
.priv_class = &perlin_class,
.init = init,
}

Definition at line 163 of file vsrc_perlin.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
OFFSET
#define OFFSET(x)
Definition: vsrc_perlin.c:50
perlin_outputs
static const AVFilterPad perlin_outputs[]
Definition: vsrc_perlin.c:154
FF_PERLIN_RANDOM_MODE_NB
@ FF_PERLIN_RANDOM_MODE_NB
Definition: perlin.h:35
FF_PERLIN_RANDOM_MODE_SEED
@ FF_PERLIN_RANDOM_MODE_SEED
Definition: perlin.h:34
FLAGS
#define FLAGS
Definition: vsrc_perlin.c:51
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
Definition: opt.h:267
config_props
static int config_props(AVFilterLink *outlink)
Definition: vsrc_perlin.c:95
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
AV_OPT_TYPE_UINT
@ AV_OPT_TYPE_UINT
Underlying C type is unsigned int.
Definition: opt.h:335
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
query_formats
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition: vsrc_perlin.c:145
FILTER_QUERY_FUNC2
#define FILTER_QUERY_FUNC2(func)
Definition: filters.h:239
init
static av_cold int init(AVFilterContext *ctx)
Definition: vsrc_perlin.c:77
FF_PERLIN_RANDOM_MODE_KEN
@ FF_PERLIN_RANDOM_MODE_KEN
Definition: perlin.h:33
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
request_frame
static int request_frame(AVFilterLink *outlink)
Definition: vsrc_perlin.c:108
FF_PERLIN_RANDOM_MODE_RANDOM
@ FF_PERLIN_RANDOM_MODE_RANDOM
Definition: perlin.h:32
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
PerlinContext
Definition: vsrc_perlin.c:34