Go to the documentation of this file.
50 #define OFFSET(x) offsetof(PerlinContext, x)
51 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
58 {
"octaves",
"set the number of components to use to generate the noise",
OFFSET(octaves),
AV_OPT_TYPE_INT, {.i64=1}, 1, INT_MAX,
FLAGS },
70 {
"random_seed",
"set the seed for filling the initial pattern",
OFFSET(random_seed),
AV_OPT_TYPE_UINT, {.i64=0}, 0, UINT_MAX,
FLAGS },
88 "s:%dx%d r:%d/%d octaves:%d persistence:%f xscale:%f yscale:%f tscale:%f\n",
100 outlink->
w = perlin->
w;
101 outlink->
h = perlin->
h;
114 uint8_t *data0, *
data;
121 picref->
pts = perlin->
pts++;
125 data0 = picref->
data[0];
127 for (
i = 0;
i < perlin->
h;
i++) {
132 for (j = 0; j < perlin->
w; j++) {
167 .priv_class = &perlin_class,
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
AVPixelFormat
Pixel format.
AVFILTER_DEFINE_CLASS(perlin)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int64_t duration
Duration of the frame, in the same units as pts.
@ AV_OPT_TYPE_VIDEO_RATE
Underlying C type is AVRational.
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).
#define AV_LOG_VERBOSE
Detailed information.
const char * name
Filter name.
static const AVOption perlin_options[]
A link between two filters.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Link properties exposed to filter code, but not external callers.
static const AVFilterPad perlin_outputs[]
void * priv
private data for use by the filter
@ FF_PERLIN_RANDOM_MODE_NB
@ FF_PERLIN_RANDOM_MODE_SEED
A filter pad used for either input or output.
Perlin generator context.
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
const AVFilter ff_vsrc_perlin
static double av_q2d(AVRational a)
Convert an AVRational to a double.
static enum AVPixelFormat pix_fmts[]
static int config_props(AVFilterLink *outlink)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define FILTER_OUTPUTS(array)
double ff_perlin_get(FFPerlin *perlin, double x, double y, double z)
Compute Perlin noise given the x, y, z coordinates.
Describe the class of an AVClass context structure.
Rational number (pair of numerator and denominator).
@ AV_OPT_TYPE_IMAGE_SIZE
Underlying C type is two consecutive integers.
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
@ AV_OPT_TYPE_UINT
Underlying C type is unsigned int.
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
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.
static FilterLink * ff_filter_link(AVFilterLink *link)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
AVFilterContext * src
source filter
enum FFPerlinRandomMode random_mode
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
#define i(width, name, range_min, range_max)
int w
agreed upon image width
#define FILTER_QUERY_FUNC2(func)
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
const char * name
Pad name.
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
static av_cold int init(AVFilterContext *ctx)
@ FF_PERLIN_RANDOM_MODE_KEN
int h
agreed upon image height
@ AV_OPT_TYPE_INT
Underlying C type is int.
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
static int request_frame(AVFilterLink *outlink)
@ FF_PERLIN_RANDOM_MODE_RANDOM
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable.
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.