Commit 2db114ec authored by Ganesh Ajjanagadde's avatar Ganesh Ajjanagadde
parent 8d48c370
...@@ -79,11 +79,11 @@ static float ssim_end1( int s1, int s2, int ss, int s12 ) ...@@ -79,11 +79,11 @@ static float ssim_end1( int s1, int s2, int ss, int s12 )
* s1*s1, s2*s2, and s1*s2 also obtain this value for edge cases: ((2^10-1)*16*4)^2 = 4286582784. * s1*s1, s2*s2, and s1*s2 also obtain this value for edge cases: ((2^10-1)*16*4)^2 = 4286582784.
* Maximum value for 9-bit is: ss*64 = (2^9-1)^2*16*4*64 = 1069551616, which will not overflow. */ * Maximum value for 9-bit is: ss*64 = (2^9-1)^2*16*4*64 = 1069551616, which will not overflow. */
#if BIT_DEPTH > 9 #if BIT_DEPTH > 9
#define type float typedef float type;
static const float ssim_c1 = .01*.01*PIXEL_MAX*PIXEL_MAX*64; static const float ssim_c1 = .01*.01*PIXEL_MAX*PIXEL_MAX*64;
static const float ssim_c2 = .03*.03*PIXEL_MAX*PIXEL_MAX*64*63; static const float ssim_c2 = .03*.03*PIXEL_MAX*PIXEL_MAX*64*63;
#else #else
#define type int typedef int type;
static const int ssim_c1 = (int)(.01*.01*PIXEL_MAX*PIXEL_MAX*64 + .5); static const int ssim_c1 = (int)(.01*.01*PIXEL_MAX*PIXEL_MAX*64 + .5);
static const int ssim_c2 = (int)(.03*.03*PIXEL_MAX*PIXEL_MAX*64*63 + .5); static const int ssim_c2 = (int)(.03*.03*PIXEL_MAX*PIXEL_MAX*64*63 + .5);
#endif #endif
...@@ -95,7 +95,6 @@ static float ssim_end1( int s1, int s2, int ss, int s12 ) ...@@ -95,7 +95,6 @@ static float ssim_end1( int s1, int s2, int ss, int s12 )
type covar = fs12*64 - fs1*fs2; type covar = fs12*64 - fs1*fs2;
return (float)(2*fs1*fs2 + ssim_c1) * (float)(2*covar + ssim_c2) return (float)(2*fs1*fs2 + ssim_c1) * (float)(2*covar + ssim_c2)
/ ((float)(fs1*fs1 + fs2*fs2 + ssim_c1) * (float)(vars + ssim_c2)); / ((float)(fs1*fs1 + fs2*fs2 + ssim_c1) * (float)(vars + ssim_c2));
#undef type
} }
static float ssim_end4( int sum0[5][4], int sum1[5][4], int width ) static float ssim_end4( int sum0[5][4], int sum1[5][4], int width )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment