[FFmpeg-devel] [PATCH] delogo will fail if interp is zero.
Michael Niedermayer
michael at niedermayer.cc
Thu Feb 1 23:25:34 EET 2018
On Wed, Jan 31, 2018 at 11:25:00AM +0800, wuxiaoyong wrote:
> With ROUNDED_DIV operation, if the first parameter is 0, it will
> overflow and return a very large number, delogo will fail.
> So, if it's zero, just set it to 1, it will not affect the result so
> much.
>
> Signed-off-by: wuxiaoyong <bonderwu at gmail.com>
> ---
> libavfilter/vf_delogo.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c
> index 065d093..73ad6b9 100644
> --- a/libavfilter/vf_delogo.c
> +++ b/libavfilter/vf_delogo.c
> @@ -126,7 +126,7 @@ static void apply_delogo(uint8_t *dst, int dst_linesize,
> botleft[x-logo_x1-1] +
> botleft[x-logo_x1+1]) * weightb;
> weight = (weightl + weightr + weightt + weightb) * 3U;
> - interp = ROUNDED_DIV(interp, weight);
> + interp = ROUNDED_DIV(interp <= 0 ? 1 : interp, weight);
>
> if (y >= logo_y+band && y < logo_y+logo_h-band &&
> x >= logo_x+band && x < logo_x+logo_w-band) {
this is definitly not correct
ROUNDED_DIV expects signed values interp and weight are uint64_t
you can fix ROUNDED_DIV so it works with unsigned values for example
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Never trust a computer, one day, it may think you are the virus. -- Compn
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180201/320c1379/attachment.sig>
More information about the ffmpeg-devel
mailing list