lavc/h264: simplify find_unused_picture()
authorClément Bœsch <u@pkh.me>
Wed, 18 Jan 2017 17:13:02 +0000 (18:13 +0100)
committerClément Bœsch <cboesch@gopro.com>
Thu, 19 Jan 2017 09:34:10 +0000 (10:34 +0100)
libavcodec/h264_slice.c

index fe71d57..ad7a75f 100644 (file)
@@ -254,25 +254,15 @@ fail:
     return (ret < 0) ? ret : AVERROR(ENOMEM);
 }
 
-static inline int pic_is_unused(H264Context *h, H264Picture *pic)
-{
-    if (!pic->f->buf[0])
-        return 1;
-    return 0;
-}
-
 static int find_unused_picture(H264Context *h)
 {
     int i;
 
     for (i = 0; i < H264_MAX_PICTURE_COUNT; i++) {
-        if (pic_is_unused(h, &h->DPB[i]))
-            break;
+        if (!h->DPB[i].f->buf[0])
+            return i;
     }
-    if (i == H264_MAX_PICTURE_COUNT)
-        return AVERROR_INVALIDDATA;
-
-    return i;
+    return AVERROR_INVALIDDATA;
 }