diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2016-10-14 17:25:55 -0400 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2016-10-18 12:58:14 +0200 |
commit | be9dba5c8abc6ecf0b8ee4ccb11c7850327fcf8d (patch) | |
tree | bec3600b29caed9f329853d68cc7d4a4bb07fd64 | |
parent | d32571626a2c36c026b7fa13d19ac4ed1aad75c9 (diff) | |
download | ffmpeg-be9dba5c8abc6ecf0b8ee4ccb11c7850327fcf8d.tar.gz |
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>
-rw-r--r-- | libswscale/input.c | 37 | ||||
-rw-r--r-- | tests/ref/fate/filter-pixfmts-scale | 4 |
2 files changed, 39 insertions, 2 deletions
diff --git a/libswscale/input.c b/libswscale/input.c index 304466bd99..9f2ef72894 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -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; diff --git a/tests/ref/fate/filter-pixfmts-scale b/tests/ref/fate/filter-pixfmts-scale index 142b6371aa..97f29bed69 100644 --- a/tests/ref/fate/filter-pixfmts-scale +++ b/tests/ref/fate/filter-pixfmts-scale @@ -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 |