From 7dab3ea0f6111876268c95d390ec85703e2f76a2 Mon Sep 17 00:00:00 2001 From: Marko Viitanen Date: Fri, 20 Mar 2015 10:25:40 +0200 Subject: [PATCH] Replaced temporary reference lists with the ones in gop configurations --- src/encoder_state-bitstream.c | 48 ++++++++--------------------------- 1 file changed, 11 insertions(+), 37 deletions(-) diff --git a/src/encoder_state-bitstream.c b/src/encoder_state-bitstream.c index 770c95df..53a1d834 100644 --- a/src/encoder_state-bitstream.c +++ b/src/encoder_state-bitstream.c @@ -604,49 +604,23 @@ void encoder_state_write_bitstream_slice_header(encoder_state_t * const state) WRITE_UE(stream, ref_positive, "num_positive_pics"); fprintf(stderr, "\nPOC: %d [L0 ", state->global->poc); for (j = 0; j < ref_negative; j++) { - /* - int8_t reflist[4][8] = { - { 1, 2, 1, 4, 1, 2, 1, 8 }, - { 0, 4, 3, 6, 5, 4, 3, 10 }, - { 0, 0, 0, 0, 0, 6, 7, 12 }, - { 0, 0, 0, 0, 0, 0, 0, 16 } - };*/ - int8_t reflist[4][8] = { - { 1, 2, 1, 4, 1, 4, 1, 8 }, - { 0, 4, 3, 6, 5, 4, 3, 10 }, - { 0, 0, 0, 0, 0, 6, 7, 12 }, - { 0, 0, 0, 0, 0, 0, 0, 16 } - }; - int32_t delta_poc_minus1 = reflist[j][(state->global->poc - 1) % 8] - last_poc - 1; - if ((state->global->poc - 1) % 8 == 7 && (state->global->poc - 1) > 8) delta_poc_minus1 = 9; - if (!state->encoder_control->cfg->gop_len) { - delta_poc_minus1 = 0; - } - WRITE_UE(stream, delta_poc_minus1, "delta_poc_s0_minus1"); + int8_t delta_poc = state->encoder_control->cfg->gop[(state->global->frame - 1) % 8].ref_neg[j]; + + WRITE_UE(stream, state->encoder_control->cfg->gop_len?delta_poc - last_poc - 1:0, "delta_poc_s0_minus1"); + last_poc = delta_poc; WRITE_U(stream,1,1, "used_by_curr_pic_s0_flag"); - fprintf(stderr, "%d ", state->global->poc - (delta_poc_minus1 + last_poc + 1)); - last_poc = delta_poc_minus1 + 1; + fprintf(stderr, "%d ", state->global->poc - (delta_poc)); } fprintf(stderr, "] [L1 "); last_poc = 0; for (j = 0; j < ref_positive; j++) { - /* - int8_t reflist[3][8] = { - { 1, 2, 1, 4, 1, 2, 1, 0 }, - { 3, 6, 5, 0, 3, 0, 0, 0 }, - { 7, 0, 0, 0, 0, 0, 0, 0 } - }; - */ - int8_t reflist[3][8] = { - { 1, 2, 1, 4, 1, 2, 1, 0 }, - { 3, 6, 5, 0, 3, 0, 0, 0 }, - { 7, 0, 0, 0, 0, 0, 0, 0 } - }; - int32_t delta_poc_minus1 = reflist[j][(state->global->poc - 1) % 8] - last_poc - 1; - fprintf(stderr, "%d ", state->global->poc + delta_poc_minus1 + last_poc + 1); - last_poc = delta_poc_minus1 + 1; - WRITE_UE(stream, delta_poc_minus1, "delta_poc_s1_minus1"); + int8_t delta_poc = state->encoder_control->cfg->gop[(state->global->frame - 1) % 8].ref_pos[j]; + + fprintf(stderr, "%d ", state->global->poc + delta_poc); + + WRITE_UE(stream, state->encoder_control->cfg->gop_len ? delta_poc - last_poc - 1 : 0, "delta_poc_s1_minus1"); + last_poc = delta_poc; WRITE_U(stream, 1, 1, "used_by_curr_pic_s1_flag"); } fprintf(stderr, "]\n");