Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-01-20 20:09:30 +0400
committerMichael Niedermayer <michaelni@gmx.at>2014-01-20 20:09:35 +0400
commitd83707c64197de354419faa1816f6ec3e7baf7ba (patch)
tree46f949d4817dffce78d78ae702eeeb4d9a5c33ea /libavcodec/mpegvideo.c
parentd08dd3286369964cd0476ddaa037a1193e9adcde (diff)
parent024db24912a39316b0ef0b7d793307d62da038f4 (diff)
Merge commit '024db24912a39316b0ef0b7d793307d62da038f4'
* commit '024db24912a39316b0ef0b7d793307d62da038f4': mpegvideo: allocate edges when encoding. Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r--libavcodec/mpegvideo.c22
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) {