MSSSIM bug
Reported by Ralf Willenbacher. Thank you.
In DistortionMetricMSSSIM.cpp
method:
DistortionMetricMSSSIM::downsample(const uint16* src, uint16* out, int iWidth, int iHeight, int oWidth, int oHeight)
Line 737 reads:
pOut[i] = (unsigned char) iShiftRightRound(tmp, normalize); //Note: Should change for different bit depth
As you can see the write to pOut
goes over a cast to ( unsigned char ), throwing bits above 8 away before writing the 16 bit value. This leads to inaccuracies in the MS-SSIM calculation at bitdepths like 10 or above.
The comment in the code suggests that the problem was found in a Code Review before but it might have been forgotten?