[FFmpeg-cvslog] vf_histogram: avoid floats, unbreak fate
Michael Niedermayer
git at videolan.org
Mon Apr 15 21:46:34 CEST 2013
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Apr 15 21:37:49 2013 +0200| [7a2a421d736c7fb647675b797cff3bc3a959c0ae] | committer: Michael Niedermayer
vf_histogram: avoid floats, unbreak fate
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7a2a421d736c7fb647675b797cff3bc3a959c0ae
---
libavfilter/vf_histogram.c | 2 +-
tests/ref/fate/filter-histogram-levels | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavfilter/vf_histogram.c b/libavfilter/vf_histogram.c
index 9434e51..3daa482 100644
--- a/libavfilter/vf_histogram.c
+++ b/libavfilter/vf_histogram.c
@@ -197,7 +197,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
h->max_hval = FFMAX(h->max_hval, h->histogram[i]);
for (i = 0; i < outlink->w; i++) {
- int col_height = h->level_height - (float)h->histogram[i] / h->max_hval * h->level_height;
+ int col_height = h->level_height - (h->histogram[i] * (int64_t)h->level_height + h->max_hval - 1) / h->max_hval;
for (j = h->level_height - 1; j >= col_height; j--) {
if (h->display_mode) {
diff --git a/tests/ref/fate/filter-histogram-levels b/tests/ref/fate/filter-histogram-levels
index c5ae111..2ee6688 100644
--- a/tests/ref/fate/filter-histogram-levels
+++ b/tests/ref/fate/filter-histogram-levels
@@ -10,7 +10,7 @@
0, 8, 8, 1, 488448, 0xbbe0ba18
0, 9, 9, 1, 488448, 0x29d7e5a6
0, 10, 10, 1, 488448, 0x9428b9ee
-0, 11, 11, 1, 488448, 0x83b3cc4f
+0, 11, 11, 1, 488448, 0xe0dacb50
0, 12, 12, 1, 488448, 0x6fbe351f
0, 13, 13, 1, 488448, 0x27b165e0
0, 14, 14, 1, 488448, 0xc1301e0c
@@ -26,7 +26,7 @@
0, 24, 24, 1, 488448, 0x8fdf8efd
0, 25, 25, 1, 488448, 0x11ad9232
0, 26, 26, 1, 488448, 0x26bd6353
-0, 27, 27, 1, 488448, 0xfcb3873d
+0, 27, 27, 1, 488448, 0xa6ab863e
0, 28, 28, 1, 488448, 0x4c14852e
0, 29, 29, 1, 488448, 0x738ce85a
0, 30, 30, 1, 488448, 0xdb84785a
More information about the ffmpeg-cvslog
mailing list