summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo_enc.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2015-05-31 15:49:54 +0200
committerVittorio Giovara <vittorio.giovara@gmail.com>2015-06-08 12:39:42 +0100
commit9bb11be0e5a75782c3139ad058c2b571499aa37d (patch)
treef7d1cc610fe5dead993d5869d19eea7217413a4b /libavcodec/mpegvideo_enc.c
parentf8716a1408f4f4ec63857b7015fbd62f9eac344a (diff)
mpegvideo: Split picture allocation for encoding and decoding
The main ff_alloc_picture() function is made more generic with all the parameters necessary as arguments. This will allows to move most of the related functions to a separate file later. Right now wrappers are provided to try and minimize the number of changes in the code.
Diffstat (limited to 'libavcodec/mpegvideo_enc.c')
-rw-r--r--libavcodec/mpegvideo_enc.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 080528376b..a2061532ae 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -941,6 +941,13 @@ static int get_intra_count(MpegEncContext *s, uint8_t *src,
return acc;
}
+static int alloc_picture(MpegEncContext *s, Picture *pic, int shared)
+{
+ return ff_alloc_picture(s->avctx, pic, &s->me, &s->sc, shared, 1,
+ s->chroma_x_shift, s->chroma_y_shift, s->out_format,
+ s->mb_stride, s->mb_height, s->b8_stride,
+ &s->linesize, &s->uvlinesize);
+}
static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
{
@@ -1007,7 +1014,7 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
if ((ret = av_frame_ref(pic->f, pic_arg)) < 0)
return ret;
}
- ret = ff_alloc_picture(s, pic, direct);
+ ret = alloc_picture(s, pic, direct);
if (ret < 0)
return ret;
@@ -1387,7 +1394,7 @@ no_output_pic:
pic = &s->picture[i];
pic->reference = s->reordered_input_picture[0]->reference;
- if (ff_alloc_picture(s, pic, 0) < 0) {
+ if (alloc_picture(s, pic, 0) < 0) {
return -1;
}