Fixed crash and incorrect info output

This commit is contained in:
Miika Metsoila 2017-06-27 15:56:30 +03:00
parent f8b6234fdb
commit dcd7acf4fd
2 changed files with 13 additions and 5 deletions

View file

@ -816,10 +816,10 @@ void kvz_encoder_create_ref_lists(const encoder_state_t *const state)
int j = 0; int j = 0;
for (j = 0; j < state->frame->ref->used_size; j++) { for (j = 0; j < state->frame->ref->used_size; j++) {
if (state->frame->ref->pocs[j] < state->frame->poc) { if (state->frame->ref->pocs[j] < state->frame->poc) {
state->frame->ref_LX[0][state->frame->ref_LX_size[0]] = state->frame->ref->pocs[j]; state->frame->ref_LX[0][state->frame->ref_LX_size[0]] = j;
state->frame->ref_LX_size[0] += 1; state->frame->ref_LX_size[0] += 1;
} else { } else {
state->frame->ref_LX[1][state->frame->ref_LX_size[1]] = state->frame->ref->pocs[j]; state->frame->ref_LX[1][state->frame->ref_LX_size[1]] = j;
state->frame->ref_LX_size[1] += 1; state->frame->ref_LX_size[1] += 1;
} }
} }

View file

@ -142,11 +142,19 @@ static void set_frame_info(kvz_frame_info *const info, const encoder_state_t *co
info->nal_unit_type = state->frame->pictype; info->nal_unit_type = state->frame->pictype;
info->slice_type = state->frame->slicetype; info->slice_type = state->frame->slicetype;
memcpy(info->ref_list[0], state->frame->ref_LX[0], 16); memset(info->ref_list[0], 0, 16);
memcpy(info->ref_list[1], state->frame->ref_LX[1], 16); memset(info->ref_list[1], 0, 16);
for (size_t i = 0; i < state->frame->ref_LX_size[0]; i++) {
info->ref_list[0][i] = state->frame->ref->pocs[state->frame->ref_LX[0][i]];
}
for (size_t i = 0; i < state->frame->ref_LX_size[1]; i++) {
info->ref_list[1][i] = state->frame->ref->pocs[state->frame->ref_LX[1][i]];
}
info->ref_list_len[0] = state->frame->ref_LX_size[0]; info->ref_list_len[0] = state->frame->ref_LX_size[0];
info->ref_list_len[1] = state->frame->ref_LX_size[1]; info->ref_list_len[1] = state->frame->ref_LX_size[1];
//kvz_encoder_create_ref_lists(state);
} }