Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate difference between PVRTexTool PSNR calculation and ours. #7

Open
Mokosha opened this issue Sep 26, 2013 · 3 comments
Open
Assignees

Comments

@Mokosha
Copy link
Member

Mokosha commented Sep 26, 2013

For example:

[pavel@Zombie-MBP ~/Projects/TexComp/build]$ CLTool/tc -q 0 -t 32 -j 32 ../test/kodim05.png
Compression time: 3666.615 ms
PSNR: 42.140

However, in PVRTexTool, we get:

Red Green Blue All
PSNR: 45.15 45.40 45.02 44.18
@ghost ghost assigned Mokosha Sep 26, 2013
@Ethatron
Copy link

Ethatron commented Feb 8, 2014

He calculates the euclidean distance of the 3D vector and then 1D PSNR on that:
diff_for_psnr=sqrt(diff_r^2+diff_g^2+diff_b^2)

@Mokosha
Copy link
Member Author

Mokosha commented Feb 20, 2014

I'm having a hard time reproducing the results even using that method. If I understand you correctly, I need to change my PSNR code from this to:

double t = 0;
for(uint32 c = 0; c < 3; c++) {
  double diff = (r[3] * r[c] - u[3] * u[c]);
  t += diff * diff;
}
mse += sqrt(t);

...?

@Mokosha
Copy link
Member Author

Mokosha commented Feb 28, 2014

Here are the two images in question, I fixed a small bug in my PSNR calculation, so that it now reports RGB PSNR weighted by alpha. The two images from the example above are the following:

Raw:
kodim05

BPTC Compressed:
kodim05-bptc

The results from FasTC and the Mali ASTC encoder are:

$ ./astcenc -compare kodim05.png kodim05-bptc.png -showpsnr
PSNR (LDR-RGBA): 43.378936 dB
Alpha-Weighted PSNR: 43.378936 dB
PSNR (LDR-RGB): 42.159781 dB

$ CLTool/compare kodim05-bptc.png ../test/kodim05.png 
PSNR: 42.140
SSIM: 0.996602052

This makes sense since kodim05-bptc.png has a few non max-alpha pixels (since it provided better compression overall), and we're using a slightly different algorithm than the ASTC encoder. However, it doesn't account for the multiple dBs of error vs. PVRTexTool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants