diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-01-20 17:09:30 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-01-20 17:09:35 +0100 |
commit | d83707c64197de354419faa1816f6ec3e7baf7ba (patch) | |
tree | 46f949d4817dffce78d78ae702eeeb4d9a5c33ea /libavcodec | |
parent | d08dd3286369964cd0476ddaa037a1193e9adcde (diff) | |
parent | 024db24912a39316b0ef0b7d793307d62da038f4 (diff) | |
download | ffmpeg-d83707c64197de354419faa1816f6ec3e7baf7ba.tar.gz |
Merge commit '024db24912a39316b0ef0b7d793307d62da038f4'
* commit '024db24912a39316b0ef0b7d793307d62da038f4':
mpegvideo: allocate edges when encoding.
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/mpegvideo.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index d96dac40b0..2b3db2fb6f 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -415,15 +415,21 @@ fail: */ static int alloc_frame_buffer(MpegEncContext *s, Picture *pic) { + int edges_needed = av_codec_is_encoder(s->avctx->codec); int r, ret; pic->tf.f = &pic->f; if (s->codec_id != AV_CODEC_ID_WMV3IMAGE && s->codec_id != AV_CODEC_ID_VC1IMAGE && - s->codec_id != AV_CODEC_ID_MSS2) + s->codec_id != AV_CODEC_ID_MSS2) { + if (edges_needed) { + pic->f.width = s->avctx->width + 2 * EDGE_WIDTH; + pic->f.height = s->avctx->height + 2 * EDGE_WIDTH; + } + r = ff_thread_get_buffer(s->avctx, &pic->tf, pic->reference ? AV_GET_BUFFER_FLAG_REF : 0); - else { + } else { pic->f.width = s->avctx->width; pic->f.height = s->avctx->height; pic->f.format = s->avctx->pix_fmt; @@ -436,6 +442,18 @@ static int alloc_frame_buffer(MpegEncContext *s, Picture *pic) return -1; } + if (edges_needed) { + int i; + for (i = 0; pic->f.data[i]; i++) { + int offset = (EDGE_WIDTH >> (i ? s->chroma_y_shift : 0)) * + pic->f.linesize[i] + + (EDGE_WIDTH >> (i ? s->chroma_x_shift : 0)); + pic->f.data[i] += offset; + } + pic->f.width = s->avctx->width; + pic->f.height = s->avctx->height; + } + if (s->avctx->hwaccel) { assert(!pic->hwaccel_picture_private); if (s->avctx->hwaccel->priv_data_size) { |