summaryrefslogtreecommitdiff
path: root/libavfilter/vf_delogo.c
Commit message (Collapse)AuthorAge
* avfilter/vf_delogo: fix show option when clippingJean Delvare2015-12-14
| | | | | | | | The show option did not take clipping into account, so the borders on the clipped side wouldn't show up. Fix it. Signed-off-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avfilter/vf_delogo: Use AVPixFmtDescriptor.nb_componentsJean Delvare2015-12-12
| | | | | | | | | Relying on AVPixFmtDescriptor.nb_components is cleaner and faster than checking data and linesize for every possible plane. Signed-off-by: Jean Delvare <jdelvare@suse.de> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avfilter/vf_delogo: round to the closest valueJean Delvare2015-12-09
| | | | | | | | | | | | | When the interpolated value is divided by the sum of weights, no rounding is done, which means the value is truncated. This results in a slight bias towards dark green in the interpolated area. Rounding properly removes the bias. I measured this change to reduce the interpolation error by 1 to 2 % on average on a number of sample input and logo area combinations. Signed-off-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avfilter/delogo: Set default band to 1Jean Delvare2015-10-08
| | | | | | | | | | | | | | | | | | | | | | | | | | The original interpolation algorithm behaved poorly on the borders and did not even guarantee continuity at the borders. For this reason, a second interpolation/blending pass was required on the borders to make them seamless. However, since the interpolation algorithm was improved in June 2013, the border issues no longer exist. The new algorithm does guarantee continuity at the borders, making the second pass useless. A larger band always increases the cumulated interpolation error. In most cases it also increases the average interpolation error, even though the samples in the band are only partially interpolated. For this reason I would like to get rid of the "band" parameter. As a first step, let's change its default value from 4 to 1 and document it as deprecated. I have benchmarked this change on a combination of input sources and realistic logo areas. Lowering the band value from 4 to 1 resulted in 8 to 39 % less interpolation error per frame (or 1 to 34 % less interpolation error per luma sample.) Signed-off-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
* avfilter/delogo: Fix show option when band is smallJean Delvare2015-09-28
| | | | | | | | | | | | | | | | | | The code assumed that the outermost interpolated pixels were always in the fuzzy area defined by the band option. However if the band value is small, there may be no fuzzy area on a given plane. In that case, option show did not work, no rectangle was drawn (or only on the luma plane, depending on the band value and chroma plane subsampling factors.) Fix the problem by not making any assumption on where the outermost interpolated pixels will be. The new code was verified to produce the same result as the original code when the band value is not small. Signed-off-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Update my email addressJean Delvare2015-09-22
| | | | | | My old address no longer works. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avfilter/delogo: use AV_OPT_TYPE_BOOL for show optionClément Bœsch2015-09-08
|
* avfilter: handle error in query_formats() of a bunch of random video filtersClément Bœsch2015-03-16
|
* Merge commit '58400ac133bcfb6bf8196b4e5208bc178307739b'Michael Niedermayer2014-04-19
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-19
| |
* | 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>
| * lavfi: do not export the filters from shared objectsAnton Khirnov2013-10-28
| |
* | avfilter: various cosmeticsPaul B Mahol2013-09-12
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | avfilter: remove redundant .get_(audio/video)_buffer initializationsPaul B Mahol2013-09-07
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | avfilter: fix plane validity checksMichael Niedermayer2013-08-03
| | | | | | | | | | | | Fixes out of array accesses Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | lavfi/delogo: Fix sign extension issueJean Delvare2013-07-13
| | | | | | | | | | | | | | | | | | | | | | | | Coverity complains about a possible sign extension issue in apply_delogo(). While it is extremely unlikely to happen, it is easy to fix so let's just do that. Using unsigned variables even makes the binary code smaller. Fixes Coverity CID 1046439. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | lavfi/delogo: band width must be at least 1Jean Delvare2013-07-05
| | | | | | | | | | | | | | | | | | | | We need at least one pixel around the logo to use as known points to interpolate from. So properly declare the band/t attribute has having a minimum value of 1. Signed-off-by: Jean Delvare <khali@linux-fr.org> Reviewed-by: Stefano Sabatini <stefasab@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | lavfi/delogo: option show shouldn't affect bandJean Delvare2013-07-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Options "show" and "band" are unrelated and should thus be independent. However, setting "show" to 1 currently resets "band" to its default value of 4. While this is documented, this still surprising and confusing IMHO. Change this behavior and make "show" and "band" independent from each other. Update the documentation accordingly. Signed-off-by: Jean Delvare <khali@linux-fr.org> Reviewed-by: Stefano Sabatini <stefasab@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | lavfi/delogo: remember left and right samples when interpolatingJean Delvare2013-07-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The left and right samples are the same for the whole line, so store their values and don't recompute them for every iteration of "y". This simple optimization results in a speed improvement between 15% and 20% in my tests (depending on the logo geometry.) Result is obviously the same. Signed-off-by: Jean Delvare <khali@linux-fr.org> Reviewed-by: Stefano Sabatini <stefasab@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | lavfi/delogo: don't recompute the same difference again and againJean Delvare2013-07-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The top left hand corner pixel coordinates are already stored in logo_x1 and logo_y1 so don't recompute each of them 6 times for every iteration. This is a simple code optimization, result is obviously the same. The performance gain is small (about 2% in my tests) but still good to have, and the new code is clearer. Signed-off-by: Jean Delvare <khali@linux-fr.org> Reviewed-by; Stefano Sabatini <stefasab@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | lavfi/delogo: avoid propagation of rounding errors in chroma planesJean Delvare2013-07-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When operating on subsampled chroma planes, some rounding is taking place. The left and top borders are rounded down while the width and height are rounded up, so all rounding is done outward to guarantee the logo area is fully covered. The problem is that the width and height are counted from the unrounded left and top borders, respectively. So if the left or top border position has indeed been rounded down, and the width or height needs no rounding (up), the position of the the right or bottom border will be effectively rounded down, i.e. inward. The issue can easily be seen with a yuv240p input and -vf delogo=45:45:60:40:show=1 -vframes 1 delogo-bug.png (or virtually any logo area with odd x and y and even width and height.) The right and bottom chroma borders (in green) are clearly off. In order to fix this, the width and height must be adjusted to include the bits lost in the rounding of the left and top border positions, respectively, prior to being themselves rounded up. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | lavfi/delogo: take SAR into accountJean Delvare2013-07-03
| | | | | | | | | | | | | | | | | | | | | | When interpolating, weights are based on relative distances, which assume square pixels. If a non-1:1 sample aspect ratio is used, it should be taken into account when comparing distances, because the human eye and brain care about the picture as it is displayed, not stored. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | lavfi/delogo: use weighted interpolationJean Delvare2013-07-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original delogo algorithm interpolates both horizontally and vertically and uses the average to compute the resulting sample. This works reasonably well when the logo area is almost square. However when the logo area is significantly larger than high or higher than large, the result is largely suboptimal. The issue can be clearly seen by testing the delogo filter with a fake logo area that is 200 pixels large and 2 pixels high. Vertical interpolation gives a very good result in that case, horizontal interpolation gives a very bad result, and the overall result is poor, because both are given the same weight. Even when the logo is roughly square, the current algorithm gives poor results on the borders of the logo area, because it always gives horizontal and vertical interpolations an equal weight, and this is suboptimal on borders. For example, in the middle of the left hand side border of the logo, you want to trust the left known point much more than the right known point (which the current algorithm already does) but also much more than the top and bottom known points (which the current algorithm doesn't do.) By properly weighting each known point when computing the value of each interpolated pixel, the visual result is much better, especially on borders and/or for high or large logo areas. The algorithm I implemented guarantees that the weight of each of the 4 known points directly depends on its distance to the interpolated point. It is largely inspired from the original algorithm, the key difference being that it computes the relative weights globally instead of separating the vertical and horizontal interpolations and combining them afterward. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
* | delogo: Fix function descriptionJean Delvare2013-06-19
| | | | | | | | | | | | | | | | The algorithm works on src and writes to dst, not the other way around. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit 'ba09675f44612fad9f7169f71b8276beb50a0dcd'Michael Niedermayer2013-05-16
|\| | | | | | | | | | | | | | | | | | | | | | | * commit 'ba09675f44612fad9f7169f71b8276beb50a0dcd': vf_delogo: use the name 's' for the pointer to the private context vf_cropdetect: use the name 's' for the pointer to the private context vf_crop: cosmetics, break lines Conflicts: libavfilter/vf_delogo.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * vf_delogo: use the name 's' for the pointer to the private contextAnton Khirnov2013-05-16
| | | | | | | | This is shorter and consistent across filters.
| * lavfi: remove now unused args parameter from AVFilter.initAnton Khirnov2013-04-09
| |
* | 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: add timeline support in {de,remove}logo.Clément Bœsch2013-04-24
| | | | | | | | Both don't change anything in the context between frames.
* | lavfi: remove now unused args parameter from AVFilter.initAnton Khirnov2013-04-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 '63e58c55c17d7f8b5eec9c082fe0f8edc305a24e'Michael Niedermayer2013-04-10
|\| | | | | | | | | | | | | | | | | | | * commit '63e58c55c17d7f8b5eec9c082fe0f8edc305a24e': vf_delogo: switch to an AVOptions-based system. Conflicts: libavfilter/vf_delogo.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * vf_delogo: switch to an AVOptions-based system.Anton Khirnov2013-04-09
| |
* | lavfi/vf_delogo: use standard options parsing.Nicolas George2013-03-20
| |
* | lavfi/delogo: 10l forgotten trailing NULL in shorthand.Clément Bœsch2013-03-16
| | | | | | | | Regression since de3e0ab3.
* | lavfi/delogo: remove sscanf and rely on av_opt_set_from_string() only.Clément Bœsch2013-03-13
| |
* | 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: switch to AVFrame.Anton Khirnov2013-03-08
| | | | | | | | | | Deprecate AVFilterBuffer/AVFilterBufferRef and everything related to it and use AVFrame instead.
* | Merge remote-tracking branch 'qatar/master'Michael Niedermayer2013-01-29
|\| | | | | | | | | | | | | | | | | | | * qatar/master: vf_delogo: fix copying the input frame. Conflicts: libavfilter/vf_delogo.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * vf_delogo: fix copying the input frame.Anton Khirnov2013-01-29
| | | | | | | | CC:libav-stable@libav.org
| * vf_delogo: fix an uninitialized read.Anton Khirnov2013-01-29
| | | | | | | | CC:libav-stable@libav.org
| * lavfi: merge start_frame/draw_slice/end_frameAnton Khirnov2012-11-28
| | | | | | | | | | Any alleged performance benefits gained from the split are purely mythological and do not justify added code complexity.
* | lavfi: declare arrays that never change as static constPaul B Mahol2012-12-21
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | lavfi: remove some video w/h settings after avfilter_copy_buffer_ref_props.Clément Bœsch2012-12-03
| | | | | | | | | | | | video->[wh] will be set with the same values as the input after avfilter_copy_buffer_ref_props. These filters don't change the size of the input so there is no need for this code.
* | lavfi: add priv_class for some forgotten filters.Clément Bœsch2012-11-29
| | | | | | | | | | This allows to print the options available when using commands such as ffmpeg -help full.
* | vf_delogo: switch to filter_frame, this filter did not support slicesMichael Niedermayer2012-11-28
| | | | | | | | | | Based on patch by Anton Khirnov Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | vf_delogo: fix order of operations in apply_delogo()Michael Niedermayer2012-11-28
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '59ee9f78b0cc4fb84ae606fa317d8102ad32a627'Michael Niedermayer2012-10-12
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '59ee9f78b0cc4fb84ae606fa317d8102ad32a627': lavfi: do not use av_pix_fmt_descriptors directly. Conflicts: libavfilter/buffersrc.c libavfilter/drawutils.c libavfilter/filtfmts.c libavfilter/vf_ass.c libavfilter/vf_boxblur.c libavfilter/vf_drawtext.c libavfilter/vf_lut.c libavfilter/vf_pad.c libavfilter/vf_scale.c libavfilter/vf_showinfo.c libavfilter/vf_transpose.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * lavfi: do not use av_pix_fmt_descriptors directly.Anton Khirnov2012-10-12
| |
* | Merge commit '4436f25a1682ada3f7226cb6fadf429946933161'Michael Niedermayer2012-10-11
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>