diff --git a/src/cli.c b/src/cli.c index c821b7bb..2bf37b75 100644 --- a/src/cli.c +++ b/src/cli.c @@ -501,14 +501,18 @@ void print_help(void) void print_frame_info(const kvz_frame_info *const info, const double frame_psnr[3], - const uint32_t bytes) + const uint32_t bytes, + const bool print_psnr) { - fprintf(stderr, "POC %4d QP %2d (%c-frame) %10d bits PSNR: %2.4f %2.4f %2.4f", + fprintf(stderr, "POC %4d QP %2d (%c-frame) %10d bits", info->poc, info->qp, "BPI"[info->slice_type % 3], - bytes << 3, - frame_psnr[0], frame_psnr[1], frame_psnr[2]); + bytes << 3); + if (print_psnr) { + fprintf(stderr, " PSNR Y %2.4f U %2.4f V %2.4f", + frame_psnr[0], frame_psnr[1], frame_psnr[2]); + } if (info->slice_type != KVZ_SLICE_I) { // Print reference picture lists diff --git a/src/cli.h b/src/cli.h index e4b4c68e..be042a3e 100644 --- a/src/cli.h +++ b/src/cli.h @@ -57,6 +57,7 @@ void print_version(void); void print_help(void); void print_frame_info(const kvz_frame_info *const info, const double frame_psnr[3], - const uint32_t bytes); + const uint32_t bytes, + const bool print_psnr); #endif diff --git a/src/encmain.c b/src/encmain.c index 47c273f5..130bd198 100644 --- a/src/encmain.c +++ b/src/encmain.c @@ -561,7 +561,7 @@ int main(int argc, char *argv[]) psnr_sum[1] += frame_psnr[1]; psnr_sum[2] += frame_psnr[2]; - print_frame_info(&info_out, frame_psnr, len_out); + print_frame_info(&info_out, frame_psnr, len_out, encoder->cfg.calc_psnr); } api->picture_free(cur_in_img); @@ -581,8 +581,8 @@ int main(int argc, char *argv[]) fprintf(stderr, " Processed %d frames, %10llu bits", frames_done, (long long unsigned int)bitstream_length * 8); - if (frames_done > 0) { - fprintf(stderr, " AVG PSNR: %2.4f %2.4f %2.4f", + if (encoder->cfg.calc_psnr && frames_done > 0) { + fprintf(stderr, " AVG PSNR Y %2.4f U %2.4f V %2.4f", psnr_sum[0] / frames_done, psnr_sum[1] / frames_done, psnr_sum[2] / frames_done);