diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-05-09 16:41:56 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-09-15 15:33:39 +0200 |
commit | 3dfc5f551f4c5960afda6f8806ac5779eb2a230b (patch) | |
tree | e1caad3b6dd8273b6dc10c19661f572864ee198e | |
parent | 60abdb6c17ea87753b37fa83b85d9419b33195c8 (diff) | |
download | ffmpeg-3dfc5f551f4c5960afda6f8806ac5779eb2a230b.tar.gz |
avfilter: avoid testing float == 0
This fixes the hypothetical case of rounding errors causing
incorrect values to be used.
We do not use *_EPSILON, because non trivial expressions can contain
errors larger than that making a zero equality test with *_EPSILON
unreliable.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavfilter/avfilter.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 83d942c076..b577c9af0e 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -1062,7 +1062,7 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame) dstctx->var_values[VAR_T] = pts == AV_NOPTS_VALUE ? NAN : pts * av_q2d(link->time_base); dstctx->var_values[VAR_POS] = pos == -1 ? NAN : pos; - dstctx->is_disabled = !av_expr_eval(dstctx->enable, dstctx->var_values, NULL); + dstctx->is_disabled = fabs(av_expr_eval(dstctx->enable, dstctx->var_values, NULL)) < 0.5; if (dstctx->is_disabled && (dstctx->filter->flags & AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC)) filter_frame = default_filter_frame; |