[FFmpeg-cvslog] avfilter/vf_psnr: avoid 64bit arithmetic in the inner loop

Michael Niedermayer git at videolan.org
Sat Sep 21 03:12:11 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Sep 21 03:02:20 2013 +0200| [68f328fcdd147a56c228abd6794a923f534138fb] | committer: Michael Niedermayer

avfilter/vf_psnr: avoid 64bit arithmetic in the inner loop

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

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

 libavfilter/vf_psnr.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c
index 1bcdd7d..bb0dbe0 100644
--- a/libavfilter/vf_psnr.c
+++ b/libavfilter/vf_psnr.c
@@ -94,8 +94,10 @@ void compute_images_mse(PSNRContext *s,
         uint64_t m = 0;
 
         for (i = 0; i < outh; i++) {
+            int m2 = 0;
             for (j = 0; j < outw; j++)
-                m += pow2(main_line[j] - ref_line[j]);
+                m2 += pow2(main_line[j] - ref_line[j]);
+            m += m2;
             ref_line += ref_linesize;
             main_line += main_linesize;
         }



More information about the ffmpeg-cvslog mailing list