Only print PSNR if some frames were encoded.

This commit is contained in:
Arttu Ylä-Outinen 2015-07-06 13:39:47 +03:00
parent 089ff895ad
commit cc580ac861

View file

@ -243,16 +243,23 @@ int main(int argc, char *argv[])
GET_TIME(&encoding_end_real_time); GET_TIME(&encoding_end_real_time);
encoding_end_cpu_time = clock(); encoding_end_cpu_time = clock();
threadqueue_flush(encoder->threadqueue); threadqueue_flush(encoder->threadqueue);
// Coding finished // Coding finished
// Print statistics of the coding // Print statistics of the coding
fprintf(stderr, " Processed %d frames, %10llu bits AVG PSNR: %2.4f %2.4f %2.4f\n", fprintf(stderr, " Processed %d frames, %10llu bits",
frames_done, (long long unsigned int)bitstream_length * 8, frames_done,
psnr_sum[0] / frames_done, psnr_sum[1] / frames_done, psnr_sum[2] / frames_done); (long long unsigned int)bitstream_length * 8);
if (frames_done > 0) {
fprintf(stderr, " AVG PSNR: %2.4f %2.4f %2.4f",
psnr_sum[0] / frames_done,
psnr_sum[1] / frames_done,
psnr_sum[2] / frames_done);
}
fprintf(stderr, "\n");
fprintf(stderr, " Total CPU time: %.3f s.\n", ((float)(clock() - start_time)) / CLOCKS_PER_SEC); fprintf(stderr, " Total CPU time: %.3f s.\n", ((float)(clock() - start_time)) / CLOCKS_PER_SEC);
{ {
double encoding_time = ( (double)(encoding_end_cpu_time - encoding_start_cpu_time) ) / (double) CLOCKS_PER_SEC; double encoding_time = ( (double)(encoding_end_cpu_time - encoding_start_cpu_time) ) / (double) CLOCKS_PER_SEC;
double wall_time = CLOCK_T_AS_DOUBLE(encoding_end_real_time) - CLOCK_T_AS_DOUBLE(encoding_start_real_time); double wall_time = CLOCK_T_AS_DOUBLE(encoding_end_real_time) - CLOCK_T_AS_DOUBLE(encoding_start_real_time);