av_freep(&h->rbsp_buffer[0]);
av_freep(&h->rbsp_buffer[1]);
+ ff_h264_unref_picture(h, &h->last_pic_for_ec);
memcpy(h, h1, offsetof(H264Context, intra_pcm_ptr));
memcpy(&h->cabac, &h1->cabac,
sizeof(H264Context) - offsetof(H264Context, cabac));
memset(&h->mb_luma_dc, 0, sizeof(h->mb_luma_dc));
memset(&h->mb_padding, 0, sizeof(h->mb_padding));
memset(&h->cur_pic, 0, sizeof(h->cur_pic));
+ memset(&h->last_pic_for_ec, 0, sizeof(h->last_pic_for_ec));
h->avctx = dst;
h->DPB = NULL;
goto fail;
}
c->avctx = h->avctx;
- if (CONFIG_ERROR_RESILIENCE) {
- c->mecc = h->mecc;
- }
c->vdsp = h->vdsp;
c->h264dsp = h->h264dsp;
c->h264qpel = h->h264qpel;
c->chroma_y_shift = h->chroma_y_shift;
c->qscale = h->qscale;
c->droppable = h->droppable;
- c->data_partitioning = h->data_partitioning;
c->low_delay = h->low_delay;
c->mb_width = h->mb_width;
c->mb_height = h->mb_height;
if (!FIELD_PICTURE(h) || h->picture_structure == last_pic_structure) {
/* Previous field is unmatched. Don't display it, but let it
* remain for reference if marked as such. */
+ h0->missing_fields ++;
h0->cur_pic_ptr = NULL;
h0->first_field = FIELD_PICTURE(h);
} else {
+ h0->missing_fields = 0;
if (h0->cur_pic_ptr->frame_num != h->frame_num) {
ff_thread_report_progress(&h0->cur_pic_ptr->tf, INT_MAX,
h0->picture_structure==PICT_BOTTOM_FIELD);
(h->ref_list[j][i].reference & 3);
}
- if (h->ref_count[0]) ff_h264_set_erpic(&h->er.last_pic, &h->ref_list[0][0]);
+ if (h->ref_count[0]) {
+ ff_h264_set_erpic(&h->er.last_pic, &h->ref_list[0][0]);
+ } else if (h->last_pic_for_ec.f.buf[0]) {
+ ff_h264_set_erpic(&h->er.last_pic, &h->last_pic_for_ec);
+ }
+
if (h->ref_count[1]) ff_h264_set_erpic(&h->er.next_pic, &h->ref_list[1][0]);
h->er.ref_count = h->ref_count[0];