summaryrefslogtreecommitdiff
path: root/libavfilter/vf_pad.c
Commit message (Collapse)AuthorAgeFilesLines
* avfilter/vf_pad: use already available outlink variablePaul B Mahol2022-03-041-2/+2
|
* avfilter: Replace query_formats callback with union of list and callbackAndreas Rheinhardt2021-10-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-201-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Combine get_(audio|video)_buffer into unionAndreas Rheinhardt2021-08-171-1/+1
| | | | | | | | These fields are mutually exclusive, so putting them in a union is possible and makes AVFilterPad smaller. Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avfilter: Constify all AVFiltersAndreas Rheinhardt2021-04-271-1/+1
| | | | | | | 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>
* remove CHAR_MIN/CHAR_MAX usagePaul B Mahol2020-03-171-6/+6
| | | | It is not needed at all.
* avfilter/pad: improve error check for w and hGyan Doshi2020-01-191-4/+4
| | | | Target dimensions have to cover entire input.
* avfilter/vf_pad: add logging context to logSteven Liu2019-10-081-1/+1
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avfilter/vf_pad: revert part of 57c3670896c69714caPaul B Mahol2017-05-121-1/+4
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* vf_pad: center image on padded area if negative x/yRicardo Constantino2017-04-071-5/+7
| | | | | | | | | | | or if x/y go beyond padded area. This is mostly useful when paired with the aspect option. Defaults aren't changed. Idea for this was taken from mpv's soon-to-be-removed expand vf. Reviewed-by: Paul B Mahol <onemda@gmail.com>
* avfilter/vf_pad: add aspect optionPaul B Mahol2017-04-031-0/+14
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avfilter/vf_pad: Fix segfault if reconfiguration failsMichael Niedermayer2017-01-021-4/+8
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avfilter/vf_pad: Add eval=frame supportMichael Niedermayer2016-12-301-1/+42
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Merge commit '0f40c9098498ad90dbbd2380eb4269015e84bde4'Clément Bœsch2016-06-211-1/+0
|\ | | | | | | | | | | | | * commit '0f40c9098498ad90dbbd2380eb4269015e84bde4': Drop pointless assert.h #includes Merged-by: Clément Bœsch <clement@stupeflix.com>
| * Drop pointless assert.h #includesDiego Biurrun2016-05-031-1/+0
| |
* | avfilter/vf_pad: fix direct paddingAndrey Turkin2016-01-061-1/+1
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | Merge commit '2ec112f71cd03ccab1b6f9a00d29199a57bcc7a5'Hendrik Leppkes2015-11-101-5/+5
|\ \ | |/ | | | | | | | | | | * commit '2ec112f71cd03ccab1b6f9a00d29199a57bcc7a5': vf_pad: fix x, y option expression evaluation Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * vf_pad: fix x, y option expression evaluationJohn Stebbins2015-11-061-5/+5
| | | | | | | | | | | | | | | | Calculation of x an y based on width and height did not work when width == 0 or height == 0. "0" substitutes the input width and height, but did so too late for x, y expression evaluation. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
| * Revert "lavfi: always check av_expr_parse_and_eval() return value"Anton Khirnov2015-05-051-8/+6
| | | | | | | | | | | | | | This reverts commit 63be97ec403023fb664798432acedaf6e6922527. All those calls were unchecked on purpose, as explained in the comments in the code.
| * lavfi: always check av_expr_parse_and_eval() return valueVittorio Giovara2014-12-181-6/+8
| | | | | | | | | | CC: libav-stable@libav.org Bug-Id: CID 703624
* | avfilter: handle error in query_formats() in bunch of filtersPaul B Mahol2015-04-081-2/+1
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | Merge commit '58400ac133bcfb6bf8196b4e5208bc178307739b'Michael Niedermayer2014-04-191-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '58400ac133bcfb6bf8196b4e5208bc178307739b': lavfi: name anonymous structs Conflicts: libavfilter/buffersink.c libavfilter/f_select.c libavfilter/src_movie.c libavfilter/vf_drawbox.c libavfilter/vf_drawtext.c libavfilter/vf_overlay.c libavfilter/vf_showinfo.c libavfilter/vf_unsharp.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * lavfi: name anonymous structsVittorio Giovara2014-04-191-1/+1
| |
* | avfilter/vf_pad: fix req_endMichael Niedermayer2013-12-031-1/+1
| | | | | | | | | | | | | | Fixes out of array accesses Fixes Ticket3190 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge remote-tracking branch 'qatar/master'Michael Niedermayer2013-10-291-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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: do not export the filters from shared objectsAnton Khirnov2013-10-281-1/+1
| |
* | avfilter: remove duplicate includesMichael Niedermayer2013-09-211-1/+0
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | lavfi/pad,crop,scale: remove options description from filter descriptionPaul B Mahol2013-09-211-1/+1
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | avfilter: various cosmeticsPaul B Mahol2013-09-121-6/+3
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | avfilter: fix plane validity checksMichael Niedermayer2013-08-031-2/+2
| | | | | | | | | | | | Fixes out of array accesses Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | lavfi/pad: use FFSIGNPaul B Mahol2013-07-081-3/+2
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | lavfi/pad: switch to AV_OPT_TYPE_COLORPaul B Mahol2013-05-171-13/+1
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | Merge remote-tracking branch 'qatar/master'Michael Niedermayer2013-05-161-69/+69
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | * qatar/master: vf_pad: use the name 's' for the pointer to the private context vf_overlay: use the name 's' for the pointer to the private context vf_lut: use the name 's' for the pointer to the private context Conflicts: libavfilter/vf_lut.c libavfilter/vf_overlay.c libavfilter/vf_pad.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * vf_pad: use the name 's' for the pointer to the private contextAnton Khirnov2013-05-161-74/+74
| | | | | | | | This is shorter and consistent across filters.
| * lavfi: remove now unused args parameter from AVFilter.initAnton Khirnov2013-04-091-1/+1
| |
* | lavfi: remove now unused args parameter from AVFilter.initAnton Khirnov2013-04-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: libavfilter/avfilter.c libavfilter/vf_drawtext.c libavfilter/vf_lut.c libavfilter/vf_select.c libavfilter/vf_setpts.c libavfilter/vsrc_color.c libavfilter/vsrc_movie.c Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '40c885c589808455a1c4b473509f1e6cd4908f55'Michael Niedermayer2013-04-101-24/+23
|\ \ | |/ | | | | | | | | | | | | | | | | | | * commit '40c885c589808455a1c4b473509f1e6cd4908f55': vf_pad: switch to an AVOptions-based system. Conflicts: doc/filters.texi libavfilter/vf_pad.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * vf_pad: switch to an AVOptions-based system.Anton Khirnov2013-04-091-15/+30
| |
| * vf_pad: fix a & instead of && typoXi Wang2013-03-101-1/+1
| | | | | | | | | | | | | | Avoid buffer overflow in buffer_needs_copy() Signed-off-by: Xi Wang <xi.wang@gmail.com> Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* | lavfi/vf_pad: use standard options parsing.Nicolas George2013-03-201-15/+3
| |
* | lavfi/pad: fix horizontal/vertical shift confusion.Clément Bœsch2013-03-181-3/+3
| |
* | lavfi/pad: avoid buffer overflow in buffer_needs_copy()Xi Wang2013-03-101-1/+1
| | | | | | | | | | | | | | Replace & with short-circuit &&. Signed-off-by: Xi Wang <xi.wang@gmail.com> Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
* | Merge commit '7e350379f87e7f74420b4813170fe808e2313911'Michael Niedermayer2013-03-101-63/+95
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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: switch to AVFrame.Anton Khirnov2013-03-081-62/+92
| | | | | | | | | | Deprecate AVFilterBuffer/AVFilterBufferRef and everything related to it and use AVFrame instead.
| * lavfi: merge start_frame/draw_slice/end_frameAnton Khirnov2012-11-281-102/+49
| | | | | | | | | | Any alleged performance benefits gained from the split are purely mythological and do not justify added code complexity.
| * lavfi: do not use av_pix_fmt_descriptors directly.Anton Khirnov2012-10-121-1/+1
| |
* | lavfi/pad: add support to named optionsStefano Sabatini2013-02-031-14/+38
| |
* | vf_pad: switch to filter_frameMichael Niedermayer2012-11-281-94/+47
| | | | | | | | | | Based on patch by Anton Khirnov Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '4436f25a1682ada3f7226cb6fadf429946933161'Michael Niedermayer2012-10-111-12/+24
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '4436f25a1682ada3f7226cb6fadf429946933161': build: remove references to unused EXTRAOBJS variable lavfi: convert input/ouput list compound literals to named objects fate: add h263 obmc vsynth tests avconv: remove bogus warning when using avconv -h without parameter averror: explicitly define AVERROR_* values flashsv: propagate inflateReset() errors indeo4/5: remove constant parameter num_bands from wavelet recomposition mxfdec: return error if no segments are available in mxf_get_sorted_table_segments Double motion vector range for HPEL interlaced picture in proper place Conflicts: libavcodec/v210dec.h libavfilter/af_aformat.c libavfilter/af_amix.c libavfilter/af_asyncts.c libavfilter/af_channelmap.c libavfilter/af_join.c libavfilter/asrc_anullsrc.c libavfilter/buffersrc.c libavfilter/f_setpts.c libavfilter/f_settb.c libavfilter/fifo.c libavfilter/src_movie.c libavfilter/vf_ass.c libavfilter/vf_blackframe.c libavfilter/vf_boxblur.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_hflip.c libavfilter/vf_overlay.c libavfilter/vf_pad.c libavfilter/vf_select.c libavfilter/vf_transpose.c libavfilter/vf_yadif.c libavfilter/vsrc_testsrc.c libavformat/mxfdec.c libavutil/error.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * lavfi: convert input/ouput list compound literals to named objectsMans Rullgard2012-10-101-13/+25
| | | | | | | | | | | | | | A number of compilers, for example those from TI and IBM, choke on these initialisers. The current style is also quite ugly. Signed-off-by: Mans Rullgard <mans@mansr.com>