From 9bb11be0e5a75782c3139ad058c2b571499aa37d Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Sun, 31 May 2015 15:49:54 +0200 Subject: 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. --- libavcodec/mpegvideo_enc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'libavcodec/mpegvideo_enc.c') 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; } -- cgit v1.2.3