Commit Graph

84 Commits

Author SHA1 Message Date
Paul B Mahol 0cacef58fa avfilter/vf_blend: use float for opacity calculations 2021-08-27 09:35:33 +02:00
Andreas Rheinhardt 8be701d9f7 avfilter/avfilter: Add numbers of (in|out)pads directly to AVFilter
Up until now, an AVFilter's lists of input and output AVFilterPads
were terminated by a sentinel and the only way to get the length
of these lists was by using avfilter_pad_count(). This has two
drawbacks: first, sizeof(AVFilterPad) is not negligible
(i.e. 64B on 64bit systems); second, getting the size involves
a function call instead of just reading the data.

This commit therefore changes this. The sentinels are removed and new
private fields nb_inputs and nb_outputs are added to AVFilter that
contain the number of elements of the respective AVFilterPad array.

Given that AVFilter.(in|out)puts are the only arrays of zero-terminated
AVFilterPads an API user has access to (AVFilterContext.(in|out)put_pads
are not zero-terminated and they already have a size field) the argument
to avfilter_pad_count() is always one of these lists, so it just has to
find the filter the list belongs to and read said number. This is slower
than before, but a replacement function that just reads the internal numbers
that users are expected to switch to will be added soon; and furthermore,
avfilter_pad_count() is probably never called in hot loops anyway.

This saves about 49KiB from the binary; notice that these sentinels are
not in .bss despite being zeroed: they are in .data.rel.ro due to the
non-sentinels.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-20 12:53:58 +02:00
Andreas Rheinhardt 1b20853fb3 avfilter/internal: Factor out executing a filter's execute_func
The current way of doing it involves writing the ctx parameter twice.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-15 21:33:25 +02:00
Andreas Rheinhardt 18ec426a86 avfilter/formats: Factor common function combinations out
Several combinations of functions happen quite often in query_format
functions; e.g. ff_set_common_formats(ctx, ff_make_format_list(sample_fmts))
is very common. This commit therefore adds functions that are equivalent
to commonly used function combinations in order to reduce code
duplication.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-13 17:36:22 +02:00
Andreas Rheinhardt a04ad248a0 avfilter: Constify all AVFilters
This is possible now that the next-API is gone.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 11:48:05 -03:00
Paul B Mahol 3d7ee5c91a avfilter/vf_blend: add support for commands 2021-02-04 21:44:31 +01:00
Andreas Rheinhardt a6fa1838e6 avfilter/vf_blend: Deduplicate options
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-08 05:06:12 +01:00
Paul B Mahol d5f87f8567 avfilter/vf_blend: add support for float formats 2020-05-26 23:27:02 +02:00
Paul B Mahol d64cbd4fda remove CHAR_MIN/CHAR_MAX usage
It is not needed at all.
2020-03-17 22:46:36 +01:00
Paul B Mahol 5ed6b735ab avfilter/vf_blend: cosmetics: reindent 2019-11-19 12:14:36 +01:00
Paul B Mahol c7abb07331 avfilter/vf_blend: add 12bit yuva formats 2019-11-18 17:47:35 +01:00
Andreas Rheinhardt 361fb42e1e avcodec/filter: Remove extra '; ' outside of functions
They are not allowed outside of functions. Fixes the warning
"ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]"
when compiling with GCC and -pedantic.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-10-07 21:15:55 +02:00
Paul B Mahol 37e69b40df avfilter/vf_blend: add 9bit support 2019-07-14 17:00:58 +02:00
Paul B Mahol d49d7d238f avfilter/vf_blend: use time_base from framesync
Fixes non-monotonous timestamps.
2019-07-03 14:54:05 +02:00
Limin Wang c9c1711f49 libavfilter/vf_blend.c: remove duplicate code with macro-defined function
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2019-06-14 13:37:45 +02:00
Limin Wang 24321b8751 libavfilter/vf_blend.c: remove duplicate code with same function
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2019-06-14 13:37:35 +02:00
Paul B Mahol 16154c019f avfilter/vf_blend: remove unused header 2019-05-03 20:48:18 +02:00
Martin Vignali d3621b2321 avfilter: use av_clip_uintp2 instead of av_clip for 10b and 12b 2018-11-17 18:06:58 +01:00
Paul B Mahol 1342ec526e avfilter/vf_blend: add 12bit support 2018-11-15 15:03:05 +01:00
Paul B Mahol c98a32e4ad avfilter/vf_blend: add 10bit support 2018-11-15 14:44:24 +01:00
Paul B Mahol a27cab9eca avfilter/vf_blend: add timeline support to tblend filter
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-05-14 18:08:35 +02:00
Paul B Mahol 79aa9d8aee avfilter/vf_blend: ignore SAR from all inputs
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-11-12 11:39:16 +01:00
Nicolas George 5f5dcf44e3 lavfi: rename framesync2 to framesync. 2017-09-12 11:03:51 +02:00
Nicolas George c1d8d33a51 lavfi/vf_blend: convert to framesync2. 2017-08-29 10:19:04 +02:00
Paul B Mahol f8d0689d3f avfilter/vf_blend: rename addition128 and difference128 to grainmerge and grainextract 2017-08-24 14:45:52 +02:00
Paul B Mahol 22a03c2900 avfilter/vf_blend: add extremity blend mode
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-25 16:39:10 +02:00
Paul B Mahol 0da3c568fd avfilter/vf_blend: add GBRAP16
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-04-10 16:53:17 +02: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
Paul B Mahol a0a57072c9 avfilter: make use of ff_filter_get_nb_threads 2016-08-29 16:27:09 +02:00
Paul B Mahol 5b8faaad6c avfilter/vf_blend: fix incorrect Y variable when threading is used
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-05-23 21:49:15 +02:00
Paul B Mahol b6a0aa1c0a avfilter/vf_blend: add freeze and heat modes
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-02-24 19:30:13 +01:00
Timothy Gu 8c56a4a1ed vf_blend: Move C dsp function mapping to separate function 2016-02-14 10:46:56 -08:00
Timothy Gu a678d66781 vf_blend: Use integers for divide mode
2.5x faster for 8-bit mode without autovectorization in GCC, 2x
slower with it on x86. However, since the platforms we enable GCC
autovectorization on most probably has support for SSE2
optimization (added in the subsequent commit), this commit should
in general do good.
2016-02-14 09:12:37 -08:00
Timothy Gu 4574323973 vf_blend: Reduce number of arguments for kernel function 2016-02-14 08:58:41 -08:00
Timothy Gu ee281b884e vf_blend: Use memcpy when opacity is 0
For xor mode, 1.8x faster on Haswell.
2016-02-14 08:57:07 -08:00
Timothy Gu ba25936df5 vf_blend: Templatize identity function and use a better name 2016-02-14 08:57:05 -08:00
Paul B Mahol ba618bde7f avfilter/vf_blend: add multiply128 mode
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-02-07 19:50:11 +01: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
Ganesh Ajjanagadde 8507b98c10 avfilter,swresample,swscale: use fabs, fabsf instead of FFABS
It is well known that fabs and fabsf are at least as fast and sometimes
faster than the FFABS macro, at least on the gcc+glibc combination.
For instance, see the reference:
http://patchwork.sourceware.org/patch/6735/.
This was a patch to glibc in order to remove their usages of a macro.

The reason essentially boils down to fabs using the __builtin_fabs of
the compiler, while FFABS needs to infer to not use a branch and to
simply change the sign bit. Usually the inference works, but sometimes
it does not. This may be easily checked by looking at the asm.

This also has the added benefit of reducing macro usage, which has
problems with side-effects.

Note that avcodec is not handled here, as it is huge and
most things there are integer arithmetic anyway.

Tested with FATE.

Reviewed-by: Clément Bœsch <u@pkh.me>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-10-22 16:13:26 -04:00
Paul B Mahol 5e0abf59d8 avfilter/vf_blend: fix normal mode with opacity != 1
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-09 12:12:03 +02:00
Michael Niedermayer fd9a528523 avfilter/vf_blend: Fix argument types, fix segfault in asm
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-03 21:59:24 +02:00
Paul B Mahol 9762554dd0 avfilter/vf_blend: add x86 SIMD for some modes
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-03 21:26:17 +02:00
Paul B Mahol 4cf60b4fa1 avfilter/vf_blend: add addition128 mode
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-09-26 15:32:56 +02:00
Nicolas George 44f660e7e7 lavfi: remove FF_LINK_FLAG_REQUEST_LOOP.
It has no longer any effect.
2015-09-20 19:02:33 +02:00
Clément Bœsch 7a29d10839 avfilter/blend: use AV_OPT_TYPE_BOOL for shortest and repeatlast options 2015-09-08 23:43:54 +02:00
Hendrik Leppkes 5d8e836d0e Replace all remaining occurances of step/depth_minus1 and offset_plus1 2015-09-08 17:10:48 +02:00
Paul B Mahol e030d3c61f avfilter/vf_blend: use the name 's' for the pointer to the private context
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-08-25 18:16:55 +00:00
Paul B Mahol 9a829a2b6a avfilter/vf_blend: unbreak tblend
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-07-18 05:01:16 +00:00
Paul B Mahol efd4e5fe68 avfilter/vf_blend: implement 16bit support
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-07-18 02:07:44 +00:00
Paul B Mahol b8c0cf7880 avfilter/vf_blend: add linearlight and glow mode
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-06-03 12:40:09 +00:00