History

swscale/output: add support for NV20

James Almer committed 1 year ago

Commit b8dc8751 parent 2f856b415 files · +52 −24Browse files

Unified · Split

15 files
  1. libswscale/format.c +2 −2
  2. libswscale/output.c +28 −21
  3. libswscale/version.h +1 −1
  4. tests/ref/fate/filter-pixdesc-nv20be +1 −0
  5. tests/ref/fate/filter-pixdesc-nv20le +1 −0
  6. tests/ref/fate/filter-pixfmts-copy +2 −0
  7. tests/ref/fate/filter-pixfmts-crop +2 −0
  8. tests/ref/fate/filter-pixfmts-field +2 −0
  9. tests/ref/fate/filter-pixfmts-fieldorder +2 −0
  10. tests/ref/fate/filter-pixfmts-hflip +2 −0
  11. tests/ref/fate/filter-pixfmts-il +2 −0
  12. tests/ref/fate/filter-pixfmts-null +2 −0
  13. tests/ref/fate/filter-pixfmts-pad +1 −0
  14. tests/ref/fate/filter-pixfmts-scale +2 −0
  15. tests/ref/fate/filter-pixfmts-vflip +2 −0
libswscale/format.c+2−2
@@ -226,8 +226,8 @@ static const FormatEntry format_entries[] = { · 225 unmodified lines
226 [AV_PIX_FMT_Y216LE] = { 1, 1 },226 [AV_PIX_FMT_Y216LE] = { 1, 1 },
227 [AV_PIX_FMT_X2RGB10LE] = { 1, 1 },227 [AV_PIX_FMT_X2RGB10LE] = { 1, 1 },
228 [AV_PIX_FMT_X2BGR10LE] = { 1, 1 },228 [AV_PIX_FMT_X2BGR10LE] = { 1, 1 },
229 [AV_PIX_FMT_NV20BE] = { 1, 0 },229 [AV_PIX_FMT_NV20BE] = { 1, 1 },
230 [AV_PIX_FMT_NV20LE] = { 1, 0 },230 [AV_PIX_FMT_NV20LE] = { 1, 1 },
231 [AV_PIX_FMT_P210BE] = { 1, 1 },231 [AV_PIX_FMT_P210BE] = { 1, 1 },
232 [AV_PIX_FMT_P210LE] = { 1, 1 },232 [AV_PIX_FMT_P210LE] = { 1, 1 },
233 [AV_PIX_FMT_P212BE] = { 1, 1 },233 [AV_PIX_FMT_P212BE] = { 1, 1 },
libswscale/output.c+28−21
@@ -472,11 +472,10 @@ static void yuv2nv12cX_c(enum AVPixelFormat dstFormat, const uint8_t *chrDither, · 471 unmodified lines
472 472
473static void yuv2p01xl1_c(const int16_t *src,473static void yuv2p01xl1_c(const int16_t *src,
474 uint16_t *dest, int dstW,474 uint16_t *dest, int dstW,
475 int big_endian, int output_bits)475 int big_endian, int output_bits, int output_shift)
476{476{
477 int i;477 int i;
478 int shift = 15 - output_bits;478 int shift = 15 - output_bits;
479 int output_shift = 16 - output_bits;
480 479
481 for (i = 0; i < dstW; i++) {480 for (i = 0; i < dstW; i++) {
482 int val = src[i] + (1 << (shift - 1));481 int val = src[i] + (1 << (shift - 1));
@@ -486,11 +485,10 @@ static void yuv2p01xl1_c(const int16_t *src, · 3 unmodified lines
486 485
487static void yuv2p01xlX_c(const int16_t *filter, int filterSize,486static void yuv2p01xlX_c(const int16_t *filter, int filterSize,
488 const int16_t **src, uint16_t *dest, int dstW,487 const int16_t **src, uint16_t *dest, int dstW,
489 int big_endian, int output_bits)488 int big_endian, int output_bits, int output_shift)
490{489{
491 int i, j;490 int i, j;
492 int shift = 11 + 16 - output_bits;491 int shift = 11 + 16 - output_bits;
493 int output_shift = 16 - output_bits;
494 492
495 for (i = 0; i < dstW; i++) {493 for (i = 0; i < dstW; i++) {
496 int val = 1 << (shift - 1);494 int val = 1 << (shift - 1);
@@ -505,12 +503,11 @@ static void yuv2p01xlX_c(const int16_t *filter, int filterSize, · 8 unmodified lines
505static void yuv2p01xcX_c(int big_endian, const uint8_t *chrDither,503static void yuv2p01xcX_c(int big_endian, const uint8_t *chrDither,
506 const int16_t *chrFilter, int chrFilterSize,504 const int16_t *chrFilter, int chrFilterSize,
507 const int16_t **chrUSrc, const int16_t **chrVSrc,505 const int16_t **chrUSrc, const int16_t **chrVSrc,
508 uint8_t *dest8, int chrDstW, int output_bits)506 uint8_t *dest8, int chrDstW, int output_bits, int output_shift)
509{507{
510 uint16_t *dest = (uint16_t*)dest8;508 uint16_t *dest = (uint16_t*)dest8;
511 int i, j;509 int i, j;
512 int shift = 11 + 16 - output_bits;510 int shift = 11 + 16 - output_bits;
513 int output_shift = 16 - output_bits;
514 511
515 for (i = 0; i < chrDstW; i++) {512 for (i = 0; i < chrDstW; i++) {
516 int u = 1 << (shift - 1);513 int u = 1 << (shift - 1);
@@ -528,38 +525,40 @@ static void yuv2p01xcX_c(int big_endian, const uint8_t *chrDither, · 11 unmodified lines
528 525
529#undef output_pixel526#undef output_pixel
530 527
531#define yuv2p01x_wrapper(bits) \528#define yuv2p01x_wrapper(fmt, bits, shift) \
532 static void yuv2p0 ## bits ## l1_LE_c(const int16_t *src, \529 static void yuv2 ## fmt ## l1_LE_c(const int16_t *src, \
533 uint8_t *dest, int dstW, \530 uint8_t *dest, int dstW, \
534 const uint8_t *dither, int offset) \531 const uint8_t *dither, int offset) \
535 { \532 { \
536 yuv2p01xl1_c(src, (uint16_t*)dest, dstW, 0, bits); \533 yuv2p01xl1_c(src, (uint16_t*)dest, dstW, 0, bits, shift); \
537 } \534 } \
538 \535 \
539 static void yuv2p0 ## bits ## l1_BE_c(const int16_t *src, \536 static void yuv2 ## fmt ## l1_BE_c(const int16_t *src, \
540 uint8_t *dest, int dstW, \537 uint8_t *dest, int dstW, \
541 const uint8_t *dither, int offset) \538 const uint8_t *dither, int offset) \
542 { \539 { \
543 yuv2p01xl1_c(src, (uint16_t*)dest, dstW, 1, bits); \540 yuv2p01xl1_c(src, (uint16_t*)dest, dstW, 1, bits, shift); \
544 } \541 } \
545 \542 \
546 static void yuv2p0 ## bits ## lX_LE_c(const int16_t *filter, \543 static void yuv2 ## fmt ## lX_LE_c(const int16_t *filter, \
547 int filterSize, const int16_t **src, \544 int filterSize, const int16_t **src, \
548 uint8_t *dest, int dstW, \545 uint8_t *dest, int dstW, \
549 const uint8_t *dither, int offset) \546 const uint8_t *dither, int offset) \
550 { \547 { \
551 yuv2p01xlX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 0, bits); \548 yuv2p01xlX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 0, \
549 bits, shift); \
552 } \550 } \
553 \551 \
554 static void yuv2p0 ## bits ## lX_BE_c(const int16_t *filter, \552 static void yuv2 ## fmt ## lX_BE_c(const int16_t *filter, \
555 int filterSize, const int16_t **src, \553 int filterSize, const int16_t **src, \
556 uint8_t *dest, int dstW, \554 uint8_t *dest, int dstW, \
557 const uint8_t *dither, int offset) \555 const uint8_t *dither, int offset) \
558 { \556 { \
559 yuv2p01xlX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 1, bits); \557 yuv2p01xlX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 1, \
558 bits, shift); \
560 } \559 } \
561 \560 \
562 static void yuv2p0 ## bits ## cX_LE_c(enum AVPixelFormat dstFormat, \561 static void yuv2 ## fmt ## cX_LE_c(enum AVPixelFormat dstFormat, \
563 const uint8_t *chrDither, \562 const uint8_t *chrDither, \
564 const int16_t *chrFilter, \563 const int16_t *chrFilter, \
565 int chrFilterSize, \564 int chrFilterSize, \
@@ -568,10 +567,10 @@ static void yuv2p01xcX_c(int big_endian, const uint8_t *chrDither, · 2 unmodified lines
568 uint8_t *dest8, int chrDstW) \567 uint8_t *dest8, int chrDstW) \
569 { \568 { \
570 yuv2p01xcX_c(0, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, \569 yuv2p01xcX_c(0, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, \
571 dest8, chrDstW, bits); \570 dest8, chrDstW, bits, shift); \
572 } \571 } \
573 \572 \
574 static void yuv2p0 ## bits ## cX_BE_c(enum AVPixelFormat dstFormat, \573 static void yuv2 ## fmt ## cX_BE_c(enum AVPixelFormat dstFormat, \
575 const uint8_t *chrDither, \574 const uint8_t *chrDither, \
576 const int16_t *chrFilter, \575 const int16_t *chrFilter, \
577 int chrFilterSize, \576 int chrFilterSize, \
@@ -580,11 +579,12 @@ static void yuv2p01xcX_c(int big_endian, const uint8_t *chrDither, · 2 unmodified lines
580 uint8_t *dest8, int chrDstW) \579 uint8_t *dest8, int chrDstW) \
581 { \580 { \
582 yuv2p01xcX_c(1, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, \581 yuv2p01xcX_c(1, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, \
583 dest8, chrDstW, bits); \582 dest8, chrDstW, bits, shift); \
584 }583 }
585 584
586yuv2p01x_wrapper(10)585yuv2p01x_wrapper(p010, 10, 6)
587yuv2p01x_wrapper(12)586yuv2p01x_wrapper(p012, 12, 4)
587yuv2p01x_wrapper(nv20, 10, 0)
588 588
589#define accumulate_bit(acc, val) \589#define accumulate_bit(acc, val) \
590 acc <<= 1; \590 acc <<= 1; \
@@ -3201,6 +3201,13 @@ av_cold void ff_sws_init_output_funcs(SwsInternal *c, · 2610 unmodified lines
3201 *yuv2nv12cX = isBE(dstFormat) ? yuv2p012cX_BE_c : yuv2p012cX_LE_c;3201 *yuv2nv12cX = isBE(dstFormat) ? yuv2p012cX_BE_c : yuv2p012cX_LE_c;
3202 } else3202 } else
3203 av_assert0(0);3203 av_assert0(0);
3204 } else if (isSemiPlanarYUV(dstFormat) && isNBPS(dstFormat)) {
3205 if (desc->comp[0].depth == 10) {
3206 *yuv2plane1 = isBE(dstFormat) ? yuv2nv20l1_BE_c : yuv2nv20l1_LE_c;
3207 *yuv2planeX = isBE(dstFormat) ? yuv2nv20lX_BE_c : yuv2nv20lX_LE_c;
3208 *yuv2nv12cX = isBE(dstFormat) ? yuv2nv20cX_BE_c : yuv2nv20cX_LE_c;
3209 } else
3210 av_assert0(0);
3204 } else if (is16BPS(dstFormat)) {3211 } else if (is16BPS(dstFormat)) {
3205 *yuv2planeX = isBE(dstFormat) ? yuv2planeX_16BE_c : yuv2planeX_16LE_c;3212 *yuv2planeX = isBE(dstFormat) ? yuv2planeX_16BE_c : yuv2planeX_16LE_c;
3206 *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_16BE_c : yuv2plane1_16LE_c;3213 *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_16BE_c : yuv2plane1_16LE_c;
libswscale/version.h+1−1
@@ -29,7 +29,7 @@ · 28 unmodified lines
29#include "version_major.h"29#include "version_major.h"
30 30
31#define LIBSWSCALE_VERSION_MINOR 1331#define LIBSWSCALE_VERSION_MINOR 13
32#define LIBSWSCALE_VERSION_MICRO 10232#define LIBSWSCALE_VERSION_MICRO 103
33 33
34#define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \34#define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
35 LIBSWSCALE_VERSION_MINOR, \35 LIBSWSCALE_VERSION_MINOR, \
tests/ref/fate/filter-pixdesc-nv20be+1−0
@@ -0,0 +1 @@
1pixdesc-nv20be 145a739af0a3f51705493f09380794e5
tests/ref/fate/filter-pixdesc-nv20le+1−0
@@ -0,0 +1 @@
1pixdesc-nv20le f28f8ab3015403e7e932592e08413120
tests/ref/fate/filter-pixfmts-copy+2−0
@@ -61,6 +61,8 @@ monob 8b04f859fee6a0be856be184acd7a0b5 · 60 unmodified lines
61monow 54d16d2c01abfd72ecdb5e51e283937c61monow 54d16d2c01abfd72ecdb5e51e283937c
62nv12 8e24feb2c544dc26a20047a71e4c27aa62nv12 8e24feb2c544dc26a20047a71e4c27aa
63nv16 22b1916c0694c4e2979bab8eb71f3d6b63nv16 22b1916c0694c4e2979bab8eb71f3d6b
64nv20be d3a724e46ec52f8796f7c0705893e0d9
65nv20le 3f0f46d5f65cf314eb1e24d21028afb8
64nv21 335d85c9af6110f26ae9e187a82ed2cf66nv21 335d85c9af6110f26ae9e187a82ed2cf
65nv24 f30fc8d0ac40af69e119ea919a31457267nv24 f30fc8d0ac40af69e119ea919a314572
66nv42 29a212f70f8780fe0eb99abcae81894d68nv42 29a212f70f8780fe0eb99abcae81894d
tests/ref/fate/filter-pixfmts-crop+2−0
@@ -59,6 +59,8 @@ grayf32be cf40ec06a8abe54852b7f85a00549eec · 58 unmodified lines
59grayf32le b672526c9da9c8959ab881f242f6890a59grayf32le b672526c9da9c8959ab881f242f6890a
60nv12 92cda427f794374731ec0321ee00caac60nv12 92cda427f794374731ec0321ee00caac
61nv16 3264b16aaae554c21f052102b491c13b61nv16 3264b16aaae554c21f052102b491c13b
62nv20be a69262f462f71973860ab08f2789ee6b
63nv20le a31f7f8105a8d9cfa6de13d865cff870
62nv21 1bcfc197f4fb95de85ba58182d8d2f6964nv21 1bcfc197f4fb95de85ba58182d8d2f69
63nv24 514c8f12082f0737e558778cbe7de25865nv24 514c8f12082f0737e558778cbe7de258
64nv42 ece9baae1c5de579dac2c66a89e08ef366nv42 ece9baae1c5de579dac2c66a89e08ef3
tests/ref/fate/filter-pixfmts-field+2−0
@@ -61,6 +61,8 @@ monob 2129cc72a484d7e10a44de9117aa9f80 · 60 unmodified lines
61monow 03d783611d265cae78293f88ea126ea161monow 03d783611d265cae78293f88ea126ea1
62nv12 16f7a46708ef25ebd0b72e47920cc11e62nv12 16f7a46708ef25ebd0b72e47920cc11e
63nv16 34f36b03f5fccf4eac147b26bbc0a5e563nv16 34f36b03f5fccf4eac147b26bbc0a5e5
64nv20be 1557f4523a0e03cf1a4c2e0cbdb8e336
65nv20le 342f2736c3c5f6277c46ba66101101ec
64nv21 7294574037cc7f9373ef5695d8ebe80966nv21 7294574037cc7f9373ef5695d8ebe809
65nv24 3b100fb527b64ee2b2d7120da573faf567nv24 3b100fb527b64ee2b2d7120da573faf5
66nv42 1841ce853152d86b27c130f319ea0db268nv42 1841ce853152d86b27c130f319ea0db2
tests/ref/fate/filter-pixfmts-fieldorder+2−0
@@ -58,6 +58,8 @@ gray9le c45eb848ab86f63f30ceb7206fb41be9 · 57 unmodified lines
58grayf32be 1aa7960131f880c54fe3c77f1344867458grayf32be 1aa7960131f880c54fe3c77f13448674
59grayf32le 4029ac9d197f255794c1b9e416520fc759grayf32le 4029ac9d197f255794c1b9e416520fc7
60nv16 085deb984ab986eb5cc961fe265e30c060nv16 085deb984ab986eb5cc961fe265e30c0
61nv20be 16998bc4aa2bfa3255d115a0a19ad80e
62nv20le c8bd359ec00903dd2b5526b4d8ecb09f
61nv24 4fdbef26042c77f012df114e666efdb263nv24 4fdbef26042c77f012df114e666efdb2
62nv42 59608290fece913e6b7d61edf581a52964nv42 59608290fece913e6b7d61edf581a529
63p210be ca2ce2c25db43dcd14729b2a72a7c60465p210be ca2ce2c25db43dcd14729b2a72a7c604
tests/ref/fate/filter-pixfmts-hflip+2−0
@@ -59,6 +59,8 @@ grayf32be a69add7bbf892a71fe81b3b75982dbe2 · 58 unmodified lines
59grayf32le 4563e176a35dc8a8a07e0829fad5eb8859grayf32le 4563e176a35dc8a8a07e0829fad5eb88
60nv12 801e58f1be5fd0b5bc4bf007c604b0b460nv12 801e58f1be5fd0b5bc4bf007c604b0b4
61nv16 06ba714cb8b220c203f5898ef39abf9361nv16 06ba714cb8b220c203f5898ef39abf93
62nv20be 979181e11f7bb74ad2d891daeebb7649
63nv20le eaac839121362f12270af3deff4d32e7
62nv21 9f10dfff8963dc327d3395af21f0554f64nv21 9f10dfff8963dc327d3395af21f0554f
63nv24 f0c5b2f42970f8d4003621d8857a872f65nv24 f0c5b2f42970f8d4003621d8857a872f
64nv42 4dcf9aec82b110712b396a8b365dcb1366nv42 4dcf9aec82b110712b396a8b365dcb13
tests/ref/fate/filter-pixfmts-il+2−0
@@ -61,6 +61,8 @@ monob faba75df28033ba7ce3d82ff2a99ee68 · 60 unmodified lines
61monow 6e9cfb8d3a344c5f0c3e1d5e1297e58061monow 6e9cfb8d3a344c5f0c3e1d5e1297e580
62nv12 3c3ba9b1b4c4dfff09c26f71b51dd14662nv12 3c3ba9b1b4c4dfff09c26f71b51dd146
63nv16 355d055f91793a171302021b3fc486b063nv16 355d055f91793a171302021b3fc486b0
64nv20be e09c264498100eb85364e10378adbc07
65nv20le 02e738d5bcd8c7b57cb56dee663232f6
64nv21 ab586d8781246b5a32d8760a61db979766nv21 ab586d8781246b5a32d8760a61db9797
65nv24 554153c71d142e3fd8e40b7dcaaec22967nv24 554153c71d142e3fd8e40b7dcaaec229
66nv42 d699724c8deaeb4f87faf2766512eec368nv42 d699724c8deaeb4f87faf2766512eec3
tests/ref/fate/filter-pixfmts-null+2−0
@@ -61,6 +61,8 @@ monob 8b04f859fee6a0be856be184acd7a0b5 · 60 unmodified lines
61monow 54d16d2c01abfd72ecdb5e51e283937c61monow 54d16d2c01abfd72ecdb5e51e283937c
62nv12 8e24feb2c544dc26a20047a71e4c27aa62nv12 8e24feb2c544dc26a20047a71e4c27aa
63nv16 22b1916c0694c4e2979bab8eb71f3d6b63nv16 22b1916c0694c4e2979bab8eb71f3d6b
64nv20be d3a724e46ec52f8796f7c0705893e0d9
65nv20le 3f0f46d5f65cf314eb1e24d21028afb8
64nv21 335d85c9af6110f26ae9e187a82ed2cf66nv21 335d85c9af6110f26ae9e187a82ed2cf
65nv24 f30fc8d0ac40af69e119ea919a31457267nv24 f30fc8d0ac40af69e119ea919a314572
66nv42 29a212f70f8780fe0eb99abcae81894d68nv42 29a212f70f8780fe0eb99abcae81894d
tests/ref/fate/filter-pixfmts-pad+1−0
@@ -26,6 +26,7 @@ gray16le 4347c5ca559a06948c1e7e7c2f06657d · 25 unmodified lines
26gray9le 99f825e62d5786901dba9abc88878ffb26gray9le 99f825e62d5786901dba9abc88878ffb
27nv12 381574979cb04be10c9168540310afad27nv12 381574979cb04be10c9168540310afad
28nv16 d3a50501d2ea8535489fd5ec49e7866d28nv16 d3a50501d2ea8535489fd5ec49e7866d
29nv20le 59511282a2565ed060e4fb1fee8f6bcb
29nv21 0fdeb2cdd56cf5a7147dc273456fa21730nv21 0fdeb2cdd56cf5a7147dc273456fa217
30nv24 193b9eadcc06ad5081609f76249b3e4731nv24 193b9eadcc06ad5081609f76249b3e47
31nv42 1738ad3c31c6c16e17679f5b09ce467732nv42 1738ad3c31c6c16e17679f5b09ce4677
tests/ref/fate/filter-pixfmts-scale+2−0
@@ -61,6 +61,8 @@ monob f01cb0b623357387827902d9d0963435 · 60 unmodified lines
61monow 35c68b86c226d6990b2dcb573a05ff6b61monow 35c68b86c226d6990b2dcb573a05ff6b
62nv12 b118d24a3653fe66e5d9e079033aef7962nv12 b118d24a3653fe66e5d9e079033aef79
63nv16 68e757396b62b84aad657274b8f6ce1563nv16 68e757396b62b84aad657274b8f6ce15
64nv20be 1f207474a71da5be34f764b20f0f59ed
65nv20le 011d1e266e52e9587b0f257ab4533095
64nv21 c74bb1c10dbbdee8a1f682b194486c4d66nv21 c74bb1c10dbbdee8a1f682b194486c4d
65nv24 2aa6e805bf6d4179ed8d7dea37d75db367nv24 2aa6e805bf6d4179ed8d7dea37d75db3
66nv42 80714d1eb2d8bcaeab3abc3124df1abd68nv42 80714d1eb2d8bcaeab3abc3124df1abd
tests/ref/fate/filter-pixfmts-vflip+2−0
@@ -61,6 +61,8 @@ monob 7810c4857822ccfc844d78f5e803269a · 60 unmodified lines
61monow 90a947bfcd5f2261e83b577f48ec57b161monow 90a947bfcd5f2261e83b577f48ec57b1
62nv12 261ebe585ae2aa4e70d39a10c167929462nv12 261ebe585ae2aa4e70d39a10c1679294
63nv16 f20f3448c900847aaff74429196f5a0063nv16 f20f3448c900847aaff74429196f5a00
64nv20be f73c202e6a0d35b9ff5b7fc7fdd04ed4
65nv20le 8f53d78acd0af1c7fb676b38ba4ba12b
64nv21 2909feacd27bebb080c8e0fa4179526966nv21 2909feacd27bebb080c8e0fa41795269
65nv24 334420b9d3df84499d2ca16bb66eed2b67nv24 334420b9d3df84499d2ca16bb66eed2b
66nv42 ba4063e2795c17fea3c8a646b01fd1f568nv42 ba4063e2795c17fea3c8a646b01fd1f5

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t