diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 54515c8206..b72ed79ae9 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -1158,6 +1158,16 @@ BGR2UV(uint16_t, bgr15ToUV, 0, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, RU<<10, GU<< BGR2UV(uint16_t, rgb16ToUV, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, RU , GU<<5, BU<<11, RV , GV<<5, BV<<11, RGB2YUV_SHIFT+8) BGR2UV(uint16_t, rgb15ToUV, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, RU , GU<<5, BU<<10, RV , GV<<5, BV<<10, RGB2YUV_SHIFT+7) +static inline void palToA(uint8_t *dst, const uint8_t *src, long width, uint32_t *pal) +{ + int i; + for (i=0; i> 24; + } +} + static inline void palToY(uint8_t *dst, const uint8_t *src, long width, uint32_t *pal) { int i; @@ -2002,6 +2012,7 @@ int sws_scale(SwsContext *c, const uint8_t* const src[], const int srcStride[], int p, r, g, b, y, u, v, a = 0xff; if(c->srcFormat == PIX_FMT_PAL8) { p=((const uint32_t*)(src[1]))[i]; + a= (p>>24)&0xFF; r= (p>>16)&0xFF; g= (p>> 8)&0xFF; b= p &0xFF; diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 6eac7e97db..de7859e3c0 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -459,6 +459,7 @@ const char *sws_format_name(enum PixelFormat format); || (x)==PIX_FMT_BGR32_1 \ || (x)==PIX_FMT_RGB32 \ || (x)==PIX_FMT_RGB32_1 \ + || (x)==PIX_FMT_PAL8 \ || (x)==PIX_FMT_GRAY8A \ || (x)==PIX_FMT_YUVA420P \ ) diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index c269281a14..864bafc85c 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -3068,6 +3068,7 @@ static void RENAME(sws_init_swScale)(SwsContext *c) case PIX_FMT_BGR32 : case PIX_FMT_BGR32_1: c->alpToYV12 = abgrToA; break; case PIX_FMT_GRAY8A : c->alpToYV12 = RENAME(yuy2ToY); break; + case PIX_FMT_PAL8 : c->alpToYV12 = palToA; break; } }