changeset 29469:a5f2750d1ff1

swscale-example: Don't check for chroma planes in mono formats.
author ramiro
date Thu, 13 Aug 2009 18:39:39 +0000
parents 947a942221c4
children 6b8f383679ea
files libswscale/swscale-example.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libswscale/swscale-example.c	Thu Aug 13 18:31:07 2009 +0000
+++ b/libswscale/swscale-example.c	Thu Aug 13 18:39:39 2009 +0000
@@ -37,6 +37,11 @@
         || (x)==PIX_FMT_GRAY16BE    \
         || (x)==PIX_FMT_GRAY16LE    \
     )
+#define hasChroma(x)   (!(           \
+            isGray(x)               \
+        || (x)==PIX_FMT_MONOBLACK   \
+        || (x)==PIX_FMT_MONOWHITE   \
+    ))
 #define isALPHA(x)      (           \
            (x)==PIX_FMT_BGR32       \
         || (x)==PIX_FMT_BGR32_1     \
@@ -139,7 +144,7 @@
     sws_scale(outContext, dst, dstStride, 0, dstH, out, refStride);
 
     ssdY= getSSD(ref[0], out[0], refStride[0], refStride[0], w, h);
-    if (!isGray(srcFormat) && !isGray(dstFormat)) {
+    if (hasChroma(srcFormat) && hasChroma(dstFormat)) {
         //FIXME check that output is really gray
         ssdU= getSSD(ref[1], out[1], refStride[1], refStride[1], (w+1)>>1, (h+1)>>1);
         ssdV= getSSD(ref[2], out[2], refStride[2], refStride[2], (w+1)>>1, (h+1)>>1);