summaryrefslogtreecommitdiff
path: root/libavfilter/vf_deshake.c
Commit message (Collapse)AuthorAge
* avfilter: Reindentation after query_formats changesAndreas Rheinhardt2021-10-05
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avfilter/vf_deshake: 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>
* 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>
* avfilter/transform: Stop exporting internal functionsAndreas Rheinhardt2021-04-27
| | | | | | | | | | | | avfilter_transform, avfilter_(add|sub|mult)_matrix are not part of the public API (transform.h is not a public header), yet they are currently exported because of their name. This commit changes this: avfilter_transform is renamed to ff_affine_transform; the other functions are just removed as they have never been used at all. Found-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* lavf, lavfi: Remove uses of sizeof(char).Carl Eugen Hoyos2020-04-04
| | | | The C standard requires sizeof(char) == 1.
* lavfi: modify avfilter_get_matrix to support separate scale factorsJarek Samic2019-08-22
|
* lavfi/deshake: fix deshake crash issue.Jun Zhao2018-10-06
| | | | | | | | | | | | | | | | | | | | | | | | Fixes ticket #7441. for block contrast calculate, the block is like this: |<---------------- stride-----------------------| +-----------------------------------------------> X | | w = 16 | (cx,cy)+------+ | | | |h=blocksize| | | | | | +------+ V Y so we calc the block contrast use: (cy + y) * stride + (cx + x) Signed-off-by: Jun Zhao <mypopydev@gmail.com>
* lavfi/deshake: Check alignment before calling asm init function.Carl Eugen Hoyos2018-03-20
| | | | | | | Do this for every frame to make sure dynamic filters do not cause crashes. Fixes ticket #7078.
* lavu,lavfi,ffmpeg: Remove experimental OpenCL APIMark Thompson2017-11-22
| | | | | | | | | | | This was added in early 2013 and abandoned several months later; as far as I can tell, there are no external users. Future OpenCL use will be via hwcontext, which requires neither special OpenCL-only API nor global state in libavutil. All internal users are also deleted - this is just the unsharp filter (replaced by unsharp_opencl, which is more flexible) and the deshake filter (no replacement).
* avfilter/vf_deshake: Free out AVFrame on errorMichael Niedermayer2017-02-03
| | | | | | | Fixes memleak Fixes part of CID1197065 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* 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>
* lavfi/deshake: use FF_CEIL_RSHIFT()Clément Bœsch2016-01-07
|
* all: use FFDIFFSIGN to resolve possible undefined behavior in comparatorsGanesh Ajjanagadde2015-11-03
| | | | | | | | | | | | | | | | | | | FFDIFFSIGN was created explicitly for this purpose, since the common return a - b idiom is unsafe regarding overflow on signed integers. It optimizes to branchless code on common compilers. FFDIFFSIGN also has the subjective benefit of being easier to read due to lack of ternary operators. Tested with FATE. Things not covered by this are unsigned integers, for which overflows are well defined, and also places where overflow is clearly impossible, e.g an instance where the a - b was being done on 24 bit values. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Reviewed-by: Clément Bœsch <u@pkh.me> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
* avfilter/vf_deshake: replace qsort with AV_QSORTGanesh Ajjanagadde2015-10-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qsort is called indirectly in filter_frame, suggesting its performance criticality. AV_QSORT is substantially faster due to the inlining of the comparison callback. Thus, the increase in performance should be worth the increase in binary size. This optimization is just a low hanging fruit. The trac ticket 1430 is a request for an improved deshake filter. Sample benchmark (x86-64, Haswell, GNU/Linux): File: original from https://trac.ffmpeg.org/ticket/1430 command: ffmpeg -stream_loop 8 -i file.webm -vf deshake=rx=64:ry=64 -f null - Timer truncated at 1024 runs. new: 28260 decicycles in qsort, 1 runs, 0 skips 35570 decicycles in qsort, 2 runs, 0 skips 39010 decicycles in qsort, 4 runs, 0 skips 46897 decicycles in qsort, 8 runs, 0 skips 40442 decicycles in qsort, 16 runs, 0 skips 41611 decicycles in qsort, 32 runs, 0 skips 40345 decicycles in qsort, 64 runs, 0 skips 38967 decicycles in qsort, 128 runs, 0 skips 38647 decicycles in qsort, 256 runs, 0 skips 40238 decicycles in qsort, 512 runs, 0 skips 39676 decicycles in qsort, 1024 runs, 0 skips old: 1740280 decicycles in qsort, 1 runs, 0 skips 923560 decicycles in qsort, 2 runs, 0 skips 511330 decicycles in qsort, 4 runs, 0 skips 309720 decicycles in qsort, 8 runs, 0 skips 194900 decicycles in qsort, 16 runs, 0 skips 142686 decicycles in qsort, 32 runs, 0 skips 112516 decicycles in qsort, 64 runs, 0 skips 98166 decicycles in qsort, 128 runs, 0 skips 88147 decicycles in qsort, 256 runs, 0 skips 88706 decicycles in qsort, 512 runs, 0 skips 86783 decicycles in qsort, 1024 runs, 0 skips Reviewed-by: Nicolas George <george@nsup.org> Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
* avfilter/vf_deshake: use a void * comparator for consistencyGanesh Ajjanagadde2015-10-24
| | | | | | | | | | | For generality, qsort uses a comparator whose elements are void *. This makes the comparator have such a form, and thus makes the void * cast of the comparator pointer useless. Furthermore, this makes the code more consistent with other usages of qsort across the codebase. Reviewed-by: Henrik Gramner <henrik@gramner.com> Reviewed-by: wm4 <nfxjfg@googlemail.com> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
* avfilter/deshake: use AV_OPT_TYPE_BOOL for opencl optionClément Bœsch2015-09-08
|
* avfilter: handle error in query_formats() of a bunch of random video filtersClément Bœsch2015-03-16
|
* vf_deshake: rename Transform.vector to Transform.vec to avoid compiler confusionAndreas Cadhalpun2014-09-18
| | | | | | | | | The token 'vector' is a keyword in the Vector/SIMD Multimedia Extension data types and thus should not be used as a variable name. This fixes building on powerpc/ppc64el. Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* vf_deshake: Avoid doing a malloc+free for every single frame.Reimar Döffinger2014-09-02
| | | | Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
* vf_deshake: reduce stack usage.Reimar Döffinger2014-09-02
| | | | Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
* avfilter/deshake: remove avcodec dependencyClément Bœsch2014-08-05
|
* reintroduce avpriv_dsputil_init() to maintain ABI until next soname bumpMichael Niedermayer2014-07-26
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* Merge commit '2d60444331fca1910510038dd3817bea885c2367'Michael Niedermayer2014-07-17
| | | | | | | | | | | | | | | | | | | | | | | | | * commit '2d60444331fca1910510038dd3817bea885c2367': dsputil: Split motion estimation compare bits off into their own context Conflicts: configure libavcodec/Makefile libavcodec/arm/Makefile libavcodec/dvenc.c libavcodec/error_resilience.c libavcodec/h264.h libavcodec/h264_slice.c libavcodec/me_cmp.c libavcodec/me_cmp.h libavcodec/motion_est.c libavcodec/motion_est_template.c libavcodec/mpeg4videoenc.c libavcodec/mpegvideo.c libavcodec/mpegvideo_enc.c libavcodec/x86/Makefile libavcodec/x86/me_cmp_init.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/vf_deshake: Use av_malloc_array()Michael Niedermayer2014-07-11
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/vf_deshake: fix macro ()Michael Niedermayer2014-06-24
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/vf_deshake: dont pass the wrong context into the SAD functionsMichael Niedermayer2014-05-03
| | | | | | | This fixes pointer type warnings The context should have been unused so this should not fix any real bug Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/vf_deshake: fix loss of precission with odd resolutionsMichael Niedermayer2014-04-16
| | | | | | Fixes part of Ticket3466 Found-by: Andrey_Karpov / PVS-Studio Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* 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/vf_deshake: fix block_contrast() lower brightness valueMichael Niedermayer2013-10-07
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/deshakeLenny Wang2013-10-07
| | | | | | The old row index looks weird and wrong to me Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/vf_deshake: check rxMichael Niedermayer2013-05-18
| | | | | | | | | | Fixes crash on SSE2 Fixes Ticket2443 Note, its possible to restructure the code to avoid the 16pixel limitation, and such change is welcome! Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* deshake: fix off by 2 errorMichael Niedermayer2013-04-15
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* vf_deshake: Fix crash with r*=64Michael Niedermayer2013-04-15
| | | | | | | | | Replace literal numbers by named R_MAX and correct their value Fixes half of Ticket2443 Based on patch by: João Bernardo <jbvsmo@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* Add avpriv_dsputil_init() and use it in lavfi where relevant.Clément Bœsch2013-04-14
| | | | | | | | dsputil_init() is deprecated and not meant to be exported. ff_dsputil_init() is internal to libavcodec and thus can not be used. avpriv_dsputil_init() is the version shared between libraries. This commit fixes 3 unjustified libavfilter deprecated warnings.
* 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/deshake: switch to an AVOptions-based system.Clément Bœsch2013-04-11
|
* vf_deshake: Reorder constant arguments in an if() statement.Carl Eugen Hoyos2013-04-03
| | | | | | Fixes compilation with clang on netbsd with --disable-optimizations. Tested-by: Paul B Mahol
* deshake opencl based on comments on 20130402 3rdhighgod04012013-04-02
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* lavfi/deshake: use standard options parsing.Clément Bœsch2013-03-24
|
* 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/deshake: support named options.Clément Bœsch2013-03-05
|
* vf_deshake: fix strict aliassing errorsMichael Niedermayer2012-12-29
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* lavfi/deshake: remove usage of link->cur_buf.Clément Bœsch2012-12-26
|
* lavfi: declare arrays that never change as static constPaul B Mahol2012-12-21
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* lavfi/deshake: small align prettifying.Clément Bœsch2012-12-06
|
* lavfi/deshake: switch inverted comments.Clément Bœsch2012-12-06
|