Print relevant lossless encoding stats in cwebp.

Change-Id: Ib8dfab498b1a05e49734bba2d3e72810343e8b0a
This commit is contained in:
Vikas Arora 2012-05-09 11:27:46 +05:30
parent e3302cfd73
commit c4ccab6463

View File

@ -530,8 +530,21 @@ static void PrintValues(const int values[4]) {
fprintf(stderr, "|\n"); fprintf(stderr, "|\n");
} }
static void PrintExtraInfo(const WebPPicture* const pic, int short_output, static void PrintExtraInfoLossless(const WebPPicture* const pic,
const char* const file_name) { int short_output,
const char* const file_name) {
const WebPAuxStats* const stats = pic->stats;
if (short_output) {
fprintf(stderr, "%7d %2.2f\n", stats->coded_size, stats->PSNR[3]);
} else {
fprintf(stderr, "File: %s\n", file_name);
fprintf(stderr, "Dimension: %d x %d\n", pic->width, pic->height);
fprintf(stderr, "Output: %d bytes\n", stats->coded_size);
}
}
static void PrintExtraInfoLossy(const WebPPicture* const pic, int short_output,
const char* const file_name) {
const WebPAuxStats* const stats = pic->stats; const WebPAuxStats* const stats = pic->stats;
if (short_output) { if (short_output) {
fprintf(stderr, "%7d %2.2f\n", stats->coded_size, stats->PSNR[3]); fprintf(stderr, "%7d %2.2f\n", stats->coded_size, stats->PSNR[3]);
@ -1011,7 +1024,11 @@ int main(int argc, const char *argv[]) {
} }
if (!quiet) { if (!quiet) {
PrintExtraInfo(&picture, short_output, in_file); if (config.lossless) {
PrintExtraInfoLossless(&picture, short_output, in_file);
} else {
PrintExtraInfoLossy(&picture, short_output, in_file);
}
} }
if (!quiet && !short_output && print_distortion > 0) { // print distortion if (!quiet && !short_output && print_distortion > 0) { // print distortion
float values[5]; float values[5];