[FFmpeg-cvslog] lavc/vp9: split a few assignment out of ifs

Clément Bœsch git at videolan.org
Mon Mar 27 22:41:15 EEST 2017


ffmpeg | branch: master | Clément Bœsch <u at pkh.me> | Sat Mar 25 12:32:45 2017 +0100| [0f8ae9d7b29ddf7040ecaf6bb573c46afdb21cf1] | committer: Clément Bœsch

lavc/vp9: split a few assignment out of ifs

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0f8ae9d7b29ddf7040ecaf6bb573c46afdb21cf1
---

 libavcodec/vp9.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index 964053d..f2235a5 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -50,10 +50,13 @@ static int vp9_frame_alloc(AVCodecContext *avctx, VP9Frame *f)
     VP9Context *s = avctx->priv_data;
     int ret, sz;
 
-    if ((ret = ff_thread_get_buffer(avctx, &f->tf, AV_GET_BUFFER_FLAG_REF)) < 0)
+    ret = ff_thread_get_buffer(avctx, &f->tf, AV_GET_BUFFER_FLAG_REF);
+    if (ret < 0)
         return ret;
+
     sz = 64 * s->sb_cols * s->sb_rows;
-    if (!(f->extradata = av_buffer_allocz(sz * (1 + sizeof(struct VP9mvrefPair))))) {
+    f->extradata = av_buffer_allocz(sz * (1 + sizeof(struct VP9mvrefPair)));
+    if (!f->extradata) {
         goto fail;
     }
 
@@ -82,11 +85,13 @@ static int vp9_frame_ref(AVCodecContext *avctx, VP9Frame *dst, VP9Frame *src)
 {
     int res;
 
-    if ((res = ff_thread_ref_frame(&dst->tf, &src->tf)) < 0) {
+    res = ff_thread_ref_frame(&dst->tf, &src->tf);
+    if (res < 0)
         return res;
-    } else if (!(dst->extradata = av_buffer_ref(src->extradata))) {
+
+    dst->extradata = av_buffer_ref(src->extradata);
+    if (!dst->extradata)
         goto fail;
-    }
 
     dst->segmentation_map = src->segmentation_map;
     dst->mv = src->mv;



More information about the ffmpeg-cvslog mailing list