[FFmpeg-cvslog] swscale: use a (more correct) function for isPacked

Clément Bœsch git at videolan.org
Mon Mar 20 09:06:24 EET 2017


ffmpeg | branch: master | Clément Bœsch <u at pkh.me> | Sun Mar 19 15:28:19 2017 +0100| [ff6bc16c5ad94704615b2cc9cb7f238e61bbe12d] | committer: Clément Bœsch

swscale: use a (more correct) function for isPacked

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

 libswscale/swscale_internal.h    | 21 +++------------------
 tests/ref/fate/sws-pixdesc-query | 19 +++++++++++++++++++
 2 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index b1fec42..ea5df26 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -784,30 +784,15 @@ static av_always_inline int isALPHA(enum AVPixelFormat pix_fmt)
     return desc->flags & AV_PIX_FMT_FLAG_ALPHA;
 }
 
-#if 1
-#define isPacked(x)         (       \
-           (x)==AV_PIX_FMT_PAL8        \
-        || (x)==AV_PIX_FMT_YUYV422     \
-        || (x)==AV_PIX_FMT_YVYU422     \
-        || (x)==AV_PIX_FMT_UYVY422     \
-        || (x)==AV_PIX_FMT_YA8       \
-        || (x)==AV_PIX_FMT_YA16LE      \
-        || (x)==AV_PIX_FMT_YA16BE      \
-        || (x)==AV_PIX_FMT_AYUV64LE    \
-        || (x)==AV_PIX_FMT_AYUV64BE    \
-        ||  isRGBinInt(x)           \
-        ||  isBGRinInt(x)           \
-    )
-#else
 static av_always_inline int isPacked(enum AVPixelFormat pix_fmt)
 {
     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
     av_assert0(desc);
-    return ((desc->nb_components >= 2 && !(desc->flags & AV_PIX_FMT_FLAG_PLANAR)) ||
-            pix_fmt == AV_PIX_FMT_PAL8);
+    return (desc->nb_components >= 2 && !(desc->flags & AV_PIX_FMT_FLAG_PLANAR)) ||
+            pix_fmt == AV_PIX_FMT_PAL8 ||
+            pix_fmt == AV_PIX_FMT_MONOBLACK || pix_fmt == AV_PIX_FMT_MONOWHITE;
 }
 
-#endif
 static av_always_inline int isPlanar(enum AVPixelFormat pix_fmt)
 {
     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query
index 1f05844..d23b4f5 100644
--- a/tests/ref/fate/sws-pixdesc-query
+++ b/tests/ref/fate/sws-pixdesc-query
@@ -594,6 +594,7 @@ Packed:
   monob
   pal8
   uyvy422
+  uyyvyy411
   bgr8
   bgr4
   bgr4_byte
@@ -621,6 +622,8 @@ Packed:
   ya8
   bgr48be
   bgr48le
+  xyz12le
+  xyz12be
   rgba64be
   rgba64le
   bgra64be
@@ -628,6 +631,22 @@ Packed:
   yvyu422
   ya16be
   ya16le
+  0rgb
+  rgb0
+  0bgr
+  bgr0
+  bayer_bggr8
+  bayer_rggb8
+  bayer_gbrg8
+  bayer_grbg8
+  bayer_bggr16le
+  bayer_bggr16be
+  bayer_rggb16le
+  bayer_rggb16be
+  bayer_gbrg16le
+  bayer_gbrg16be
+  bayer_grbg16le
+  bayer_grbg16be
   ayuv64le
   ayuv64be
 



More information about the ffmpeg-cvslog mailing list