## Revision 5ae4251c

View differences:

doc/eval.texi
60 60
```Evaluate expression @var{expr} while the expression @var{cond} is
```
61 61
```non-zero, and returns the value of the last @var{expr} evaluation, or
```
62 62
```NAN if @var{cond} was always false.
```
63

64
```@item ceil(expr)
```
65
```Round the value of expression @var{expr} upwards to the nearest
```
66
```integer. For example, "ceil(1.5)" is "2.0".
```
67

68
```@item floor(expr)
```
69
```Round the value of expression @var{expr} downwards to the nearest
```
70
```integer. For example, "floor(-1.5)" is "-2.0".
```
71

72
```@item trunc(expr)
```
73
```Round the value of expression @var{expr} towards zero to the nearest
```
74
```integer. For example, "trunc(-1.5)" is "-1.0".
```
63 75
```@end table
```
64 76

65 77
```Note that:
```
libavutil/avutil.h
41 41

42 42
```#define LIBAVUTIL_VERSION_MAJOR 50
```
43 43
```#define LIBAVUTIL_VERSION_MINOR 40
```
44
```#define LIBAVUTIL_VERSION_MICRO  0
```
44
```#define LIBAVUTIL_VERSION_MICRO  1
```
45 45

46 46
```#define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
```
47 47
```                                               LIBAVUTIL_VERSION_MINOR, \
```
libavutil/eval.c
121 121
```        e_squish, e_gauss, e_ld, e_isnan,
```
122 122
```        e_mod, e_max, e_min, e_eq, e_gt, e_gte,
```
123 123
```        e_pow, e_mul, e_div, e_add,
```
124
```        e_last, e_st, e_while,
```
124
```        e_last, e_st, e_while, e_floor, e_ceil, e_trunc,
```
125 125
```    } type;
```
126 126
```    double value; // is sign in other types
```
127 127
```    union {
```
......
145 145
```        case e_gauss: { double d = eval_expr(p, e->param[0]); return exp(-d*d/2)/sqrt(2*M_PI); }
```
146 146
```        case e_ld:     return e->value * p->var[av_clip(eval_expr(p, e->param[0]), 0, VARS-1)];
```
147 147
```        case e_isnan:  return e->value * !!isnan(eval_expr(p, e->param[0]));
```
148
```        case e_floor:  return e->value * floor(eval_expr(p, e->param[0]));
```
149
```        case e_ceil :  return e->value * ceil (eval_expr(p, e->param[0]));
```
150
```        case e_trunc:  return e->value * trunc(eval_expr(p, e->param[0]));
```
148 151
```        case e_while: {
```
149 152
```            double d = NAN;
```
150 153
```            while (eval_expr(p, e->param[0]))
```
......
276 279
```    else if (strmatch(next, "isnan" )) d->type = e_isnan;
```
277 280
```    else if (strmatch(next, "st"    )) d->type = e_st;
```
278 281
```    else if (strmatch(next, "while" )) d->type = e_while;
```
282
```    else if (strmatch(next, "floor" )) d->type = e_floor;
```
283
```    else if (strmatch(next, "ceil"  )) d->type = e_ceil;
```
284
```    else if (strmatch(next, "trunc" )) d->type = e_trunc;
```
279 285
```    else {
```
280 286
```        for (i=0; p->func1_names && p->func1_names[i]; i++) {
```
281 287
```            if (strmatch(next, p->func1_names[i])) {
```
......
439 445
```        case e_squish:
```
440 446
```        case e_ld:
```
441 447
```        case e_gauss:
```
442
```        case e_isnan: return verify_expr(e->param[0]);
```
448
```        case e_isnan:
```
449
```        case e_floor:
```
450
```        case e_ceil:
```
451
```        case e_trunc:
```
452
```            return verify_expr(e->param[0]);
```
443 453
```        default: return verify_expr(e->param[0]) && verify_expr(e->param[1]);
```
444 454
```    }
```
445 455
```}
```
......
611 621
```        "st(0, 1); while(lte(ld(0),100), st(1, ld(1)+ld(0)); st(0, ld(0)+1))",
```
612 622
```        "isnan(1)",
```
613 623
```        "isnan(NAN)",
```
624
```        "floor(NAN)",
```
625
```        "floor(123.123)",
```
626
```        "floor(-123.123)",
```
627
```        "trunc(123.123)",
```
628
```        "trunc(-123.123)",
```
629
```        "ceil(123.123)",
```
630
```        "ceil(-123.123)",
```
614 631
```        NULL
```
615 632
```    };
```
616 633

Also available in: Unified diff