Commit 07a79cf8 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '7a4f74ee'

* commit '7a4f74ee':
  h264: embed the DPB in the context

Conflicts:
	libavcodec/h264.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 4a95cd5d 7a4f74ee
...@@ -621,9 +621,6 @@ static int h264_init_context(AVCodecContext *avctx, H264Context *h) ...@@ -621,9 +621,6 @@ static int h264_init_context(AVCodecContext *avctx, H264Context *h)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
h->DPB = av_mallocz_array(H264_MAX_PICTURE_COUNT, sizeof(*h->DPB));
if (!h->DPB)
return AVERROR(ENOMEM);
for (i = 0; i < H264_MAX_PICTURE_COUNT; i++) for (i = 0; i < H264_MAX_PICTURE_COUNT; i++)
av_frame_unref(&h->DPB[i].f); av_frame_unref(&h->DPB[i].f);
av_frame_unref(&h->cur_pic.f); av_frame_unref(&h->cur_pic.f);
...@@ -1084,7 +1081,6 @@ static void flush_dpb(AVCodecContext *avctx) ...@@ -1084,7 +1081,6 @@ static void flush_dpb(AVCodecContext *avctx)
ff_h264_flush_change(h); ff_h264_flush_change(h);
if (h->DPB)
for (i = 0; i < H264_MAX_PICTURE_COUNT; i++) for (i = 0; i < H264_MAX_PICTURE_COUNT; i++)
ff_h264_unref_picture(h, &h->DPB[i]); ff_h264_unref_picture(h, &h->DPB[i]);
h->cur_pic_ptr = NULL; h->cur_pic_ptr = NULL;
...@@ -1850,12 +1846,9 @@ av_cold void ff_h264_free_context(H264Context *h) ...@@ -1850,12 +1846,9 @@ av_cold void ff_h264_free_context(H264Context *h)
ff_h264_free_tables(h); ff_h264_free_tables(h);
if (h->DPB) {
for (i = 0; i < H264_MAX_PICTURE_COUNT; i++) for (i = 0; i < H264_MAX_PICTURE_COUNT; i++)
ff_h264_unref_picture(h, &h->DPB[i]); ff_h264_unref_picture(h, &h->DPB[i]);
memset(h->delayed_pic, 0, sizeof(h->delayed_pic)); memset(h->delayed_pic, 0, sizeof(h->delayed_pic));
av_freep(&h->DPB);
}
h->cur_pic_ptr = NULL; h->cur_pic_ptr = NULL;
......
...@@ -506,7 +506,7 @@ typedef struct H264Context { ...@@ -506,7 +506,7 @@ typedef struct H264Context {
H264QpelContext h264qpel; H264QpelContext h264qpel;
GetBitContext gb; GetBitContext gb;
H264Picture *DPB; H264Picture DPB[H264_MAX_PICTURE_COUNT];
H264Picture *cur_pic_ptr; H264Picture *cur_pic_ptr;
H264Picture cur_pic; H264Picture cur_pic;
H264Picture last_pic_for_ec; H264Picture last_pic_for_ec;
......
...@@ -498,9 +498,9 @@ int ff_h264_update_thread_context(AVCodecContext *dst, ...@@ -498,9 +498,9 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
h->droppable = h1->droppable; h->droppable = h1->droppable;
h->low_delay = h1->low_delay; h->low_delay = h1->low_delay;
for (i = 0; h->DPB && i < H264_MAX_PICTURE_COUNT; i++) { for (i = 0; i < H264_MAX_PICTURE_COUNT; i++) {
ff_h264_unref_picture(h, &h->DPB[i]); ff_h264_unref_picture(h, &h->DPB[i]);
if (h1->DPB && h1->DPB[i].f.buf[0] && if (h1->DPB[i].f.buf[0] &&
(ret = ff_h264_ref_picture(h, &h->DPB[i], &h1->DPB[i])) < 0) (ret = ff_h264_ref_picture(h, &h->DPB[i], &h1->DPB[i])) < 0)
return ret; return ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment