swscale: add full bgra64 support

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
pull/64/head
Michael Niedermayer 11 years ago
parent cc8b45c0ce
commit 37f69cd93e
  1. 25
      libswscale/input.c
  2. 68
      libswscale/output.c
  3. 4
      libswscale/utils.c
  4. 4
      libswscale/version.h
  5. 2
      tests/ref/fate/filter-pixdesc
  6. 4
      tests/ref/fate/filter-pixfmts-copy
  7. 4
      tests/ref/fate/filter-pixfmts-crop
  8. 4
      tests/ref/fate/filter-pixfmts-field
  9. 4
      tests/ref/fate/filter-pixfmts-fieldorder
  10. 4
      tests/ref/fate/filter-pixfmts-hflip
  11. 4
      tests/ref/fate/filter-pixfmts-il
  12. 4
      tests/ref/fate/filter-pixfmts-null
  13. 4
      tests/ref/fate/filter-pixfmts-scale
  14. 4
      tests/ref/fate/filter-pixfmts-vflip

@ -37,8 +37,8 @@
#define input_pixel(pos) (isBE(origin) ? AV_RB16(pos) : AV_RL16(pos))
#define r ((origin == AV_PIX_FMT_BGR48BE || origin == AV_PIX_FMT_BGR48LE) ? b_r : r_b)
#define b ((origin == AV_PIX_FMT_BGR48BE || origin == AV_PIX_FMT_BGR48LE) ? r_b : b_r)
#define r ((origin == AV_PIX_FMT_BGR48BE || origin == AV_PIX_FMT_BGR48LE || origin == AV_PIX_FMT_BGRA64BE || origin == AV_PIX_FMT_BGRA64LE) ? b_r : r_b)
#define b ((origin == AV_PIX_FMT_BGR48BE || origin == AV_PIX_FMT_BGR48LE || origin == AV_PIX_FMT_BGRA64BE || origin == AV_PIX_FMT_BGRA64LE) ? r_b : b_r)
static av_always_inline void
rgb64ToY_c_template(uint16_t *dst, const uint16_t *src, int width,
@ -124,6 +124,8 @@ static void pattern ## 64 ## BE_LE ## ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV
rgb64funcs(rgb, LE, AV_PIX_FMT_RGBA64LE)
rgb64funcs(rgb, BE, AV_PIX_FMT_RGBA64BE)
rgb64funcs(bgr, LE, AV_PIX_FMT_BGRA64LE)
rgb64funcs(bgr, BE, AV_PIX_FMT_BGRA64BE)
static av_always_inline void rgb48ToY_c_template(uint16_t *dst,
const uint16_t *src, int width,
@ -934,6 +936,12 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
case AV_PIX_FMT_RGBA64LE:
c->chrToYV12 = rgb64LEToUV_half_c;
break;
case AV_PIX_FMT_BGRA64BE:
c->chrToYV12 = bgr64BEToUV_half_c;
break;
case AV_PIX_FMT_BGRA64LE:
c->chrToYV12 = bgr64LEToUV_half_c;
break;
case AV_PIX_FMT_RGB48BE:
c->chrToYV12 = rgb48BEToUV_half_c;
break;
@ -1013,6 +1021,12 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
case AV_PIX_FMT_RGBA64LE:
c->chrToYV12 = rgb64LEToUV_c;
break;
case AV_PIX_FMT_BGRA64BE:
c->chrToYV12 = bgr64BEToUV_c;
break;
case AV_PIX_FMT_BGRA64LE:
c->chrToYV12 = bgr64LEToUV_c;
break;
case AV_PIX_FMT_RGB48BE:
c->chrToYV12 = rgb48BEToUV_c;
break;
@ -1279,6 +1293,11 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
case AV_PIX_FMT_RGBA64LE:
c->lumToYV12 = rgb64LEToY_c;
break;
case AV_PIX_FMT_BGRA64BE:
c->lumToYV12 = bgr64BEToY_c;
break;
case AV_PIX_FMT_BGRA64LE:
c->lumToYV12 = bgr64LEToY_c;
}
if (c->alpPixBuf) {
if (is16BPS(srcFormat) || isNBPS(srcFormat)) {
@ -1286,6 +1305,8 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
c->alpToYV12 = bswap16Y_c;
}
switch (srcFormat) {
case AV_PIX_FMT_BGRA64LE:
case AV_PIX_FMT_BGRA64BE:
case AV_PIX_FMT_RGBA64LE:
case AV_PIX_FMT_RGBA64BE: c->alpToYV12 = rgba64ToA_c; break;
case AV_PIX_FMT_BGRA:

@ -663,8 +663,8 @@ yuv2422_1_c_template(SwsContext *c, const int16_t *buf0,
YUV2PACKEDWRAPPER(yuv2, 422, yuyv422, AV_PIX_FMT_YUYV422)
YUV2PACKEDWRAPPER(yuv2, 422, uyvy422, AV_PIX_FMT_UYVY422)
#define R_B ((target == AV_PIX_FMT_RGB48LE || target == AV_PIX_FMT_RGB48BE) ? R : B)
#define B_R ((target == AV_PIX_FMT_RGB48LE || target == AV_PIX_FMT_RGB48BE) ? B : R)
#define R_B ((target == AV_PIX_FMT_RGB48LE || target == AV_PIX_FMT_RGB48BE || target == AV_PIX_FMT_RGBA64LE || target == AV_PIX_FMT_RGBA64BE) ? R : B)
#define B_R ((target == AV_PIX_FMT_RGB48LE || target == AV_PIX_FMT_RGB48BE || target == AV_PIX_FMT_RGBA64LE || target == AV_PIX_FMT_RGBA64BE) ? B : R)
#define output_pixel(pos, val) \
if (isBE(target)) { \
AV_WB16(pos, val); \
@ -735,13 +735,13 @@ yuv2rgba64_X_c_template(SwsContext *c, const int16_t *lumFilter,
B = U * c->yuv2rgb_u2b_coeff;
// 8bit: 30 - 22 = 8bit, 16bit: 30bit - 14 = 16bit
output_pixel(&dest[0], av_clip_uintp2(B_R + Y1, 30) >> 14);
output_pixel(&dest[0], av_clip_uintp2(R_B + Y1, 30) >> 14);
output_pixel(&dest[1], av_clip_uintp2( G + Y1, 30) >> 14);
output_pixel(&dest[2], av_clip_uintp2(R_B + Y1, 30) >> 14);
output_pixel(&dest[2], av_clip_uintp2(B_R + Y1, 30) >> 14);
output_pixel(&dest[3], av_clip_uintp2(A1 , 30) >> 14);
output_pixel(&dest[4], av_clip_uintp2(B_R + Y2, 30) >> 14);
output_pixel(&dest[4], av_clip_uintp2(R_B + Y2, 30) >> 14);
output_pixel(&dest[5], av_clip_uintp2( G + Y2, 30) >> 14);
output_pixel(&dest[6], av_clip_uintp2(R_B + Y2, 30) >> 14);
output_pixel(&dest[6], av_clip_uintp2(B_R + Y2, 30) >> 14);
output_pixel(&dest[7], av_clip_uintp2(A2 , 30) >> 14);
dest += 8;
}
@ -790,13 +790,13 @@ yuv2rgba64_2_c_template(SwsContext *c, const int32_t *buf[2],
A2 += 1 << 13;
}
output_pixel(&dest[0], av_clip_uintp2(B_R + Y1, 30) >> 14);
output_pixel(&dest[0], av_clip_uintp2(R_B + Y1, 30) >> 14);
output_pixel(&dest[1], av_clip_uintp2( G + Y1, 30) >> 14);
output_pixel(&dest[2], av_clip_uintp2(R_B + Y1, 30) >> 14);
output_pixel(&dest[2], av_clip_uintp2(B_R + Y1, 30) >> 14);
output_pixel(&dest[3], av_clip_uintp2(A1 , 30) >> 14);
output_pixel(&dest[4], av_clip_uintp2(B_R + Y2, 30) >> 14);
output_pixel(&dest[4], av_clip_uintp2(R_B + Y2, 30) >> 14);
output_pixel(&dest[5], av_clip_uintp2( G + Y2, 30) >> 14);
output_pixel(&dest[6], av_clip_uintp2(R_B + Y2, 30) >> 14);
output_pixel(&dest[6], av_clip_uintp2(B_R + Y2, 30) >> 14);
output_pixel(&dest[7], av_clip_uintp2(A2 , 30) >> 14);
dest += 8;
}
@ -839,13 +839,13 @@ yuv2rgba64_1_c_template(SwsContext *c, const int32_t *buf0,
G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
B = U * c->yuv2rgb_u2b_coeff;
output_pixel(&dest[0], av_clip_uintp2(B_R + Y1, 30) >> 14);
output_pixel(&dest[0], av_clip_uintp2(R_B + Y1, 30) >> 14);
output_pixel(&dest[1], av_clip_uintp2( G + Y1, 30) >> 14);
output_pixel(&dest[2], av_clip_uintp2(R_B + Y1, 30) >> 14);
output_pixel(&dest[2], av_clip_uintp2(B_R + Y1, 30) >> 14);
output_pixel(&dest[3], av_clip_uintp2(A1 , 30) >> 14);
output_pixel(&dest[4], av_clip_uintp2(B_R + Y2, 30) >> 14);
output_pixel(&dest[4], av_clip_uintp2(R_B + Y2, 30) >> 14);
output_pixel(&dest[5], av_clip_uintp2( G + Y2, 30) >> 14);
output_pixel(&dest[6], av_clip_uintp2(R_B + Y2, 30) >> 14);
output_pixel(&dest[6], av_clip_uintp2(B_R + Y2, 30) >> 14);
output_pixel(&dest[7], av_clip_uintp2(A2 , 30) >> 14);
dest += 8;
}
@ -878,13 +878,13 @@ yuv2rgba64_1_c_template(SwsContext *c, const int32_t *buf0,
G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
B = U * c->yuv2rgb_u2b_coeff;
output_pixel(&dest[0], av_clip_uintp2(B_R + Y1, 30) >> 14);
output_pixel(&dest[0], av_clip_uintp2(R_B + Y1, 30) >> 14);
output_pixel(&dest[1], av_clip_uintp2( G + Y1, 30) >> 14);
output_pixel(&dest[2], av_clip_uintp2(R_B + Y1, 30) >> 14);
output_pixel(&dest[2], av_clip_uintp2(B_R + Y1, 30) >> 14);
output_pixel(&dest[3], av_clip_uintp2(A1 , 30) >> 14);
output_pixel(&dest[4], av_clip_uintp2(B_R + Y2, 30) >> 14);
output_pixel(&dest[4], av_clip_uintp2(R_B + Y2, 30) >> 14);
output_pixel(&dest[5], av_clip_uintp2( G + Y2, 30) >> 14);
output_pixel(&dest[6], av_clip_uintp2(R_B + Y2, 30) >> 14);
output_pixel(&dest[6], av_clip_uintp2(B_R + Y2, 30) >> 14);
output_pixel(&dest[7], av_clip_uintp2(A2 , 30) >> 14);
dest += 8;
}
@ -1117,6 +1117,10 @@ YUV2PACKED16WRAPPER(yuv2, rgba64, rgba64be, AV_PIX_FMT_RGBA64BE, 1)
YUV2PACKED16WRAPPER(yuv2, rgba64, rgba64le, AV_PIX_FMT_RGBA64LE, 1)
YUV2PACKED16WRAPPER(yuv2, rgba64, rgbx64be, AV_PIX_FMT_RGBA64BE, 0)
YUV2PACKED16WRAPPER(yuv2, rgba64, rgbx64le, AV_PIX_FMT_RGBA64LE, 0)
YUV2PACKED16WRAPPER(yuv2, rgba64, bgra64be, AV_PIX_FMT_BGRA64BE, 1)
YUV2PACKED16WRAPPER(yuv2, rgba64, bgra64le, AV_PIX_FMT_BGRA64LE, 1)
YUV2PACKED16WRAPPER(yuv2, rgba64, bgrx64be, AV_PIX_FMT_BGRA64BE, 0)
YUV2PACKED16WRAPPER(yuv2, rgba64, bgrx64le, AV_PIX_FMT_BGRA64LE, 0)
/*
* Write out 2 RGB pixels in the target pixel format. This function takes a
@ -2041,6 +2045,34 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
*yuv2packedX = yuv2rgbx64be_X_c;
}
break;
case AV_PIX_FMT_BGRA64LE:
#if CONFIG_SWSCALE_ALPHA
if (c->alpPixBuf) {
*yuv2packed1 = yuv2bgra64le_1_c;
*yuv2packed2 = yuv2bgra64le_2_c;
*yuv2packedX = yuv2bgra64le_X_c;
} else
#endif /* CONFIG_SWSCALE_ALPHA */
{
*yuv2packed1 = yuv2bgrx64le_1_c;
*yuv2packed2 = yuv2bgrx64le_2_c;
*yuv2packedX = yuv2bgrx64le_X_c;
}
break;
case AV_PIX_FMT_BGRA64BE:
#if CONFIG_SWSCALE_ALPHA
if (c->alpPixBuf) {
*yuv2packed1 = yuv2bgra64be_1_c;
*yuv2packed2 = yuv2bgra64be_2_c;
*yuv2packedX = yuv2bgra64be_X_c;
} else
#endif /* CONFIG_SWSCALE_ALPHA */
{
*yuv2packed1 = yuv2bgrx64be_1_c;
*yuv2packed2 = yuv2bgrx64be_2_c;
*yuv2packedX = yuv2bgrx64be_X_c;
}
break;
case AV_PIX_FMT_RGB48LE:
*yuv2packed1 = yuv2rgb48le_1_c;
*yuv2packed2 = yuv2rgb48le_2_c;

@ -165,8 +165,8 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = {
[AV_PIX_FMT_Y400A] = { 1, 0 },
[AV_PIX_FMT_BGR48BE] = { 1, 1 },
[AV_PIX_FMT_BGR48LE] = { 1, 1 },
[AV_PIX_FMT_BGRA64BE] = { 0, 0, 1 },
[AV_PIX_FMT_BGRA64LE] = { 0, 0, 1 },
[AV_PIX_FMT_BGRA64BE] = { 1, 1, 1 },
[AV_PIX_FMT_BGRA64LE] = { 1, 1, 1 },
[AV_PIX_FMT_YUV420P9BE] = { 1, 1 },
[AV_PIX_FMT_YUV420P9LE] = { 1, 1 },
[AV_PIX_FMT_YUV420P10BE] = { 1, 1 },

@ -27,8 +27,8 @@
#include "libavutil/version.h"
#define LIBSWSCALE_VERSION_MAJOR 2
#define LIBSWSCALE_VERSION_MINOR 5
#define LIBSWSCALE_VERSION_MICRO 102
#define LIBSWSCALE_VERSION_MINOR 6
#define LIBSWSCALE_VERSION_MICRO 100
#define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
LIBSWSCALE_VERSION_MINOR, \

@ -15,6 +15,8 @@ bgr565be 13a36d6502be88fc0c2aec05b8d2d501
bgr565le ed027571692aecd522aa65a90cc7e09b
bgr8 71ef789609c746c2e7e4be9dec29062c
bgra 0364b074268682ea46168742a8239f7d
bgra64be f9923238a300b84e69dc980d83306871
bgra64le 0f1b4be0ec298d5ac1be6876862ff243
gbrap 412a2449fdfaeb5ebdf5e4196cc7391a
gbrp 4778f8cc2bdbcd65e272ea1761cdca6d
gbrp10be 0be11fe4b2324054be6f949e81966691

@ -15,8 +15,8 @@ bgr565be 13a36d6502be88fc0c2aec05b8d2d501
bgr565le ed027571692aecd522aa65a90cc7e09b
bgr8 71ef789609c746c2e7e4be9dec29062c
bgra 0364b074268682ea46168742a8239f7d
bgra64be d41d8cd98f00b204e9800998ecf8427e
bgra64le d41d8cd98f00b204e9800998ecf8427e
bgra64be f9923238a300b84e69dc980d83306871
bgra64le 0f1b4be0ec298d5ac1be6876862ff243
gbrap 412a2449fdfaeb5ebdf5e4196cc7391a
gbrp 4778f8cc2bdbcd65e272ea1761cdca6d
gbrp10be 0be11fe4b2324054be6f949e81966691

@ -15,8 +15,8 @@ bgr565be ee9a1debb896d41c53a026f9e6ce006b
bgr565le ab7b6055bc3b6b7edc9a5e4de43ec90d
bgr8 f85ff16e21d922ad6d32648ef3acfbfb
bgra 9f2e37d73ad3b759fc9d6b12ee668c38
bgra64be d41d8cd98f00b204e9800998ecf8427e
bgra64le d41d8cd98f00b204e9800998ecf8427e
bgra64be 2f531afc71f6de3efd9aba9f0f0d5bf4
bgra64le 340a060c3b031c998be480faa3ee1ea3
gbrap 32c0326859b41ae1fee015648162c6a0
gbrp 0f59d3a61d391c3dea6f6e5861e9c2f7
gbrp10be bc12b34950af11e3f1016acbe2d5dec5

@ -15,8 +15,8 @@ bgr565be bf955b9a035af0e613cf1de249f55f9d
bgr565le 6dd85cd5e19266c53a54cbcf06d396a7
bgr8 9669f6974f0fc1c0afa1c7d4df093c0b
bgra f7cabae31dd7465dab2203f45db646f8
bgra64be d41d8cd98f00b204e9800998ecf8427e
bgra64le d41d8cd98f00b204e9800998ecf8427e
bgra64be de8d641a4b551e41bf421eaa686b4440
bgra64le c9910e3fe536904f107bf65bada7423a
gbrap fdb15f25cd6db3d19a7df727e0f4de3a
gbrp 0867ccbcdf50a02871ad7788e3e0931e
gbrp10be c452475d38b13a4707634eff74001215

@ -15,8 +15,8 @@ bgr565be c37ced8fa4951da20831edf9bd46b35c
bgr565le da0ee7f773efa07fdacc62b7deac452b
bgr8 94a043f6d5e01de077a92a9be6f77582
bgra 02db5e046ced11d3f09d901cae205e2f
bgra64be d41d8cd98f00b204e9800998ecf8427e
bgra64le d41d8cd98f00b204e9800998ecf8427e
bgra64be 2cac1095d15c99bcde803c06ada336eb
bgra64le 8b08d4e293c86303245b24881ab3f978
gbrap 5317a66b677c943203b2a5e93607dc68
gbrp b1ffeba90a60e9a23c9f35466c135069
gbrp10be 07b2842fdf9b92f6cd8e8cf3a8abdfac

@ -15,8 +15,8 @@ bgr565be 3b464a00c619410eac7bdea9c96faf60
bgr565le 4b4c708d4ad222f41734dce68e9d48b6
bgr8 ad1db7a17cdfab2ede6f22c2415a3fbf
bgra 85fa06ad9fd156c3179a647a2e741b60
bgra64be d41d8cd98f00b204e9800998ecf8427e
bgra64le d41d8cd98f00b204e9800998ecf8427e
bgra64be 0547b0113c2a2039d4839438504ff553
bgra64le f0c7a3bdee9ed33deb705ad8d76ea77d
gbrap 5fbf0a36ee9486161a862a4b2d6f8242
gbrp 8b00ca96932c9bce5bca01ee621e0957
gbrp10be df96591083deab8382c1907ea1e99e9e

@ -15,8 +15,8 @@ bgr565be 5ff7a76d9f58800e38f21a84d88c7129
bgr565le 485b2b6f589a936d6fb12d0033809dca
bgr8 d7fae34b87a67556c273585d9140ff96
bgra 7b4abc57f0ee99a0226e9bfd5d25cf9e
bgra64be d41d8cd98f00b204e9800998ecf8427e
bgra64le d41d8cd98f00b204e9800998ecf8427e
bgra64be 8cb71765f8067bfe06a5eec14d234808
bgra64le daa5a2bdc6f0c7cf03ae0e78809209df
gbrap 583131faa19f062f6523321da52066de
gbrp a2db88b8efce6681a3c858be2c229a33
gbrp10be 714a32d10c27395406f4e4afb20a2216

@ -15,8 +15,8 @@ bgr565be 13a36d6502be88fc0c2aec05b8d2d501
bgr565le ed027571692aecd522aa65a90cc7e09b
bgr8 71ef789609c746c2e7e4be9dec29062c
bgra 0364b074268682ea46168742a8239f7d
bgra64be d41d8cd98f00b204e9800998ecf8427e
bgra64le d41d8cd98f00b204e9800998ecf8427e
bgra64be f9923238a300b84e69dc980d83306871
bgra64le 0f1b4be0ec298d5ac1be6876862ff243
gbrap 412a2449fdfaeb5ebdf5e4196cc7391a
gbrp 4778f8cc2bdbcd65e272ea1761cdca6d
gbrp10be 0be11fe4b2324054be6f949e81966691

@ -15,8 +15,8 @@ bgr565be fca6f07daf23d9dd84381dd4c9afd959
bgr565le f524e9f16bdd68b247dbcb621e543fc0
bgr8 2a6509639c181fb7829721bdbf78187c
bgra fec5335edde2f1ee1f40d2fe4305855c
bgra64be d41d8cd98f00b204e9800998ecf8427e
bgra64le d41d8cd98f00b204e9800998ecf8427e
bgra64be 512685e00ff5c1b38dc672fb68d2116c
bgra64le 4a2c03afb71865936892ef6e5ee1fa1d
gbrap 76ddf2bedea40c8743f4117b786d4773
gbrp e2704defddf1cb8d75f0c80fec6491d3
gbrp10be 7dce0805f7ead7d480bd83323d76bf9c

@ -15,8 +15,8 @@ bgr565be 7100c2ddfee42e7efafec1ccefecf7c6
bgr565le 9fab295d966386d4ef99d5b43066da47
bgr8 275ce12eeb05de67a6915f67cbb43ce5
bgra d29c35871248c476c366e678db580982
bgra64be d41d8cd98f00b204e9800998ecf8427e
bgra64le d41d8cd98f00b204e9800998ecf8427e
bgra64be b8038291cb44061a65a2bbbeb3846087
bgra64le 0cf6acd27b6024cf584d824159e5c73f
gbrap 29844a8e4334493fdd2d499bcb532535
gbrp d3f2823513bfdac8f714385513cc396b
gbrp10be 49b93ac01777e4bafcb9afd4d9d74533

Loading…
Cancel
Save