make -short work with -print_ssim, -print_psnr, etc.

PSNR was always printed when using -short

Change-Id: I826785917961d355a980e4ac27dd1cf1295cb6de
This commit is contained in:
skal 2013-12-23 12:03:00 +01:00
parent c72e08119a
commit fff2a11b03

View File

@ -298,6 +298,9 @@ static void PrintExtraInfoLossy(const WebPPicture* const pic, int short_output,
PrintFullLosslessInfo(stats, "alpha");
}
}
}
static void PrintMapInfo(const WebPPicture* const pic) {
if (pic->extra_info != NULL) {
const int mb_w = (pic->width + 15) / 16;
const int mb_h = (pic->height + 15) / 16;
@ -716,7 +719,7 @@ int main(int argc, const char *argv[]) {
config.show_compressed = 1;
print_distortion = 2;
} else if (!strcmp(argv[c], "-short")) {
short_output++;
++short_output;
} else if (!strcmp(argv[c], "-s") && c < argc - 2) {
picture.width = strtol(argv[++c], NULL, 0);
picture.height = strtol(argv[++c], NULL, 0);
@ -1057,16 +1060,17 @@ int main(int argc, const char *argv[]) {
}
if (!quiet) {
if (!short_output || print_distortion < 0) {
if (config.lossless) {
PrintExtraInfoLossless(&picture, short_output, in_file);
} else {
PrintExtraInfoLossy(&picture, short_output, config.low_memory, in_file);
}
if (!short_output) {
PrintMetadataInfo(&metadata, metadata_written);
}
if (!short_output && picture.extra_info_type > 0) {
PrintMapInfo(&picture);
}
if (!quiet && !short_output && print_distortion >= 0) { // print distortion
if (print_distortion >= 0) { // print distortion
static const char* distortion_names[] = { "PSNR", "SSIM", "LSIM" };
float values[5];
// Comparison is performed in YUVA colorspace.
@ -1085,9 +1089,17 @@ int main(int argc, const char *argv[]) {
fprintf(stderr, "Error while computing the distortion.\n");
goto Error;
}
if (!short_output) {
fprintf(stderr, "%s: Y:%.2f U:%.2f V:%.2f A:%.2f Total:%.2f\n",
distortion_names[print_distortion],
values[0], values[1], values[2], values[3], values[4]);
} else {
fprintf(stderr, "%7d %.4f\n", picture.stats->coded_size, values[4]);
}
}
if (!short_output) {
PrintMetadataInfo(&metadata, metadata_written);
}
}
return_value = 0;