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

sdrik subversion
Tue Apr 14 16:11:57 CEST 2009


Author: sdrik
Date: Tue Apr 14 16:11:57 2009
New Revision: 29179

Log:
Do not use abgrToA for both luma and alpha channel in hyscale.
This fixes RGB32 (et al.) scaling.

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

Modified: trunk/libswscale/swscale_internal.h
==============================================================================
--- trunk/libswscale/swscale_internal.h	Mon Apr 13 23:43:57 2009	(r29178)
+++ trunk/libswscale/swscale_internal.h	Tue Apr 14 16:11:57 2009	(r29179)
@@ -250,6 +250,8 @@ typedef struct SwsContext{
 
     void (*hyscale_internal)(uint8_t *dst, const uint8_t *src,
                              long width, uint32_t *pal);
+    void (*hascale_internal)(uint8_t *dst, const uint8_t *src,
+                             long width, uint32_t *pal);
     void (*hcscale_internal)(uint8_t *dstU, uint8_t *dstV,
                              const uint8_t *src1, const uint8_t *src2,
                              long width, uint32_t *pal);

Modified: trunk/libswscale/swscale_template.c
==============================================================================
--- trunk/libswscale/swscale_template.c	Mon Apr 13 23:43:57 2009	(r29178)
+++ trunk/libswscale/swscale_template.c	Tue Apr 14 16:11:57 2009	(r29179)
@@ -2272,6 +2272,7 @@ static inline void RENAME(hyscale)(SwsCo
     int16_t *mmx2Filter = c->lumMmx2Filter;
     int canMMX2BeUsed = c->canMMX2BeUsed;
     void *funnyYCode = c->funnyYCode;
+    void (*internal_func)(uint8_t *, const uint8_t *, long, uint32_t *) = isAlpha ? c->hascale_internal : c->hyscale_internal;
 
     if (isAlpha) {
         if (srcFormat == PIX_FMT_RGB32   || srcFormat == PIX_FMT_BGR32  )
@@ -2281,8 +2282,8 @@ static inline void RENAME(hyscale)(SwsCo
             src += ALT32_CORR;
     }
 
-    if (c->hyscale_internal) {
-        c->hyscale_internal(formatConvBuffer, src, srcW, pal);
+    if (internal_func) {
+        internal_func(formatConvBuffer, src, srcW, pal);
         src= formatConvBuffer;
     }
 
@@ -3114,6 +3115,7 @@ static void RENAME(sws_init_swScale)(Sws
     }
 
     c->hyscale_internal = NULL;
+    c->hascale_internal = NULL;
     switch (srcFormat) {
     case PIX_FMT_YUYV422  :
     case PIX_FMT_GRAY16BE : c->hyscale_internal = RENAME(yuy2ToY); break;
@@ -3132,20 +3134,17 @@ static void RENAME(sws_init_swScale)(Sws
     case PIX_FMT_RGB4_BYTE: c->hyscale_internal = RENAME(palToY); break;
     case PIX_FMT_MONOBLACK: c->hyscale_internal = RENAME(monoblack2Y); break;
     case PIX_FMT_MONOWHITE: c->hyscale_internal = RENAME(monowhite2Y); break;
+    case PIX_FMT_RGB32  :
+    case PIX_FMT_RGB32_1: c->hyscale_internal = RENAME(bgr32ToY); break;
+    case PIX_FMT_BGR32  :
+    case PIX_FMT_BGR32_1: c->hyscale_internal = RENAME(rgb32ToY); break;
     }
     if (c->alpPixBuf) {
         switch (srcFormat) {
         case PIX_FMT_RGB32  :
         case PIX_FMT_RGB32_1:
         case PIX_FMT_BGR32  :
-        case PIX_FMT_BGR32_1: c->hyscale_internal = RENAME(abgrToA); break;
-        }
-    } else {
-        switch (srcFormat) {
-        case PIX_FMT_RGB32  :
-        case PIX_FMT_RGB32_1: c->hyscale_internal = RENAME(bgr32ToY); break;
-        case PIX_FMT_BGR32  :
-        case PIX_FMT_BGR32_1: c->hyscale_internal = RENAME(rgb32ToY); break;
+        case PIX_FMT_BGR32_1: c->hascale_internal = RENAME(abgrToA); break;
         }
     }
 }



More information about the ffmpeg-cvslog mailing list