In the command line tool make sure that the compressed image is valid before trying to calculate its PSNR.

This commit is contained in:
Pavel Krajcevski 2012-09-18 22:33:18 -04:00
parent 78da9499ec
commit 3cac6ae464

View file

@ -83,7 +83,11 @@ int main(int argc, char **argv) {
settings.iNumCompressions = numCompressions;
CompressedImage *ci = CompressImage(file, settings);
if(NULL == ci) {
fprintf(stderr, "Error compressing image!\n");
return 1;
}
double PSNR = ComputePSNR(*ci, file);
if(PSNR > 0.0) {
fprintf(stdout, "PSNR: %.3f\n", PSNR);
@ -93,8 +97,7 @@ int main(int argc, char **argv) {
}
// Cleanup
if(NULL != ci)
delete ci;
delete ci;
return 0;
}