Go to the documentation of this file.
51 #define OFFSET(x) offsetof(TileContext, x)
52 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
56 {.str =
"6x5"}, 0, 0,
FLAGS },
57 {
"nb_frames",
"set maximum number of frame to render",
OFFSET(nb_frames),
59 {
"margin",
"set outer border margin in pixels",
OFFSET(margin),
61 {
"padding",
"set inner border thickness in pixels",
OFFSET(padding),
64 {
"overlap",
"set how many frames to overlap for each render",
OFFSET(overlap),
66 {
"init_padding",
" set how many frames to initially pad",
OFFSET(init_padding),
77 if (tile->
w > UINT_MAX / tile->
h) {
84 if ((tile->
w - 1 > (UINT32_MAX - 2 * tile->
margin) / tile->
padding) ||
96 tile->
w, tile->
h, tile->
w * tile->
h);
124 const unsigned total_margin_w = (tile->
w - 1) * tile->
padding + 2*tile->
margin;
125 const unsigned total_margin_h = (tile->
h - 1) * tile->
padding + 2*tile->
margin;
127 if (
inlink->w > (INT_MAX - total_margin_w) / tile->
w) {
132 if (
inlink->h > (INT_MAX - total_margin_h) / tile->
h) {
137 outlink->
w = tile->
w *
inlink->w + total_margin_w;
138 outlink->
h = tile->
h *
inlink->h + total_margin_h;
152 const unsigned tx = current % tile->
w;
153 const unsigned ty = current / tile->
w;
217 0, 0, outlink->
w, outlink->
h);
296 .priv_class = &tile_class,
static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
static int query_formats(AVFilterContext *ctx)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
#define AV_LOG_WARNING
Something somehow does not look correct.
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
static const AVFilterPad tile_outputs[]
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
#define AVERROR_EOF
End of file.
static av_cold void uninit(AVFilterContext *ctx)
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
This structure describes decoded (raw) audio or video data.
static int config_props(AVFilterLink *outlink)
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
const char * name
Filter name.
A link between two filters.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
A filter pad used for either input or output.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
void ff_copy_rectangle2(FFDrawContext *draw, uint8_t *dst[], int dst_linesize[], uint8_t *src[], int src_linesize[], int dst_x, int dst_y, int src_x, int src_y, int w, int h)
Copy a rectangle from an image to another.
static const AVFilterPad outputs[]
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable; if left to 0/0,...
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags)
Init a draw context.
Describe the class of an AVClass context structure.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
static const AVOption tile_options[]
static void get_tile_pos(AVFilterContext *ctx, unsigned *x, unsigned *y, unsigned current)
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to 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
static const AVFilterPad tile_inputs[]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static AVRational av_make_q(int num, int den)
Create an AVRational.
void ff_fill_rectangle(FFDrawContext *draw, FFDrawColor *color, uint8_t *dst[], int dst_linesize[], int dst_x, int dst_y, int w, int h)
Fill a rectangle with an uniform color.
AVFilterContext * src
source filter
static int request_frame(AVFilterLink *outlink)
#define i(width, name, range_min, range_max)
int w
agreed upon image width
AVFilterFormats * ff_draw_supported_pixel_formats(unsigned flags)
Return the list of pixel formats supported by the draw functions.
static av_cold int init(AVFilterContext *ctx)
const char * name
Pad name.
static int end_last_frame(AVFilterContext *ctx)
void ff_draw_color(FFDrawContext *draw, FFDrawColor *color, const uint8_t rgba[4])
Prepare a color.
int h
agreed upon image height
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
static void draw_blank_frame(AVFilterContext *ctx, AVFrame *out_buf)
AVFILTER_DEFINE_CLASS(tile)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.