Commit Graph

160 Commits

Author SHA1 Message Date
Paul B Mahol 8440835dbe avfilter/vf_overlay: fix filtering with negative y 2018-12-03 10:32:59 +01:00
Paul B Mahol 57815cfad5 avfilter/vf_overlay: fix crash with negative y 2018-11-20 23:18:47 +01:00
Paul B Mahol 0f0d468fbc avfilter/vf_overlay: exclude nv12/nv21 formats from x86 asm check
They are yet to be supported,

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-05-03 09:22:28 +02:00
Paul B Mahol 6d7c63588c avfilter/vf_overlay: add x86 SIMD
Specifically for yuv444, yuv422, yuv420 format when main stream has no alpha, and alpha
is straight.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-05-02 23:58:21 +02:00
Paul B Mahol 70d25b89db avfilter/vf_overlay: use slice_end in alpha_composite()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-29 10:02:57 +02:00
Paul B Mahol d54014d157 avfilter/vf_overlay: add slice threading
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-28 18:54:12 +02:00
Steven Liu 27fe8930e0 avfilter: add comments for duplicate line
comment about the looks like a duplicate line.
but that is used to reason x is expressed from y

Suggested-by: Paul B Mahol
Suggested-by: Michael Niedermayer
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-02-01 10:55:19 +08:00
Mateusz 6260ab60a8 avfilter/vf_overlay: fix packed_rgb case
Signed-off-by: Mateusz Brzostek <mateuszb@poczta.onet.pl>
2017-12-18 14:48:37 +01:00
Paul B Mahol d29f784a54 avfilter/vf_overlay: add premultiplied alpha mode
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-12-16 18:40:04 +01:00
Nicolas George 5f5dcf44e3 lavfi: rename framesync2 to framesync. 2017-09-12 11:03:51 +02:00
Michael Niedermayer d8bc198d09 avfilter/vf_overlay: Restore shorthand option order
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-09-05 23:55:19 +02:00
Nicolas George 878fd0545a lavfi/vf_overlay: use framesync2 options. 2017-08-29 10:19:04 +02:00
Nicolas George 19804024d5 lavfi/vf_overlay: move to framesync2. 2017-08-29 10:19:04 +02:00
Marton Balint 498c90c708 avfilter/vf_overlay: fix alpha blending for planar formats with a transparent background
When the background had an alpha channel, the old code in blend_plane
calculated premultiplied alpha from the destination plane colors instead of the
destination alpha.

Also the calculation of the output alpha should only happen after the color
planes are already finished.

Fixes output of:
ffplay -f lavfi "testsrc2=alpha=32[a];color=black[b];[b][a]overlay[out0]"

Signed-off-by: Marton Balint <cus@passwd.hu>
2017-08-10 22:25:51 +02:00
Paul B Mahol f269a1e0b8 avfilter/vf_overlay: separate functions with main alpha
~5-15% faster overall with main input without alpha.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-25 12:32:53 +02:00
Paul B Mahol c1b43e8452 avfilter/vf_overlay: remove rgb option
Its been deprecated for over 3 years.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-24 19:20:46 +02:00
Paul B Mahol 565dc0e283 avfilter/vf_overlay: add auto format mode
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-24 10:18:30 +02:00
Muhammad Faiz 6af050d7d0 avfilter: do not use AVFrame accessor
Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2017-04-23 14:40:30 +07:00
Paul B Mahol 3405d6c7bc avfilter/overlay: add gbrp output format
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-01-31 10:54:03 +01:00
Nicolas George 183ce55b0d lavfi: split frame_count between input and output.
AVFilterLink.frame_count is supposed to count the number of frames
that were passed on the link, but with min_samples, that number is
not always the same for the source and destination filters.
With the addition of a FIFO on the link, the difference will become
more significant.

Split the variable in two: frame_count_in counts the number of
frames that entered the link, frame_count_out counts the number
of frames that were sent to the destination filter.
2016-11-13 10:41:16 +01:00
Rodger Combs f53c26c694
lavfi/vf_overlay: support NV12 and NV21
Tested-by: Michael on x86-32/64 linux, mingw, mips/arm qemu linux
2016-10-26 20:13:30 -05:00
Paul B Mahol 97f50d1c62 avfilter/vf_overlay: add YUVA422P to alpha_pix_fmts
Now yuv422 output format gives similar expected output as other output formats.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-09-17 15:38:30 +02:00
Paul B Mahol 0e7d2c60e9 avfilter/vf_overlay: support J formats too
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-09-17 15:38:30 +02:00
Paul B Mahol 97297fb144 avfilter/vf_overlay: inline yuv output formats
Overall speedup ~10-20%

Tested-by: Michael on mingw32 mingw64 linux32 mips and arm
2016-09-11 00:38:13 +02:00
Paul B Mahol 140a0485d3 avfilter/vf_overlay: split blend_image into functions for each overlay format
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-09-11 00:27:01 +02:00
Clément Bœsch 8ef57a0d61 Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'
* commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb':
  cosmetics: Fix spelling mistakes

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-21 21:55:34 +02:00
Vittorio Giovara 41ed7ab45f cosmetics: Fix spelling mistakes
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-04 18:16:21 +02:00
Derek Buitenhuis 21f9468402 avutil: Rename FF_CEIL_COMPAT to AV_CEIL_COMPAT
Libav, for some reason, merged this as a public API function. This will
aid in future merges.

A define is left for backwards compat, just in case some person
used it, since it is in a public header.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-01-27 16:36:46 +00:00
Bela Bodecs cc83177db4 vf_overlay: handles expression evaluation of frame size change in frame-by-frame evalutaion mode
vf_overlay video filter accepts expressions in its parameters. In
'frame-by-frame' evaluation mode it recalculates them regularly, but
incoming video frame size changes did not reflect in their values. So if
you used width or height of any source videos in expressions as
parameters, they stayed on their initial values. This patch corrects
this bug.

Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu>
Reviewed-by: Paul B Mahol <onemda@gmail.com
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-19 23:30:36 +01:00
Ganesh Ajjanagadde 08a96708a5 lavfi/vf_overlay: fix unitialized pointers
Missed in commit 301c2784b3.

Found-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-12-10 07:53:47 -05:00
Ganesh Ajjanagadde 301c2784b3 lavfi/vf_overlay: fix memory leaks
Recent commits 6aaac24d72 and
3835554bf8 made progress towards cleaning
up usage of the formats API, and in particular fixed possible NULL pointer
dereferences.

This commit addresses the issue of possible resource leaks when some intermediate
call fails.

Tested with valgrind --leak-check=full --show-leak-kinds=all, and manual simulation
of malloc/realloc failures.

Fixes: CID 1338327.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-12-09 07:57:57 -05:00
Ganesh Ajjanagadde 6aaac24d72 avfilter/all: propagate errors of functions from avfilter/formats
Many of the functions from avfilter/formats can return errors, usually AVERROR(ENOMEM).
This propagates the return values.

All of these were found by using av_warn_unused_result, demonstrating its utility.

Tested with FATE. I am least sure of the changes to avfilter/filtergraph,
since I don't know what/how reduce_format is intended to behave and how it should
react to errors.

Fixes: CID 1325680, 1325679, 1325678.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Previous version Reviewed-by: Nicolas George <george@nsup.org>
Previous version Reviewed-by: Clément Bœsch <u@pkh.me>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-10-14 10:04:01 -04:00
Clément Bœsch 9c52eafd5b avfilter/overlay: use AV_OPT_TYPE_BOOL for rgb, shortest and repeatlast options 2015-09-09 00:33:02 +02:00
Michael Niedermayer 1a79850a8f avfilter/vf_overlay: Change enums to int, which are accessed via AVOption as int
This fixes depending on implementation defined behavior

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-20 19:11:58 +01:00
Reimar Döffinger d9e2aceb7f Add missing "const" all over the place.
Only "./configure --enable-gpl" on x86 was tested.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2014-08-29 18:57:25 +02:00
Stefano Sabatini 462c9ee3ac lavfi/overlay: show incoming frames on debug messages
This is especially useful to debug queue overflow issues.

Ideally we should be able to set the debug message at the
dualinput/framesync level, but they do not have the information related
to the filter context and the inlink, so cannot access much useful
information.

Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
2014-07-02 18:42:15 +02:00
Clément Bœsch d5f817793e avfilter/overlay: reindent 2014-06-29 13:26:12 +02:00
Michael Niedermayer 74a8dbe1c4 Merge commit '58400ac133bcfb6bf8196b4e5208bc178307739b'
* commit '58400ac133bcfb6bf8196b4e5208bc178307739b':
  lavfi: name anonymous structs

Conflicts:
	libavfilter/buffersink.c
	libavfilter/f_select.c
	libavfilter/src_movie.c
	libavfilter/vf_drawbox.c
	libavfilter/vf_drawtext.c
	libavfilter/vf_overlay.c
	libavfilter/vf_showinfo.c
	libavfilter/vf_unsharp.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-19 18:20:17 +02:00
Vittorio Giovara 58400ac133 lavfi: name anonymous structs 2014-04-19 16:20:57 +02:00
Michael Niedermayer 905cd28a5a Merge commit 'de203abd71baae7f120313259b45cf935c85203e'
* commit 'de203abd71baae7f120313259b45cf935c85203e':
  vf_overlay: add eof_action switch

Conflicts:
	doc/filters.texi
	libavfilter/vf_overlay.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-04 14:33:33 +01:00
Keith Lawson de203abd71 vf_overlay: add eof_action switch
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-02-04 10:54:26 +01:00
Stefano Sabatini a270f63e83 lavfi/overlay: add yuv422 format mode 2014-02-02 11:50:21 +01:00
Michael Niedermayer 325f6e0a97 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  lavfi: do not export the filters from shared objects

Conflicts:
	libavfilter/af_amix.c
	libavfilter/af_anull.c
	libavfilter/asrc_anullsrc.c
	libavfilter/f_select.c
	libavfilter/f_settb.c
	libavfilter/split.c
	libavfilter/src_movie.c
	libavfilter/vf_aspect.c
	libavfilter/vf_blackframe.c
	libavfilter/vf_colorbalance.c
	libavfilter/vf_copy.c
	libavfilter/vf_crop.c
	libavfilter/vf_cropdetect.c
	libavfilter/vf_drawbox.c
	libavfilter/vf_format.c
	libavfilter/vf_framestep.c
	libavfilter/vf_frei0r.c
	libavfilter/vf_hflip.c
	libavfilter/vf_libopencv.c
	libavfilter/vf_lut.c
	libavfilter/vf_null.c
	libavfilter/vf_overlay.c
	libavfilter/vf_scale.c
	libavfilter/vf_transpose.c
	libavfilter/vf_unsharp.c
	libavfilter/vf_vflip.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-29 11:58:11 +01:00
Anton Khirnov cd43ca0443 lavfi: do not export the filters from shared objects 2013-10-28 15:29:54 +01:00
Benedict Endemann 696aa74b1a lavfi/overlay: correct small error in intersection detection
The image size of the destination image was used to determine if a source
image was positioned outside the destination image, that no intersection
could occur.  Actually for these two cases the size of the source image
has to be used!

Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
2013-10-27 15:01:02 +01:00
Paul B Mahol cd1b22d8e8 avfilter/dualinput: simplify
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-09-30 08:47:40 +00:00
Nicolas George 231e50157c lavfi/dualinput: reimplement on top of framesync. 2013-09-23 09:50:09 +02:00
Michael Niedermayer 4bc7a2a64b avfilter: remove duplicate includes
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-21 15:36:33 +02:00
Paul B Mahol b211607b5c avfilter: various cosmetics
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-09-12 14:01:43 +00:00
Paul B Mahol b077d8d908 avfilter: remove redundant .get_(audio/video)_buffer initializations
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-09-07 18:20:16 +00:00