[FFmpeg-devel] [PATCH 3/8] Optimize / simplify av_get_pix_fmt_name().

Stefano Sabatini stefano.sabatini-lala
Fri Nov 5 12:00:48 CET 2010


---
 libavutil/pixdesc.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index c099d03..01e2917 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -816,10 +816,8 @@ static enum PixelFormat get_pix_fmt_internal(const char *name)
 
 const char *av_get_pix_fmt_name(enum PixelFormat pix_fmt)
 {
-    if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB)
-        return NULL;
-    else
-        return av_pix_fmt_descriptors[pix_fmt].name;
+    return ((unsigned)pix_fmt >= PIX_FMT_NB) ?
+        av_pix_fmt_descriptors[pix_fmt].name : NULL;
 }
 
 #if HAVE_BIGENDIAN
-- 
1.7.1




More information about the ffmpeg-devel mailing list