[FFmpeg-devel] [PATCH 6/7] Implement if(expr, cond) binary function evaluation.

Stefano Sabatini stefano.sabatini-lala
Mon Nov 1 01:52:17 CET 2010


On date Monday 2010-11-01 01:22:48 +0100, Michael Niedermayer encoded:
> On Mon, Nov 01, 2010 at 12:23:32AM +0100, Stefano Sabatini wrote:
> > ---
> >  doc/eval.texi    |    5 +++++
> >  libavutil/eval.c |   11 ++++++++++-
> >  2 files changed, 15 insertions(+), 1 deletions(-)
> > 
> > diff --git a/doc/eval.texi b/doc/eval.texi
> > index 2416442..c944b3e 100644
> > --- a/doc/eval.texi
> > +++ b/doc/eval.texi
> > @@ -56,6 +56,11 @@ The function returns the loaded value.
> >  Evaluate expression @var{expr} when the expression @var{cond} is
> >  true, and returns the value of the last @var{expr} evaluation, or NAN
> >  if @var{cond} was always false.
> > +
> > + at item if(cond, expr)
> > +Evaluate expression @var{expr} only if the expression @var{cond} is
> > +true, and returns the value of the last @var{expr} evaluation, or NAN
> > +if @var{cond} was false.
> >  @end table
> 
> the syntax is ugly and i dont see how to extend this to else if /else
> some parts of the eval code are already quite ugly i object to adding more
> ugly confusing syntax, especially without strong advantage for some real
> use case.

"PTS=st(0, PTS); if(isnan(ld(0)), st(0,PREV_INPTS+k)); ld(0)"

I know that this is ugly as an a####le but I can't conceive other
ways to express such an expression. while() could be used but would be
even uglier. Best solution would be to have an if(COND,EXPR,ELSEEXPR)
but this requires more work on eval.
-- 
FFmpeg = Fancy and Fierce Minimal Portable Experimenting Gymnast



More information about the ffmpeg-devel mailing list