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),
84 if ((
tile->w - 1 > (UINT32_MAX - 2 *
tile->margin) /
tile->padding) ||
85 (
tile->h - 1 > (UINT32_MAX - 2 *
tile->margin) /
tile->padding)) {
92 if (
tile->nb_frames == 0) {
100 if (
tile->overlap >=
tile->nb_frames) {
102 tile->overlap =
tile->nb_frames - 1;
105 if (
tile->init_padding >=
tile->nb_frames) {
129 const unsigned total_margin_w = (
tile->w - 1) *
tile->padding + 2*
tile->margin;
130 const unsigned total_margin_h = (
tile->h - 1) *
tile->padding + 2*
tile->margin;
133 if (inlink->
w > (INT_MAX - total_margin_w) /
tile->w) {
138 if (inlink->
h > (INT_MAX - total_margin_h) /
tile->h) {
143 outlink->
w =
tile->w * inlink->
w + total_margin_w;
144 outlink->
h =
tile->h * inlink->
h + total_margin_h;
164 *x =
tile->margin + (inlink->
w +
tile->padding) * tx;
165 *y =
tile->margin + (inlink->
h +
tile->padding) * ty;
177 x0, y0, inlink->
w, inlink->
h);
188 while (
tile->current <
tile->nb_frames)
211 if (!
tile->out_ref) {
213 if (!
tile->out_ref) {
218 tile->out_ref->width = outlink->
w;
219 tile->out_ref->height = outlink->
h;
222 if (
tile->margin ||
tile->padding ||
tile->init_padding)
225 tile->out_ref->linesize,
226 0, 0, outlink->
w, outlink->
h);
227 tile->init_padding = 0;
230 if (
tile->prev_out_ref) {
237 tile->out_ref->data,
tile->out_ref->linesize,
238 tile->prev_out_ref->data,
tile->prev_out_ref->linesize,
239 x0, y0, x1, y1, inlink->
w, inlink->
h);
246 tile->out_ref->data,
tile->out_ref->linesize,
248 x0, y0, 0, 0, inlink->
w, inlink->
h);
251 if (++
tile->current ==
tile->nb_frames)
298 .p.priv_class = &tile_class,
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
static int request_frame(AVFilterLink *outlink)
const FFFilter ff_vf_tile
static AVFormatContext * ctx
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
Main libavfilter public API header.
static int FUNC tile(CodedBitstreamContext *ctx, RWContext *rw, APVRawTile *current, int tile_idx, uint32_t tile_size)
#define i(width, name, range_min, range_max)
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
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.
void ff_draw_color(FFDrawContext *draw, FFDrawColor *color, const uint8_t rgba[4])
Prepare a color.
AVFilterFormats * ff_draw_supported_pixel_formats(unsigned flags)
Return the list of pixel formats supported by the draw functions.
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.
int ff_draw_init_from_link(FFDrawContext *draw, const AVFilterLink *link, unsigned flags)
Init a draw context, taking the format, colorspace and range from the given filter link.
int(* init)(AVBSFContext *ctx)
static struct @111144215057303131116103221376075045141373005341 current
@ AV_OPT_TYPE_IMAGE_SIZE
Underlying C type is two consecutive integers.
@ AV_OPT_TYPE_INT
Underlying C type is int.
@ AV_OPT_TYPE_COLOR
Underlying C type is uint8_t[4].
#define AVERROR_EOF
End of file.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
static AVRational av_make_q(int num, int den)
Create an AVRational.
static av_cold void uninit(AVBitStreamFilterContext *ctx)
#define FILTER_INPUTS(array)
#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 int config_props(AVBitStreamFilterLink *link)
Describe the class of an AVClass context structure.
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
AVFilterContext * src
source filter
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
AVFilterContext * dst
dest filter
A filter pad used for either input or output.
This structure describes decoded (raw) audio or video data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
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 int config_props(AVFilterLink *outlink)
static void get_tile_pos(AVFilterContext *ctx, unsigned *x, unsigned *y, unsigned current)
static const AVOption tile_options[]
static int end_last_frame(AVFilterContext *ctx)
static int request_frame(AVFilterLink *outlink)
static const AVFilterPad tile_inputs[]
static void draw_blank_frame(AVFilterContext *ctx, AVFrame *out_buf)
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
static av_cold void uninit(AVFilterContext *ctx)
static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
static const AVFilterPad tile_outputs[]
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.