From: Yunqing Wang Date: Wed, 29 Feb 2012 13:24:53 +0000 (-0500) Subject: vpxenc: fix time and fps calculation in 2-pass encoding X-Git-Tag: v1.1.0~72 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aabae97e57378356cdc8c94af5e369f8363b9831;p=libvpx 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 --- diff --git a/vpxenc.c b/vpxenc.c index 7d6758a7d..a44352939 100644 --- a/vpxenc.c +++ b/vpxenc.c @@ -2071,6 +2071,9 @@ static void setup_pass(struct stream_state *stream, : 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 @@ int main(int argc, const char **argv_) 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 @@ int main(int argc, const char **argv_) 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,