[FFmpeg-devel] [PATCH] lavu/eval: add ifzero() and ifnonzero() expression

Reimar Döffinger Reimar.Doeffinger at gmx.de
Mon Jan 16 00:19:10 CET 2012


On Mon, Jan 16, 2012 at 12:06:45AM +0100, Stefano Sabatini wrote:
> On date Sunday 2012-01-15 23:20:57 +0100, Reimar Döffinger encoded:
> > On Sun, Jan 15, 2012 at 11:08:55PM +0100, Stefano Sabatini wrote:
> > > They allow to implement the if/then/else logic, which cannot be
> > > implemented otherwise.
> > > 
> > > For example the expression:
> > > A*B + not(A)*C
> > > 
> > > always evaluates to NaN if B is NaN, even in the case where A is 0.
> > 
> > Hmm. I guess we have no way to do that, bur casting to int would usually
> > result in the NaN becoming 0.
> > When and why is NaN a problem?
> 
> The property of NaN is that every operation with operand NaN will
> evaluate to NaN

Except of course those that can't, like conversion to integer or
comparison.
I had misread and thought that A would be NaN, so that's why
my question probably didn't make sense to you.
But still useful to see what the use case is.


More information about the ffmpeg-devel mailing list