History

avutils/pixfmt: add YUV444/GBRP 10 and 12 bit MSB formats

Timo Rothenpieler committed 1 year ago

Commit e93de991 parent cd914694 files · +175 −0Browse files

Unified · Split

4 files
  1. libavutil/pixdesc.c +96 −0
  2. libavutil/pixfmt.h +15 −0
  3. tests/ref/fate/imgutils +16 −0
  4. tests/ref/fate/sws-pixdesc-query +48 −0
libavutil/pixdesc.c+96−0
@@ -1701,6 +1701,30 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { · 1700 unmodified lines
17011701 },
17021702 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
17031703 },
1704+ [AV_PIX_FMT_YUV444P10MSBLE] = {
1705+ .name = "yuv444p10msble",
1706+ .nb_components = 3,
1707+ .log2_chroma_w = 0,
1708+ .log2_chroma_h = 0,
1709+ .comp = {
1710+ { 0, 2, 0, 6, 10 }, /* Y */
1711+ { 1, 2, 0, 6, 10 }, /* U */
1712+ { 2, 2, 0, 6, 10 }, /* V */
1713+ },
1714+ .flags = AV_PIX_FMT_FLAG_PLANAR,
1715+ },
1716+ [AV_PIX_FMT_YUV444P10MSBBE] = {
1717+ .name = "yuv444p10msbbe",
1718+ .nb_components = 3,
1719+ .log2_chroma_w = 0,
1720+ .log2_chroma_h = 0,
1721+ .comp = {
1722+ { 0, 2, 0, 6, 10 }, /* Y */
1723+ { 1, 2, 0, 6, 10 }, /* U */
1724+ { 2, 2, 0, 6, 10 }, /* V */
1725+ },
1726+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1727+ },
17041728 [AV_PIX_FMT_YUV444P9LE] = {
17051729 .name = "yuv444p9le",
17061730 .nb_components = 3,
@@ -1749,6 +1773,30 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { · 42 unmodified lines
17491773 },
17501774 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
17511775 },
1776+ [AV_PIX_FMT_YUV444P12MSBLE] = {
1777+ .name = "yuv444p12msble",
1778+ .nb_components = 3,
1779+ .log2_chroma_w = 0,
1780+ .log2_chroma_h = 0,
1781+ .comp = {
1782+ { 0, 2, 0, 4, 12 }, /* Y */
1783+ { 1, 2, 0, 4, 12 }, /* U */
1784+ { 2, 2, 0, 4, 12 }, /* V */
1785+ },
1786+ .flags = AV_PIX_FMT_FLAG_PLANAR,
1787+ },
1788+ [AV_PIX_FMT_YUV444P12MSBBE] = {
1789+ .name = "yuv444p12msbbe",
1790+ .nb_components = 3,
1791+ .log2_chroma_w = 0,
1792+ .log2_chroma_h = 0,
1793+ .comp = {
1794+ { 0, 2, 0, 4, 12 }, /* Y */
1795+ { 1, 2, 0, 4, 12 }, /* U */
1796+ { 2, 2, 0, 4, 12 }, /* V */
1797+ },
1798+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1799+ },
17521800 [AV_PIX_FMT_YUV444P14LE] = {
17531801 .name = "yuv444p14le",
17541802 .nb_components = 3,
@@ -1877,6 +1925,30 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { · 122 unmodified lines
18771925 },
18781926 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
18791927 },
1928+ [AV_PIX_FMT_GBRP10MSBLE] = {
1929+ .name = "gbrp10msble",
1930+ .nb_components = 3,
1931+ .log2_chroma_w = 0,
1932+ .log2_chroma_h = 0,
1933+ .comp = {
1934+ { 2, 2, 0, 6, 10 }, /* R */
1935+ { 0, 2, 0, 6, 10 }, /* G */
1936+ { 1, 2, 0, 6, 10 }, /* B */
1937+ },
1938+ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1939+ },
1940+ [AV_PIX_FMT_GBRP10MSBBE] = {
1941+ .name = "gbrp10msbbe",
1942+ .nb_components = 3,
1943+ .log2_chroma_w = 0,
1944+ .log2_chroma_h = 0,
1945+ .comp = {
1946+ { 2, 2, 0, 6, 10 }, /* R */
1947+ { 0, 2, 0, 6, 10 }, /* G */
1948+ { 1, 2, 0, 6, 10 }, /* B */
1949+ },
1950+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1951+ },
18801952 [AV_PIX_FMT_GBRP12LE] = {
18811953 .name = "gbrp12le",
18821954 .nb_components = 3,
@@ -1901,6 +1973,30 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { · 18 unmodified lines
19011973 },
19021974 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
19031975 },
1976+ [AV_PIX_FMT_GBRP12MSBLE] = {
1977+ .name = "gbrp12msble",
1978+ .nb_components = 3,
1979+ .log2_chroma_w = 0,
1980+ .log2_chroma_h = 0,
1981+ .comp = {
1982+ { 2, 2, 0, 4, 12 }, /* R */
1983+ { 0, 2, 0, 4, 12 }, /* G */
1984+ { 1, 2, 0, 4, 12 }, /* B */
1985+ },
1986+ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1987+ },
1988+ [AV_PIX_FMT_GBRP12MSBBE] = {
1989+ .name = "gbrp12msbbe",
1990+ .nb_components = 3,
1991+ .log2_chroma_w = 0,
1992+ .log2_chroma_h = 0,
1993+ .comp = {
1994+ { 2, 2, 0, 4, 12 }, /* R */
1995+ { 0, 2, 0, 4, 12 }, /* G */
1996+ { 1, 2, 0, 4, 12 }, /* B */
1997+ },
1998+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1999+ },
19042000 [AV_PIX_FMT_GBRP14LE] = {
19052001 .name = "gbrp14le",
19062002 .nb_components = 3,
libavutil/pixfmt.h+15−0
@@ -488,6 +488,15 @@ enum AVPixelFormat { · 487 unmodified lines
488488 AV_PIX_FMT_GBRAP32BE, ///< planar GBRA 4:4:4:4 128bpp, big-endian
489489 AV_PIX_FMT_GBRAP32LE, ///< planar GBRA 4:4:4:4 128bpp, little-endian
490490
491+ AV_PIX_FMT_YUV444P10MSBBE, ///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), lowest bits zero, big-endian
492+ AV_PIX_FMT_YUV444P10MSBLE, ///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), lowest bits zero, little-endian
493+ AV_PIX_FMT_YUV444P12MSBBE, ///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), lowest bits zero, big-endian
494+ AV_PIX_FMT_YUV444P12MSBLE, ///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), lowest bits zero, little-endian
495+ AV_PIX_FMT_GBRP10MSBBE, ///< planar GBR 4:4:4 30bpp, lowest bits zero, big-endian
496+ AV_PIX_FMT_GBRP10MSBLE, ///< planar GBR 4:4:4 30bpp, lowest bits zero, little-endian
497+ AV_PIX_FMT_GBRP12MSBBE, ///< planar GBR 4:4:4 36bpp, lowest bits zero, big-endian
498+ AV_PIX_FMT_GBRP12MSBLE, ///< planar GBR 4:4:4 36bpp, lowest bits zero, little-endian
499+
491500 AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
492501 };
493502
@@ -540,6 +549,9 @@ enum AVPixelFormat { · 46 unmodified lines
540549 #define AV_PIX_FMT_YUV422P16 AV_PIX_FMT_NE(YUV422P16BE, YUV422P16LE)
541550 #define AV_PIX_FMT_YUV444P16 AV_PIX_FMT_NE(YUV444P16BE, YUV444P16LE)
542551
552+#define AV_PIX_FMT_YUV444P10MSB AV_PIX_FMT_NE(YUV444P10MSBBE, YUV444P10MSBLE)
553+#define AV_PIX_FMT_YUV444P12MSB AV_PIX_FMT_NE(YUV444P12MSBBE, YUV444P12MSBLE)
554+
543555 #define AV_PIX_FMT_GBRP9 AV_PIX_FMT_NE(GBRP9BE , GBRP9LE)
544556 #define AV_PIX_FMT_GBRP10 AV_PIX_FMT_NE(GBRP10BE, GBRP10LE)
545557 #define AV_PIX_FMT_GBRP12 AV_PIX_FMT_NE(GBRP12BE, GBRP12LE)
@@ -551,6 +563,9 @@ enum AVPixelFormat { · 5 unmodified lines
551563 #define AV_PIX_FMT_GBRAP16 AV_PIX_FMT_NE(GBRAP16BE, GBRAP16LE)
552564 #define AV_PIX_FMT_GBRAP32 AV_PIX_FMT_NE(GBRAP32BE, GBRAP32LE)
553565
566+#define AV_PIX_FMT_GBRP10MSB AV_PIX_FMT_NE(GBRP10MSBBE, GBRP10MSBLE)
567+#define AV_PIX_FMT_GBRP12MSB AV_PIX_FMT_NE(GBRP12MSBBE, GBRP12MSBLE)
568+
554569 #define AV_PIX_FMT_BAYER_BGGR16 AV_PIX_FMT_NE(BAYER_BGGR16BE, BAYER_BGGR16LE)
555570 #define AV_PIX_FMT_BAYER_RGGB16 AV_PIX_FMT_NE(BAYER_RGGB16BE, BAYER_RGGB16LE)
556571 #define AV_PIX_FMT_BAYER_GBRG16 AV_PIX_FMT_NE(BAYER_GBRG16BE, BAYER_GBRG16LE)
tests/ref/fate/imgutils+16−0
@@ -298,6 +298,14 @@ yaf16be planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 · 297 unmodified lines
298298 yaf16le planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288
299299 gbrap32be planes: 4, linesizes: 256 256 256 256, plane_sizes: 12288 12288 12288 12288, plane_offsets: 12288 12288 12288, total_size: 49152
300300 gbrap32le planes: 4, linesizes: 256 256 256 256, plane_sizes: 12288 12288 12288 12288, plane_offsets: 12288 12288 12288, total_size: 49152
301+yuv444p10msbbe planes: 3, linesizes: 128 128 128 0, plane_sizes: 6144 6144 6144 0, plane_offsets: 6144 6144 0, total_size: 18432
302+yuv444p10msble planes: 3, linesizes: 128 128 128 0, plane_sizes: 6144 6144 6144 0, plane_offsets: 6144 6144 0, total_size: 18432
303+yuv444p12msbbe planes: 3, linesizes: 128 128 128 0, plane_sizes: 6144 6144 6144 0, plane_offsets: 6144 6144 0, total_size: 18432
304+yuv444p12msble planes: 3, linesizes: 128 128 128 0, plane_sizes: 6144 6144 6144 0, plane_offsets: 6144 6144 0, total_size: 18432
305+gbrp10msbbe planes: 3, linesizes: 128 128 128 0, plane_sizes: 6144 6144 6144 0, plane_offsets: 6144 6144 0, total_size: 18432
306+gbrp10msble planes: 3, linesizes: 128 128 128 0, plane_sizes: 6144 6144 6144 0, plane_offsets: 6144 6144 0, total_size: 18432
307+gbrp12msbbe planes: 3, linesizes: 128 128 128 0, plane_sizes: 6144 6144 6144 0, plane_offsets: 6144 6144 0, total_size: 18432
308+gbrp12msble planes: 3, linesizes: 128 128 128 0, plane_sizes: 6144 6144 6144 0, plane_offsets: 6144 6144 0, total_size: 18432
301309
302310 image_fill_black tests
303311 yuv420p total_size: 4608, black_unknown_crc: 0xd00f6cc6, black_tv_crc: 0xd00f6cc6, black_pc_crc: 0x234969af
@@ -543,3 +551,11 @@ yaf16be total_size: 12288, black_unknown_crc: 0x7afe9aae, black_tv_cr · 239 unmodified lines
543551 yaf16le total_size: 12288, black_unknown_crc: 0x94c0068b, black_tv_crc: 0x94c0068b, black_pc_crc: 0xc05ce449
544552 gbrap32be total_size: 49152, black_unknown_crc: 0x7bd30c95, black_tv_crc: 0x7bd30c95, black_pc_crc: 0x7bd30c95
545553 gbrap32le total_size: 49152, black_unknown_crc: 0x7bd30c95, black_tv_crc: 0x7bd30c95, black_pc_crc: 0x7bd30c95
554+yuv444p10msbbe total_size: 18432, black_unknown_crc: 0x26991800, black_tv_crc: 0x26991800, black_pc_crc: 0xfe7f6700
555+yuv444p10msble total_size: 18432, black_unknown_crc: 0x4028ac30, black_tv_crc: 0x4028ac30, black_pc_crc: 0xab7c7698
556+yuv444p12msbbe total_size: 18432, black_unknown_crc: 0x26991800, black_tv_crc: 0x26991800, black_pc_crc: 0xfe7f6700
557+yuv444p12msble total_size: 18432, black_unknown_crc: 0x4028ac30, black_tv_crc: 0x4028ac30, black_pc_crc: 0xab7c7698
558+gbrp10msbbe total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000
559+gbrp10msble total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000
560+gbrp12msbbe total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000
561+gbrp12msble total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000
tests/ref/fate/sws-pixdesc-query+48−0
@@ -61,8 +61,12 @@ isNBPS: · 60 unmodified lines
6161 gbrap14le
6262 gbrp10be
6363 gbrp10le
64+ gbrp10msbbe
65+ gbrp10msble
6466 gbrp12be
6567 gbrp12le
68+ gbrp12msbbe
69+ gbrp12msble
6670 gbrp14be
6771 gbrp14le
6872 gbrp9be
@@ -127,8 +131,12 @@ isNBPS: · 58 unmodified lines
127131 yuv440p12le
128132 yuv444p10be
129133 yuv444p10le
134+ yuv444p10msbbe
135+ yuv444p10msble
130136 yuv444p12be
131137 yuv444p12le
138+ yuv444p12msbbe
139+ yuv444p12msble
132140 yuv444p14be
133141 yuv444p14le
134142 yuv444p9be
@@ -169,7 +177,9 @@ isBE: · 34 unmodified lines
169177 gbrapf16be
170178 gbrapf32be
171179 gbrp10be
180+ gbrp10msbbe
172181 gbrp12be
182+ gbrp12msbbe
173183 gbrp14be
174184 gbrp16be
175185 gbrp9be
@@ -230,7 +240,9 @@ isBE: · 54 unmodified lines
230240 yuv440p10be
231241 yuv440p12be
232242 yuv444p10be
243+ yuv444p10msbbe
233244 yuv444p12be
245+ yuv444p12msbbe
234246 yuv444p14be
235247 yuv444p16be
236248 yuv444p9be
@@ -336,8 +348,12 @@ isYUV: · 99 unmodified lines
336348 yuv444p
337349 yuv444p10be
338350 yuv444p10le
351+ yuv444p10msbbe
352+ yuv444p10msble
339353 yuv444p12be
340354 yuv444p12le
355+ yuv444p12msbbe
356+ yuv444p12msble
341357 yuv444p14be
342358 yuv444p14le
343359 yuv444p16be
@@ -435,8 +451,12 @@ isPlanarYUV: · 91 unmodified lines
435451 yuv444p
436452 yuv444p10be
437453 yuv444p10le
454+ yuv444p10msbbe
455+ yuv444p10msble
438456 yuv444p12be
439457 yuv444p12le
458+ yuv444p12msbbe
459+ yuv444p12msble
440460 yuv444p14be
441461 yuv444p14le
442462 yuv444p16be
@@ -551,8 +571,12 @@ isRGB: · 108 unmodified lines
551571 gbrp
552572 gbrp10be
553573 gbrp10le
574+ gbrp10msbbe
575+ gbrp10msble
554576 gbrp12be
555577 gbrp12le
578+ gbrp12msbbe
579+ gbrp12msble
556580 gbrp14be
557581 gbrp14le
558582 gbrp16be
@@ -727,8 +751,12 @@ AnyRGB: · 168 unmodified lines
727751 gbrp
728752 gbrp10be
729753 gbrp10le
754+ gbrp10msbbe
755+ gbrp10msble
730756 gbrp12be
731757 gbrp12le
758+ gbrp12msbbe
759+ gbrp12msble
732760 gbrp14be
733761 gbrp14le
734762 gbrp16be
@@ -966,8 +994,12 @@ Planar: · 231 unmodified lines
966994 gbrp
967995 gbrp10be
968996 gbrp10le
997+ gbrp10msbbe
998+ gbrp10msble
969999 gbrp12be
9701000 gbrp12le
1001+ gbrp12msbbe
1002+ gbrp12msble
9711003 gbrp14be
9721004 gbrp14le
9731005 gbrp16be
@@ -1035,8 +1067,12 @@ Planar: · 61 unmodified lines
10351067 yuv444p
10361068 yuv444p10be
10371069 yuv444p10le
1070+ yuv444p10msbbe
1071+ yuv444p10msble
10381072 yuv444p12be
10391073 yuv444p12le
1074+ yuv444p12msbbe
1075+ yuv444p12msble
10401076 yuv444p14be
10411077 yuv444p14le
10421078 yuv444p16be
@@ -1159,8 +1195,12 @@ PlanarRGB: · 116 unmodified lines
11591195 gbrp
11601196 gbrp10be
11611197 gbrp10le
1198+ gbrp10msbbe
1199+ gbrp10msble
11621200 gbrp12be
11631201 gbrp12le
1202+ gbrp12msbbe
1203+ gbrp12msble
11641204 gbrp14be
11651205 gbrp14le
11661206 gbrp16be
@@ -1181,6 +1221,10 @@ usePal: · 14 unmodified lines
11811221 rgb8
11821222
11831223 DataInHighBits:
1224+ gbrp10msbbe
1225+ gbrp10msble
1226+ gbrp12msbbe
1227+ gbrp12msble
11841228 p010be
11851229 p010le
11861230 p012be
@@ -1201,6 +1245,10 @@ DataInHighBits: · 14 unmodified lines
12011245 y210le
12021246 y212be
12031247 y212le
1248+ yuv444p10msbbe
1249+ yuv444p10msble
1250+ yuv444p12msbbe
1251+ yuv444p12msble
12041252
12051253 SwappedChroma:
12061254 nv21

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