[FFmpeg-devel] [PATCH] lavfi/delogo: avoid propagation of rounding errors in chroma planes
Michael Niedermayer
michaelni at gmx.at
Wed Jul 3 23:19:09 CEST 2013
On Tue, Jul 02, 2013 at 01:50:02PM +0200, Jean Delvare wrote:
> 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 at linux-fr.org>
> ---
> libavfilter/vf_delogo.c | 6 -
> tests/ref/fate/filter-delogo | 218 +++++++++++++++++++++----------------------
> 2 files changed, 113 insertions(+), 111 deletions(-)
applied
thanks
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130703/1a850d3c/attachment.asc>
More information about the ffmpeg-devel
mailing list