Go to the documentation of this file.
54 #define OFFSET(x) offsetof(SierpinskiContext, x)
55 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
74 int pos_x = x +
s->pos_x;
75 int pos_y = y +
s->pos_y;
77 while (pos_x != 0 && pos_y != 0) {
78 if (
FFABS(pos_x % 3) == 1 &&
FFABS(pos_y % 3) == 1)
94 const int start = (
height * job ) / nb_jobs;
95 const int end = (
height * (job+1)) / nb_jobs;
98 for (
int y = start; y < end; y++) {
99 for (
int x = 0; x <
width; x++) {
100 if ((
s->pos_x + x) & (
s->pos_y + y)) {
101 AV_WL32(&dst[x*4], 0x00000000);
103 AV_WL32(&dst[x*4], 0xFFFFFFFF);
119 const int start = (
height * job ) / nb_jobs;
120 const int end = (
height * (job+1)) / nb_jobs;
123 for (
int y = start; y < end; y++) {
124 for (
int x = 0; x <
width; x++) {
126 AV_WL32(&dst[x*4], 0x00000000);
128 AV_WL32(&dst[x*4], 0xFFFFFFFF);
165 if (
s->pos_x ==
s->dest_x &&
s->pos_y ==
s->dest_y) {
167 int mod = 2 *
s->jump + 1;
169 s->dest_x += (
int)((
rnd & 0xffff) %
mod) -
s->jump;
170 s->dest_y += (
int)((
rnd >> 16) %
mod) -
s->jump;
172 if (
s->pos_x <
s->dest_x)
174 else if (
s->pos_x >
s->dest_x)
177 if (
s->pos_y <
s->dest_y)
179 else if (
s->pos_y >
s->dest_y)
214 .
name =
"sierpinski",
217 .priv_class = &sierpinski_class,
AVFILTER_DEFINE_CLASS(sierpinski)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
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
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
static const AVOption sierpinski_options[]
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
offset must point to 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).
const char * name
Filter name.
A link between two filters.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
uint32_t av_get_random_seed(void)
Get a seed to use in conjunction with random functions.
static int config_output(AVFilterLink *outlink)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
A filter pad used for either input or output.
static int draw_carpet_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs)
static unsigned int av_lfg_get(AVLFG *c)
Get the next random unsigned 32-bit number using an ALFG.
#define AV_PIX_FMT_0BGR32
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable; if left to 0/0,...
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 link
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
Describe the class of an AVClass context structure.
Rational number (pair of numerator and denominator).
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to two consecutive integers
const AVFilter ff_vsrc_sierpinski
static void draw_sierpinski(AVFilterContext *ctx, AVFrame *frame)
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
Context structure for the Lagged Fibonacci PRNG.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static const AVFilterPad sierpinski_outputs[]
AVFilterContext * src
source filter
int(* draw_slice)(AVFilterContext *ctx, void *arg, int job, int nb_jobs)
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
int w
agreed upon image width
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
const char * name
Pad name.
static int mod(int a, int b)
Modulo operation with only positive remainders.
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
static int draw_triangle_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs)
int h
agreed upon image height
static int fill_sierpinski(SierpinskiContext *s, int x, int y)
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
#define FILTER_OUTPUTS(array)
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
static av_always_inline int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
static int sierpinski_request_frame(AVFilterLink *link)