[FFmpeg-devel] [PATCH] lavu/eval: add clip function

Stefano Sabatini stefasab at gmail.com
Fri Jul 4 16:40:50 CEST 2014


On date Friday 2014-07-04 14:26:45 +0200, Clément Bœsch encoded:
> On Fri, Jul 04, 2014 at 02:13:58PM +0200, Stefano Sabatini wrote:
> > TODO: bump micro
> > ---
> >  doc/utils.texi   | 4 ++++
> >  libavutil/eval.c | 6 +++++-
> >  2 files changed, 9 insertions(+), 1 deletion(-)
> > 
> > diff --git a/doc/utils.texi b/doc/utils.texi
> > index 5abfb0c..83ff8b0 100644
> > --- a/doc/utils.texi
> > +++ b/doc/utils.texi
> > @@ -782,6 +782,10 @@ large numbers (usually 2^53 and larger).
> >  Round the value of expression @var{expr} upwards to the nearest
> >  integer. For example, "ceil(1.5)" is "2.0".
> >  
> > + at item clip(x, min, max)
> > +Return the value of @var{x} clipped between @var{min} and
> > + at var{max}. Result is undefined if @var{min} is greater than @var{max}.
> > +
> 
> You should add an extra check, because depending on the build
> configuration it can be used to make ffmpeg abort.

Yeah. Also checking for NAN adds a lot of additional code. If we just
want to avoid the abort() we can avoid the NAN checks. Another
alternative would be to have a clip-safe slower function which
performs checks on NAN.
-- 
FFmpeg = Forgiving and Furious Multimedia Patchable Exploitable Gymnast
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-lavu-eval-add-clip-function.patch
Type: text/x-diff
Size: 3708 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140704/dea281c2/attachment.bin>


More information about the ffmpeg-devel mailing list