summaryrefslogtreecommitdiff
path: root/libavfilter/vf_noise.c
Commit message (Collapse)AuthorAge
* all: Replace if (ARCH_FOO) checks by #if ARCH_FOOAndreas Rheinhardt2022-06-15
| | | | | | | | | | | | | | | | | | This is more spec-compliant because it does not rely on dead-code elimination by the compiler. Especially MSVC has problems with this, as can be seen in https://ffmpeg.org/pipermail/ffmpeg-devel/2022-May/296373.html or https://ffmpeg.org/pipermail/ffmpeg-devel/2022-May/297022.html This commit does not eliminate every instance where we rely on dead code elimination: It only tackles branching to the initialization of arch-specific dsp code, not e.g. all uses of CONFIG_ and HAVE_ checks. But maybe it is already enough to compile FFmpeg with MSVC with whole-programm-optimizations enabled (if one does not disable too many components). 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>
* 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: 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: make use of ff_filter_get_nb_threadsPaul B Mahol2016-08-29
|
* avutil: Rename FF_CEIL_COMPAT to AV_CEIL_COMPATDerek Buitenhuis2016-01-27
| | | | | | | | | | 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>
* avfilter/all: propagate errors of functions from avfilter/formatsGanesh Ajjanagadde2015-10-14
| | | | | | | | | | | | | | | | | | 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>
* Replace all remaining occurances of step/depth_minus1 and offset_plus1Hendrik Leppkes2015-09-08
|
* avfilter: handle error in query_formats() in bunch of filtersPaul B Mahol2015-04-08
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* x86/vf_noise: move asm code to a separate fileJames Almer2014-10-17
| | | | | Reviewed-by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: James Almer <jamrial@gmail.com>
* avfilter/vf_noise: Use a separate seed for each planeMichael Niedermayer2014-10-16
| | | | | | This should reduce the correlation between planes Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/vf_noise: use per component rand_shiftMichael Niedermayer2014-10-16
| | | | | | This allows using different shifts per plane Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/vf_noise: move shift calculation to filter_frame()Michael Niedermayer2014-10-16
| | | | | | This makes the temporal noise case deterministic with threads Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/vf_noise: fix high resolution supportMichael Niedermayer2014-10-16
| | | | | Fixes Ticket4017 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/vf_noise: make constant things constMichael Niedermayer2014-08-05
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/vf_noise: Avoid using non public AV_PIX_FMT_NBMichael Niedermayer2014-05-27
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* Fix compilation with !HAVE_6REGS.Carl Eugen Hoyos2014-04-19
| | | | | Can be tested with: $ ./configure --cc='cc -m32' --disable-optimizations --enable-pic
* 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>
* libavfilter/vf_noise: relicense to LGPLPaul B Mahol2013-10-27
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avfilter: add av_cold to init()Paul B Mahol2013-09-27
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avfilter/vf_noise: rename linesize to bytewidthMichael Niedermayer2013-09-13
| | | | | | | Its the width in bytes and not the linesize or stride. This makes the naming more consistent with the rest of the codebase Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* Revert "avfilter/vf_noise: dont corrupt the picture outside width x height"Michael Niedermayer2013-09-13
| | | | | | | | | | This reverts commit 51dab60c7b91a21ec280c7d3042aa8350aae048f. this fixed nothing, and was just the result of assuming that the variable named linesize was the linesize. Its not, its the width in bytes which was already correct. Found-by: durandal_1707
* avfilter/vf_noise: dont corrupt the picture outside width x heightMichael Niedermayer2013-09-12
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/vf_noise: unbreak filter when inline assembly is not presentPaul B Mahol2013-09-12
| | | | 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>
* lavfi/noise: fix out of array accessPaul B Mahol2013-05-29
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* lavfi/noise: support slice threadingPaul B Mahol2013-05-29
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* lavfi/noise: use av_image_copy_plane()Paul B Mahol2013-05-26
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* lavfi/field, il, noise: use av_pix_fmt_count_planes()Paul B Mahol2013-05-24
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* replace remaining PIX_FMT_* flags with AV_PIX_FMT_FLAG_*Michael Niedermayer2013-05-15
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* 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: use ceil right shift for chroma width/height.Clément Bœsch2013-05-10
| | | | | | | This should fix several issues with odd dimensions inputs. lut, vflip, pad and crop video filters also need to be checked for such issues. It's possible sws is also affected.
* lavfi/noise: remove get_video_buffer, its redundant nowPaul B Mahol2013-04-25
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* lavfi/noise: add missing emms_c()Paul B Mahol2013-04-25
| | | | 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/noise: remove pointless storePaul B Mahol2013-04-15
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* 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/noise: switch to an AVOptions-based system.Clément Bœsch2013-04-11
|
* avfilter/vf_noise: fix build without mmx*inlineMichael Niedermayer2013-04-09
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* lavfi/noise: copy inline asm from mp=noisePaul B Mahol2013-04-08
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* lavfi/blend,noise: remove unedeed av_opt_free() callPaul B Mahol2013-04-08
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* vf_noise: Fix av_lfg_get() maximum valueMichael Niedermayer2013-04-06
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* vf_noise: remove low quality modeMichael Niedermayer2013-04-06
| | | | | | It produces vissible correlation between lines Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* lavfi/noise: use standard options parsingPaul B Mahol2013-04-05
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* lavfi: remove remaining forgotten min/rej perms.Clément Bœsch2013-03-10
|
* Merge commit '7e350379f87e7f74420b4813170fe808e2313911'Michael Niedermayer2013-03-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '7e350379f87e7f74420b4813170fe808e2313911': lavfi: switch to AVFrame. Conflicts: doc/filters.texi libavfilter/af_ashowinfo.c libavfilter/audio.c libavfilter/avfilter.c libavfilter/avfilter.h libavfilter/buffersink.c libavfilter/buffersrc.c libavfilter/buffersrc.h libavfilter/f_select.c libavfilter/f_setpts.c libavfilter/fifo.c libavfilter/split.c libavfilter/src_movie.c libavfilter/version.h libavfilter/vf_aspect.c libavfilter/vf_bbox.c libavfilter/vf_blackframe.c libavfilter/vf_delogo.c libavfilter/vf_drawbox.c libavfilter/vf_drawtext.c libavfilter/vf_fade.c libavfilter/vf_fieldorder.c libavfilter/vf_fps.c libavfilter/vf_frei0r.c libavfilter/vf_gradfun.c libavfilter/vf_hqdn3d.c libavfilter/vf_lut.c libavfilter/vf_overlay.c libavfilter/vf_pad.c libavfilter/vf_scale.c libavfilter/vf_showinfo.c libavfilter/vf_transpose.c libavfilter/vf_vflip.c libavfilter/vf_yadif.c libavfilter/video.c libavfilter/vsrc_testsrc.c libavfilter/yadif.h Following are notes about the merge authorship and various technical details. Michael Niedermayer: * Main merge operation, notably avfilter.c and video.c * Switch to AVFrame: - afade - anullsrc - apad - aresample - blackframe - deshake - idet - il - mandelbrot - mptestsrc - noise - setfield - smartblur - tinterlace * various merge changes and fixes in: - ashowinfo - blackdetect - field - fps - select - testsrc - yadif Nicolas George: * Switch to AVFrame: - make rawdec work with refcounted frames. Adapted from commit 759001c534287a96dc96d1e274665feb7059145d by Anton Khirnov. Also, fix the use of || instead of | in a flags check. - make buffer sink and src, audio and video work all together Clément Bœsch: * Switch to AVFrame: - aevalsrc - alphaextract - blend - cellauto - colormatrix - concat - earwax - ebur128 - edgedetect - geq - histeq - histogram - hue - kerndeint - life - movie - mp (with the help of Michael) - overlay - pad - pan - pp - pp - removelogo - sendcmd - showspectrum - showwaves - silencedetect - stereo3d - subtitles - super2xsai - swapuv - thumbnail - tile Hendrik Leppkes: * Switch to AVFrame: - aconvert - amerge - asetnsamples - atempo - biquads Matthieu Bouron: * Switch to AVFrame - alphamerge - decimate - volumedetect Stefano Sabatini: * Switch to AVFrame: - astreamsync - flite - framestep Signed-off-by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: Nicolas George <nicolas.george@normalesup.org> Signed-off-by: Clément Bœsch <ubitux@gmail.com> Signed-off-by: Hendrik Leppkes <h.leppkes@gmail.com> Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com> Signed-off-by: Stefano Sabatini <stefasab@gmail.com> Merged-by: Michael Niedermayer <michaelni@gmx.at>
* lavfi/noise: switch to AVLFG noise generatorPaul B Mahol2013-02-17
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* lavfi: port MP noise filterPaul B Mahol2013-02-16
Signed-off-by: Paul B Mahol <onemda@gmail.com>