return out_i;
}
-int ff_h264_fill_default_ref_list(H264Context *h, H264SliceContext *sl)
+static void h264_initialise_ref_list(H264Context *h, H264SliceContext *sl)
{
int i, len;
len += add_sorted(sorted + len, h->short_ref, h->short_ref_count, cur_poc, 0 ^ list);
assert(len <= 32);
- len = build_def_list(h->default_ref_list[list], FF_ARRAY_ELEMS(h->default_ref_list[0]),
+ len = build_def_list(sl->ref_list[list], FF_ARRAY_ELEMS(sl->ref_list[0]),
sorted, len, 0, h->picture_structure);
- len += build_def_list(h->default_ref_list[list] + len,
- FF_ARRAY_ELEMS(h->default_ref_list[0]) - len,
+ len += build_def_list(sl->ref_list[list] + len,
+ FF_ARRAY_ELEMS(sl->ref_list[0]) - len,
h->long_ref, 16, 1, h->picture_structure);
if (len < sl->ref_count[list])
- memset(&h->default_ref_list[list][len], 0, sizeof(H264Ref) * (sl->ref_count[list] - len));
+ memset(&sl->ref_list[list][len], 0, sizeof(H264Ref) * (sl->ref_count[list] - len));
lens[list] = len;
}
if (lens[0] == lens[1] && lens[1] > 1) {
for (i = 0; i < lens[0] &&
- h->default_ref_list[0][i].parent->f->buf[0]->buffer ==
- h->default_ref_list[1][i].parent->f->buf[0]->buffer; i++);
+ sl->ref_list[0][i].parent->f->buf[0]->buffer ==
+ sl->ref_list[1][i].parent->f->buf[0]->buffer; i++);
if (i == lens[0]) {
- FFSWAP(H264Ref, h->default_ref_list[1][0], h->default_ref_list[1][1]);
+ FFSWAP(H264Ref, sl->ref_list[1][0], sl->ref_list[1][1]);
}
}
} else {
- len = build_def_list(h->default_ref_list[0], FF_ARRAY_ELEMS(h->default_ref_list[0]),
+ len = build_def_list(sl->ref_list[0], FF_ARRAY_ELEMS(sl->ref_list[0]),
h->short_ref, h->short_ref_count, 0, h->picture_structure);
- len += build_def_list(h->default_ref_list[0] + len,
- FF_ARRAY_ELEMS(h->default_ref_list[0]) - len,
+ len += build_def_list(sl->ref_list[0] + len,
+ FF_ARRAY_ELEMS(sl->ref_list[0]) - len,
h-> long_ref, 16, 1, h->picture_structure);
if (len < sl->ref_count[0])
- memset(&h->default_ref_list[0][len], 0, sizeof(H264Ref) * (sl->ref_count[0] - len));
+ memset(&sl->ref_list[0][len], 0, sizeof(H264Ref) * (sl->ref_count[0] - len));
}
#ifdef TRACE
for (i = 0; i < sl->ref_count[0]; i++) {
ff_tlog(h->avctx, "List0: %s fn:%d 0x%p\n",
- (h->default_ref_list[0][i].long_ref ? "LT" : "ST"),
- h->default_ref_list[0][i].pic_id,
- h->default_ref_list[0][i].f->data[0]);
+ (sl->ref_list[0][i].long_ref ? "LT" : "ST"),
+ sl->ref_list[0][i].pic_id,
+ sl->ref_list[0][i].f->data[0]);
}
if (sl->slice_type_nos == AV_PICTURE_TYPE_B) {
for (i = 0; i < sl->ref_count[1]; i++) {
ff_tlog(h->avctx, "List1: %s fn:%d 0x%p\n",
- (h->default_ref_list[1][i].long_ref ? "LT" : "ST"),
- h->default_ref_list[1][i].pic_id,
- h->default_ref_list[1][i].f->data[0]);
+ (sl->ref_list[1][i].long_ref ? "LT" : "ST"),
+ sl->ref_list[1][i].pic_id,
+ sl->ref_list[1][i].f->data[0]);
}
}
#endif
- return 0;
}
static void print_short_term(H264Context *h);
print_short_term(h);
print_long_term(h);
- for (list = 0; list < sl->list_count; list++) {
- memcpy(sl->ref_list[list], h->default_ref_list[list], sl->ref_count[list] * sizeof(sl->ref_list[0][0]));
+ h264_initialise_ref_list(h, sl);
+ for (list = 0; list < sl->list_count; list++) {
if (get_bits1(&sl->gb)) { // ref_pic_list_modification_flag_l[01]
int pred = h->curr_pic_num;
for (index = 0; index < sl->ref_count[list]; index++) {
if (!sl->ref_list[list][index].parent) {
av_log(h->avctx, AV_LOG_ERROR, "Missing reference picture\n");
- if (h->default_ref_list[list][0].parent)
- sl->ref_list[list][index] = h->default_ref_list[list][0];
- else
- return -1;
+ return -1;
}
}
}
h->dequant_coeff_pps = h1->dequant_coeff_pps;
// POC timing
- copy_fields(h, h1, poc_lsb, default_ref_list);
-
- // reference lists
- copy_fields(h, h1, short_ref, current_slice);
+ copy_fields(h, h1, poc_lsb, current_slice);
copy_picture_range(h->short_ref, h1->short_ref, 32, h, h1);
copy_picture_range(h->long_ref, h1->long_ref, 32, h, h1);
copy_picture_range(h->delayed_pic, h1->delayed_pic,
MAX_DELAYED_PIC_COUNT + 2, h, h1);
- h->last_slice_type = h1->last_slice_type;
-
if (!h->cur_pic_ptr)
return 0;
unsigned int pps_id;
int ret;
unsigned int slice_type, tmp, i, j;
- int default_ref_list_done = 0;
int last_pic_structure, last_pic_droppable;
int needs_reinit = 0;
int field_pic_flag, bottom_field_flag;
sl->slice_type_fixed = 0;
slice_type = golomb_to_pict_type[slice_type];
- if (slice_type == AV_PICTURE_TYPE_I ||
- (h->current_slice != 0 && slice_type == h->last_slice_type)) {
- default_ref_list_done = 1;
- }
sl->slice_type = slice_type;
sl->slice_type_nos = slice_type & 3;
ret = ff_set_ref_count(h, sl);
if (ret < 0)
return ret;
- else if (ret == 1)
- default_ref_list_done = 0;
-
- if (!default_ref_list_done)
- ff_h264_fill_default_ref_list(h, sl);
if (sl->slice_type_nos != AV_PICTURE_TYPE_I) {
ret = ff_h264_decode_ref_pic_list_reordering(h, sl);
h->pps.chroma_qp_index_offset[1]) +
6 * (h->sps.bit_depth_luma - 8);
- h->last_slice_type = slice_type;
sl->slice_num = ++h->current_slice;
if (sl->slice_num >= MAX_SLICES) {
av_log(h->avctx, AV_LOG_ERROR,