mirror of
https://github.com/yuzu-emu/FasTC
synced 2024-11-23 14:43:39 +00:00
Fix some small bugs with SSIM.
This commit is contained in:
parent
8d37d6eee5
commit
2d8c291107
2 changed files with 7 additions and 3 deletions
|
@ -106,7 +106,7 @@ namespace FasTC {
|
||||||
}
|
}
|
||||||
|
|
||||||
double ComputePSNR(Image<PixelType> *other);
|
double ComputePSNR(Image<PixelType> *other);
|
||||||
double ComputeMSSIM(Image<PixelType> *other) const;
|
double ComputeMSSIM(Image<PixelType> *other);
|
||||||
|
|
||||||
// Function to allow derived classes to populate the pixel array.
|
// Function to allow derived classes to populate the pixel array.
|
||||||
// This may involve decompressing a compressed image or otherwise
|
// This may involve decompressing a compressed image or otherwise
|
||||||
|
|
|
@ -222,6 +222,7 @@ template<typename PixelType>
|
||||||
static Image<PixelType> FilterValid(const Image<PixelType> &img, uint32 size, double sigma) {
|
static Image<PixelType> FilterValid(const Image<PixelType> &img, uint32 size, double sigma) {
|
||||||
assert(size % 2);
|
assert(size % 2);
|
||||||
Image<IPixel> gaussian(size, size);
|
Image<IPixel> gaussian(size, size);
|
||||||
|
GenerateGaussianKernel(gaussian, size, sigma);
|
||||||
Image<PixelType> tmp = img;
|
Image<PixelType> tmp = img;
|
||||||
tmp.Filter(gaussian);
|
tmp.Filter(gaussian);
|
||||||
|
|
||||||
|
@ -237,7 +238,7 @@ static Image<PixelType> FilterValid(const Image<PixelType> &img, uint32 size, do
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename PixelType>
|
template<typename PixelType>
|
||||||
double Image<PixelType>::ComputeMSSIM(Image<PixelType> *other) const {
|
double Image<PixelType>::ComputeSSIM(Image<PixelType> *other) {
|
||||||
if(!other) {
|
if(!other) {
|
||||||
return -1.0;
|
return -1.0;
|
||||||
}
|
}
|
||||||
|
@ -247,6 +248,9 @@ double Image<PixelType>::ComputeMSSIM(Image<PixelType> *other) const {
|
||||||
return -1.0;
|
return -1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ComputePixels();
|
||||||
|
other->ComputePixels();
|
||||||
|
|
||||||
double C1 = (0.01 * 255.0 * 0.01 * 255.0);
|
double C1 = (0.01 * 255.0 * 0.01 * 255.0);
|
||||||
double C2 = (0.03 * 255.0 * 0.03 * 255.0);
|
double C2 = (0.03 * 255.0 * 0.03 * 255.0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue