51#define OFFSET(x) offsetof(PerlinContext, x)
52#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
59 {
"octaves",
"set the number of components to use to generate the noise",
OFFSET(octaves),
AV_OPT_TYPE_INT, {.i64=1}, 1, INT_MAX,
FLAGS },
71 {
"random_seed",
"set the seed for filling the initial pattern",
OFFSET(random_seed),
AV_OPT_TYPE_UINT, {.i64=0}, 0, UINT_MAX,
FLAGS },
89 "s:%dx%d r:%d/%d octaves:%d persistence:%f xscale:%f yscale:%f tscale:%f\n",
101 outlink->
w = perlin->
w;
102 outlink->
h = perlin->
h;
115 uint8_t *data0, *
data;
122 picref->
pts = perlin->
pts++;
126 data0 = picref->
data[0];
128 for (
i = 0;
i < perlin->
h;
i++) {
133 for (j = 0; j < perlin->
w; j++) {
167 .p.priv_class = &perlin_class,
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
static int request_frame(AVFilterLink *outlink)
const FFFilter ff_vsrc_perlin
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Main libavfilter public API header.
#define i(width, name, range_min, range_max)
int(* init)(AVBSFContext *ctx)
@ AV_OPT_TYPE_IMAGE_SIZE
Underlying C type is two consecutive integers.
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
@ AV_OPT_TYPE_VIDEO_RATE
Underlying C type is AVRational.
@ AV_OPT_TYPE_INT
Underlying C type is int.
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
@ AV_OPT_TYPE_UINT
Underlying C type is unsigned int.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_VERBOSE
Detailed information.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
#define FILTER_OUTPUTS(array)
static FilterLink * ff_filter_link(AVFilterLink *link)
#define AVFILTER_DEFINE_CLASS(fname)
#define FILTER_QUERY_FUNC2(func)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static enum AVPixelFormat pix_fmts[]
int ff_perlin_init(FFPerlin *perlin, double period, int octaves, double persistence, enum FFPerlinRandomMode random_mode, unsigned int random_seed)
Initialize the Perlin noise generator with parameters.
double ff_perlin_get(FFPerlin *perlin, double x, double y, double z)
Compute Perlin noise given the x, y, z coordinates.
@ FF_PERLIN_RANDOM_MODE_NB
@ FF_PERLIN_RANDOM_MODE_RANDOM
@ FF_PERLIN_RANDOM_MODE_SEED
@ FF_PERLIN_RANDOM_MODE_KEN
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
static int config_props(AVBitStreamFilterLink *link)
Describe the class of an AVClass context structure.
void * priv
private data for use by the filter
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
AVFilterContext * src
source filter
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
A filter pad used for either input or output.
This structure describes decoded (raw) audio or video data.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
int64_t duration
Duration of the frame, in the same units as pts.
Rational number (pair of numerator and denominator).
Perlin generator context.
Link properties exposed to filter code, but not external callers.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable.
static AVFormatContext * ctx
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
static int config_props(AVFilterLink *outlink)
static const AVFilterPad perlin_outputs[]
static int request_frame(AVFilterLink *outlink)
static const AVOption perlin_options[]
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)