[FFmpeg-cvslog] avfilter/f_select: fix loss of precission in SAD calculation

Michael Niedermayer git at videolan.org
Mon Jun 23 17:55:54 CEST 2014


ffmpeg | branch: release/2.1 | Michael Niedermayer <michaelni at gmx.at> | Wed Apr 16 02:06:37 2014 +0200| [90a384cde1631188fc87088ecbc6813c9885898e] | committer: Michael Niedermayer

avfilter/f_select: fix loss of precission in SAD calculation

Fixes part of Ticket3466
Found-by: Andrey_Karpov / PVS-Studio
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 5a8ef3c66b762f265b05aa096105555f1d26879c)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=90a384cde1631188fc87088ecbc6813c9885898e
---

 libavfilter/f_select.c                     |    2 +-
 tests/ref/fate/filter-metadata-scenedetect |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c
index 60cc311..1baa5c2 100644
--- a/libavfilter/f_select.c
+++ b/libavfilter/f_select.c
@@ -279,7 +279,7 @@ static double get_scene_score(AVFilterContext *ctx, AVFrame *frame)
             p2 += 8 * linesize;
         }
         emms_c();
-        mafd = nb_sad ? sad / nb_sad : 0;
+        mafd = nb_sad ? (double)sad / nb_sad : 0;
         diff = fabs(mafd - select->prev_mafd);
         ret  = av_clipf(FFMIN(mafd, diff) / 100., 0, 1);
         select->prev_mafd = mafd;
diff --git a/tests/ref/fate/filter-metadata-scenedetect b/tests/ref/fate/filter-metadata-scenedetect
index 67251df..4e70723 100644
--- a/tests/ref/fate/filter-metadata-scenedetect
+++ b/tests/ref/fate/filter-metadata-scenedetect
@@ -1,10 +1,10 @@
 pkt_pts=1620|tag:lavfi.scene_score=1.000000
-pkt_pts=4140|tag:lavfi.scene_score=0.880000
+pkt_pts=4140|tag:lavfi.scene_score=0.876043
 pkt_pts=5800|tag:lavfi.scene_score=1.000000
-pkt_pts=6720|tag:lavfi.scene_score=0.460000
+pkt_pts=6720|tag:lavfi.scene_score=0.463259
 pkt_pts=8160|tag:lavfi.scene_score=1.000000
 pkt_pts=9760|tag:lavfi.scene_score=1.000000
-pkt_pts=14080|tag:lavfi.scene_score=0.840000
+pkt_pts=14080|tag:lavfi.scene_score=0.841420
 pkt_pts=15700|tag:lavfi.scene_score=1.000000
-pkt_pts=18500|tag:lavfi.scene_score=0.470000
+pkt_pts=18500|tag:lavfi.scene_score=0.471738
 pkt_pts=21760|tag:lavfi.scene_score=1.000000



More information about the ffmpeg-cvslog mailing list