[FFmpeg-devel] [PATCH] avfilter: avoid testing float == 0

Michael Niedermayer michaelni at gmx.at
Thu May 9 16:56:39 CEST 2013


This fixes the hypothetical case of rounding errors causing
incorrect values to be used.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavfilter/avfilter.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 3f94dde..6c3cb05 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -994,7 +994,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)
             filter_frame = dst->passthrough_filter_frame ? dst->passthrough_filter_frame
                                                          : default_filter_frame;
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list