summaryrefslogtreecommitdiff
path: root/vpxenc.c
diff options
context:
space:
mode:
authorJohn Koleszar <jkoleszar@google.com>2013-03-11 15:03:00 -0700
committerJohn Koleszar <jkoleszar@google.com>2013-03-11 15:03:00 -0700
commit2bf563c335faf8f52571aad8c36c1cb841d4861f (patch)
tree82834e2f496ca75dc069d53db8d1e5e67209ce32 /vpxenc.c
parent83f2a112acc7ea58e29344c479fc740ac5259358 (diff)
downloadlibvpx-2bf563c335faf8f52571aad8c36c1cb841d4861f.tar.gz
vpxenc: improve progress indicators with --skip
Account for skipped input frames when calculating frame rates, ETA. Fixes https://code.google.com/p/webm/issues/detail?id=556 Change-Id: I9c8b51e02e9ff0ab2cf6f16fc9382fc7f6c77b80
Diffstat (limited to 'vpxenc.c')
-rw-r--r--vpxenc.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/vpxenc.c b/vpxenc.c
index 3f81ac7e7..5c1819468 100644
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -2508,7 +2508,7 @@ int main(int argc, const char **argv_) {
usage_exit();
for (pass = global.pass ? global.pass - 1 : 0; pass < global.passes; pass++) {
- int frames_in = 0;
+ int frames_in = 0, seen_frames = 0;
int64_t estimated_time_left = -1;
int64_t average_rate = -1;
off_t lagged_count = 0;
@@ -2589,9 +2589,11 @@ int main(int argc, const char **argv_) {
if (frame_avail)
frames_in++;
+ seen_frames = frames_in > global.skip_frames ?
+ frames_in - global.skip_frames : 0;
if (!global.quiet) {
- float fps = usec_to_fps(cx_time, frames_in);
+ float fps = usec_to_fps(cx_time, seen_frames);
fprintf(stderr, "\rPass %d/%d ", pass + 1, global.passes);
if (stream_cnt == 1)
@@ -2627,16 +2629,17 @@ int main(int argc, const char **argv_) {
FOREACH_STREAM(get_cx_data(stream, &global, &got_data));
if (!got_data && input.length && !streams->frames_out) {
- lagged_count = global.limit ? frames_in : ftello(input.file);
+ lagged_count = global.limit ? seen_frames : ftello(input.file);
} else if (input.length) {
int64_t remaining;
int64_t rate;
if (global.limit) {
- int frame_in_lagged = (frames_in - lagged_count) * 1000;
+ int frame_in_lagged = (seen_frames - lagged_count) * 1000;
rate = cx_time ? frame_in_lagged * (int64_t)1000000 / cx_time : 0;
- remaining = 1000 * (global.limit - frames_in + lagged_count);
+ remaining = 1000 * (global.limit - global.skip_frames
+ - seen_frames + lagged_count);
} else {
off_t input_pos = ftello(input.file);
off_t input_pos_lagged = input_pos - lagged_count;
@@ -2668,14 +2671,14 @@ int main(int argc, const char **argv_) {
"\rPass %d/%d frame %4d/%-4d %7"PRId64"B %7lub/f %7"PRId64"b/s"
" %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 ? (int64_t)stream->nbytes * 8
+ seen_frames ? (unsigned long)(stream->nbytes * 8 / seen_frames) : 0,
+ seen_frames ? (int64_t)stream->nbytes * 8
* (int64_t)global.framerate.num / global.framerate.den
- / frames_in
+ / seen_frames
: 0,
stream->cx_time > 9999999 ? stream->cx_time / 1000 : stream->cx_time,
stream->cx_time > 9999999 ? "ms" : "us",
- usec_to_fps(stream->cx_time, frames_in));
+ usec_to_fps(stream->cx_time, seen_frames));
);
if (global.show_psnr)