diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-12-19 14:55:07 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-12-19 15:44:59 +0100 |
commit | 642a655f7d9a6afc97fff5f3ecd6a7ad5d53e0ca (patch) | |
tree | b09ea65812ccdada345d88802afa71016e1b357e /libavcodec/h264.c | |
parent | e84194f06024892fc33684c5a1726c97a0c0a45c (diff) | |
parent | f1d8763a02b5fce9a7d9789e049d74a45b15e1e8 (diff) | |
download | ffmpeg-642a655f7d9a6afc97fff5f3ecd6a7ad5d53e0ca.tar.gz |
Merge commit 'f1d8763a02b5fce9a7d9789e049d74a45b15e1e8'
* commit 'f1d8763a02b5fce9a7d9789e049d74a45b15e1e8':
mpegvideo: allocate scratch buffers after linesize is known
Conflicts:
libavcodec/mpegvideo.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r-- | libavcodec/h264.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index c3f600f2a6..3e50ba58e0 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -2300,8 +2300,10 @@ static int field_end(H264Context *h, int in_setup) /** * Replicate H264 "master" context to thread contexts. */ -static void clone_slice(H264Context *dst, H264Context *src) +static int clone_slice(H264Context *dst, H264Context *src) { + int ret; + memcpy(dst->block_offset, src->block_offset, sizeof(dst->block_offset)); dst->s.current_picture_ptr = src->s.current_picture_ptr; dst->s.current_picture = src->s.current_picture; @@ -2309,6 +2311,13 @@ static void clone_slice(H264Context *dst, H264Context *src) dst->s.uvlinesize = src->s.uvlinesize; dst->s.first_field = src->s.first_field; + if (!dst->s.edge_emu_buffer && + (ret = ff_mpv_frame_size_alloc(&dst->s, dst->s.linesize))) { + av_log(dst->s.avctx, AV_LOG_ERROR, + "Failed to allocate scratch buffers\n"); + return ret; + } + dst->prev_poc_msb = src->prev_poc_msb; dst->prev_poc_lsb = src->prev_poc_lsb; dst->prev_frame_num_offset = src->prev_frame_num_offset; @@ -2322,6 +2331,8 @@ static void clone_slice(H264Context *dst, H264Context *src) memcpy(dst->dequant4_coeff, src->dequant4_coeff, sizeof(src->dequant4_coeff)); memcpy(dst->dequant8_coeff, src->dequant8_coeff, sizeof(src->dequant8_coeff)); + + return 0; } /** @@ -2901,8 +2912,8 @@ static int decode_slice_header(H264Context *h, H264Context *h0) ff_release_unused_pictures(s, 0); } } - if (h != h0) - clone_slice(h, h0); + if (h != h0 && (ret = clone_slice(h, h0)) < 0) + return ret; s->current_picture_ptr->frame_num = h->frame_num; // FIXME frame_num cleanup |