History

swscale/output: add Y216LE output support

James Almer committed 2 years ago

Commit b520d951 parent 7756cd911 files · +54 −2Browse files

Unified · Split

11 files
  1. libswscale/output.c +44 −0
  2. libswscale/utils.c +1 −1
  3. libswscale/version.h +1 −1
  4. tests/ref/fate/filter-pixdesc-y216le +1 −0
  5. tests/ref/fate/filter-pixfmts-copy +1 −0
  6. tests/ref/fate/filter-pixfmts-field +1 −0
  7. tests/ref/fate/filter-pixfmts-fieldorder +1 −0
  8. tests/ref/fate/filter-pixfmts-il +1 −0
  9. tests/ref/fate/filter-pixfmts-null +1 −0
  10. tests/ref/fate/filter-pixfmts-scale +1 −0
  11. tests/ref/fate/filter-pixfmts-vflip +1 −0
libswscale/output.c+44−0
@@ -2983,6 +2983,47 @@ AYUVPACKEDWRAPPER(uyva, AV_PIX_FMT_UYVA) · 2982 unmodified lines
29832983 yuv2y2xx_wrapper(10)
29842984 yuv2y2xx_wrapper(12)
29852985
2986+static void
2987+yuv2y216le_X_c(SwsContext *c, const int16_t *lumFilter,
2988+ const int16_t **_lumSrc, int lumFilterSize,
2989+ const int16_t *chrFilter,
2990+ const int16_t **_chrUSrc,
2991+ const int16_t **_chrVSrc, int chrFilterSize,
2992+ const int16_t **_alpSrc,
2993+ uint8_t *dest, int dstW, int y)
2994+{
2995+ const int32_t **lumSrc = (const int32_t **)_lumSrc;
2996+ const int32_t **chrUSrc = (const int32_t **)_chrUSrc;
2997+ const int32_t **chrVSrc = (const int32_t **)_chrVSrc;
2998+ int shift = 15;
2999+
3000+ for (int i = 0; i < ((dstW + 1) >> 1); i++) {
3001+ int Y1 = 1 << (shift - 1), Y2 = 1 << (shift - 1);
3002+ int U = 1 << (shift - 1), V = 1 << (shift - 1);
3003+
3004+ /* See yuv2planeX_16_c_template for details. */
3005+ Y1 -= 0x40000000;
3006+ U -= 0x40000000;
3007+ Y2 -= 0x40000000;
3008+ V -= 0x40000000;
3009+
3010+ for (int j = 0; j < lumFilterSize; j++) {
3011+ Y1 += lumSrc[j][i * 2] * (unsigned)lumFilter[j];
3012+ Y2 += lumSrc[j][i * 2 + 1] * (unsigned)lumFilter[j];
3013+ }
3014+
3015+ for (int j = 0; j < chrFilterSize; j++) {
3016+ U += chrUSrc[j][i] * (unsigned)chrFilter[j];
3017+ V += chrVSrc[j][i] * (unsigned)chrFilter[j];
3018+ }
3019+
3020+ AV_WL16(dest + 8 * i + 0, 0x8000 + av_clip_int16(Y1 >> shift));
3021+ AV_WL16(dest + 8 * i + 2, 0x8000 + av_clip_int16(U >> shift));
3022+ AV_WL16(dest + 8 * i + 4, 0x8000 + av_clip_int16(Y2 >> shift));
3023+ AV_WL16(dest + 8 * i + 6, 0x8000 + av_clip_int16(V >> shift));
3024+ }
3025+}
3026+
29863027 static void
29873028 yuv2vyu444_1_c(SwsContext *c, const int16_t *buf0,
29883029 const int16_t *ubuf[2], const int16_t *vbuf[2],
@@ -3656,5 +3697,8 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c, · 667 unmodified lines
36563697 case AV_PIX_FMT_Y212LE:
36573698 *yuv2packedX = yuv2y212le_X_c;
36583699 break;
3700+ case AV_PIX_FMT_Y216LE:
3701+ *yuv2packedX = yuv2y216le_X_c;
3702+ break;
36593703 }
36603704 }
libswscale/utils.c+1−1
@@ -248,7 +248,7 @@ static const FormatEntry format_entries[] = { · 247 unmodified lines
248248 [AV_PIX_FMT_NV42] = { 1, 1 },
249249 [AV_PIX_FMT_Y210LE] = { 1, 1 },
250250 [AV_PIX_FMT_Y212LE] = { 1, 1 },
251− [AV_PIX_FMT_Y216LE] = { 1, 0 },
251+ [AV_PIX_FMT_Y216LE] = { 1, 1 },
252252 [AV_PIX_FMT_X2RGB10LE] = { 1, 1 },
253253 [AV_PIX_FMT_X2BGR10LE] = { 1, 1 },
254254 [AV_PIX_FMT_P210BE] = { 1, 1 },
libswscale/version.h+1−1
@@ -29,7 +29,7 @@ · 28 unmodified lines
2929 #include "version_major.h"
3030
3131 #define LIBSWSCALE_VERSION_MINOR 6
32−#define LIBSWSCALE_VERSION_MICRO 100
32+#define LIBSWSCALE_VERSION_MICRO 101
3333
3434 #define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
3535 LIBSWSCALE_VERSION_MINOR, \
tests/ref/fate/filter-pixdesc-y216le+1−0
@@ -0,0 +1 @@
1+pixdesc-y216le ff17fa6e341a5cfe0d549faa25c24257
tests/ref/fate/filter-pixfmts-copy+1−0
@@ -113,6 +113,7 @@ xyz12be a1ef56bf746d71f59669c28e48fc8450 · 112 unmodified lines
113113 xyz12le 831ff03c1ba4ef19374686f16a064d8c
114114 y210le 0736b017e0814daf38d3350c42796f7a
115115 y212le 825768be8fe92708ae80be84855066ed
116+y216le 610cc638e695eb64f3004cc5f24c5a7b
116117 ya16be 37c07787e544f900c87b853253bfc8dd
117118 ya16le e8cab8fad88cba6d285b224d8bf0d4df
118119 ya8 dbb99fbcdc204aaa1a7397ff561f1a67
tests/ref/fate/filter-pixfmts-field+1−0
@@ -113,6 +113,7 @@ xyz12be d2fa69ec91d3ed862f2dac3f8e7a3437 · 112 unmodified lines
113113 xyz12le 02bccd5e0b6824779a1f848b0ea3e3b5
114114 y210le 025beb25f047a762e3788dbea4b60864
115115 y212le ac2a47c45187dd54d0f55293cbffd954
116+y216le 332801737b0f779bdf14ff535fd925fd
116117 ya16be 40403b5277364777e0671da4d38e01ac
117118 ya16le 54f3295f5326a13d456ac53e973ba398
118119 ya8 28cea4f98ed452bd3da9c752e5e3399c
tests/ref/fate/filter-pixfmts-fieldorder+1−0
@@ -102,6 +102,7 @@ xyz12be 15f5cda71de5fef9cec5e75e3833b6bc · 101 unmodified lines
102102 xyz12le 7be6c8781f38c21a6b8f602f62ca31e6
103103 y210le ee45acfb1386288af98af5313162ff3e
104104 y212le 2f08fb195b948056c844acb1eee8d649
105+y216le 4176a190d167f0f6d7dbca7ff65d3f48
105106 ya16be 0f13e0f52586d172aaa07710fa3e8f31
106107 ya16le d481d93ea1a1a04d759d9994958983de
107108 ya8 055ac5ab5ff8533dd319edc17a398af1
tests/ref/fate/filter-pixfmts-il+1−0
@@ -112,6 +112,7 @@ xyz12be 7c7d54c55f136cbbc50b18029f3be0b3 · 111 unmodified lines
112112 xyz12le 090ba6b1170baf2b1358b43b971d33b0
113113 y210le 306ec4238b49dbc8625a97b678ea1c5f
114114 y212le d5a2b4677ddb4a3bc3e5cd5cbb20f426
115+y216le ef6d5ebd8bf99809fb8ac658cf7acbf8
115116 ya16be 7bc720918bc0132e9717acbde89874e0
116117 ya16le 61203295a8d39601b841de90f2c9797b
117118 ya8 a38d6e288f582f1a04310232ed764afc
tests/ref/fate/filter-pixfmts-null+1−0
@@ -113,6 +113,7 @@ xyz12be a1ef56bf746d71f59669c28e48fc8450 · 112 unmodified lines
113113 xyz12le 831ff03c1ba4ef19374686f16a064d8c
114114 y210le 0736b017e0814daf38d3350c42796f7a
115115 y212le 825768be8fe92708ae80be84855066ed
116+y216le 610cc638e695eb64f3004cc5f24c5a7b
116117 ya16be 37c07787e544f900c87b853253bfc8dd
117118 ya16le e8cab8fad88cba6d285b224d8bf0d4df
118119 ya8 dbb99fbcdc204aaa1a7397ff561f1a67
tests/ref/fate/filter-pixfmts-scale+1−0
@@ -113,6 +113,7 @@ xyz12be c7ba8345998c0141ddc079cdd29b1a40 · 112 unmodified lines
113113 xyz12le 95f5d3a0de834cc495c9032a14987cde
114114 y210le 1c2708a520477f955d1fedf6ca7a41bd
115115 y212le 39a3c0c843041ad4501b3107dd91ef17
116+y216le 21ead8be695827822e627df20ab49b1f
116117 ya16be 20d4842899d61068f5fb6af478bf26a6
117118 ya16le 6a05895adce85143ae1c1b3470cb4070
118119 ya8 0a9db5bb4b009de9197eede5e9d19e16
tests/ref/fate/filter-pixfmts-vflip+1−0
@@ -113,6 +113,7 @@ xyz12be 23fa9fb36d49dce61e284d41b83e0e6b · 112 unmodified lines
113113 xyz12le ef73e6d1f932a9a355df1eedd628394f
114114 y210le 9544c81f8e1fc95e9fa4009dbecfea25
115115 y212le c801725ae31e3b8f5be269359d49f191
116+y216le 0ca0f60d7fd78ec32f417d6209f18a5b
116117 ya16be 55b1dbbe4d56ed0d22461685ce85520d
117118 ya16le d5bf02471823a16dc523a46cace0101a
118119 ya8 4299c6ca3b470a7d8a420e26eb485b1d

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