[FFmpeg-cvslog] ssim: refactor a weird double loop.

Ronald S. Bultje git at videolan.org
Mon Jul 13 02:39:10 CEST 2015


ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Sat Jul 11 19:55:58 2015 -0400| [a1f48480497bb462c5d1d589ae393335f50b06e0] | committer: Michael Niedermayer

ssim: refactor a weird double loop.

Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavfilter/vf_ssim.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vf_ssim.c b/libavfilter/vf_ssim.c
index 40c70b8..b1c3368 100644
--- a/libavfilter/vf_ssim.c
+++ b/libavfilter/vf_ssim.c
@@ -132,7 +132,7 @@ static float ssim_end1(int s1, int s2, int ss, int s12)
          / ((float)(fs1 * fs1 + fs2 * fs2 + ssim_c1) * (float)(vars + ssim_c2));
 }
 
-static float ssim_end4(int sum0[5][4], int sum1[5][4], int width)
+static float ssim_endn(int (*sum0)[4], int (*sum1)[4], int width)
 {
     float ssim = 0.0;
     int i;
@@ -167,8 +167,7 @@ static float ssim_plane(uint8_t *main, int main_stride,
                                 &sum0[x]);
         }
 
-        for (x = 0; x < width - 1; x += 4)
-            ssim += ssim_end4(sum0 + x, sum1 + x, FFMIN(4, width - x - 1));
+        ssim += ssim_endn(sum0, sum1, width - 1);
     }
 
     return ssim / ((height - 1) * (width - 1));



More information about the ffmpeg-cvslog mailing list