From dcd7acf4fddc5f567eee6d6b4e2b24e48d87c99b Mon Sep 17 00:00:00 2001 From: Miika Metsoila Date: Tue, 27 Jun 2017 15:56:30 +0300 Subject: [PATCH] Fixed crash and incorrect info output --- src/encoderstate.c | 4 ++-- src/kvazaar.c | 14 +++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/encoderstate.c b/src/encoderstate.c index 709efde7..2728f7c2 100644 --- a/src/encoderstate.c +++ b/src/encoderstate.c @@ -816,10 +816,10 @@ void kvz_encoder_create_ref_lists(const encoder_state_t *const state) int j = 0; for (j = 0; j < state->frame->ref->used_size; j++) { 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; } 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; } } diff --git a/src/kvazaar.c b/src/kvazaar.c index ad20a7f0..2e14ec0a 100644 --- a/src/kvazaar.c +++ b/src/kvazaar.c @@ -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->slice_type = state->frame->slicetype; - memcpy(info->ref_list[0], state->frame->ref_LX[0], 16); - memcpy(info->ref_list[1], state->frame->ref_LX[1], 16); + memset(info->ref_list[0], 0, 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[1] = state->frame->ref_LX_size[1]; - //kvz_encoder_create_ref_lists(state); }