summaryrefslogtreecommitdiff
path: root/libavfilter/af_compand.c
Commit message (Collapse)AuthorAge
* avfilter: convert to new channel layout APIJames Almer2022-03-15
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avfilter/af_compand: Store format in filter, remove 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/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>
* Stop hardcoding align=32 in av_frame_get_buffer() calls.Anton Khirnov2020-05-22
| | | | Use 0, which selects the alignment automatically.
* avfilter/af_compand: change error condition into warningPaul B Mahol2019-08-28
|
* avfilter: pass outlink to ff_get_audio_buffer()Paul B Mahol2018-01-03
| | | | | | This is more correct. Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avfilter/af_compand: change default attack to 0Paul B Mahol2017-05-15
| | | | | | Fixes many distortions. Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avfilter/af_compand: fix default companding to avoid clippingPaul B Mahol2017-05-14
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avfilter/af_compand: Check av_strtok() for failureMichael Niedermayer2017-04-20
| | | | | | Fixes CID1396256 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* all: move ff_exp10, ff_exp10f, ff_fast_powf to lavu/ffmath.hGanesh Ajjanagadde2016-03-22
| | | | | | | | | | | The idea is to use ffmath.h for internal implementations of math functions. Currently, it is used for variants of libm functions, but is by no means limited to such things. Note that this is not exported; use lavu/mathematics for such purposes. Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com> Signed-off-by: Ganesh Ajjanagadde <gajjanag@gmail.com>
* lavfi/af_compand: replace pow(10,x) by ff_exp10(x)Ganesh Ajjanagadde2015-12-25
| | | | Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
* avfilter/af_compand: do not clip; allow >0dB curve pointsPaul B Mahol2015-12-02
| | | | | | | Do not clip output samples, so that clipping can be handled by other filters. Alow setting curve points above 0dB. This is useful when operating with floats. Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avfilter/af_compand: use hypot()Ganesh Ajjanagadde2015-11-30
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
* lavfi: remove FF_LINK_FLAG_REQUEST_LOOP.Nicolas George2015-09-20
| | | | It has no longer any effect.
* avfilter: use ff_all_channel_counts() instead of ff_all_channel_layouts()Paul B Mahol2015-09-12
| | | | | | Fixes playback of some files with ffplay. Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avfilter/af_compand: fix clipping with default optionsPaul B Mahol2015-07-17
| | | | | | | | | Decays and attacks where by default set only for first channel which caused poor defaults to be used which produced clipping on any higher channel. Reported-by: lachs0r Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avfilter: handle error in query_formats() in bunch of filtersPaul B Mahol2015-04-08
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* Merge commit 'd3cfd7aff86ee3d449ca68aba21d67b9b2136a9b'Michael Niedermayer2014-07-08
|\ | | | | | | | | | | | | | | * commit 'd3cfd7aff86ee3d449ca68aba21d67b9b2136a9b': af_compand: make sure request_frame always outputs at least one frame See: 6b68e2a43b3407522080be50a2a19cff2f9715ef Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * af_compand: make sure request_frame always outputs at least one frameAndrew Kelley2014-07-08
| | | | | | | | | | | | | | | | | | | | | | This fixes a segmentation fault because request_frame in fifo.c assumes that the call to ff_request_frame will populate fifo->root.next. Before, it was possible for request_frame in af_compand to not do this, resulting in a null pointer access. Now, request_frame in af_compand always will return at least one frame or an error, as per the API specifications in avfilter.h for request_frame. Signed-off-by: Anton Khirnov <anton@khirnov.net>
| * af_compand: replace strtok_r() with av_get_token()Anton Khirnov2014-02-28
| |
| * lavfi: add compand audio filterAndrew Kelley2014-02-26
| | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* avfilter/af_compand: Silence "may be used uninitialized" warningMichael Niedermayer2014-05-08
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter: remove superflous linesPaul B Mahol2014-02-26
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avfilter/af_compand: some more cosmetics to decrease difference with qatarPaul B Mahol2014-02-26
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avfilter/af_compand: more cosmetics from libavfilter/af_compand_fork.cMichael Niedermayer2014-02-26
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/af_compand: cosmetics from libavfilter/af_compand_fork.cMichael Niedermayer2014-02-26
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/af_compand: switch defaults to libavfilter/af_compand_fork.cMichael Niedermayer2014-02-26
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/af_compand: "use local variable for channels" from ↵Michael Niedermayer2014-02-26
| | | | | | libavfilter/af_compand_fork.c Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/af_compand: error checks from libavfilter/af_compand_fork.cMichael Niedermayer2014-02-26
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/af_compand: pts init code from libavfilter/af_compand_fork.cMichael Niedermayer2014-02-26
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/af_compand: cosmetics and doxy comment from ↵Michael Niedermayer2014-02-26
| | | | | | libavfilter/af_compand_fork.c Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/af_compand: add Andrew Kelley to the copyrightMichael Niedermayer2014-02-26
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/af_compand: merge avframe code from af_compand_forkMichael Niedermayer2014-02-26
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/af_compand: merge uninit() calls on error from af_compand_fork.cMichael Niedermayer2014-02-26
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/af_compand: also support '|' as seperatorMichael Niedermayer2014-02-26
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/af_compand: whitespace changes from af_compand_forkMichael Niedermayer2014-02-26
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/af_compand: fix invalid readAndrew Kelley2014-02-25
| | | | Fixes #3383.
* avfilter/af_compand: do not leak frames on errorPaul B Mahol2014-02-15
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* 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>
* avfilter/af_aecho & af_compand: use extended_dataPaul B Mahol2013-09-15
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avfilter: various cosmeticsPaul B Mahol2013-09-12
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avfilter/af_compand: silence "maybe uninitialized" warningsMichael Niedermayer2013-09-07
| | | | | | if channels is 0 it actually would be uninitialized, thus an assert with comment is added Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/af_compand: %f is for printing doublesMichael Niedermayer2013-07-30
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* lavfi: add compand filterPaul B Mahol2013-07-29
Signed-off-by: Paul B Mahol <onemda@gmail.com>