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

Víctor Paesa victorpaesa
Mon Nov 1 08:53:35 CET 2010


On Mon, Nov 1, 2010 at 01:52, Stefano Sabatini
<stefano.sabatini-lala at poste.it> wrote:
> 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:


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

should be equivalent to
"PTS=isnan(PTS)*PTS + eq(isnan(PTS),0)*(PREV_INPTS+k)"

> 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.

* works like AND
+ works like OR

"if A then B else C"
is equivalent to
"A*B + not(A)*C"

When A evaluates to either 1 or 0, that is the same as
"A*B + eq(A,0)*C"


More information about the ffmpeg-devel mailing list