changeset 29139:cd5d58b02153

Do not use abgrToA for both luma and alpha channel in hyscale. This fixes RGB32 (et al.) scaling.
author sdrik
date Tue, 14 Apr 2009 14:11:57 +0000
parents 8aeebf532e48
children b322381cf5e1
files libswscale/swscale_internal.h libswscale/swscale_template.c
diffstat 2 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libswscale/swscale_internal.h	Mon Apr 13 21:43:57 2009 +0000
+++ b/libswscale/swscale_internal.h	Tue Apr 14 14:11:57 2009 +0000
@@ -250,6 +250,8 @@
 
     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);
--- a/libswscale/swscale_template.c	Mon Apr 13 21:43:57 2009 +0000
+++ b/libswscale/swscale_template.c	Tue Apr 14 14:11:57 2009 +0000
@@ -2272,6 +2272,7 @@
     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 @@
             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 @@
     }
 
     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 @@
     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;
         }
     }
 }