[FFmpeg-devel] [PATCH 7/7] Implement isnan() function evaluation.
Stefano Sabatini
stefano.sabatini-lala
Mon Nov 1 10:46:37 CET 2010
On date Monday 2010-11-01 09:35:52 +0100, V?ctor Paesa encoded:
> Hi,
>
> On Mon, Nov 1, 2010 at 00:23, Stefano Sabatini wrote:
> > ---
> > ?doc/eval.texi ? ?| ? ?1 +
> > ?libavutil/eval.c | ? ?9 +++++++--
> > ?2 files changed, 8 insertions(+), 2 deletions(-)
> >
> > diff --git a/doc/eval.texi b/doc/eval.texi
> > index c944b3e..768525c 100644
> > --- a/doc/eval.texi
> > +++ b/doc/eval.texi
> > @@ -33,6 +33,7 @@ The following functions are available:
> > ?@item abs(x)
> > ?@item squish(x)
> > ?@item gauss(x)
> > + at item isnan(x)
> > ?@item mod(x, y)
> > ?@item max(x, y)
> > ?@item min(x, y)
> > diff --git a/libavutil/eval.c b/libavutil/eval.c
> > index 83e602d..7438ab2 100644
> > --- a/libavutil/eval.c
> > +++ b/libavutil/eval.c
> > @@ -118,7 +118,7 @@ static int strmatch(const char *s, const char *prefix)
> > ?struct AVExpr {
> > ? ? enum {
> > ? ? ? ? e_value, e_const, e_func0, e_func1, e_func2,
> > - ? ? ? ?e_squish, e_gauss, e_ld,
> > + ? ? ? ?e_squish, e_gauss, e_ld, e_isnan,
> > ? ? ? ? e_mod, e_max, e_min, e_eq, e_gt, e_gte,
> > ? ? ? ? e_pow, e_mul, e_div, e_add,
> > ? ? ? ? e_last, e_st, e_while, e_if,
> > @@ -144,6 +144,7 @@ static double eval_expr(Parser *p, AVExpr *e)
> > ? ? ? ? case e_squish: return 1/(1+exp(4*eval_expr(p, e->param[0])));
> > ? ? ? ? case e_gauss: { double d = eval_expr(p, e->param[0]); return exp(-d*d/2)/sqrt(2*M_PI); }
> > ? ? ? ? case e_ld: ? ? return e->value * p->var[av_clip(eval_expr(p, e->param[0]), 0, VARS-1)];
> > + ? ? ? ?case e_isnan: ?return e->value * isnan(eval_expr(p, e->param[0]));
>
> I would prefer that eval's isnan returns either 1 or 0.
> (The math.h isnan() returns either a non-zero value or 0)
Looks reasonable, patch updated.
--
FFmpeg = Fostering and Fierce Mega Peaceless EnGine
More information about the ffmpeg-devel
mailing list