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),
77 if (tile->
w > UINT_MAX / tile->
h) {
84 if ((tile->
w - 1 > (UINT32_MAX - 2 * tile->
margin) / tile->
padding) ||
86 av_log(ctx,
AV_LOG_ERROR,
"Combination of Tile size %ux%u, padding %d and margin %d overflows.\n",
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;
168 x0, y0, inlink->
w, inlink->
h);
217 0, 0, outlink->
w, outlink->
h);
230 x0, y0, x1, y1, inlink->
w, inlink->
h);
239 x0, y0, 0, 0, inlink->
w, inlink->
h);
297 .priv_class = &tile_class,
AVFilterFormats * ff_draw_supported_pixel_formats(unsigned flags)
Return the list of pixel formats supported by the draw functions.
This structure describes decoded (raw) audio or video data.
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 int request_frame(AVFilterLink *outlink)
#define AV_LOG_WARNING
Something somehow does not look correct.
Main libavfilter public API header.
int h
agreed upon image height
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
const char * name
Pad name.
AVFilterLink ** inputs
array of pointers to input links
static int end_last_frame(AVFilterContext *ctx)
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static int config_props(AVFilterLink *outlink)
#define AVERROR_EOF
End of file.
static const AVFilterPad tile_inputs[]
A filter pad used for either input or output.
A link between two filters.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable; if left to 0/0, will be automatically copied from the first input of the source filter if it exists.
static void draw_blank_frame(AVFilterContext *ctx, AVFrame *out_buf)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
AVFILTER_DEFINE_CLASS(tile)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
void ff_draw_color(FFDrawContext *draw, FFDrawColor *color, const uint8_t rgba[4])
Prepare a color.
int w
agreed upon image width
static int query_formats(AVFilterContext *ctx)
AVFilterContext * src
source filter
static const AVFilterPad tile_outputs[]
static av_cold int init(AVFilterContext *ctx)
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
static const AVFilterPad outputs[]
int format
agreed upon media format
static av_cold void uninit(AVFilterContext *ctx)
static void get_tile_pos(AVFilterContext *ctx, unsigned *x, unsigned *y, unsigned current)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
static AVRational av_make_q(int num, int den)
Create an AVRational.
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
Describe the class of an AVClass context structure.
const char * name
Filter name.
int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags)
Init a draw context.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
offset must point to two consecutive integers
AVFilterLink ** outputs
array of pointers to output links
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
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
AVFilterContext * dst
dest filter
static const AVOption tile_options[]
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.
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
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 av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.