Fix keeping of reference frames over IDR boundary.

-
This commit is contained in:
Ari Koivula 2015-04-30 13:02:02 +03:00
parent c0c9bc619a
commit b43f1cb9eb

View file

@ -720,7 +720,7 @@ static void encoder_state_remove_refs(encoder_state_t *state) {
refnumber = encoder->cfg->gop[state->global->gop_offset].ref_neg_count + encoder->cfg->gop[state->global->gop_offset].ref_pos_count; refnumber = encoder->cfg->gop[state->global->gop_offset].ref_neg_count + encoder->cfg->gop[state->global->gop_offset].ref_pos_count;
check_refs = 1; check_refs = 1;
} else if (state->global->slicetype == SLICE_I) { } else if (state->global->slicetype == SLICE_I) {
refnumber = 1; refnumber = 0;
} }
// Remove the ref pic (if present) // Remove the ref pic (if present)
while (check_refs || state->global->ref->used_size > (uint32_t)refnumber) { while (check_refs || state->global->ref->used_size > (uint32_t)refnumber) {
@ -798,11 +798,11 @@ static void encoder_state_new_frame(encoder_state_t * const state) {
if (state->global->is_radl_frame) { if (state->global->is_radl_frame) {
encoder_state_clear_refs(state); encoder_state_clear_refs(state);
} else {
encoder_state_remove_refs(state);
encoder_state_ref_sort(state);
} }
encoder_state_remove_refs(state);
encoder_state_ref_sort(state);
if (state->encoder_control->cfg->gop_len) { if (state->encoder_control->cfg->gop_len) {
if (state->global->slicetype == SLICE_I) { if (state->global->slicetype == SLICE_I) {
state->global->QP = state->encoder_control->cfg->qp; state->global->QP = state->encoder_control->cfg->qp;