summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo_enc.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2014-11-04 09:37:03 -0500
committerVittorio Giovara <vittorio.giovara@gmail.com>2014-11-06 10:44:46 -0500
commite0a1d0a2b04eb5220d00fc7ce46a57cc5e3c7118 (patch)
tree173234576a731aeedb2ecf07e25962435c41ca3e /libavcodec/mpegvideo_enc.c
parent05e59135b3539062465b5005b6d46ec0418a5fc4 (diff)
mpegvideo_enc: rework direct mode check
Remove stray semicolon and share codepaths. CC: libav-stable@libav.org Bug-Id: CID 991857
Diffstat (limited to 'libavcodec/mpegvideo_enc.c')
-rw-r--r--libavcodec/mpegvideo_enc.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index bb612d69bb..9006c653c9 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -985,39 +985,29 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
}
if (pic_arg) {
- if (!pic_arg->buf[0]);
- direct = 0;
- if (pic_arg->linesize[0] != s->linesize)
- direct = 0;
- if (pic_arg->linesize[1] != s->uvlinesize)
- direct = 0;
- if (pic_arg->linesize[2] != s->uvlinesize)
+ if (!pic_arg->buf[0] ||
+ pic_arg->linesize[0] != s->linesize ||
+ pic_arg->linesize[1] != s->uvlinesize ||
+ pic_arg->linesize[2] != s->uvlinesize)
direct = 0;
av_dlog(s->avctx, "%d %d %td %td\n", pic_arg->linesize[0],
pic_arg->linesize[1], s->linesize, s->uvlinesize);
- if (direct) {
- i = ff_find_unused_picture(s, 1);
- if (i < 0)
- return i;
+ i = ff_find_unused_picture(s, direct);
+ if (i < 0)
+ return i;
- pic = &s->picture[i];
- pic->reference = 3;
+ pic = &s->picture[i];
+ pic->reference = 3;
+ 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 {
- i = ff_find_unused_picture(s, 0);
- if (i < 0)
- return i;
-
- pic = &s->picture[i];
- pic->reference = 3;
-
if (ff_alloc_picture(s, pic, 0) < 0) {
return -1;
}