[FFmpeg-cvslog] r30096 - in trunk/libswscale: swscale_internal.h swscale_template.c

ramiro subversion
Mon Dec 21 02:34:45 CET 2009


Author: ramiro
Date: Mon Dec 21 02:34:45 2009
New Revision: 30096

Log:
Check if chroma horizontal scaler is needed in sws_init_swScale().

Modified:
   trunk/libswscale/swscale_internal.h
   trunk/libswscale/swscale_template.c

Modified: trunk/libswscale/swscale_internal.h
==============================================================================
--- trunk/libswscale/swscale_internal.h	Mon Dec 21 02:30:55 2009	(r30095)
+++ trunk/libswscale/swscale_internal.h	Mon Dec 21 02:34:45 2009	(r30096)
@@ -279,6 +279,8 @@ typedef struct SwsContext {
     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)
 

Modified: trunk/libswscale/swscale_template.c
==============================================================================
--- trunk/libswscale/swscale_template.c	Mon Dec 21 02:30:55 2009	(r30095)
+++ trunk/libswscale/swscale_template.c	Mon Dec 21 02:34:45 2009	(r30096)
@@ -2438,9 +2438,6 @@ inline static void RENAME(hcscale)(SwsCo
     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 @@ static int RENAME(swScale)(SwsContext *c
             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 @@ static void RENAME(sws_init_swScale)(Sws
             c->chrConvertRange = RENAME(chrRangeToJpeg);
         }
     }
+
+    if (!(isGray(srcFormat) || isGray(c->dstFormat) ||
+          srcFormat == PIX_FMT_MONOBLACK || srcFormat == PIX_FMT_MONOWHITE))
+        c->needs_hcscale = 1;
 }



More information about the ffmpeg-cvslog mailing list