ffmpeg/libavfilter
Jean Delvare 16fd75ceec lavfi/delogo: use weighted interpolation
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>
2013-07-01 09:33:33 +02:00
..
libmpcodecs lavfi/mp: remove mp=spp. 2013-06-14 01:27:22 +02:00
x86 lavfi: add spp filter. 2013-06-14 01:27:22 +02:00
af_aconvert.c
af_afade.c lavfi/afade: add timeline support 2013-05-25 13:20:27 +00:00
af_aformat.c
af_amerge.c
af_amix.c
af_anull.c
af_apad.c
af_aphaser.c
af_aresample.c
af_asetnsamples.c
af_asetrate.c
af_ashowinfo.c
af_astats.c avfilter/af_astats: rename stat() 2013-06-03 14:59:52 +02:00
af_astreamsync.c
af_asyncts.c
af_atempo.c
af_biquads.c Rename constant HZ in af_biquads.c as HERTZ. 2013-06-30 13:47:45 +02:00
af_channelmap.c lavfi/channelmap: make use of AVFILTER_DEFINE_CLASS 2013-05-27 11:31:52 +00:00
af_channelsplit.c
af_earwax.c
af_join.c lavfi/join: make use of AVFILTER_DEFINE_CLASS 2013-05-27 11:10:39 +00:00
af_pan.c
af_resample.c
af_silencedetect.c
af_volume.c
af_volume.h
af_volumedetect.c
all_channel_layouts.inc
allfilters.c lavfi: add spp filter. 2013-06-14 01:27:22 +02:00
asink_anullsink.c
asrc_abuffer.h
asrc_aevalsrc.c
asrc_anullsrc.c
asrc_flite.c
asrc_sine.c
audio.c Merge remote-tracking branch 'qatar/master' 2013-06-19 08:27:35 +02:00
audio.h
avcodec.c
avcodec.h
avf_avectorscope.c
avf_concat.c
avf_showspectrum.c
avf_showwaves.c
avfilter.c avfilter/avfilter: Make avfilter_register() thread safe 2013-06-28 12:44:03 +02:00
avfilter.h Merge commit '8b7dffc2d6c6c19f8e0a1fedcd0e95dce7a273ff' 2013-06-05 12:05:41 +02:00
avfiltergraph.c
avfiltergraph.h
bbox.c
bbox.h
buffer.c
bufferqueue.h
buffersink.c
buffersink.h
buffersrc.c
buffersrc.h
deshake_opencl_kernel.h
deshake_opencl.c
deshake_opencl.h
deshake.h
drawutils.c lavfi/drawutils: attempt to fix subsampling. 2013-05-28 19:20:27 +02:00
drawutils.h
dualinput.c lavfi: add dual input helpers. 2013-05-27 20:32:28 +02:00
dualinput.h lavfi: add dual input helpers. 2013-05-27 20:32:28 +02:00
f_ebur128.c
f_interleave.c
f_perms.c
f_select.c
f_sendcmd.c
f_settb.c
f_zmq.c
fifo.c
filtfmts.c
formats.c
formats.h
gradfun.h
graphdump.c
graphparser.c
internal.h
lavfutils.c
lavfutils.h
libavfilter.v
lswsutils.c
lswsutils.h
Makefile lavfi/mp: remove mp=spp. 2013-06-14 01:27:22 +02:00
opencl_allkernels.c
opencl_allkernels.h
pthread.c Rename thread_init() in libavcodec and libavfilter as library_thread_init(). 2013-06-30 13:47:45 +02:00
setpts.c lavfi/setpts: make use of AVFILTER_DEFINE_CLASS 2013-05-27 11:14:43 +00:00
split.c
src_movie.c avfilter/src_movie: Fix handling of packet size for video 2013-06-26 13:46:19 +02:00
thread.h
transform.c
transform.h
trim.c lavfi/trim: mark link closed on EOF. 2013-06-02 23:19:42 +02:00
unsharp_opencl_kernel.h
unsharp_opencl.c
unsharp_opencl.h
unsharp.h
version.h lavfi/mp: remove mp=spp. 2013-06-14 01:27:22 +02:00
vf_alphamerge.c
vf_aspect.c
vf_bbox.c lavfi/bbox: export bbox info to frame metadata 2013-05-26 14:00:10 +00:00
vf_blackdetect.c
vf_blackframe.c
vf_blend.c lavfi/blend: support slice threading 2013-05-24 21:41:28 +00:00
vf_boxblur.c
vf_colorbalance.c
vf_colorchannelmixer.c
vf_colormatrix.c
vf_copy.c
vf_crop.c
vf_cropdetect.c
vf_curves.c
vf_dctdnoiz.c lavfi/dctdnoiz: move DC normalization out of loops. 2013-05-26 22:41:02 +02:00
vf_decimate.c
vf_delogo.c lavfi/delogo: use weighted interpolation 2013-07-01 09:33:33 +02:00
vf_deshake.c
vf_drawbox.c vf_drawbox: give all v_log() a context 2013-06-26 00:54:08 +02:00
vf_drawtext.c add the start_number offset to var_values[VAR_N] directly, instead of adding it in func_frame_num 2013-06-18 17:38:17 -04:00
vf_edgedetect.c
vf_extractplanes.c
vf_fade.c vf_fade: remove unused function 2013-05-24 20:50:15 +02:00
vf_field.c
vf_fieldmatch.c
vf_fieldorder.c
vf_format.c lavfi/format: make use of AVFILTER_DEFINE_CLASS 2013-05-27 11:17:34 +00:00
vf_fps.c
vf_framestep.c lavfi/framestep: cosmetics: reindent AVFilter 2013-06-06 17:19:16 +00:00
vf_frei0r.c lavfi/frei0r: make use of AVFILTER_DEFINE_CLASS 2013-05-27 11:31:52 +00:00
vf_geq.c
vf_gradfun.c
vf_hflip.c
vf_histeq.c
vf_histogram.c
vf_hqdn3d.c lavfi/hqdn3d: make use of AVFILTER_DEFINE_CLASS 2013-05-27 10:58:45 +00:00
vf_hqdn3d.h
vf_hue.c
vf_idet.c lavfi/idet: remove request_frame hack 2013-05-27 09:55:39 +00:00
vf_il.c lavfi/il: add timeline support 2013-06-06 17:44:54 +00:00
vf_interlace.c Merge remote-tracking branch 'qatar/master' 2013-06-18 09:31:05 +02:00
vf_kerndeint.c
vf_libopencv.c lavfi/ocv: make use of AVFILTER_DEFINE_CLASS 2013-05-27 11:31:52 +00:00
vf_lut3d.c lavfi/lut3d: add sanity checks. 2013-06-07 01:48:41 +02:00
vf_lut.c
vf_mcdeint.c avfilter/vf_mcdeint: free frame on error 2013-06-03 15:41:29 +02:00
vf_mp.c avfilter/vf_mp: preserve pixel format when possible 2013-06-28 03:32:00 +02:00
vf_mpdecimate.c
vf_noise.c lavfi/noise: fix out of array access 2013-05-29 16:54:28 +00:00
vf_null.c
vf_overlay.c lavfi/overlay: remove do_blend forward declaration. 2013-05-27 20:42:46 +02:00
vf_owdenoise.c
vf_pad.c
vf_pixdesctest.c lavfi/pixdesctest: fix chroma subsampling with odd sizes. 2013-06-01 12:05:55 +02:00
vf_pp.c lavfi/pp: set out frame size. 2013-06-08 23:23:30 +02:00
vf_removelogo.c
vf_rotate.c lavfi/rotate: add angle command 2013-06-13 01:21:47 +02:00
vf_sab.c vf_sab: Fix memleak 2013-06-10 22:00:43 +02:00
vf_scale.c
vf_separatefields.c
vf_setfield.c
vf_showinfo.c
vf_smartblur.c
vf_spp.c lavfi/spp: fix description. 2013-06-14 06:53:52 +02:00
vf_spp.h lavfi: add spp filter. 2013-06-14 01:27:22 +02:00
vf_stereo3d.c
vf_subtitles.c
vf_super2xsai.c
vf_swapuv.c
vf_telecine.c
vf_thumbnail.c
vf_tile.c
vf_tinterlace.c Merge remote-tracking branch 'qatar/master' 2013-06-18 09:31:05 +02:00
vf_transpose.c
vf_unsharp.c
vf_vflip.c
vf_vidstabdetect.c
vf_vidstabtransform.c
vf_vignette.c lavfi/vignette: remove extra semi-colon. 2013-05-31 10:22:03 +02:00
vf_yadif.c
video.c
video.h
vidstabutils.c
vidstabutils.h
vsink_nullsink.c
vsrc_cellauto.c
vsrc_life.c
vsrc_mandelbrot.c
vsrc_mptestsrc.c lavfi/mptestsrc: fix chroma subsampling with odd sizes. 2013-06-01 12:05:55 +02:00
vsrc_testsrc.c avfilter/vsrc_testsrc: fix artifacts with odd height 2013-06-24 23:21:17 +02:00
yadif.h