1 @chapter Expression Evaluation
2 @c man begin EXPRESSION EVALUATION
4 When evaluating an arithemetic expression, FFmpeg uses an internal
5 formula evaluator, implemented through the @file{libavutil/eval.h}
8 An expression may contain unary, binary operators, constants, and
11 Two expressions @var{expr1} and @var{expr2} can be combined to form
12 another expression "@var{expr1};@var{expr2}".
13 @var{expr1} and @var{expr2} are evaluated in turn, and the new
14 expression evaluates to the value of @var{expr2}.
16 The following binary operators are available: @code{+}, @code{-},
17 @code{*}, @code{/}, @code{^}.
19 The following unary operators are available: @code{+}, @code{-}.
21 The following functions are available:
38 Return 1.0 if @var{x} is NAN, 0.0 otherwise.
49 Allow to store the value of the expression @var{expr} in an internal
50 variable. @var{var} specifies the number of the variable where to
51 store the value, and it is a value ranging from 0 to 9. The function
52 returns the value stored in the internal variable.
55 Allow to load the value of the internal variable with number
56 @var{var}, which was previosly stored with st(@var{var}, @var{expr}).
57 The function returns the loaded value.
59 @item while(cond, expr)
60 Evaluate expression @var{expr} while the expression @var{cond} is
61 non-zero, and returns the value of the last @var{expr} evaluation, or
62 NAN if @var{cond} was always false.
67 @code{*} works like AND
69 @code{+} works like OR
80 When A evaluates to either 1 or 0, that is the same as
85 In your C code, you can extend the list of unary and binary functions,
86 and define recognized constants, so that they are available for your
89 The evaluator also recognizes the International System number
90 postfixes. If 'i' is appended after the postfix, powers of 2 are used
91 instead of powers of 10. The 'B' postfix multiplies the value for 8,
92 and can be appended after another postfix or used alone. This allows
93 using for example 'KB', 'MiB', 'G' and 'B' as postfix.
95 Follows the list of available International System postfixes, with
96 indication of the corresponding powers of 10 and of 2.