mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-30 20:54:07 +00:00
Added prints to bitrate and AVG QP
This commit is contained in:
parent
6d7a4f555c
commit
252bab8820
|
@ -30,7 +30,7 @@
|
|||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
#include <ctype.h>
|
||||
|
||||
unsigned int sum_of_qps = 0;
|
||||
static const char short_options[] = "i:o:d:w:h:n:q:p:r:";
|
||||
static const struct option long_options[] = {
|
||||
{ "input", required_argument, NULL, 'i' },
|
||||
|
@ -571,6 +571,7 @@ void print_frame_info(const kvz_frame_info *const info,
|
|||
info->qp,
|
||||
"BPI"[info->slice_type % 3],
|
||||
bytes << 3);
|
||||
sum_of_qps += info->qp;
|
||||
if (print_psnr) {
|
||||
fprintf(stderr, " PSNR Y %2.4f U %2.4f V %2.4f",
|
||||
frame_psnr[0], frame_psnr[1], frame_psnr[2]);
|
||||
|
@ -591,3 +592,8 @@ void print_frame_info(const kvz_frame_info *const info,
|
|||
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
unsigned int return_sum_of_qps()
|
||||
{
|
||||
return sum_of_qps;
|
||||
}
|
||||
|
|
|
@ -59,5 +59,6 @@ void print_frame_info(const kvz_frame_info *const info,
|
|||
const double frame_psnr[3],
|
||||
const uint32_t bytes,
|
||||
const bool print_psnr);
|
||||
unsigned int return_sum_of_qps();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -638,6 +638,19 @@ int main(int argc, char *argv[])
|
|||
fprintf(stderr, " Encoding wall time: %.3f s.\n", wall_time);
|
||||
fprintf(stderr, " Encoding CPU usage: %.2f%%\n", encoding_time/wall_time*100.f);
|
||||
fprintf(stderr, " FPS: %.2f\n", ((double)frames_done)/wall_time);
|
||||
double bitrate = (long long unsigned int)bitstream_length * 8 / 1024 / ((double)frames_done) * frames_done / wall_time;
|
||||
|
||||
if (bitrate > 1024) {
|
||||
bitrate = bitrate / 1024;
|
||||
fprintf(stderr, " Bitrate: %.1f mbps\n", bitrate);
|
||||
}
|
||||
|
||||
else {
|
||||
fprintf(stderr, " Bitrate: %.1f kbps\n", bitrate);
|
||||
}
|
||||
fprintf(stderr, " AVG QP: %.1f\n", (double)(return_sum_of_qps() /frames_done));
|
||||
|
||||
;
|
||||
}
|
||||
pthread_join(input_thread, NULL);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue