Move some init code to encoder_state_new_frame

This commit is contained in:
Laurent Fasnacht 2014-05-08 07:59:12 +02:00
parent 1cb3f14dfe
commit 8451d5b100

View file

@ -1084,11 +1084,7 @@ static void encoder_state_encode_tile(encoder_state * const encoder_state) {
// for the extra pixel on the top right. // for the extra pixel on the top right.
yuv_t *ver_buf = yuv_t_alloc(LCU_WIDTH + 2); yuv_t *ver_buf = yuv_t_alloc(LCU_WIDTH + 2);
cabac_start(&encoder_state->cabac);
init_contexts(encoder_state, encoder_state->global->QP, encoder_state->global->slicetype);
// Initialize lambda value(s) to use in search
encoder_state_init_lambda(encoder_state);
{ {
picture* const cur_pic = encoder_state->tile->cur_pic; picture* const cur_pic = encoder_state->tile->cur_pic;
@ -1271,8 +1267,12 @@ static void encoder_state_new_frame(encoder_state * const main_state) {
bitstream_clear(&main_state->stream); bitstream_clear(&main_state->stream);
} }
cabac_start(&main_state->cabac);
init_contexts(main_state, main_state->global->QP, main_state->global->slicetype); init_contexts(main_state, main_state->global->QP, main_state->global->slicetype);
// Initialize lambda value(s) to use in search
encoder_state_init_lambda(main_state);
for (i = 0; main_state->children[i].encoder_control; ++i) { for (i = 0; main_state->children[i].encoder_control; ++i) {
encoder_state_new_frame(&main_state->children[i]); encoder_state_new_frame(&main_state->children[i]);
} }