diff options
author | Cédric Schieli <cschieli@gmail.com> | 2009-04-14 14:11:57 +0000 |
---|---|---|
committer | Cédric Schieli <cschieli@gmail.com> | 2009-04-14 14:11:57 +0000 |
commit | 39e5f87b1accebee2df27ef2bf5f4f77a727dd5d (patch) | |
tree | 2df01960e17bb72ec5b4737a532cac69ca35d07d | |
parent | 373afbaf76eb315729b5b86fa4f3c70b10105c64 (diff) | |
download | ffmpeg-39e5f87b1accebee2df27ef2bf5f4f77a727dd5d.tar.gz |
Do not use abgrToA for both luma and alpha channel in hyscale.
This fixes RGB32 (et al.) scaling.
Originally committed as revision 29179 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
-rw-r--r-- | libswscale/swscale_internal.h | 2 | ||||
-rw-r--r-- | libswscale/swscale_template.c | 19 |
2 files changed, 11 insertions, 10 deletions
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 4b16381001..564d060a3d 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -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); diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index 49ce0d32d5..a5bd2f5e46 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -2272,6 +2272,7 @@ static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth, 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)(SwsContext *c, uint16_t *dst, long dstWidth, 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)(SwsContext *c) } 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)(SwsContext *c) 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; } } } |