From: Yaowu Xu Date: Tue, 16 Apr 2019 17:09:21 +0000 (-0700) Subject: Fix PSNRHVS computation X-Git-Tag: v1.8.1~106^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6382a95feee6b28b9c2ad536f1b645daeb4dffd0;p=libvpx Fix PSNRHVS computation Cherry-pick libaom #1362e15990eccab8101305be418528824fb32245 to fix PSNRHVS calculation. BUG=webm:1620 Change-Id: Ife7bd8056fcaed06992ad76e8c1ab734c3956ad7 --- diff --git a/vpx_dsp/psnrhvs.c b/vpx_dsp/psnrhvs.c index 3b533decd..d7ec1a429 100644 --- a/vpx_dsp/psnrhvs.c +++ b/vpx_dsp/psnrhvs.c @@ -144,7 +144,7 @@ static double calc_psnrhvs(const unsigned char *src, int _systride, been normalized and then squared." Their CSF matrix (from PSNR-HVS) was also constructed from the JPEG matrices. I can not find any obvious scheme of normalizing to produce their table, but if I multiply their - CSF by 0.38857 and square the result I get their masking table. + CSF by 0.3885746225901003 and square the result I get their masking table. I have no idea where this constant comes from, but deviating from it too greatly hurts MOS agreement. @@ -152,11 +152,15 @@ static double calc_psnrhvs(const unsigned char *src, int _systride, Jaakko Astola, Vladimir Lukin, "On between-coefficient contrast masking of DCT basis functions", CD-ROM Proceedings of the Third International Workshop on Video Processing and Quality Metrics for Consumer - Electronics VPQM-07, Scottsdale, Arizona, USA, 25-26 January, 2007, 4 p.*/ + Electronics VPQM-07, Scottsdale, Arizona, USA, 25-26 January, 2007, 4 p. + + Suggested in aomedia issue #2363: + 0.3885746225901003 is a reciprocal of the maximum coefficient (2.573509) + of the old JPEG based matrix from the paper. Since you are not using that, + divide by actual maximum coefficient. */ for (x = 0; x < 8; x++) for (y = 0; y < 8; y++) - mask[x][y] = - (_csf[x][y] * 0.3885746225901003) * (_csf[x][y] * 0.3885746225901003); + mask[x][y] = (_csf[x][y] / _csf[1][0]) * (_csf[x][y] / _csf[1][0]); for (y = 0; y < _h - 7; y += _step) { for (x = 0; x < _w - 7; x += _step) { int i;