aboutsummaryrefslogtreecommitdiffstats
path: root/doc/eval.texi
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2012-01-15 22:59:42 +0100
committerStefano Sabatini <stefasab@gmail.com>2012-01-17 12:03:30 +0100
commit999495734b9de597f59590708979902f28ebce61 (patch)
tree5d7bf9d6735a8aea4b5d93f8ed481eed738fc950 /doc/eval.texi
parenta798c20a76196d76db27f7446ab90f8062f3c4eb (diff)
downloadffmpeg-999495734b9de597f59590708979902f28ebce61.tar.gz
lavu/eval: add if() and ifnot() eval functions
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.
Diffstat (limited to 'doc/eval.texi')
-rw-r--r--doc/eval.texi12
1 files changed, 10 insertions, 2 deletions
diff --git a/doc/eval.texi b/doc/eval.texi
index b325b37dff..95e9df5a80 100644
--- a/doc/eval.texi
+++ b/doc/eval.texi
@@ -98,6 +98,14 @@ point (@var{x}, @var{y}) from the origin.
@item gcd(x, y)
Return the greatest common divisor of @var{x} and @var{y}. If both @var{x} and
@var{y} are 0 or either or both are less than zero then behavior is undefined.
+
+@item if(x, y)
+Evaluate @var{x}, and if the result is non-zero return the result of
+the evaluation of @var{y}, return 0 otherwise.
+
+@item ifnot(x, y)
+Evaluate @var{x}, and if the result is zero return the result of the
+evaluation of @var{y}, return 0 otherwise.
@end table
The following constants are available:
@@ -116,13 +124,13 @@ Note that:
@code{+} works like OR
-thus
+and the construct:
@example
if A then B else C
@end example
is equivalent to
@example
-A*B + not(A)*C
+if(A,B) + ifnot(A,C)
@end example
In your C code, you can extend the list of unary and binary functions,