Commit Graph

44 Commits

Author SHA1 Message Date
Andreas Rheinhardt 1ea3650823 Replace all occurences of av_mallocz_array() by av_calloc()
They do the same.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-20 01:03:52 +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 d7cb8c51f0 avfilter/vf_curves: add commands support 2021-02-09 18:20:15 +01:00
Paul B Mahol d6e50e0716 avfilter/vf_curves: add planar rgb support 2018-09-25 16:35:29 +02:00
Paul B Mahol ed93ed5ee3 avfilter: don't anonymously typedef structs
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-05-13 11:39:28 +02:00
Paul B Mahol a0a57072c9 avfilter: make use of ff_filter_get_nb_threads 2016-08-29 16:27:09 +02:00
Clément Bœsch c6e900e925 lavfi/curves: fix meaningless const int returned value
Spotted-by: James Almer <jamrial@gmail.com>
2016-07-26 21:22:27 +02:00
Clément Bœsch b470d81f4e lavfi/curves: prefix init and uninit function names 2016-07-24 12:18:30 +02:00
Clément Bœsch 62a31aecf6 lavfi/curves: pass log ctx as void* instead of AVFilterContext* 2016-07-24 12:18:30 +02:00
Clément Bœsch 39c6d4a8c5 lavfi/curves: reindent after previous commit 2016-07-24 12:18:30 +02:00
Clément Bœsch e30cdac14b lavfi/curves: add 16-bit support 2016-07-24 12:18:30 +02:00
Clément Bœsch f19f5b906d lavfi/curves: move alloc and init of LUTs inside config_input()
This is needed in order to have different sizes of LUTs according to the
input.
2016-07-24 12:18:30 +02:00
Clément Bœsch 050f790594 lavfi/curves: dynamically allocate LUTs
This simplifies following commits.
2016-07-24 12:18:30 +02:00
Clément Bœsch 4eee06ae87 lavfi/curves: add various const where it makes sense 2016-07-24 12:18:30 +02:00
Clément Bœsch 51a873d441 lavfi/curves: remove pointless logging since the addition of plot option 2016-07-24 12:18:30 +02:00
Clément Bœsch 4a8f5f1fd8 lavfi/curves: add plot option 2016-07-24 12:18:30 +02:00
Clément Bœsch 5c14018fc4 lavfi/curves: do not automatically insert points at x=0 and x=1
There is actually a need for the origin and end point not to be defined.
We can not automatically insert them with the y value of the first and
last point as it will influence the curves in a wrong way.

Fixes #5397
2016-07-24 12:18:30 +02:00
Clément Bœsch fd682b1892 avfilter: handle error in query_formats() of a bunch of random video filters 2015-03-16 23:43:12 +01:00
Michael Niedermayer 08880c1f71 avfilter/vf_curves: 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-08 21:10:31 +01:00
Clément Bœsch b2cfd1fde7 avfilter/curves: fix resource leaks.
Fixes CID1206650
2014-04-27 11:49:13 +02:00
Clément Bœsch 0e97ec54de avfilter/curves: support slice threading. 2014-02-13 14:35:10 +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
Paul B Mahol 811b17fbad lavfi: cosmetics: fix vertical alignment for pads in some filters
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-05-14 15:31:56 +00:00
Clément Bœsch 1776177b7f lavfi: replace passthrough_filter_frame with a flag.
With the introduction of AVFilterContext->is_disabled, we can simplify
the custom passthrough mode in filters.

This commit is technically a small compat break, but the timeline was
introduced very recently.

Doxy by Stefano Sabatini.
2013-05-12 13:07:47 +02:00
Clément Bœsch a9705e4de9 lavfi/curves: avoid ctx pointer indirection. 2013-05-10 23:47:28 +02:00
Paul B Mahol 09250e3445 lavfi/curves: add support for more rgb formats
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-04-26 09:37:28 +00:00
Clément Bœsch fdd93eabfb lavfi: add timeline support.
Flag added in a few simple filters. A bunch of other filters can likely
use the feature as well.
2013-04-23 01:02:27 +02:00
Clément Bœsch 9ecdd76679 lavfi/curves: fix memleak after master component dition. 2013-04-15 18:04:35 +02:00
Clément Bœsch 1cb02d4fbc lavfi/curves: add support for Photoshop curves files (.acv). 2013-04-15 11:35:46 +02:00
Clément Bœsch 99dac39339 lavfi/curves: add support for master component. 2013-04-15 11:35:06 +02:00
Michael Niedermayer fd6228e657 lavfi: remove now unused args parameter from AVFilter.init and init_opaque
This is mostly automated global search and replace

The deprecated aconvert filter is disabled, if it still has users
it should be updated

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-12 11:54:39 +02:00
Clément Bœsch 2844ea86c8 lavfi/curves: introduce "all" field in presets and use it. 2013-04-11 13:05:06 +02:00
Clément Bœsch 7e7dc1489f lavfi/curves: make possible to customize presets. 2013-04-11 13:05:06 +02:00
Clément Bœsch a1e798ef0a lavfi/curves: fix a spacing weirdness. 2013-04-11 13:05:06 +02:00
Clément Bœsch 34610e11e7 lavfi/curves: switch to an AVOptions-based system. 2013-04-10 23:16:03 +02:00
Michael Niedermayer 9280fc7da1 vf_curves: add option to set all curves at once
Reviewed-by: ubitux
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-10 19:29:11 +02:00
Clément Bœsch 6278bc8a6c lavfi/curves: make use of options to store the preset names. 2013-04-01 20:37:45 +02:00
Clément Bœsch 133035c40d lavfi/curves: add forgotten strong_contrast preset. 2013-03-26 01:05:26 +01:00
Clément Bœsch 183f3450fd lavfi/curves: support preset shorthand. 2013-03-26 00:04:06 +01:00
Clément Bœsch dc65d784df lavfi/curves: add presets support.
Except for the vintage preset, the values are defined by Lou Logan based
on the ones found in Adobe Photoshop CS6.

Signed-off-by: Clément Bœsch <ubitux@gmail.com>
Signed-off-by: Lou Logan <lou@lrcd.com>
2013-03-25 23:48:51 +01:00
Clément Bœsch 65fc80f012 lavfi: add curves filter. 2013-03-10 03:00:10 +01:00