mirror of
https://github.com/yuzu-emu/FasTC.git
synced 2025-01-23 21:11:00 +00:00
Make sure to take alpha into account when computing PSNR
This commit is contained in:
parent
82e51a49cf
commit
1abc54cf21
|
@ -80,15 +80,17 @@ double Image::ComputePSNR(const CompressedImage &ci) const {
|
||||||
const unsigned char *pixelDataRaw = m_PixelData + i;
|
const unsigned char *pixelDataRaw = m_PixelData + i;
|
||||||
const unsigned char *pixelDataUncomp = unCompData + i;
|
const unsigned char *pixelDataUncomp = unCompData + i;
|
||||||
|
|
||||||
double dr = double(sad(pixelDataRaw[0], pixelDataUncomp[0])) * wr;
|
double rawAlphaScale = double(pixelDataRaw[3]) / 255.0;
|
||||||
double dg = double(sad(pixelDataRaw[1], pixelDataUncomp[1])) * wg;
|
double uncompAlphaScale = double(pixelDataUncomp[3]) / 255.0;
|
||||||
double db = double(sad(pixelDataRaw[2], pixelDataUncomp[2])) * wb;
|
double dr = double(sad(rawAlphaScale * pixelDataRaw[0], uncompAlphaScale * pixelDataUncomp[0])) * wr;
|
||||||
|
double dg = double(sad(rawAlphaScale * pixelDataRaw[1], uncompAlphaScale * pixelDataUncomp[1])) * wg;
|
||||||
|
double db = double(sad(rawAlphaScale * pixelDataRaw[2], uncompAlphaScale * pixelDataUncomp[2])) * wb;
|
||||||
|
|
||||||
const double pixelMSE =
|
const double pixelMSE =
|
||||||
(double(dr) * double(dr)) +
|
(double(dr) * double(dr)) +
|
||||||
(double(dg) * double(dg)) +
|
(double(dg) * double(dg)) +
|
||||||
(double(db) * double(db));
|
(double(db) * double(db));
|
||||||
|
|
||||||
//fprintf(stderr, "Pixel MSE: %f\n", pixelMSE);
|
//fprintf(stderr, "Pixel MSE: %f\n", pixelMSE);
|
||||||
MSE += pixelMSE;
|
MSE += pixelMSE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue