91 for (p = 0; p <
s->nb_planes; p++) {
95 for (y =
s->borders[p].top; y < s->
planeheight[p] -
s->borders[p].bottom; y++) {
96 memset(ptr + y * linesize,
97 *(ptr + y * linesize +
s->borders[p].left),
99 memset(ptr + y * linesize +
s->planewidth[p] -
s->borders[p].right,
100 *(ptr + y * linesize +
s->planewidth[p] -
s->borders[p].right - 1),
101 s->borders[p].right);
104 for (y = 0; y <
s->borders[p].top; y++) {
105 memcpy(ptr + y * linesize,
106 ptr +
s->borders[p].top * linesize,
s->planewidth[p]);
109 for (y =
s->planeheight[p] -
s->borders[p].bottom; y < s->
planeheight[p]; y++) {
110 memcpy(ptr + y * linesize,
111 ptr + (
s->planeheight[p] -
s->borders[p].bottom - 1) * linesize,
121 for (p = 0; p <
s->nb_planes; p++) {
122 uint16_t *ptr = (uint16_t *)
frame->
data[p];
125 for (y =
s->borders[p].top; y < s->
planeheight[p] -
s->borders[p].bottom; y++) {
126 for (x = 0; x <
s->borders[p].left; x++) {
127 ptr[y * linesize + x] = *(ptr + y * linesize +
s->borders[p].left);
130 for (x = 0; x <
s->borders[p].right; x++) {
131 ptr[y * linesize +
s->planewidth[p] -
s->borders[p].right + x] =
132 *(ptr + y * linesize +
s->planewidth[p] -
s->borders[p].right - 1);
136 for (y = 0; y <
s->borders[p].top; y++) {
137 memcpy(ptr + y * linesize,
138 ptr +
s->borders[p].top * linesize,
s->planewidth[p] * 2);
141 for (y =
s->planeheight[p] -
s->borders[p].bottom; y < s->
planeheight[p]; y++) {
142 memcpy(ptr + y * linesize,
143 ptr + (
s->planeheight[p] -
s->borders[p].bottom - 1) * linesize,
144 s->planewidth[p] * 2);
153 for (p = 0; p <
s->nb_planes; p++) {
157 for (y =
s->borders[p].top; y < s->
planeheight[p] -
s->borders[p].bottom; y++) {
158 for (x = 0; x <
s->borders[p].left; x++) {
159 ptr[y * linesize + x] = ptr[y * linesize +
s->borders[p].left * 2 - 1 - x];
162 for (x = 0; x <
s->borders[p].right; x++) {
163 ptr[y * linesize +
s->planewidth[p] -
s->borders[p].right + x] =
164 ptr[y * linesize +
s->planewidth[p] -
s->borders[p].right - 1 - x];
168 for (y = 0; y <
s->borders[p].top; y++) {
169 memcpy(ptr + y * linesize,
170 ptr + (
s->borders[p].top * 2 - 1 - y) * linesize,
174 for (y = 0; y <
s->borders[p].bottom; y++) {
175 memcpy(ptr + (
s->planeheight[p] -
s->borders[p].bottom + y) * linesize,
176 ptr + (
s->planeheight[p] -
s->borders[p].bottom - 1 - y) * linesize,
186 for (p = 0; p <
s->nb_planes; p++) {
187 uint16_t *ptr = (uint16_t *)
frame->
data[p];
190 for (y =
s->borders[p].top; y < s->
planeheight[p] -
s->borders[p].bottom; y++) {
191 for (x = 0; x <
s->borders[p].left; x++) {
192 ptr[y * linesize + x] = ptr[y * linesize +
s->borders[p].left * 2 - 1 - x];
195 for (x = 0; x <
s->borders[p].right; x++) {
196 ptr[y * linesize +
s->planewidth[p] -
s->borders[p].right + x] =
197 ptr[y * linesize +
s->planewidth[p] -
s->borders[p].right - 1 - x];
201 for (y = 0; y <
s->borders[p].top; y++) {
202 memcpy(ptr + y * linesize,
203 ptr + (
s->borders[p].top * 2 - 1 - y) * linesize,
204 s->planewidth[p] * 2);
207 for (y = 0; y <
s->borders[p].bottom; y++) {
208 memcpy(ptr + (
s->planeheight[p] -
s->borders[p].bottom + y) * linesize,
209 ptr + (
s->planeheight[p] -
s->borders[p].bottom - 1 - y) * linesize,
210 s->planewidth[p] * 2);
219 for (p = 0; p <
s->nb_planes; p++) {
224 for (y =
s->borders[p].top; y < s->
planeheight[p] -
s->borders[p].bottom; y++) {
225 memset(ptr + y * linesize,
fill,
s->borders[p].left);
226 memset(ptr + y * linesize +
s->planewidth[p] -
s->borders[p].right,
fill,
227 s->borders[p].right);
230 for (y = 0; y <
s->borders[p].top; y++) {
231 memset(ptr + y * linesize,
fill,
s->planewidth[p]);
234 for (y =
s->planeheight[p] -
s->borders[p].bottom; y < s->
planeheight[p]; y++) {
235 memset(ptr + y * linesize,
fill,
s->planewidth[p]);
244 for (p = 0; p <
s->nb_planes; p++) {
245 uint16_t *ptr = (uint16_t *)
frame->
data[p];
246 uint16_t
fill =
s->fill[p] << (
s->depth - 8);
249 for (y =
s->borders[p].top; y < s->
planeheight[p] -
s->borders[p].bottom; y++) {
250 for (x = 0; x <
s->borders[p].left; x++) {
251 ptr[y * linesize + x] =
fill;
254 for (x = 0; x <
s->borders[p].right; x++) {
255 ptr[y * linesize +
s->planewidth[p] -
s->borders[p].right + x] =
fill;
259 for (y = 0; y <
s->borders[p].top; y++) {
260 for (x = 0; x <
s->planewidth[p]; x++) {
261 ptr[y * linesize + x] =
fill;
265 for (y =
s->planeheight[p] -
s->borders[p].bottom; y < s->
planeheight[p]; y++) {
266 for (x = 0; x <
s->planewidth[p]; x++) {
267 ptr[y * linesize + x] =
fill;
277 for (p = 0; p <
s->nb_planes; p++) {
281 for (y =
s->borders[p].top; y < s->
planeheight[p] -
s->borders[p].bottom; y++) {
282 for (x = 0; x <
s->borders[p].left; x++) {
283 ptr[y * linesize + x] = ptr[y * linesize +
s->borders[p].left * 2 - x];
286 for (x = 0; x <
s->borders[p].right; x++) {
287 ptr[y * linesize +
s->planewidth[p] -
s->borders[p].right + x] =
288 ptr[y * linesize +
s->planewidth[p] -
s->borders[p].right - 2 - x];
292 for (y = 0; y <
s->borders[p].top; y++) {
293 memcpy(ptr + y * linesize,
294 ptr + (
s->borders[p].top * 2 - y) * linesize,
298 for (y = 0; y <
s->borders[p].bottom; y++) {
299 memcpy(ptr + (
s->planeheight[p] -
s->borders[p].bottom + y) * linesize,
300 ptr + (
s->planeheight[p] -
s->borders[p].bottom - 2 - y) * linesize,
310 for (p = 0; p <
s->nb_planes; p++) {
311 uint16_t *ptr = (uint16_t *)
frame->
data[p];
314 for (y =
s->borders[p].top; y < s->
planeheight[p] -
s->borders[p].bottom; y++) {
315 for (x = 0; x <
s->borders[p].left; x++) {
316 ptr[y * linesize + x] = ptr[y * linesize +
s->borders[p].left * 2 - x];
319 for (x = 0; x <
s->borders[p].right; x++) {
320 ptr[y * linesize +
s->planewidth[p] -
s->borders[p].right + x] =
321 ptr[y * linesize +
s->planewidth[p] -
s->borders[p].right - 2 - x];
325 for (y = 0; y <
s->borders[p].top; y++) {
326 memcpy(ptr + y * linesize,
327 ptr + (
s->borders[p].top * 2 - y) * linesize,
328 s->planewidth[p] * 2);
331 for (y = 0; y <
s->borders[p].bottom; y++) {
332 memcpy(ptr + (
s->planeheight[p] -
s->borders[p].bottom + y) * linesize,
333 ptr + (
s->planeheight[p] -
s->borders[p].bottom - 2 - y) * linesize,
334 s->planewidth[p] * 2);
343 for (p = 0; p <
s->nb_planes; p++) {
347 for (y =
s->borders[p].top; y < s->
planeheight[p] -
s->borders[p].bottom; y++) {
348 for (x = 0; x <
s->borders[p].left; x++) {
349 ptr[y * linesize + x] = ptr[y * linesize +
s->planewidth[p] -
s->borders[p].right -
s->borders[p].left + x];
352 for (x = 0; x <
s->borders[p].right; x++) {
353 ptr[y * linesize +
s->planewidth[p] -
s->borders[p].right + x] =
354 ptr[y * linesize +
s->borders[p].left + x];
358 for (y = 0; y <
s->borders[p].top; y++) {
359 memcpy(ptr + y * linesize,
360 ptr + (
s->planeheight[p] -
s->borders[p].bottom -
s->borders[p].top + y) * linesize,
364 for (y = 0; y <
s->borders[p].bottom; y++) {
365 memcpy(ptr + (
s->planeheight[p] -
s->borders[p].bottom + y) * linesize,
366 ptr + (
s->borders[p].top + y) * linesize,
376 for (p = 0; p <
s->nb_planes; p++) {
377 uint16_t *ptr = (uint16_t *)
frame->
data[p];
380 for (y =
s->borders[p].top; y < s->
planeheight[p] -
s->borders[p].bottom; y++) {
381 for (x = 0; x <
s->borders[p].left; x++) {
382 ptr[y * linesize + x] = ptr[y * linesize +
s->planewidth[p] -
s->borders[p].right -
s->borders[p].left + x];
385 for (x = 0; x <
s->borders[p].right; x++) {
386 ptr[y * linesize +
s->planewidth[p] -
s->borders[p].right + x] =
387 ptr[y * linesize +
s->borders[p].left + x];
391 for (y = 0; y <
s->borders[p].top; y++) {
392 memcpy(ptr + y * linesize,
393 ptr + (
s->planeheight[p] -
s->borders[p].bottom -
s->borders[p].top + y) * linesize,
394 s->planewidth[p] * 2);
397 for (y = 0; y <
s->borders[p].bottom; y++) {
398 memcpy(ptr + (
s->planeheight[p] -
s->borders[p].bottom + y) * linesize,
399 ptr + (
s->borders[p].top + y) * linesize,
400 s->planewidth[p] * 2);
419 for (p = 0; p <
s->nb_planes; p++) {
423 const int start_left =
s->borders[p].left;
424 const int start_right =
s->planewidth[p] -
s->borders[p].right;
425 const int start_top =
s->borders[p].top;
426 const int start_bottom =
s->planeheight[p] -
s->borders[p].bottom;
428 for (y = 0; y < start_top; y++) {
429 for (x = 0; x <
s->planewidth[p]; x++) {
430 int src = ptr[y * linesize + x];
431 ptr[y * linesize + x] =
lerp8(
fill,
src, start_top - y, start_top);
435 for (y = start_bottom; y <
s->planeheight[p]; y++) {
436 for (x = 0; x <
s->planewidth[p]; x++) {
437 int src = ptr[y * linesize + x];
438 ptr[y * linesize + x] =
lerp8(
fill,
src, y - start_bottom,
s->borders[p].bottom);
442 for (y = 0; y <
s->planeheight[p]; y++) {
443 for (x = 0; x < start_left; x++) {
444 int src = ptr[y * linesize + x];
445 ptr[y * linesize + x] =
lerp8(
fill,
src, start_left - x, start_left);
448 for (x = 0; x <
s->borders[p].right; x++) {
449 int src = ptr[y * linesize + start_right + x];
450 ptr[y * linesize + start_right + x] =
lerp8(
fill,
src, x,
s->borders[p].right);
458 const int depth =
s->depth;
461 for (p = 0; p <
s->nb_planes; p++) {
462 uint16_t *ptr = (uint16_t *)
frame->
data[p];
463 const uint16_t
fill =
s->fill[p] << (
depth - 8);
465 const int start_left =
s->borders[p].left;
466 const int start_right =
s->planewidth[p] -
s->borders[p].right;
467 const int start_top =
s->borders[p].top;
468 const int start_bottom =
s->planeheight[p] -
s->borders[p].bottom;
470 for (y = 0; y < start_top; y++) {
471 for (x = 0; x <
s->planewidth[p]; x++) {
472 int src = ptr[y * linesize + x];
477 for (y = start_bottom; y <
s->planeheight[p]; y++) {
478 for (x = 0; x <
s->planewidth[p]; x++) {
479 int src = ptr[y * linesize + x];
484 for (y = 0; y <
s->planeheight[p]; y++) {
485 for (x = 0; x < start_left; x++) {
486 int src = ptr[y * linesize + x];
490 for (x = 0; x <
s->borders[p].right; x++) {
491 int src = ptr[y * linesize + start_right + x];
513 s->nb_planes =
desc->nb_components;
514 s->depth =
desc->comp[0].depth;
517 s->planeheight[0] =
s->planeheight[3] = inlink->
h;
519 s->planewidth[0] =
s->planewidth[3] = inlink->
w;
521 if (inlink->
w <
s->left +
s->right ||
522 inlink->
w <=
s->left ||
523 inlink->
w <=
s->right ||
524 inlink->
h <
s->top +
s->bottom ||
525 inlink->
h <=
s->top ||
526 inlink->
h <=
s->bottom ||
527 inlink->
w <
s->left * 2 ||
528 inlink->
w <
s->right * 2 ||
529 inlink->
h <
s->top * 2 ||
530 inlink->
h <
s->bottom * 2) {
535 s->borders[0].left =
s->borders[3].left =
s->left;
536 s->borders[0].right =
s->borders[3].right =
s->right;
537 s->borders[0].top =
s->borders[3].top =
s->top;
538 s->borders[0].bottom =
s->borders[3].bottom =
s->bottom;
540 s->borders[1].left =
s->left >>
desc->log2_chroma_w;
541 s->borders[1].right =
s->right >>
desc->log2_chroma_w;
542 s->borders[1].top =
s->top >>
desc->log2_chroma_h;
543 s->borders[1].bottom =
s->bottom >>
desc->log2_chroma_h;
545 s->borders[2].left =
s->left >>
desc->log2_chroma_w;
546 s->borders[2].right =
s->right >>
desc->log2_chroma_w;
547 s->borders[2].top =
s->top >>
desc->log2_chroma_h;
548 s->borders[2].bottom =
s->bottom >>
desc->log2_chroma_h;
563 s->yuv_color[
A] =
s->rgba_color[
A];
570 for (
i = 0;
i < 4;
i++)
571 s->fill[rgba_map[
i]] =
s->rgba_color[
i];
573 memcpy(
s->fill,
s->yuv_color,
sizeof(
s->yuv_color));
580 char *res,
int res_len,
int flags)
591 #define OFFSET(x) offsetof(FillBordersContext, x)
592 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
632 .
name =
"fillborders",
635 .priv_class = &fillborders_class,
static const AVFilterPad inputs[]
static const AVFilterPad outputs[]
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options.
Main libavfilter public API header.
#define flags(name, subs,...)
common internal and external API header
#define AV_CEIL_RSHIFT(a, b)
static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
Clip a signed integer to an unsigned power of two range.
int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt)
mode
Use these values in ebur128_init (or'ed).
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Various defines for YUV<->RGB conversion.
#define RGB_TO_U_CCIR(r1, g1, b1, shift)
#define RGB_TO_Y_CCIR(r, g, b)
#define RGB_TO_V_CCIR(r1, g1, b1, shift)
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static enum AVPixelFormat pix_fmts[]
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
#define AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUV420P14
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
#define AV_PIX_FMT_YUVA422P12
#define AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY14
#define AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P10
typedef void(RENAME(mix_any_func_type))
Describe the class of an AVClass context structure.
void * priv
private data for use by the filter
AVFilterLink ** outputs
array of pointers to output links
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
AVFilterContext * dst
dest filter
int format
agreed upon media format
A filter pad used for either input or output.
const char * name
Pad name.
const char * name
Filter name.
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, size in bytes of each picture line.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
void(* fillborders)(struct FillBordersContext *s, AVFrame *frame)
static void mirror_borders8(FillBordersContext *s, AVFrame *frame)
static void reflect_borders16(FillBordersContext *s, AVFrame *frame)
static void mirror_borders16(FillBordersContext *s, AVFrame *frame)
static void smear_borders8(FillBordersContext *s, AVFrame *frame)
static void fixed_borders16(FillBordersContext *s, AVFrame *frame)
static void fixed_borders8(FillBordersContext *s, AVFrame *frame)
static const AVOption fillborders_options[]
static const AVFilterPad fillborders_inputs[]
AVFILTER_DEFINE_CLASS(fillborders)
static int query_formats(AVFilterContext *ctx)
static void fade_borders16(FillBordersContext *s, AVFrame *frame)
static int config_input(AVFilterLink *inlink)
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
static int lerp8(int fill, int src, int pos, int size)
static void wrap_borders8(FillBordersContext *s, AVFrame *frame)
static const AVFilterPad fillborders_outputs[]
AVFilter ff_vf_fillborders
static void smear_borders16(FillBordersContext *s, AVFrame *frame)
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
static void reflect_borders8(FillBordersContext *s, AVFrame *frame)
static void wrap_borders16(FillBordersContext *s, AVFrame *frame)
static int lerp16(int fill, int src, int pos, int size, int depth)
static void fade_borders8(FillBordersContext *s, AVFrame *frame)