Commit 3dfc5f55 authored by Michael Niedermayer's avatar Michael Niedermayer

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: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 60abdb6c
...@@ -1062,7 +1062,7 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame) ...@@ -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_T] = pts == AV_NOPTS_VALUE ? NAN : pts * av_q2d(link->time_base);
dstctx->var_values[VAR_POS] = pos == -1 ? NAN : pos; 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 && if (dstctx->is_disabled &&
(dstctx->filter->flags & AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC)) (dstctx->filter->flags & AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC))
filter_frame = default_filter_frame; filter_frame = default_filter_frame;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment