[FFmpeg-cvslog] lavc/h264: simplify find_unused_picture()

Clément Bœsch git at videolan.org
Thu Jan 19 11:40:56 EET 2017


ffmpeg | branch: master | Clément Bœsch <u at pkh.me> | Wed Jan 18 18:13:02 2017 +0100| [e5ac554ba7d6c0298a2504f9dc2411a81e1a6d96] | committer: Clément Bœsch

lavc/h264: simplify find_unused_picture()

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

 libavcodec/h264_slice.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index fe71d57..ad7a75f 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -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;
 }
 
 



More information about the ffmpeg-cvslog mailing list