94 return (
int)d & ~((1 << chroma_sub) - 1);
120 "Error when evaluating the expression '%s' for %s\n",
131 char *res,
int res_len,
int flags)
136 if (!strcmp(cmd,
"x"))
138 else if (!strcmp(cmd,
"y"))
172 static const enum AVPixelFormat overlay_pix_fmts_yuv420[] = {
176 static const enum AVPixelFormat main_pix_fmts_yuv420p10[] = {
180 static const enum AVPixelFormat overlay_pix_fmts_yuv420p10[] = {
187 static const enum AVPixelFormat overlay_pix_fmts_yuv422[] = {
191 static const enum AVPixelFormat main_pix_fmts_yuv422p10[] = {
194 static const enum AVPixelFormat overlay_pix_fmts_yuv422p10[] = {
201 static const enum AVPixelFormat overlay_pix_fmts_yuv444[] = {
230 main_formats = main_pix_fmts_yuv420;
231 overlay_formats = overlay_pix_fmts_yuv420;
234 main_formats = main_pix_fmts_yuv420p10;
235 overlay_formats = overlay_pix_fmts_yuv420p10;
238 main_formats = main_pix_fmts_yuv422;
239 overlay_formats = overlay_pix_fmts_yuv422;
242 main_formats = main_pix_fmts_yuv422p10;
243 overlay_formats = overlay_pix_fmts_yuv422p10;
246 main_formats = main_pix_fmts_yuv444;
247 overlay_formats = overlay_pix_fmts_yuv444;
250 main_formats = main_pix_fmts_rgb;
251 overlay_formats = overlay_pix_fmts_rgb;
254 main_formats = main_pix_fmts_gbrp;
255 overlay_formats = overlay_pix_fmts_gbrp;
311 "main w:%d h:%d fmt:%s overlay w:%d h:%d fmt:%s\n",
337 #define FAST_DIV255(x) ((((x) + 128) * 257) >> 16) 343 #define UNPREMULTIPLY_ALPHA(x, y) ((((x) << 16) - ((x) << 9) + (x)) / ((((x) + (y)) << 8) - ((x) + (y)) - (y) * (x))) 351 int main_has_alpha,
int x,
int y,
352 int is_straight,
int jobnr,
int nb_jobs)
355 int i, imax, j, jmax;
356 const int src_w = src->
width;
357 const int src_h = src->
height;
358 const int dst_w = dst->
width;
359 const int dst_h = dst->
height;
375 imax =
FFMIN3(-y + dst_h,
FFMIN(src_h, dst_h), y + src_h);
377 slice_start = i + (imax * jobnr) / nb_jobs;
378 slice_end = i + (imax * (jobnr+1)) / nb_jobs;
381 dp = dst->
data[0] + (y + slice_start) * dst->
linesize[0];
383 for (i = slice_start; i <
slice_end; i++) {
386 d = dp + (x+j) * dstep;
388 for (jmax =
FFMIN(-x + dst_w, src_w); j < jmax; j++) {
393 if (main_has_alpha && alpha != 0 && alpha != 255) {
409 d[dr] = is_straight ?
FAST_DIV255(d[dr] * (255 - alpha) + S[sr] * alpha) :
411 d[dg] = is_straight ?
FAST_DIV255(d[dg] * (255 - alpha) + S[sg] * alpha) :
413 d[db] = is_straight ?
FAST_DIV255(d[db] * (255 - alpha) + S[sb] * alpha) :
416 if (main_has_alpha) {
436 #define DEFINE_BLEND_PLANE(depth, nbits) \ 437 static av_always_inline void blend_plane_##depth##_##nbits##bits(AVFilterContext *ctx, \ 438 AVFrame *dst, const AVFrame *src, \ 439 int src_w, int src_h, \ 440 int dst_w, int dst_h, \ 441 int i, int hsub, int vsub, \ 443 int main_has_alpha, \ 452 OverlayContext *octx = ctx->priv; \ 453 int src_wp = AV_CEIL_RSHIFT(src_w, hsub); \ 454 int src_hp = AV_CEIL_RSHIFT(src_h, vsub); \ 455 int dst_wp = AV_CEIL_RSHIFT(dst_w, hsub); \ 456 int dst_hp = AV_CEIL_RSHIFT(dst_h, vsub); \ 459 uint##depth##_t *s, *sp, *d, *dp, *dap, *a, *da, *ap; \ 460 int jmax, j, k, kmax; \ 461 int slice_start, slice_end; \ 462 const uint##depth##_t max = (1 << nbits) - 1; \ 463 const uint##depth##_t mid = (1 << (nbits -1)) ; \ 464 int bytes = depth / 8; \ 468 jmax = FFMIN3(-yp + dst_hp, FFMIN(src_hp, dst_hp), yp + src_hp); \ 470 slice_start = j + (jmax * jobnr) / nb_jobs; \ 471 slice_end = j + (jmax * (jobnr+1)) / nb_jobs; \ 473 sp = (uint##depth##_t *)(src->data[i] + (slice_start) * src->linesize[i]); \ 474 dp = (uint##depth##_t *)(dst->data[dst_plane] \ 475 + (yp + slice_start) * dst->linesize[dst_plane] \ 477 ap = (uint##depth##_t *)(src->data[3] + (slice_start << vsub) * src->linesize[3]); \ 478 dap = (uint##depth##_t *)(dst->data[3] + ((yp + slice_start) << vsub) * dst->linesize[3]); \ 480 for (j = slice_start; j < slice_end; j++) { \ 482 d = dp + (xp+k) * dst_step; \ 484 a = ap + (k<<hsub); \ 485 da = dap + ((xp+k) << hsub); \ 486 kmax = FFMIN(-xp + dst_wp, src_wp); \ 488 if (nbits == 8 && ((vsub && j+1 < src_hp) || !vsub) && octx->blend_row[i]) { \ 489 int c = octx->blend_row[i]((uint8_t*)d, (uint8_t*)da, (uint8_t*)s, \ 490 (uint8_t*)a, kmax - k, src->linesize[3]); \ 494 da += (1 << hsub) * c; \ 495 a += (1 << hsub) * c; \ 498 for (; k < kmax; k++) { \ 499 int alpha_v, alpha_h, alpha; \ 502 if (hsub && vsub && j+1 < src_hp && k+1 < src_wp) { \ 503 alpha = (a[0] + a[src->linesize[3]] + \ 504 a[1] + a[src->linesize[3]+1]) >> 2; \ 505 } else if (hsub || vsub) { \ 506 alpha_h = hsub && k+1 < src_wp ? \ 507 (a[0] + a[1]) >> 1 : a[0]; \ 508 alpha_v = vsub && j+1 < src_hp ? \ 509 (a[0] + a[src->linesize[3]]) >> 1 : a[0]; \ 510 alpha = (alpha_v + alpha_h) >> 1; \ 515 if (main_has_alpha && alpha != 0 && alpha != max) { \ 518 if (hsub && vsub && j+1 < src_hp && k+1 < src_wp) { \ 519 alpha_d = (da[0] + da[dst->linesize[3]] + \ 520 da[1] + da[dst->linesize[3]+1]) >> 2; \ 521 } else if (hsub || vsub) { \ 522 alpha_h = hsub && k+1 < src_wp ? \ 523 (da[0] + da[1]) >> 1 : da[0]; \ 524 alpha_v = vsub && j+1 < src_hp ? \ 525 (da[0] + da[dst->linesize[3]]) >> 1 : da[0]; \ 526 alpha_d = (alpha_v + alpha_h) >> 1; \ 529 alpha = UNPREMULTIPLY_ALPHA(alpha, alpha_d); \ 533 *d = (*d * (max - alpha) + *s * alpha) / max; \ 535 *d = FAST_DIV255(*d * (255 - alpha) + *s * alpha); \ 539 *d = av_clip((*d * (max - alpha) + *s * alpha) / max + *s - mid, -mid, mid) + mid; \ 541 *d = FFMIN((*d * (max - alpha) + *s * alpha) / max + *s, max); \ 544 *d = av_clip(FAST_DIV255((*d - mid) * (max - alpha)) + *s - mid, -mid, mid) + mid; \ 546 *d = FFMIN(FAST_DIV255(*d * (max - alpha)) + *s, max); \ 554 dp += dst->linesize[dst_plane] / bytes; \ 555 sp += src->linesize[i] / bytes; \ 556 ap += (1 << vsub) * src->linesize[3] / bytes; \ 557 dap += (1 << vsub) * dst->linesize[3] / bytes; \ 563 #define DEFINE_ALPHA_COMPOSITE(depth, nbits) \ 564 static inline void alpha_composite_##depth##_##nbits##bits(const AVFrame *src, const AVFrame *dst, \ 565 int src_w, int src_h, \ 566 int dst_w, int dst_h, \ 568 int jobnr, int nb_jobs) \ 570 uint##depth##_t alpha; \ 571 uint##depth##_t *s, *sa, *d, *da; \ 572 int i, imax, j, jmax; \ 573 int slice_start, slice_end; \ 574 const uint##depth##_t max = (1 << nbits) - 1; \ 575 int bytes = depth / 8; \ 577 imax = FFMIN(-y + dst_h, src_h); \ 578 slice_start = (imax * jobnr) / nb_jobs; \ 579 slice_end = ((imax * (jobnr+1)) / nb_jobs); \ 582 sa = (uint##depth##_t *)(src->data[3] + (i + slice_start) * src->linesize[3]); \ 583 da = (uint##depth##_t *)(dst->data[3] + (y + i + slice_start) * dst->linesize[3]); \ 585 for (i = i + slice_start; i < slice_end; i++) { \ 590 for (jmax = FFMIN(-x + dst_w, src_w); j < jmax; j++) { \ 592 if (alpha != 0 && alpha != max) { \ 593 uint8_t alpha_d = *d; \ 594 alpha = UNPREMULTIPLY_ALPHA(alpha, alpha_d); \ 598 else if (alpha > 0) { \ 601 *d += (max - *d) * *s / max; \ 603 *d += FAST_DIV255((max - *d) * *s); \ 608 da += dst->linesize[3] / bytes; \ 609 sa += src->linesize[3] / bytes; \ 615 #define DEFINE_BLEND_SLICE_YUV(depth, nbits) \ 616 static av_always_inline void blend_slice_yuv_##depth##_##nbits##bits(AVFilterContext *ctx, \ 617 AVFrame *dst, const AVFrame *src, \ 618 int hsub, int vsub, \ 619 int main_has_alpha, \ 622 int jobnr, int nb_jobs) \ 624 OverlayContext *s = ctx->priv; \ 625 const int src_w = src->width; \ 626 const int src_h = src->height; \ 627 const int dst_w = dst->width; \ 628 const int dst_h = dst->height; \ 630 blend_plane_##depth##_##nbits##bits(ctx, dst, src, src_w, src_h, dst_w, dst_h, 0, 0, 0, \ 631 x, y, main_has_alpha, s->main_desc->comp[0].plane, s->main_desc->comp[0].offset, \ 632 s->main_desc->comp[0].step, is_straight, 1, jobnr, nb_jobs); \ 633 blend_plane_##depth##_##nbits##bits(ctx, dst, src, src_w, src_h, dst_w, dst_h, 1, hsub, vsub, \ 634 x, y, main_has_alpha, s->main_desc->comp[1].plane, s->main_desc->comp[1].offset, \ 635 s->main_desc->comp[1].step, is_straight, 1, jobnr, nb_jobs); \ 636 blend_plane_##depth##_##nbits##bits(ctx, dst, src, src_w, src_h, dst_w, dst_h, 2, hsub, vsub, \ 637 x, y, main_has_alpha, s->main_desc->comp[2].plane, s->main_desc->comp[2].offset, \ 638 s->main_desc->comp[2].step, is_straight, 1, jobnr, nb_jobs); \ 640 if (main_has_alpha) \ 641 alpha_composite_##depth##_##nbits##bits(src, dst, src_w, src_h, dst_w, dst_h, x, y, \ 657 const int src_w = src->width;
658 const int src_h = src->height;
659 const int dst_w = dst->width;
660 const int dst_h = dst->height;
662 blend_plane_8_8bits(ctx, dst, src, src_w, src_h, dst_w, dst_h, 0, 0, 0, x, y, main_has_alpha,
665 blend_plane_8_8bits(ctx, dst, src, src_w, src_h, dst_w, dst_h, 1, hsub, vsub, x, y, main_has_alpha,
668 blend_plane_8_8bits(ctx, dst, src, src_w, src_h, dst_w, dst_h, 2, hsub, vsub, x, y, main_has_alpha,
673 alpha_composite_8_8bits(src, dst, src_w, src_h, dst_w, dst_h, x, y, jobnr, nb_jobs);
680 blend_slice_yuv_8_8bits(ctx, td->
dst, td->
src, 1, 1, 0, s->
x, s->
y, 1, jobnr, nb_jobs);
688 blend_slice_yuv_8_8bits(ctx, td->
dst, td->
src, 1, 1, 1, s->
x, s->
y, 1, jobnr, nb_jobs);
696 blend_slice_yuv_16_10bits(ctx, td->
dst, td->
src, 1, 1, 0, s->
x, s->
y, 1, jobnr, nb_jobs);
704 blend_slice_yuv_16_10bits(ctx, td->
dst, td->
src, 1, 1, 1, s->
x, s->
y, 1, jobnr, nb_jobs);
712 blend_slice_yuv_16_10bits(ctx, td->
dst, td->
src, 1, 0, 0, s->
x, s->
y, 1, jobnr, nb_jobs);
720 blend_slice_yuv_16_10bits(ctx, td->
dst, td->
src, 1, 0, 1, s->
x, s->
y, 1, jobnr, nb_jobs);
728 blend_slice_yuv_8_8bits(ctx, td->
dst, td->
src, 1, 0, 0, s->
x, s->
y, 1, jobnr, nb_jobs);
736 blend_slice_yuv_8_8bits(ctx, td->
dst, td->
src, 1, 0, 1, s->
x, s->
y, 1, jobnr, nb_jobs);
744 blend_slice_yuv_8_8bits(ctx, td->
dst, td->
src, 0, 0, 0, s->
x, s->
y, 1, jobnr, nb_jobs);
752 blend_slice_yuv_8_8bits(ctx, td->
dst, td->
src, 0, 0, 1, s->
x, s->
y, 1, jobnr, nb_jobs);
760 blend_slice_planar_rgb(ctx, td->
dst, td->
src, 0, 0, 0, s->
x, s->
y, 1, jobnr, nb_jobs);
768 blend_slice_planar_rgb(ctx, td->
dst, td->
src, 0, 0, 1, s->
x, s->
y, 1, jobnr, nb_jobs);
776 blend_slice_yuv_8_8bits(ctx, td->
dst, td->
src, 1, 1, 0, s->
x, s->
y, 0, jobnr, nb_jobs);
784 blend_slice_yuv_8_8bits(ctx, td->
dst, td->
src, 1, 1, 1, s->
x, s->
y, 0, jobnr, nb_jobs);
792 blend_slice_yuv_8_8bits(ctx, td->
dst, td->
src, 1, 0, 0, s->
x, s->
y, 0, jobnr, nb_jobs);
800 blend_slice_yuv_8_8bits(ctx, td->
dst, td->
src, 1, 0, 1, s->
x, s->
y, 0, jobnr, nb_jobs);
808 blend_slice_yuv_8_8bits(ctx, td->
dst, td->
src, 0, 0, 0, s->
x, s->
y, 0, jobnr, nb_jobs);
816 blend_slice_yuv_8_8bits(ctx, td->
dst, td->
src, 0, 0, 1, s->
x, s->
y, 0, jobnr, nb_jobs);
824 blend_slice_planar_rgb(ctx, td->
dst, td->
src, 0, 0, 0, s->
x, s->
y, 0, jobnr, nb_jobs);
832 blend_slice_planar_rgb(ctx, td->
dst, td->
src, 0, 0, 1, s->
x, s->
y, 0, jobnr, nb_jobs);
1026 if (s->
x < mainpic->
width && s->
x + second->
width >= 0 &&
1052 #define OFFSET(x) offsetof(OverlayContext, x) 1053 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM 1058 {
"eof_action",
"Action to take when encountering EOF from secondary input ",
1067 {
"shortest",
"force termination when the shortest input terminates",
OFFSET(
fs.opt_shortest),
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1,
FLAGS },
1112 .preinit = overlay_framesync_preinit,
1116 .priv_class = &overlay_class,
1120 .
inputs = avfilter_vf_overlay_inputs,
1121 .
outputs = avfilter_vf_overlay_outputs,
static int activate(AVFilterContext *ctx)
int plane
Which of the 4 planes contains the component.
static int blend_slice_yuv420p10(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
static int blend_slice_rgb_pm(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
This structure describes decoded (raw) audio or video data.
#define AV_PIX_FMT_YUVA420P10
int64_t pkt_pos
reordered pos from the last AVPacket that has been input into the decoder
#define AV_PIX_FMT_YUVA422P10
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Main libavfilter public API header.
packed RGB 8:8:8, 24bpp, RGBRGB...
int h
agreed upon image height
const AVPixFmtDescriptor * main_desc
format descriptor for main input
static int blend_slice_yuv444_pm(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static const AVFilterPad avfilter_vf_overlay_inputs[]
void ff_overlay_init_x86(OverlayContext *s, int format, int pix_format, int alpha_format, int main_has_alpha)
int ff_framesync_configure(FFFrameSync *fs)
Configure a frame sync structure.
static int blend_slice_rgba_pm(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
int av_expr_parse(AVExpr **expr, const char *s, const char *const *const_names, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), int log_offset, void *log_ctx)
Parse an expression.
AVFilterFormatsConfig outcfg
Lists of supported formats / etc.
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
static int blend_slice_yuva420_pm(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int blend_slice_gbrp(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int blend_slice_yuv420(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], const AVPixFmtDescriptor *pixdesc)
Compute the max pixel step for each plane of an image with a format described by pixdesc.
const char * name
Pad name.
AVFilterContext * parent
Parent filter context.
AVFilterLink ** inputs
array of pointers to input links
#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.
static int blend_slice_yuv422(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
#define fs(width, name, subs,...)
timestamp utils, mostly useful for debugging/logging purposes
static const char *const var_names[]
int ff_framesync_init_dualinput(FFFrameSync *fs, AVFilterContext *parent)
Initialize a frame sync structure for dualinput.
double var_values[VAR_VARS_NB]
static int blend_slice_yuva444(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
int ff_framesync_dualinput_get_writable(FFFrameSync *fs, AVFrame **f0, AVFrame **f1)
Same as ff_framesync_dualinput_get(), but make sure that f0 is writable.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
uint8_t overlay_rgba_map[4]
static double av_q2d(AVRational a)
Convert an AVRational to a double.
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
#define AV_LOG_VERBOSE
Detailed information.
static int blend_slice_yuva422p10(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int blend_slice_yuv444(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
A filter pad used for either input or output.
A link between two filters.
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define UNPREMULTIPLY_ALPHA(x, y)
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
void ff_framesync_uninit(FFFrameSync *fs)
Free all memory currently allocated.
static int blend_slice_gbrap_pm(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int blend_slice_yuva422_pm(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
void * priv
private data for use by the filter
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
static int config_input_overlay(AVFilterLink *inlink)
static int blend_slice_yuva444_pm(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
int ff_framesync_activate(FFFrameSync *fs)
Examine the frames in the filter's input and try to produce output.
int(* on_event)(struct FFFrameSync *fs)
Callback called when a frame event is ready.
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
int w
agreed upon image width
as above, but U and V bytes are swapped
static const AVFilterPad avfilter_vf_overlay_outputs[]
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
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
static int blend_slice_yuva422(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
packed RGB 8:8:8, 24bpp, BGRBGR...
AVFilterContext * src
source filter
static av_cold int init(AVFilterContext *ctx)
int(* blend_slice)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
int main_pix_step[4]
steps per pixel for each plane of the main output
static const AVFilterPad outputs[]
int format
agreed upon media format
static int blend_slice_yuv422_pm(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt)
static const AVOption overlay_options[]
static int blend_slice_rgba(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int blend_slice_rgb(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int blend_slice_gbrp_pm(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
#define DEFINE_BLEND_SLICE_YUV(depth, nbits)
static av_always_inline void blend_slice_packed_rgb(AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int main_has_alpha, int x, int y, int is_straight, int jobnr, int nb_jobs)
Blend image in src to destination buffer dst at position (x, y).
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
static int blend_slice_yuv422p10(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static av_cold void uninit(AVFilterContext *ctx)
Used for passing data between threads.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
static int set_expr(AVExpr **pexpr, const char *expr, const char *option, void *log_ctx)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
static const int16_t alpha[]
static int blend_slice_yuv420_pm(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
int y
position of overlaid picture
#define AV_PIX_FMT_YUV420P10
static int blend_slice_yuva420(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
uint8_t overlay_has_alpha
uint8_t overlay_is_packed_rgb
const char * name
Filter name.
static av_always_inline void blend_slice_planar_rgb(AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int hsub, int vsub, int main_has_alpha, int x, int y, int is_straight, int jobnr, int nb_jobs)
static int query_formats(AVFilterContext *ctx)
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
int overlay_pix_step[4]
steps per pixel for each plane of the overlay
AVFilterLink ** outputs
array of pointers to output links
int offset
Number of elements before the component of the first pixel.
#define flags(name, subs,...)
AVFilterInternal * internal
An opaque struct for libavfilter internal use.
#define AV_PIX_FMT_YUV422P10
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
#define DEFINE_BLEND_PLANE(depth, nbits)
static int normalize_xy(double d, int chroma_sub)
static int config_input_main(AVFilterLink *inlink)
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define DEFINE_ALPHA_COMPOSITE(depth, nbits)
common internal and external API header
static int blend_slice_gbrap(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
planar GBRA 4:4:4:4 32bpp
static int blend_slice_yuva420p10(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
int vsub
chroma subsampling values
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
AVFilterFormatsConfig incfg
Lists of supported formats / etc.
avfilter_execute_func * execute
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
AVFilterContext * dst
dest filter
static int config_output(AVFilterLink *outlink)
uint8_t main_is_packed_rgb
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
FRAMESYNC_DEFINE_CLASS(overlay, OverlayContext, fs)
static void eval_expr(AVFilterContext *ctx)
static int do_blend(FFFrameSync *fs)
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
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
AVPixelFormat
Pixel format.
#define AV_NOPTS_VALUE
Undefined timestamp value.
static enum AVPixelFormat alpha_pix_fmts[]
int step
Number of elements between 2 horizontally consecutive pixels.
simple arithmetic expression evaluator