[FFmpeg-devel] [PATCH] vf_blend: Use integers for divide mode

Martin Vignali martin.vignali at gmail.com
Tue Feb 23 08:01:41 CET 2016


2016-02-23 0:22 GMT+01:00 Ganesh Ajjanagadde <gajjanag at gmail.com>:

> On Fri, Feb 19, 2016 at 1:06 PM, Martin Vignali
> <martin.vignali at gmail.com> wrote:
> > Hello,
> >
> > Is it necessary to clip value, if B == 0 ?
>
> Well, integer division by 0 is undefined...
>
> >
> >
> > Martin
> >
> > 2016-02-19 18:47 GMT+01:00 Timothy Gu <timothygu99 at gmail.com>:
> >
> [...]
>

Yes, but in that case, zero division can't happen, because B == 0 is tested.

For now, this is the line

av_clip_uint8(B == 0 ? 255 : 255 * A / B))


I think something like this can be enough :

B == 0 ? 255 : av_clip_uint8(255 * A / B))


Martin


More information about the ffmpeg-devel mailing list