diff options
author | Martin Storsjö <martin@martin.st> | 2012-07-01 16:11:23 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2012-07-04 15:10:56 +0300 |
commit | 143f1e92034429e0b87a24bca0f98da81f17d38a (patch) | |
tree | 814de5e5ffbf6b10f58f3343e0e0f03e99966518 /libavutil | |
parent | 25accf93ad7b0ad3e2a17718e689c05fbc5b5698 (diff) | |
download | ffmpeg-143f1e92034429e0b87a24bca0f98da81f17d38a.tar.gz |
eval: Add the isinf() function and tests for it
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/avutil.h | 2 | ||||
-rw-r--r-- | libavutil/eval.c | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/libavutil/avutil.h b/libavutil/avutil.h index 351e8279ac..69c5727fb2 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -153,7 +153,7 @@ #define LIBAVUTIL_VERSION_MAJOR 51 #define LIBAVUTIL_VERSION_MINOR 34 -#define LIBAVUTIL_VERSION_MICRO 0 +#define LIBAVUTIL_VERSION_MICRO 1 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ diff --git a/libavutil/eval.c b/libavutil/eval.c index 36b5ce5dda..f2d619f5c9 100644 --- a/libavutil/eval.c +++ b/libavutil/eval.c @@ -120,7 +120,7 @@ static int strmatch(const char *s, const char *prefix) struct AVExpr { enum { e_value, e_const, e_func0, e_func1, e_func2, - e_squish, e_gauss, e_ld, e_isnan, + e_squish, e_gauss, e_ld, e_isnan, e_isinf, 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, @@ -148,6 +148,7 @@ static double eval_expr(Parser *p, AVExpr *e) case e_gauss: { double d = eval_expr(p, e->param[0]); return exp(-d*d/2)/sqrt(2*M_PI); } case e_ld: return e->value * p->var[av_clip(eval_expr(p, e->param[0]), 0, VARS-1)]; case e_isnan: return e->value * !!isnan(eval_expr(p, e->param[0])); + case e_isinf: return e->value * !!isinf(eval_expr(p, e->param[0])); case e_floor: return e->value * floor(eval_expr(p, e->param[0])); 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])); @@ -282,6 +283,7 @@ static int parse_primary(AVExpr **e, Parser *p) else if (strmatch(next, "lt" )) { AVExpr *tmp = d->param[1]; d->param[1] = d->param[0]; d->param[0] = tmp; d->type = e_gte; } else if (strmatch(next, "ld" )) d->type = e_ld; else if (strmatch(next, "isnan" )) d->type = e_isnan; + else if (strmatch(next, "isinf" )) d->type = e_isinf; else if (strmatch(next, "st" )) d->type = e_st; else if (strmatch(next, "while" )) d->type = e_while; else if (strmatch(next, "floor" )) d->type = e_floor; @@ -453,6 +455,7 @@ static int verify_expr(AVExpr *e) case e_ld: case e_gauss: case e_isnan: + case e_isinf: case e_floor: case e_ceil: case e_trunc: @@ -601,6 +604,10 @@ int main(int argc, char **argv) "st(0, 1); while(lte(ld(0),100), st(1, ld(1)+ld(0)); st(0, ld(0)+1))", "isnan(1)", "isnan(NAN)", + "isnan(INF)", + "isinf(1)", + "isinf(NAN)", + "isinf(INF)", "floor(NAN)", "floor(123.123)", "floor(-123.123)", |