1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

swscale: Properly load alpha for planar rgb

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:
Michael Niedermayer 2016-10-14 17:25:55 -04:00 committed by Luca Barbato
parent d32571626a
commit be9dba5c8a
2 changed files with 39 additions and 2 deletions

View File

@ -671,6 +671,19 @@ static av_always_inline void planar_rgb16_to_y(uint8_t *_dst, const uint8_t *_sr
}
}
static av_always_inline void planar_rgb16_to_a(uint8_t *_dst, const uint8_t *_src[4],
int width, int bpc, int is_be)
{
int i;
const uint16_t **src = (const uint16_t **)_src;
uint16_t *dst = (uint16_t *)_dst;
int shift = bpc < 15 ? bpc : 14;
for (i = 0; i < width; i++) {
dst[i] = rdpx(src[3] + i) << (14 - shift);
}
}
static void planar_rgb9le_to_y(uint8_t *dst, const uint8_t *src[4], int w)
{
planar_rgb16_to_y(dst, src, w, 9, 0);
@ -696,21 +709,41 @@ static void planar_rgb12le_to_y(uint8_t *dst, const uint8_t *src[4], int w)
planar_rgb16_to_y(dst, src, w, 12, 0);
}
static void planar_rgb12le_to_a(uint8_t *dst, const uint8_t *src[4], int w)
{
planar_rgb16_to_a(dst, src, w, 12, 0);
}
static void planar_rgb12be_to_y(uint8_t *dst, const uint8_t *src[4], int w)
{
planar_rgb16_to_y(dst, src, w, 12, 1);
}
static void planar_rgb12be_to_a(uint8_t *dst, const uint8_t *src[4], int w)
{
planar_rgb16_to_a(dst, src, w, 12, 1);
}
static void planar_rgb16le_to_y(uint8_t *dst, const uint8_t *src[4], int w)
{
planar_rgb16_to_y(dst, src, w, 16, 0);
}
static void planar_rgb16le_to_a(uint8_t *dst, const uint8_t *src[4], int w)
{
planar_rgb16_to_a(dst, src, w, 16, 0);
}
static void planar_rgb16be_to_y(uint8_t *dst, const uint8_t *src[4], int w)
{
planar_rgb16_to_y(dst, src, w, 16, 1);
}
static void planar_rgb16be_to_a(uint8_t *dst, const uint8_t *src[4], int w)
{
planar_rgb16_to_a(dst, src, w, 16, 1);
}
static av_always_inline void planar_rgb16_to_uv(uint8_t *_dstU, uint8_t *_dstV,
const uint8_t *_src[4], int width,
int bpc, int is_be)
@ -1044,10 +1077,12 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
c->readLumPlanar = planar_rgb10le_to_y;
break;
case AV_PIX_FMT_GBRAP12LE:
c->readAlpPlanar = planar_rgb12le_to_a;
case AV_PIX_FMT_GBRP12LE:
c->readLumPlanar = planar_rgb12le_to_y;
break;
case AV_PIX_FMT_GBRAP16LE:
c->readAlpPlanar = planar_rgb16le_to_a;
case AV_PIX_FMT_GBRP16LE:
c->readLumPlanar = planar_rgb16le_to_y;
break;
@ -1058,10 +1093,12 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
c->readLumPlanar = planar_rgb10be_to_y;
break;
case AV_PIX_FMT_GBRAP12BE:
c->readAlpPlanar = planar_rgb12be_to_a;
case AV_PIX_FMT_GBRP12BE:
c->readLumPlanar = planar_rgb12be_to_y;
break;
case AV_PIX_FMT_GBRAP16BE:
c->readAlpPlanar = planar_rgb16be_to_a;
case AV_PIX_FMT_GBRP16BE:
c->readLumPlanar = planar_rgb16be_to_y;
break;

View File

@ -13,8 +13,8 @@ bgr565le 34438643c183ff1748cf7d71453f981c
bgr8 e731ba3dbec294e1daa7313e08e88034
bgra 6e1f417ae41636f631de1cfe39ce1778
gbrap eefdbfd1426765ce5e9790022533db0d
gbrap12be c676f72b634c77b08a00ab12dc21c5dc
gbrap12le 90ca5271960dc1ebd6ebe14189223e36
gbrap12be af4acb3ad0a6630f6ec4534e4d2e869a
gbrap12le fb66da21243e922b4e12ca05d8242c42
gbrp 5d14768d2ab6cbf3879966b5d5c6befb
gbrp10be 4192c246f4a52ec7a37919665190cce9
gbrp10le 170189b2c2dd46f31165d8fa6cadef0a