summaryrefslogtreecommitdiff
path: root/libavfilter/vf_tinterlace.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: Reindentation after query_formats changesAndreas Rheinhardt2021-10-05
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avfilter/vf_tinterlace: 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/vf_tinterlace: fix mergex2, first frame is always considered oddPaul B Mahol2020-07-17
|
* avfilter/vf_tinterlace: use frame counter from lavfiPaul B Mahol2020-07-17
| | | | Remove internal counter.
* avfilter/vf_interlace: do not interlace already interlaced framesMarton Balint2019-12-15
| | | | | | The filter used to work this way before it was merged into tinterlace. Signed-off-by: Marton Balint <cus@passwd.hu>
* avfilter/vf_tinterlace: add support for bypassing already interlaced framesMarton Balint2019-12-15
| | | | | | The old interlace filter worked this way before it was merged with tinterlace. Signed-off-by: Marton Balint <cus@passwd.hu>
* avfilter/vf_interlace: restore lowpass mode constantsMarton Balint2019-12-14
| | | | | | | | The documentation still mentions numerical constants in addition to textual ones. It is also wrong to use distinct modes as flags and it disallows us to actually use the flags field for real flags in the future. Signed-off-by: Marton Balint <cus@passwd.hu>
* avfilter/vf_tinterlace: re-enable lowpass optionPaul B Mahol2019-07-08
|
* avfilter/vf_interlace: fix numerical optionsThomas Mundt2018-09-07
| | | | | | Regression since 9c01cdb94e24aaf50f867a0a5c42b097c17c42b1 Signed-off-by: Thomas Mundt <tmundt75@gmail.com>
* avfilter/vf_interlace: remove duplicate code with same funcionalityVasile Toncu2018-04-23
|
* avfilter/interlace: rename two variables for consistencyThomas Mundt2017-09-25
| | | | Signed-off-by: Thomas Mundt <tmundt75@gmail.com>
* avfilter/interlace: add support for 10 and 12 bitThomas Mundt2017-09-23
| | | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Thomas Mundt <tmundt75@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avfilter/tinterlace: use drawutils for pad modeThomas Mundt2017-09-23
| | | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Thomas Mundt <tmundt75@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avfilter/tinterlace: Simplify checks for lowpass filtering flagsJames Almer2017-09-18
|
* avfilter/interlace: simplify codeThomas Mundt2017-09-15
| | | | | Signed-off-by: Thomas Mundt <tmundt75@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avfilter/interlace: prevent over-sharpening with the complex low-pass filterThomas Mundt2017-09-15
| | | | | | | | | | | | | | | | | The complex vertical low-pass filter slightly over-sharpens the picture. This becomes visible when several transcodings are cascaded and the error potentises, e.g. some generations of HD->SD SD->HD. To prevent this behaviour the destination pixel must not exceed the source pixel when the average of the pixels above and below is less than the source pixel. And the other way around. Tested and approved in a visual transcoding cascade test by video professionals. SSIM/PSNR test with the first generation of an HD->SD file as a reference against the 6th generation(3 x SD->HD HD->SD): Results without the patch: SSIM Y:0.956508 (13.615881) U:0.991601 (20.757750) V:0.993004 (21.551382) All:0.974405 (15.918463) PSNR y:31.838009 u:48.424280 v:48.962711 average:34.759466 min:31.699297 max:40.857847 Results with the patch: SSIM Y:0.970051 (15.236232) U:0.991883 (20.905857) V:0.993174 (21.658049) All:0.981290 (17.279202) PSNR y:34.412108 u:48.504454 v:48.969496 average:37.264644 min:34.310637 max:42.373392 Signed-off-by: Thomas Mundt <tmundt75@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avfilter/interlace: add complex vertical low-pass filterThomas Mundt2017-05-02
| | | | | | | This complex (-1 2 6 2 -1) filter slightly less reduces interlace 'twitter' but better retain detail and subjective sharpness impression compared to the linear (1 2 1) filter. Signed-off-by: Thomas Mundt <tmundt75@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avfilter/interlace: change lowpass_line function prototypeThomas Mundt2017-04-22
| | | | | Signed-off-by: Thomas Mundt <tmundt75@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavfi: split frame_count between input and output.Nicolas George2016-11-13
| | | | | | | | | | | | AVFilterLink.frame_count is supposed to count the number of frames that were passed on the link, but with min_samples, that number is not always the same for the source and destination filters. With the addition of a FIFO on the link, the difference will become more significant. Split the variable in two: frame_count_in counts the number of frames that entered the link, frame_count_out counts the number of frames that were sent to the destination filter.
* avfilter/vf_tinterlace: fix image alignmentMichael Niedermayer2016-02-14
| | | | 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>
* avfilter/vf_tinterlace: add mergex2 modePaul B Mahol2015-10-03
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* lavfi: remove FF_LINK_FLAG_REQUEST_LOOP.Nicolas George2015-09-20
| | | | It has no longer any effect.
* lavfi/tinterlace: Double aspect ratio for modes merge and pad.Carl Eugen Hoyos2015-06-04
|
* avfilter: handle error in query_formats() in bunch of filtersPaul B Mahol2015-04-08
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* vfilter/vf_tinterlace: Fix issues with linesize and colsMichael Niedermayer2015-01-06
| | | | | | Based on patch by Vittorio Giovara <vittorio.giovara@gmail.com> from 696141e898193311c994b399a8dc60713709092f Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/vf_tinterlace: Favor using standard timebases for the outputMichael Niedermayer2014-12-02
| | | | | | Reported-by: Vittorio Giovara <vittorio.giovara@gmail.com> Inspired by discussion with Kieran Kunhya <kierank@obe.tv> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/vf_tinterlace: remove unused variableMichael Niedermayer2014-11-16
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/tinterlace: add Support for ff_lowpass_line_avx() & ↵Michael Niedermayer2014-11-15
| | | | | | | | ff_lowpass_line_sse2() Based-on: 2e1704059ae8625beda2ffde847ad22c5ba416dc by Kieran Kunhya Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/tinterlace: Move lowpass_line to a separate function and call it ↵Michael Niedermayer2014-11-15
| | | | | | | | | through a function pointer This permits replacing it by a optimized implementation Based-on / Idea-from: 2e1704059ae8625beda2ffde847ad22c5ba416dc by Kieran Kunhya Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/tinterlace: split context definition into seperate header so it can ↵Michael Niedermayer2014-11-15
| | | | | | | | be used by future optimizations Idea from 2e1704059ae8625beda2ffde847ad22c5ba416dc from Kieran Kunhya Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/vf_tinterlace: fix linesize vs. widthMichael Niedermayer2014-11-15
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/vf_tinterlace: Fix output top field first flag for MODE_INTERLACEX2Michael Niedermayer2014-11-15
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/vf_tinterlace: fix frame rateAleksey Vasenev2014-11-13
| | | | | Signed-off-by: Aleksey Vasenev <margtu-fivt@ya.ru> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* lavfi: add const/static const to pix_fmts arrays.Reimar Döffinger2014-08-31
| | | | Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
* avfilter/vf_tinterlace: Fix vf_tinterlace mode 6 (interlacex2)Jasper Taylor2014-03-16
| | | | | | | | | | | | | | | | The purpose of this filter mode is to allow interlaced content to display properly in interlaced video modes, as described in http://forum.xbmc.org/showthread.php?tid=81834 and https://github.com/mpv-player/mpv/issues/624#issuecomment-37685195 . The filter doubles the video frame rate, but does not work properly because: (1) it does not set the properties of the output stream to indicate the doubled frame rate, and (2) it does not set an appropriate PTS on the extra frames. The attached patch fixes these problems by settling these values the same way they are set in vf_yadif mode 1 (field) which also doubles the frame rate. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/vf_tinterlace: check clone return valueMichael Niedermayer2013-11-19
| | | | | | Inspired by: 3a16ec19d2426457419cb8a7304f97982699efda 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_tinterlace: add yuv411p, yuv440p, yuva422p and yuva444pPaul B Mahol2013-09-21
| | | | 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>
* Merge remote-tracking branch 'qatar/master'Michael Niedermayer2013-06-18
| | | | | | | * qatar/master: lavfi: math typo in interlace filter Merged-by: Michael Niedermayer <michaelni@gmx.at>
* lavfi/tinterlace: remove request frame hackPaul B Mahol2013-05-27
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* 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.
* lavu: add FF_CEIL_RSHIFT and use it in various places.Clément Bœsch2013-05-09
|
* avfilter/vf_tinterlace: fix handling of not so even sizesMichael Niedermayer2013-04-29
| | | | | | Fixes green bottom line Signed-off-by: Michael Niedermayer <michaelni@gmx.at>