int ff_h264_fill_default_ref_list(H264Context *h, H264SliceContext *sl)
{
int i, len;
+ int j;
if (sl->slice_type_nos == AV_PICTURE_TYPE_B) {
H264Picture *sorted[32];
}
}
#endif
+
+ for (j = 0; j<1+(sl->slice_type_nos == AV_PICTURE_TYPE_B); j++) {
+ for (i = 0; i < sl->ref_count[j]; i++) {
+ if (h->default_ref_list[j][i].parent) {
+ AVFrame *f = h->default_ref_list[j][i].parent->f;
+ if (h->cur_pic_ptr->f->width != f->width ||
+ h->cur_pic_ptr->f->height != f->height ||
+ h->cur_pic_ptr->f->format != f->format) {
+ av_log(h->avctx, AV_LOG_ERROR, "Discarding mismatching reference\n");
+ memset(&h->default_ref_list[j][i], 0, sizeof(h->default_ref_list[j][i]));
+ }
+ }
+ }
+ }
+
return 0;
}
remove_short_at_index(h, 0);
}
- if (h->long_ref[mmco[i].long_arg] != h->cur_pic_ptr) {
- if (h->cur_pic_ptr->long_ref) {
- for(j=0; j<16; j++) {
- if(h->long_ref[j] == h->cur_pic_ptr) {
- remove_long(h, j, 0);
+ /* make sure the current picture is not already assigned as a long ref */
+ if (h->cur_pic_ptr->long_ref) {
+ for (j = 0; j < FF_ARRAY_ELEMS(h->long_ref); j++) {
+ if (h->long_ref[j] == h->cur_pic_ptr) {
+ if (j != mmco[i].long_arg)
av_log(h->avctx, AV_LOG_ERROR, "mmco: cannot assign current picture to 2 long term references\n");
- }
+ remove_long(h, j, 0);
}
}
+ }
+
+ if (h->long_ref[mmco[i].long_arg] != h->cur_pic_ptr) {
av_assert0(!h->cur_pic_ptr->long_ref);
remove_long(h, mmco[i].long_arg, 0);