summaryrefslogtreecommitdiff
path: root/libavfilter/vf_curves.c
Commit message (Collapse)AuthorAge
* avfilter/vf_curves: Use formats list instead of query functionAndreas Rheinhardt2021-10-05
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avfilter: Replace query_formats callback with union of list and callbackAndreas Rheinhardt2021-10-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If one looks at the many query_formats callbacks in existence, one will immediately recognize that there is one type of default callback for video and a slightly different default callback for audio: It is "return ff_set_common_formats_from_list(ctx, pix_fmts);" for video with a filter-specific pix_fmts list. For audio, it is the same with a filter-specific sample_fmts list together with ff_set_common_all_samplerates() and ff_set_common_all_channel_counts(). This commit allows to remove the boilerplate query_formats callbacks by replacing said callback with a union consisting the old callback and pointers for pixel and sample format arrays. For the not uncommon case in which these lists only contain a single entry (besides the sentinel) enum AVPixelFormat and enum AVSampleFormat fields are also added to the union to store them directly in the AVFilter, thereby avoiding a relocation. The state of said union will be contained in a new, dedicated AVFilter field (the nb_inputs and nb_outputs fields have been shrunk to uint8_t in order to create a hole for this new field; this is no problem, as the maximum of all the nb_inputs is four; for nb_outputs it is only two). The state's default value coincides with the earlier default of query_formats being unset, namely that the filter accepts all formats (and also sample rates and channel counts/layouts for audio) provided that these properties agree coincide for all inputs and outputs. By using different union members for audio and video filters the type-unsafety of using the same functions for audio and video lists will furthermore be more confined to formats.c than before. When the new fields are used, they will also avoid allocations: Currently something nearly equivalent to ff_default_query_formats() is called after every successful call to a query_formats callback; yet in the common case that the newly allocated AVFilterFormats are not used at all (namely if there are no free links) these newly allocated AVFilterFormats are freed again without ever being used. Filters no longer using the callback will not exhibit this any more. Reviewed-by: Paul B Mahol <onemda@gmail.com> Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Replace all occurences of av_mallocz_array() by av_calloc()Andreas Rheinhardt2021-09-20
| | | | | | | They do the same. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avfilter/avfilter: Add numbers of (in|out)pads directly to AVFilterAndreas Rheinhardt2021-08-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* avfilter/internal: Factor out executing a filter's execute_funcAndreas Rheinhardt2021-08-15
| | | | | | | 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>
* avfilter/formats: Factor common function combinations outAndreas Rheinhardt2021-08-13
| | | | | | | | | | | 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>
* avfilter: Constify all AVFiltersAndreas Rheinhardt2021-04-27
| | | | | | | 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>
* avfilter/vf_curves: add commands supportPaul B Mahol2021-02-09
|
* avfilter/vf_curves: add planar rgb supportPaul B Mahol2018-09-25
|
* avfilter: don't anonymously typedef structsPaul B Mahol2017-05-13
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avfilter: make use of ff_filter_get_nb_threadsPaul B Mahol2016-08-29
|
* lavfi/curves: fix meaningless const int returned valueClément Bœsch2016-07-26
| | | | Spotted-by: James Almer <jamrial@gmail.com>
* lavfi/curves: prefix init and uninit function namesClément Bœsch2016-07-24
|
* lavfi/curves: pass log ctx as void* instead of AVFilterContext*Clément Bœsch2016-07-24
|
* lavfi/curves: reindent after previous commitClément Bœsch2016-07-24
|
* lavfi/curves: add 16-bit supportClément Bœsch2016-07-24
|
* lavfi/curves: move alloc and init of LUTs inside config_input()Clément Bœsch2016-07-24
| | | | | This is needed in order to have different sizes of LUTs according to the input.
* lavfi/curves: dynamically allocate LUTsClément Bœsch2016-07-24
| | | | This simplifies following commits.
* lavfi/curves: add various const where it makes senseClément Bœsch2016-07-24
|
* lavfi/curves: remove pointless logging since the addition of plot optionClément Bœsch2016-07-24
|
* lavfi/curves: add plot optionClément Bœsch2016-07-24
|
* lavfi/curves: do not automatically insert points at x=0 and x=1Clément Bœsch2016-07-24
| | | | | | | | 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
* avfilter: handle error in query_formats() of a bunch of random video filtersClément Bœsch2015-03-16
|
* avfilter/vf_curves: Change enums to int, which are accessed via AVOption as intMichael Niedermayer2015-03-08
| | | | | | This fixes depending on implementation defined behavior Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/curves: fix resource leaks.Clément Bœsch2014-04-27
| | | | Fixes CID1206650
* avfilter/curves: support slice threading.Clément Bœsch2014-02-13
|
* Merge remote-tracking branch 'qatar/master'Michael Niedermayer2013-10-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* lavfi: cosmetics: fix vertical alignment for pads in some filtersPaul B Mahol2013-05-14
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* lavfi: replace passthrough_filter_frame with a flag.Clément Bœsch2013-05-12
| | | | | | | | | | 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.
* lavfi/curves: avoid ctx pointer indirection.Clément Bœsch2013-05-10
|
* lavfi/curves: add support for more rgb formatsPaul B Mahol2013-04-26
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* lavfi: add timeline support.Clément Bœsch2013-04-23
| | | | | Flag added in a few simple filters. A bunch of other filters can likely use the feature as well.
* lavfi/curves: fix memleak after master component dition.Clément Bœsch2013-04-15
|
* lavfi/curves: add support for Photoshop curves files (.acv).Clément Bœsch2013-04-15
|
* lavfi/curves: add support for master component.Clément Bœsch2013-04-15
|
* lavfi: remove now unused args parameter from AVFilter.init and init_opaqueMichael Niedermayer2013-04-12
| | | | | | | | | 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>
* lavfi/curves: introduce "all" field in presets and use it.Clément Bœsch2013-04-11
|
* lavfi/curves: make possible to customize presets.Clément Bœsch2013-04-11
|
* lavfi/curves: fix a spacing weirdness.Clément Bœsch2013-04-11
|
* lavfi/curves: switch to an AVOptions-based system.Clément Bœsch2013-04-10
|
* vf_curves: add option to set all curves at onceMichael Niedermayer2013-04-10
| | | | | Reviewed-by: ubitux Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* lavfi/curves: make use of options to store the preset names.Clément Bœsch2013-04-01
|
* lavfi/curves: add forgotten strong_contrast preset.Clément Bœsch2013-03-26
|
* lavfi/curves: support preset shorthand.Clément Bœsch2013-03-26
|
* lavfi/curves: add presets support.Clément Bœsch2013-03-25
| | | | | | | | 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>
* lavfi: add curves filter.Clément Bœsch2013-03-10