summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo_enc.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2015-04-15 15:16:13 +0100
committerVittorio Giovara <vittorio.giovara@gmail.com>2015-04-19 23:17:56 +0100
commit3d71b1f8f09fccea7158e868fb9bd81b81205449 (patch)
tree68d758c3739de9a597ada1c8d49f0c77d12dd1c3 /libavcodec/mpegvideo_enc.c
parent0251c9be5a9d79cb669e97086a82dc4d44a917b0 (diff)
mpegvideo_enc: Simplify picture allocation
Diffstat (limited to 'libavcodec/mpegvideo_enc.c')
-rw-r--r--libavcodec/mpegvideo_enc.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 0ad131f5e0..b0d80b1079 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1006,14 +1006,12 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
if (direct) {
if ((ret = av_frame_ref(pic->f, pic_arg)) < 0)
return ret;
- if (ff_alloc_picture(s, pic, 1) < 0) {
- return -1;
- }
- } else {
- if (ff_alloc_picture(s, pic, 0) < 0) {
- return -1;
- }
+ }
+ ret = ff_alloc_picture(s, pic, direct);
+ if (ret < 0)
+ return ret;
+ if (!direct) {
if (pic->f->data[0] + INPLACE_OFFSET == pic_arg->data[0] &&
pic->f->data[1] + INPLACE_OFFSET == pic_arg->data[1] &&
pic->f->data[2] + INPLACE_OFFSET == pic_arg->data[2]) {