changeset 30054:67e244d32f1c

Check if chroma horizontal scaler is needed in sws_init_swScale().
author ramiro
date Mon, 21 Dec 2009 01:34:45 +0000
parents ea27997a3635
children 4c712237a601
files libswscale/swscale_internal.h libswscale/swscale_template.c
diffstat 2 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libswscale/swscale_internal.h	Mon Dec 21 01:30:55 2009 +0000
+++ b/libswscale/swscale_internal.h	Mon Dec 21 01:34:45 2009 +0000
@@ -279,6 +279,8 @@
     int chrSrcOffset; ///< Offset given to chroma src pointers passed to horizontal input functions.
     int alpSrcOffset; ///< Offset given to alpha src pointers passed to horizontal input functions.
 
+    int needs_hcscale; ///< Set if there are chroma planes to be converted.
+
 } SwsContext;
 //FIXME check init (where 0)
 
--- a/libswscale/swscale_template.c	Mon Dec 21 01:30:55 2009 +0000
+++ b/libswscale/swscale_template.c	Mon Dec 21 01:34:45 2009 +0000
@@ -2438,9 +2438,6 @@
     int     av_unused canMMX2BeUsed  = c->canMMX2BeUsed;
     void    av_unused *mmx2FilterCode= c->chrMmx2FilterCode;
 
-    if (isGray(srcFormat) || srcFormat==PIX_FMT_MONOBLACK || srcFormat==PIX_FMT_MONOWHITE)
-        return;
-
     src1 += c->chrSrcOffset;
     src2 += c->chrSrcOffset;
 
@@ -2717,7 +2714,7 @@
             assert(lastInChrBuf + 1 - chrSrcSliceY >= 0);
             //FIXME replace parameters through context struct (some at least)
 
-            if (!(isGray(srcFormat) || isGray(dstFormat)))
+            if (c->needs_hcscale)
                 RENAME(hcscale)(c, chrPixBuf[ chrBufIndex ], chrDstW, src1, src2, chrSrcW, chrXInc,
                                 flags, hChrFilter, hChrFilterPos, hChrFilterSize,
                                 c->srcFormat, formatConvBuffer,
@@ -3067,4 +3064,8 @@
             c->chrConvertRange = RENAME(chrRangeToJpeg);
         }
     }
+
+    if (!(isGray(srcFormat) || isGray(c->dstFormat) ||
+          srcFormat == PIX_FMT_MONOBLACK || srcFormat == PIX_FMT_MONOWHITE))
+        c->needs_hcscale = 1;
 }