diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-06-13 12:10:05 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-06-13 12:12:33 +0200 |
commit | 294af5140132521f11723467c7230e7285702545 (patch) | |
tree | cde71a2d89ca5efe92c7314f8f413f60f5948404 | |
parent | 4027e136635759999ffb5fa16d1053f26c1dec5e (diff) | |
parent | 50ec1db62d977b6e864f315a53c1c580a6d7efa4 (diff) | |
download | ffmpeg-294af5140132521f11723467c7230e7285702545.tar.gz |
Merge commit '50ec1db62d977b6e864f315a53c1c580a6d7efa4'
* commit '50ec1db62d977b6e864f315a53c1c580a6d7efa4':
4xm: fold last_picture lazy allocation in decode_p_frame
Conflicts:
libavcodec/4xm.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/4xm.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c index a396a6d739..096a8db7f7 100644 --- a/libavcodec/4xm.c +++ b/libavcodec/4xm.c @@ -416,6 +416,16 @@ static int decode_p_frame(FourXContext *f, AVFrame *frame, uint16_t *src; unsigned int bitstream_size, bytestream_size, wordstream_size, extra, bytestream_offset, wordstream_offset; + int ret; + + if (!f->last_picture->data[0]) { + if ((ret = ff_get_buffer(f->avctx, f->last_picture, + AV_GET_BUFFER_FLAG_REF)) < 0) { + return ret; + } + for (y=0; y<f->avctx->height; y++) + memset(f->last_picture->data[0] + y*f->last_picture->linesize[0], 0, 2*f->avctx->width); + } src = (uint16_t *)f->last_picture->data[0]; @@ -902,14 +912,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, return ret; } } else if (frame_4cc == AV_RL32("pfrm") || frame_4cc == AV_RL32("pfr2")) { - if (!f->last_picture->data[0]) { - if ((ret = ff_get_buffer(avctx, f->last_picture, - AV_GET_BUFFER_FLAG_REF)) < 0) - return ret; - for (i=0; i<avctx->height; i++) - memset(f->last_picture->data[0] + i*f->last_picture->linesize[0], 0, 2*avctx->width); - } - f->current_picture->pict_type = AV_PICTURE_TYPE_P; if ((ret = decode_p_frame(f, f->current_picture, buf, frame_size)) < 0) { av_log(f->avctx, AV_LOG_ERROR, "decode p frame failed\n"); |