diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2011-05-23 13:13:50 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2011-09-19 12:38:34 +0200 |
commit | 8cee38a298bb818a400f0dce0efd54d593250eec (patch) | |
tree | 656773e37b2d96dbc24ca23040b4231930e5bcb9 /libavutil | |
parent | 9bc393908a6b522c93034b87b8f9f21cb13d7d69 (diff) | |
download | ffmpeg-8cee38a298bb818a400f0dce0efd54d593250eec.tar.gz |
eval: implement not() expression
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/avutil.h | 2 | ||||
-rw-r--r-- | libavutil/eval.c | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/libavutil/avutil.h b/libavutil/avutil.h index 7d995c25c6..5d378ce3a9 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -41,7 +41,7 @@ #define LIBAVUTIL_VERSION_MAJOR 51 #define LIBAVUTIL_VERSION_MINOR 10 -#define LIBAVUTIL_VERSION_MICRO 1 +#define LIBAVUTIL_VERSION_MICRO 2 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ diff --git a/libavutil/eval.c b/libavutil/eval.c index 878cf5c643..4126cd7f69 100644 --- a/libavutil/eval.c +++ b/libavutil/eval.c @@ -123,7 +123,7 @@ struct AVExpr { e_mod, e_max, e_min, e_eq, e_gt, e_gte, e_pow, e_mul, e_div, e_add, e_last, e_st, e_while, e_floor, e_ceil, e_trunc, - e_sqrt, + e_sqrt, e_not, } type; double value; // is sign in other types union { @@ -151,6 +151,7 @@ static double eval_expr(Parser *p, AVExpr *e) case e_ceil : return e->value * ceil (eval_expr(p, e->param[0])); case e_trunc: return e->value * trunc(eval_expr(p, e->param[0])); case e_sqrt: return e->value * sqrt (eval_expr(p, e->param[0])); + case e_not: return e->value * eval_expr(p, e->param[0]) == 0; case e_while: { double d = NAN; while (eval_expr(p, e->param[0])) @@ -286,6 +287,7 @@ static int parse_primary(AVExpr **e, Parser *p) else if (strmatch(next, "ceil" )) d->type = e_ceil; else if (strmatch(next, "trunc" )) d->type = e_trunc; else if (strmatch(next, "sqrt" )) d->type = e_sqrt; + else if (strmatch(next, "not" )) d->type = e_not; else { for (i=0; p->func1_names && p->func1_names[i]; i++) { if (strmatch(next, p->func1_names[i])) { @@ -454,6 +456,7 @@ static int verify_expr(AVExpr *e) case e_ceil: case e_trunc: case e_sqrt: + case e_not: return verify_expr(e->param[0]); default: return verify_expr(e->param[0]) && verify_expr(e->param[1]); } @@ -606,6 +609,9 @@ int main(int argc, char **argv) "ceil(-123.123)", "sqrt(1764)", "sqrt(-1)", + "not(1)", + "not(NAN)", + "not(0)", NULL }; |