Replaced temporary reference lists with the ones in gop configurations

This commit is contained in:
Marko Viitanen 2015-03-20 10:25:40 +02:00
parent f166d25dd0
commit 7dab3ea0f6

View file

@ -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");