mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
swscale: add gbr(a)p16 output support
This commit is contained in:
parent
fbdf8f176e
commit
6427c9ffee
@ -2021,6 +2021,81 @@ yuv2gbrp_full_X_c(SwsContext *c, const int16_t *lumFilter,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
yuv2gbrp16_full_X_c(SwsContext *c, const int16_t *lumFilter,
|
||||
const int16_t **lumSrcx, int lumFilterSize,
|
||||
const int16_t *chrFilter, const int16_t **chrUSrcx,
|
||||
const int16_t **chrVSrcx, int chrFilterSize,
|
||||
const int16_t **alpSrc, uint8_t **dest,
|
||||
int dstW, int y)
|
||||
{
|
||||
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->dstFormat);
|
||||
int i;
|
||||
int hasAlpha = (desc->flags & AV_PIX_FMT_FLAG_ALPHA) && alpSrc;
|
||||
uint16_t **dest16 = (uint16_t**)dest;
|
||||
const int32_t **lumSrc = (const int32_t**)lumSrcx;
|
||||
const int32_t **chrUSrc = (const int32_t**)chrUSrcx;
|
||||
const int32_t **chrVSrc = (const int32_t**)chrVSrcx;
|
||||
int A = 0; // init to silence warning
|
||||
|
||||
for (i = 0; i < dstW; i++) {
|
||||
int j;
|
||||
int Y = -0x40000000;
|
||||
int U = -(128 << 23);
|
||||
int V = -(128 << 23);
|
||||
int R, G, B;
|
||||
|
||||
for (j = 0; j < lumFilterSize; j++)
|
||||
Y += lumSrc[j][i] * (unsigned)lumFilter[j];
|
||||
|
||||
for (j = 0; j < chrFilterSize; j++) {
|
||||
U += chrUSrc[j][i] * (unsigned)chrFilter[j];
|
||||
V += chrVSrc[j][i] * (unsigned)chrFilter[j];
|
||||
}
|
||||
|
||||
Y >>= 14;
|
||||
Y += 0x10000;
|
||||
U >>= 14;
|
||||
V >>= 14;
|
||||
|
||||
if (hasAlpha) {
|
||||
A = 1 << 18;
|
||||
|
||||
for (j = 0; j < lumFilterSize; j++)
|
||||
A += alpSrc[j][i] * lumFilter[j];
|
||||
|
||||
if (A & 0xF8000000)
|
||||
A = av_clip_uintp2(A, 27);
|
||||
}
|
||||
|
||||
Y -= c->yuv2rgb_y_offset;
|
||||
Y *= c->yuv2rgb_y_coeff;
|
||||
Y += 1 << 13;
|
||||
R = V * c->yuv2rgb_v2r_coeff;
|
||||
G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
|
||||
B = U * c->yuv2rgb_u2b_coeff;
|
||||
|
||||
R = av_clip_uintp2(Y + R, 30);
|
||||
G = av_clip_uintp2(Y + G, 30);
|
||||
B = av_clip_uintp2(Y + B, 30);
|
||||
|
||||
dest16[0][i] = G >> 14;
|
||||
dest16[1][i] = B >> 14;
|
||||
dest16[2][i] = R >> 14;
|
||||
if (hasAlpha)
|
||||
dest16[3][i] = A >> 11;
|
||||
}
|
||||
if ((!isBE(c->dstFormat)) != (!HAVE_BIGENDIAN)) {
|
||||
for (i = 0; i < dstW; i++) {
|
||||
dest16[0][i] = av_bswap16(dest16[0][i]);
|
||||
dest16[1][i] = av_bswap16(dest16[1][i]);
|
||||
dest16[2][i] = av_bswap16(dest16[2][i]);
|
||||
if (hasAlpha)
|
||||
dest16[3][i] = av_bswap16(dest16[3][i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
yuv2ya8_1_c(SwsContext *c, const int16_t *buf0,
|
||||
const int16_t *ubuf[2], const int16_t *vbuf[2],
|
||||
@ -2402,8 +2477,6 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
|
||||
case AV_PIX_FMT_GBRP12LE:
|
||||
case AV_PIX_FMT_GBRP14BE:
|
||||
case AV_PIX_FMT_GBRP14LE:
|
||||
case AV_PIX_FMT_GBRP16BE:
|
||||
case AV_PIX_FMT_GBRP16LE:
|
||||
case AV_PIX_FMT_GBRAP:
|
||||
case AV_PIX_FMT_GBRAP10BE:
|
||||
case AV_PIX_FMT_GBRAP10LE:
|
||||
@ -2411,6 +2484,12 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
|
||||
case AV_PIX_FMT_GBRAP12LE:
|
||||
*yuv2anyX = yuv2gbrp_full_X_c;
|
||||
break;
|
||||
case AV_PIX_FMT_GBRP16BE:
|
||||
case AV_PIX_FMT_GBRP16LE:
|
||||
case AV_PIX_FMT_GBRAP16BE:
|
||||
case AV_PIX_FMT_GBRAP16LE:
|
||||
*yuv2anyX = yuv2gbrp16_full_X_c;
|
||||
break;
|
||||
}
|
||||
if (!*yuv2packedX && !*yuv2anyX)
|
||||
goto YUV_PACKED;
|
||||
|
@ -230,11 +230,11 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = {
|
||||
[AV_PIX_FMT_GBRAP12BE] = { 1, 1 },
|
||||
[AV_PIX_FMT_GBRP14LE] = { 1, 1 },
|
||||
[AV_PIX_FMT_GBRP14BE] = { 1, 1 },
|
||||
[AV_PIX_FMT_GBRP16LE] = { 1, 0 },
|
||||
[AV_PIX_FMT_GBRP16BE] = { 1, 0 },
|
||||
[AV_PIX_FMT_GBRP16LE] = { 1, 1 },
|
||||
[AV_PIX_FMT_GBRP16BE] = { 1, 1 },
|
||||
[AV_PIX_FMT_GBRAP] = { 1, 1 },
|
||||
[AV_PIX_FMT_GBRAP16LE] = { 1, 0 },
|
||||
[AV_PIX_FMT_GBRAP16BE] = { 1, 0 },
|
||||
[AV_PIX_FMT_GBRAP16LE] = { 1, 1 },
|
||||
[AV_PIX_FMT_GBRAP16BE] = { 1, 1 },
|
||||
[AV_PIX_FMT_BAYER_BGGR8] = { 1, 0 },
|
||||
[AV_PIX_FMT_BAYER_RGGB8] = { 1, 0 },
|
||||
[AV_PIX_FMT_BAYER_GBRG8] = { 1, 0 },
|
||||
|
1
tests/ref/fate/filter-pixdesc-gbrap16be
Normal file
1
tests/ref/fate/filter-pixdesc-gbrap16be
Normal file
@ -0,0 +1 @@
|
||||
pixdesc-gbrap16be 7874e7fd35419ef212a450ea637ffb24
|
1
tests/ref/fate/filter-pixdesc-gbrap16le
Normal file
1
tests/ref/fate/filter-pixdesc-gbrap16le
Normal file
@ -0,0 +1 @@
|
||||
pixdesc-gbrap16le a83c7d0bbbfb1c1a8208f75680358387
|
1
tests/ref/fate/filter-pixdesc-gbrp16be
Normal file
1
tests/ref/fate/filter-pixdesc-gbrp16be
Normal file
@ -0,0 +1 @@
|
||||
pixdesc-gbrp16be daccdd0a7d41d566ab40c4d00e552cbe
|
1
tests/ref/fate/filter-pixdesc-gbrp16le
Normal file
1
tests/ref/fate/filter-pixdesc-gbrp16le
Normal file
@ -0,0 +1 @@
|
||||
pixdesc-gbrp16le 04f40ad1a27963be3125624446ed195e
|
@ -23,6 +23,8 @@ gbrap10be edcffb185e44b6dae5c2ead5505b7125
|
||||
gbrap10le 2a7392e14b21b1f9457526a071236a6d
|
||||
gbrap12be 0c4c1f8af361571265ca259d5f70f026
|
||||
gbrap12le 5f1d8c663d4c28863e687192433b34a4
|
||||
gbrap16be e4edca4361d643794034e5aa9ef290b1
|
||||
gbrap16le 9a95b389d2bf556179e8f4b27fb550ab
|
||||
gbrp 5fbc319e30110d19d539f5b274eddb6d
|
||||
gbrp10be 703a17591a2a5c236675c5101c349bcc
|
||||
gbrp10le ee014153f55c011918df5b2394815780
|
||||
@ -30,6 +32,8 @@ gbrp12be 527d337eb5813ebba7cf969ee660d423
|
||||
gbrp12le fd192920b171a0cf88d61e8310e95d81
|
||||
gbrp14be 46d502db6dc5eb7e9da3c60016b2df91
|
||||
gbrp14le 1607f5c8f13360b53b8186f523996b1b
|
||||
gbrp16be 7b6764a504c853b09f5c7d0b2223c5a4
|
||||
gbrp16le fb9323a5bd060282bec7bfd7d38dc230
|
||||
gbrp9be a4dc6f6f9bb051de2dc348b592ad4282
|
||||
gbrp9le 699da3a3b324f3fd001a56aee9683384
|
||||
gray 188590b1231afd231ea910815aef2b25
|
||||
|
@ -23,6 +23,8 @@ gbrap10be 1880c4856d9cc6492b8b859f2711aaf1
|
||||
gbrap10le c2b6e35f8b7ca363a7ec021ccdf31d1f
|
||||
gbrap12be c9769d18733cdc2664d8b9af09a03f6d
|
||||
gbrap12le 3f80453c1ac6c5d1b2febf3ef141b476
|
||||
gbrap16be 21c98d0d7e7de2a93f9f095e5bb5c227
|
||||
gbrap16le ea9a96870c1b742dd9f065c5db568184
|
||||
gbrp ec671f573c2105072ab68a1933c58fee
|
||||
gbrp10be 6f0130a41f01e58593d3840446dd94b7
|
||||
gbrp10le 9c152b7dfb7ad7bc477518d97316d04f
|
||||
@ -30,6 +32,8 @@ gbrp12be 561516202a6e37dd19543f9bb3af339f
|
||||
gbrp12le 3e7f87d834748844ab326e22eb2b7487
|
||||
gbrp14be 057232bca98c472a003cc46b3fd939e4
|
||||
gbrp14le d4764dba3c3efd1263c2c8e0f5ac9f6a
|
||||
gbrp16be 59e4c27ee33520e23dbceafbec27aa9b
|
||||
gbrp16le 0768a2462783829f63ed0bfd53d01222
|
||||
gbrp9be 4af43999e5e9742992b6550ea5ad9b23
|
||||
gbrp9le b4cbfa7878706a14295f09212e41f7fe
|
||||
gray 0d70b54b4b888ec4dbd89713620ac1ee
|
||||
|
@ -23,6 +23,8 @@ gbrap10be 29d46cbf021b233f5f1886e5d5fe21b4
|
||||
gbrap10le 4017c5d8c124438eb9aefa107db58d3b
|
||||
gbrap12be e7f471132628b1c034199cc109b84bc2
|
||||
gbrap12le 886207e5aa379a0312485b94e5fd5edd
|
||||
gbrap16be eaa0158f27ebc40cde9e3d6eef1e2ba1
|
||||
gbrap16le 6cf68992d4fcac2aa025d1014b669d24
|
||||
gbrp 838025a3062f7f31e99196ce66961ad7
|
||||
gbrp10be f63c2555ea19fc78b00fd5b3e2b48e8c
|
||||
gbrp10le be64c374ab318235d912372e99a0516a
|
||||
@ -30,6 +32,8 @@ gbrp12be ef164a1c062dc3572c61b9ef10897ca1
|
||||
gbrp12le 0527fdb6f75b1cb0d380809eb7a7589a
|
||||
gbrp14be 6aff3ad388e2ed97d59b71a75029746d
|
||||
gbrp14le ed9ccbc7a4f3e269a2ec37d210359fd8
|
||||
gbrp16be 020eff1626415ea726c55b23162ce59a
|
||||
gbrp16le 0ab77b498d4a39905515b6e1f0329ed2
|
||||
gbrp9be 170da3a8644cbea61c3caeadc45354c5
|
||||
gbrp9le da5d80e6f12cabaa7081bb85d3b7fd30
|
||||
gray 57fd8e6e00f6be8752726005974cce1b
|
||||
|
@ -23,6 +23,8 @@ gbrap10be 8b27254a69cd0e25fa55262a743f95e6
|
||||
gbrap10le 52278021718ec370903dccc923dc8bf6
|
||||
gbrap12be 302b353dff696ec9fd0d85a0cc14802b
|
||||
gbrap12le ae2d6db2c9c825f06d92389de21263d2
|
||||
gbrap16be 52c10d8046d123dfc4a478276906467c
|
||||
gbrap16le 2317737b8f5140add27d121de8f5ba95
|
||||
gbrp 506dea2fe492e985a396d1b11ccd8db3
|
||||
gbrp10be 55bbfe2d472780dcbadf3027778caa0e
|
||||
gbrp10le 13a39077ab1b2c3b49afd3e250b84a77
|
||||
@ -30,6 +32,8 @@ gbrp12be f1b59334c687a39ba076fe47e6ee9515
|
||||
gbrp12le e64ab4d290eb10476db165054720173f
|
||||
gbrp14be b3806ade527ef7452c29106054946cd1
|
||||
gbrp14le b01b1a05d8de36f51a133d25102fe1f3
|
||||
gbrp16be f82e4bda468275f51becf70f3880be52
|
||||
gbrp16le c7813a905f94aabb2bcade79c9b7e39e
|
||||
gbrp9be b8d294d4bc81ceef1fb529e917c02e48
|
||||
gbrp9le 0d42cc9e222d806c33172781b45cb3e3
|
||||
gray d96e0f1c73d3f0b9506d691b5cd36c73
|
||||
|
@ -23,6 +23,8 @@ gbrap10be f188dc23756469cbdd172fe97ad58121
|
||||
gbrap10le 262f0501633ea4670020fae8ac6835e2
|
||||
gbrap12be ffe9aa4cbcc42f71757efe18826764ac
|
||||
gbrap12le 88a85c1b3c5e19e299fdd209b73ac1ba
|
||||
gbrap16be 3117e84b258433a7efb9288bbb8815d4
|
||||
gbrap16le 3ad08cf8b49d8eb31a1b356ec4b7b88b
|
||||
gbrp 0ecfeca171ba3a1a2ff4e92f572b71cf
|
||||
gbrp10be 774398c2f81757a536c094f16cfc541a
|
||||
gbrp10le e9a6434d691be541f789f850963da181
|
||||
@ -30,6 +32,8 @@ gbrp12be 13d819d869f8e84aadca57e21883030e
|
||||
gbrp12le 22046339442c155fbb9b02ceff5e1c15
|
||||
gbrp14be 7e1d2f9d9bb7cc90d88540f36998acd6
|
||||
gbrp14le 91bb636f4e1f5d50312b136c185542e9
|
||||
gbrp16be 46cf9473646a4b9dbcb05661ade658ec
|
||||
gbrp16le 6ce6093b24d09c0edcd55b2d6fec89a0
|
||||
gbrp9be 174de037c2a9f2b6fb4d9444ae0ff82f
|
||||
gbrp9le ba7c2631fb2967aa909c66509bd243fe
|
||||
gray 8bd4ece1dbf89b20ee785e0515356e07
|
||||
|
@ -23,6 +23,8 @@ gbrap10be bafa57a2e4331d8a39f6f0087c85d4b1
|
||||
gbrap10le 553a1f439d8184dc400432d3f786fbce
|
||||
gbrap12be 48609d6b61ff6313939fa2d9c3ebb6d9
|
||||
gbrap12le e3b5342c8e47820f2de7e2dd61872312
|
||||
gbrap16be 696c84c8b009c7320cad7f3847bb35da
|
||||
gbrap16le 9bacb81fbbe9cdfd04d71eb55a9719d2
|
||||
gbrp dc06edb62e70024a216c8e303b79b328
|
||||
gbrp10be 321e7f061d8b9b5801221b6cf3c99666
|
||||
gbrp10le 799ed3afca01076439a0b6785b3dc4bb
|
||||
@ -30,6 +32,8 @@ gbrp12be 7ca179ad8f7b018de48a48bdb0776965
|
||||
gbrp12le c69843651e7e60e85c5e8a2fe4ecb290
|
||||
gbrp14be 5dc5e8131c25125347758e03d15b69e6
|
||||
gbrp14le bf3d5dec9b58cecd4ca1c5d3a4d57c31
|
||||
gbrp16be c8c95027703c680ed8f8f91c725db40a
|
||||
gbrp16le c95c9d7c2b19826b73ff1811d9fe6bdb
|
||||
gbrp9be f029d87fa642f4261160471ad27fd53f
|
||||
gbrp9le b310d3cf37f7b41d706155993f8f0584
|
||||
gray 52ae18648161ac43144f5c9cd2127786
|
||||
|
@ -4,10 +4,12 @@ bgr24 fa43e3b2abfde8d9e60e157a9acc553d
|
||||
bgra 4e2e689897ee7a8e42b16234597bab35
|
||||
gbrap 0d1eb2c39e291c53c57302cdc653c2fc
|
||||
gbrap12le 43fec231bd1d3dd957cdd8478cab9259
|
||||
gbrap16le 22ca3644658ae306541116c31e135074
|
||||
gbrp e572d53183f3f2ed3951aa9940d440a1
|
||||
gbrp10le a8fd1ebbc36a477e2b134241fed91687
|
||||
gbrp12le c5a4b89571f7095eb737ad9fd6b1ee08
|
||||
gbrp14le bdfdfd6f36c60497d1cdae791f3cc117
|
||||
gbrp16le df095ef3a20995935cfcaf144afc68b6
|
||||
gbrp9le a8c4e29f4cb627db81ba053e0853e702
|
||||
rgb24 a356171207723a580e7d277078072005
|
||||
rgb48le 5c7dd8575836d18c91e09f1915cf9aa9
|
||||
|
@ -23,6 +23,8 @@ gbrap10be edcffb185e44b6dae5c2ead5505b7125
|
||||
gbrap10le 2a7392e14b21b1f9457526a071236a6d
|
||||
gbrap12be 0c4c1f8af361571265ca259d5f70f026
|
||||
gbrap12le 5f1d8c663d4c28863e687192433b34a4
|
||||
gbrap16be e4edca4361d643794034e5aa9ef290b1
|
||||
gbrap16le 9a95b389d2bf556179e8f4b27fb550ab
|
||||
gbrp 5fbc319e30110d19d539f5b274eddb6d
|
||||
gbrp10be 703a17591a2a5c236675c5101c349bcc
|
||||
gbrp10le ee014153f55c011918df5b2394815780
|
||||
@ -30,6 +32,8 @@ gbrp12be 527d337eb5813ebba7cf969ee660d423
|
||||
gbrp12le fd192920b171a0cf88d61e8310e95d81
|
||||
gbrp14be 46d502db6dc5eb7e9da3c60016b2df91
|
||||
gbrp14le 1607f5c8f13360b53b8186f523996b1b
|
||||
gbrp16be 7b6764a504c853b09f5c7d0b2223c5a4
|
||||
gbrp16le fb9323a5bd060282bec7bfd7d38dc230
|
||||
gbrp9be a4dc6f6f9bb051de2dc348b592ad4282
|
||||
gbrp9le 699da3a3b324f3fd001a56aee9683384
|
||||
gray 188590b1231afd231ea910815aef2b25
|
||||
|
@ -8,10 +8,12 @@ bgra 929aac15e848038e367c250037575f9f
|
||||
gbrap 5f16cccab5a17cb766c882e865995167
|
||||
gbrap10le 454bf36e86ae92ab7853a9508bb75a99
|
||||
gbrap12le e0e43f838cfbe98086042ba54b5f70be
|
||||
gbrap16le 0f4414db67b84a720106d7a3b2435766
|
||||
gbrp 3c94d39256db2409015df913fd330a90
|
||||
gbrp10le 5b356737cd8a396f39bbdadb7cb35e06
|
||||
gbrp12le 91fdad0d1edf7bfa2805e2041e8da3cd
|
||||
gbrp14le deb2c3af6b48faa52f6a1f6590a0cdf7
|
||||
gbrp16le a6156d1a37e05ee621b2a343fb158bd6
|
||||
gbrp9le 9e827f438e081d334a6cae7e282698b0
|
||||
gray ddc663a0491df3959d9c5795dceaa72e
|
||||
gray10le 92431ca3c9a3ac8f344089a799c665d0
|
||||
|
@ -23,6 +23,8 @@ gbrap10be 6d89abb9248006c3e9017545e9474654
|
||||
gbrap10le cf974e23f485a10740f5de74a5c8c3df
|
||||
gbrap12be 1d9b57766ba9c2192403f43967cb9af0
|
||||
gbrap12le bb1ba1c157717db3dd612a76d38a018e
|
||||
gbrap16be 81542b96575d1fe3b239d23899f5ece3
|
||||
gbrap16le 6feb8b9da131917abe867e0eaaf07b90
|
||||
gbrp dc3387f925f972c61aae7eb23cdc19f0
|
||||
gbrp10be 0277d4c3a8498d75e2783fb81379e481
|
||||
gbrp10le f3d70f8ab845c3c9b8f7452e4a6e285a
|
||||
@ -30,6 +32,8 @@ gbrp12be fbd4e149c452c351c6d1c11d6b6e176a
|
||||
gbrp12le c51d51c3b753d735eb22983397262c88
|
||||
gbrp14be cd20808592e62cc439786c18a14b3e70
|
||||
gbrp14le 456f7d1ff5990aa6379137d84dd63862
|
||||
gbrp16be 5fc826cfabebfc1442cb793c4b6303e2
|
||||
gbrp16le 1b3e0b63d47a3e1b6b20931316883bf2
|
||||
gbrp9be d9c88968001e1452ff31fbc8d16b18a0
|
||||
gbrp9le 2ccfed0816bf6bd4bb3a5b7591d9603a
|
||||
gray 221201cc7cfc4964eacd8b3e426fd276
|
||||
|
@ -23,6 +23,8 @@ gbrap10be e8134b72acc090b093b4d9b4d4703c7e
|
||||
gbrap10le 43bde7bd6a676c6ac33dbcc4c72762f3
|
||||
gbrap12be 16a3d105ba852a9fa23ea5232db51b48
|
||||
gbrap12le 6ef8a3ac4129ec23c34aec14ac41f249
|
||||
gbrap16be 70b020b6b9e1896b72f890de3570ffda
|
||||
gbrap16le e0cf341cdbaf1f5c40016f181bc9d7d4
|
||||
gbrp 413b0f6ea51588d4be5f0c76d43d8796
|
||||
gbrp10be d02bd50db83213667808f5bacefe667c
|
||||
gbrp10le 2d4a5ebc773ffc3d857a6ef24afbe10e
|
||||
@ -30,6 +32,8 @@ gbrp12be a668b7dba68817736501386ffe9f3adc
|
||||
gbrp12le 299695016c22a4947d94b16f0975536b
|
||||
gbrp14be eeebacfb19c970dd76ad044ef85e8fe5
|
||||
gbrp14le 6e93b87047e433995111eb5397751c3f
|
||||
gbrp16be 3fef87fe67bf1fd0e2f5056dc0db2ef4
|
||||
gbrp16le f3b2b76fe707f77eb1376640759f5168
|
||||
gbrp9be 99c694dd47d12ae48fc8f47a0c410333
|
||||
gbrp9le 26e103a4ab99fb3f58667df490997a36
|
||||
gray 41811422d5819ed69389357294384c10
|
||||
|
Loading…
Reference in New Issue
Block a user