ref: aabae97e57378356cdc8c94af5e369f8363b9831
parent: ce328b855f951e5a9fd0d9d92df09d65ea0d8be9
author: Yunqing Wang <yunqingwang@google.com>
date: Wed Feb 29 03:24:53 EST 2012
vpxenc: fix time and fps calculation in 2-pass encoding When we do 2-pass encoding, elapsed time is accumulated through whole 2-pass process, which gives incorrect time and fps results for second pass. This change fixed that by resetting the time accumulator for second pass. Change-Id: Ie6cbf0d0e66e6874e7071305e253c6267529cf20
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -2071,6 +2071,9 @@
: VPX_RC_ONE_PASS;
if (pass)
stream->config.cfg.rc_twopass_stats_in = stats_get(&stream->stats);
+
+ stream->cx_time = 0;
+ stream->nbytes = 0;
}
@@ -2378,7 +2381,7 @@
fprintf(stderr,
"\rPass %d/%d frame %4d/%-4d %7"PRId64"B \033[K",
pass + 1, global.passes, frames_in,
- streams->frames_out, streams->nbytes);
+ streams->frames_out, (int64_t)streams->nbytes);
else
fprintf(stderr,
"\rPass %d/%d frame %4d %7lu %s (%.2f fps)\033[K",
@@ -2412,10 +2415,10 @@
FOREACH_STREAM(fprintf(
stderr,
"\rPass %d/%d frame %4d/%-4d %7"PRId64"B %7lub/f %7"PRId64"b/s"
- " %7lu %s (%.2f fps)\033[K\n", pass + 1,
- global.passes, frames_in, stream->frames_out, stream->nbytes,
+ " %7"PRId64" %s (%.2f fps)\033[K\n", pass + 1,
+ global.passes, frames_in, stream->frames_out, (int64_t)stream->nbytes,
frames_in ? (unsigned long)(stream->nbytes * 8 / frames_in) : 0,
- frames_in ? stream->nbytes * 8
+ frames_in ? (int64_t)stream->nbytes * 8
* (int64_t)global.framerate.num / global.framerate.den
/ frames_in
: 0,
--
⑨