Merge branch 'psnr-output-changes'

This commit is contained in:
Arttu Ylä-Outinen 2017-07-19 10:51:54 +03:00
commit 20d6444f07
3 changed files with 13 additions and 8 deletions

View file

@ -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,
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

View file

@ -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

View file

@ -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);