Commit a7bb3360 authored by Yaowu Xu's avatar Yaowu Xu

Fix stats format and correct data size and bit rate output

Change-ID: I093abe6094589a0d73f6ca85b825678a19e68285
parent 8caa5c2d
...@@ -991,7 +991,6 @@ int main(int argc, const char **argv_) ...@@ -991,7 +991,6 @@ int main(int argc, const char **argv_)
while ((pkt = vpx_codec_get_cx_data(&encoder, &iter))) while ((pkt = vpx_codec_get_cx_data(&encoder, &iter)))
{ {
got_data = 1; got_data = 1;
nbytes += pkt->data.raw.sz;
switch (pkt->kind) switch (pkt->kind)
{ {
...@@ -1001,6 +1000,7 @@ int main(int argc, const char **argv_) ...@@ -1001,6 +1000,7 @@ int main(int argc, const char **argv_)
(unsigned long)pkt->data.frame.sz); (unsigned long)pkt->data.frame.sz);
write_ivf_frame_header(outfile, pkt); write_ivf_frame_header(outfile, pkt);
fwrite(pkt->data.frame.buf, 1, pkt->data.frame.sz, outfile); fwrite(pkt->data.frame.buf, 1, pkt->data.frame.sz, outfile);
nbytes += pkt->data.raw.sz;
break; break;
case VPX_CODEC_STATS_PKT: case VPX_CODEC_STATS_PKT:
frames_out++; frames_out++;
...@@ -1009,6 +1009,7 @@ int main(int argc, const char **argv_) ...@@ -1009,6 +1009,7 @@ int main(int argc, const char **argv_)
stats_write(&stats, stats_write(&stats,
pkt->data.twopass_stats.buf, pkt->data.twopass_stats.buf,
pkt->data.twopass_stats.sz); pkt->data.twopass_stats.sz);
nbytes += pkt->data.raw.sz;
break; break;
case VPX_CODEC_PSNR_PKT: case VPX_CODEC_PSNR_PKT:
...@@ -1035,7 +1036,7 @@ int main(int argc, const char **argv_) ...@@ -1035,7 +1036,7 @@ int main(int argc, const char **argv_)
printf("\rPass %d/%d frame %4d/%-4d %7ldB %7ldb/f %7"PRId64"b/s" printf("\rPass %d/%d frame %4d/%-4d %7ldB %7ldb/f %7"PRId64"b/s"
" %7lu %s (%.2f fps)\033[K", pass + 1, " %7lu %s (%.2f fps)\033[K", pass + 1,
arg_passes, frames_in, frames_out, nbytes, nbytes * 8 / frames_in, arg_passes, frames_in, frames_out, nbytes, nbytes * 8 / frames_in,
nbytes * 8 *(int64_t)cfg.g_timebase.den / cfg.g_timebase.num / frames_in, nbytes * 8 *(int64_t)cfg.g_timebase.den/2/ cfg.g_timebase.num / frames_in,
cx_time > 9999999 ? cx_time / 1000 : cx_time, cx_time > 9999999 ? cx_time / 1000 : cx_time,
cx_time > 9999999 ? "ms" : "us", cx_time > 9999999 ? "ms" : "us",
(float)frames_in * 1000000.0 / (float)cx_time); (float)frames_in * 1000000.0 / (float)cx_time);
......
...@@ -2251,7 +2251,7 @@ void vp8_remove_compressor(VP8_PTR *ptr) ...@@ -2251,7 +2251,7 @@ void vp8_remove_compressor(VP8_PTR *ptr)
double total_psnr2 = vp8_mse2psnr(samples, 255.0, cpi->total_sq_error2); double total_psnr2 = vp8_mse2psnr(samples, 255.0, cpi->total_sq_error2);
double total_ssim = 100 * pow(cpi->summed_quality / cpi->summed_weights, 8.0); double total_ssim = 100 * pow(cpi->summed_quality / cpi->summed_weights, 8.0);
fprintf(f, "Bitrate\AVGPsnr\tGLBPsnr\tAVPsnrP\tGLPsnrP\tVPXSSIM\t Time(us)\n"); fprintf(f, "Bitrate\tAVGPsnr\tGLBPsnr\tAVPsnrP\tGLPsnrP\tVPXSSIM\t Time(us)\n");
fprintf(f, "%7.3f\t%7.3f\t%7.3f\t%7.3f\t%7.3f\t%7.3f %8.0f\n", fprintf(f, "%7.3f\t%7.3f\t%7.3f\t%7.3f\t%7.3f\t%7.3f %8.0f\n",
dr, cpi->total / cpi->count, total_psnr, cpi->totalp / cpi->count, total_psnr2, total_ssim, dr, cpi->total / cpi->count, total_psnr, cpi->totalp / cpi->count, total_psnr2, total_ssim,
total_encode_time); total_encode_time);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment