diff --git a/src/encmain.c b/src/encmain.c index f1504f12..4d62cf2d 100644 --- a/src/encmain.c +++ b/src/encmain.c @@ -323,7 +323,6 @@ int main(int argc, char *argv[]) int first_enc = current_encoder_state; do { double frame_psnr[3] = { 0.0, 0.0, 0.0 }; - current_encoder_state = (current_encoder_state + 1) % (encoder.owf + 1); encoder_state_t *state = &encoder_states[current_encoder_state]; if (!state->stats_done) { @@ -334,6 +333,8 @@ int main(int argc, char *argv[]) psnr_sum[1] += frame_psnr[1]; psnr_sum[2] += frame_psnr[2]; } + + current_encoder_state = (current_encoder_state + 1) % (encoder.owf + 1); } while (current_encoder_state != first_enc); } diff --git a/src/encoderstate.c b/src/encoderstate.c index 3375fcb3..da3e7f4a 100644 --- a/src/encoderstate.c +++ b/src/encoderstate.c @@ -843,7 +843,8 @@ void encode_one_frame(encoder_state_t * const state) #else char* job_description = NULL; #endif - + + state->stats_done = 0; job = threadqueue_submit(state->encoder_control->threadqueue, encoder_state_worker_write_bitstream, (void*) state, 1, job_description); _encode_one_frame_add_bitstream_deps(state, job); @@ -1058,7 +1059,7 @@ void encoder_next_frame(encoder_state_t *state) { //Blocking call threadqueue_waitfor(encoder->threadqueue, state->tqj_bitstream_written); - state->stats_done = 0; + state->stats_done = 1; if (state->global->frame == -1) { //We're at the first frame, so don't care about all this stuff;