You've already forked FFmpeg
							
							
				mirror of
				https://github.com/FFmpeg/FFmpeg.git
				synced 2025-10-30 23:18:11 +02:00 
			
		
		
		
	lavu/pixfmt: add 420 and 422, 10 and 12-bit MSB padded variants
Vulkan has defined all its 3-plane formats as MSB padded.
This commit is contained in:
		| @@ -1503,6 +1503,30 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { | ||||
|         }, | ||||
|         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, | ||||
|     }, | ||||
|     [AV_PIX_FMT_YUV420P10MSBLE] = { | ||||
|         .name = "yuv420p10msble", | ||||
|         .nb_components = 3, | ||||
|         .log2_chroma_w = 1, | ||||
|         .log2_chroma_h = 1, | ||||
|         .comp = { | ||||
|             { 0, 2, 0, 6, 10 },        /* Y */ | ||||
|             { 1, 2, 0, 6, 10 },        /* U */ | ||||
|             { 2, 2, 0, 6, 10 },        /* V */ | ||||
|         }, | ||||
|         .flags = AV_PIX_FMT_FLAG_PLANAR, | ||||
|     }, | ||||
|     [AV_PIX_FMT_YUV420P10MSBBE] = { | ||||
|         .name = "yuv420p10msbbe", | ||||
|         .nb_components = 3, | ||||
|         .log2_chroma_w = 1, | ||||
|         .log2_chroma_h = 1, | ||||
|         .comp = { | ||||
|             { 0, 2, 0, 6, 10 },        /* Y */ | ||||
|             { 1, 2, 0, 6, 10 },        /* U */ | ||||
|             { 2, 2, 0, 6, 10 },        /* V */ | ||||
|         }, | ||||
|         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, | ||||
|     }, | ||||
|     [AV_PIX_FMT_YUV420P12LE] = { | ||||
|         .name = "yuv420p12le", | ||||
|         .nb_components = 3, | ||||
| @@ -1527,6 +1551,30 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { | ||||
|         }, | ||||
|         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, | ||||
|     }, | ||||
|     [AV_PIX_FMT_YUV420P12MSBLE] = { | ||||
|         .name = "yuv420p12msble", | ||||
|         .nb_components = 3, | ||||
|         .log2_chroma_w = 1, | ||||
|         .log2_chroma_h = 1, | ||||
|         .comp = { | ||||
|             { 0, 2, 0, 4, 12 },        /* Y */ | ||||
|             { 1, 2, 0, 4, 12 },        /* U */ | ||||
|             { 2, 2, 0, 4, 12 },        /* V */ | ||||
|         }, | ||||
|         .flags = AV_PIX_FMT_FLAG_PLANAR, | ||||
|     }, | ||||
|     [AV_PIX_FMT_YUV420P12MSBBE] = { | ||||
|         .name = "yuv420p12msbbe", | ||||
|         .nb_components = 3, | ||||
|         .log2_chroma_w = 1, | ||||
|         .log2_chroma_h = 1, | ||||
|         .comp = { | ||||
|             { 0, 2, 0, 4, 12 },        /* Y */ | ||||
|             { 1, 2, 0, 4, 12 },        /* U */ | ||||
|             { 2, 2, 0, 4, 12 },        /* V */ | ||||
|         }, | ||||
|         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, | ||||
|     }, | ||||
|     [AV_PIX_FMT_YUV420P14LE] = { | ||||
|         .name = "yuv420p14le", | ||||
|         .nb_components = 3, | ||||
| @@ -1623,6 +1671,30 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { | ||||
|         }, | ||||
|         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, | ||||
|     }, | ||||
|     [AV_PIX_FMT_YUV422P10MSBLE] = { | ||||
|         .name = "yuv422p10msble", | ||||
|         .nb_components = 3, | ||||
|         .log2_chroma_w = 1, | ||||
|         .log2_chroma_h = 0, | ||||
|         .comp = { | ||||
|             { 0, 2, 0, 6, 10 },        /* Y */ | ||||
|             { 1, 2, 0, 6, 10 },        /* U */ | ||||
|             { 2, 2, 0, 6, 10 },        /* V */ | ||||
|         }, | ||||
|         .flags = AV_PIX_FMT_FLAG_PLANAR, | ||||
|     }, | ||||
|     [AV_PIX_FMT_YUV422P10MSBBE] = { | ||||
|         .name = "yuv422p10msbbe", | ||||
|         .nb_components = 3, | ||||
|         .log2_chroma_w = 1, | ||||
|         .log2_chroma_h = 0, | ||||
|         .comp = { | ||||
|             { 0, 2, 0, 6, 10 },        /* Y */ | ||||
|             { 1, 2, 0, 6, 10 },        /* U */ | ||||
|             { 2, 2, 0, 6, 10 },        /* V */ | ||||
|         }, | ||||
|         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, | ||||
|     }, | ||||
|     [AV_PIX_FMT_YUV422P12LE] = { | ||||
|         .name = "yuv422p12le", | ||||
|         .nb_components = 3, | ||||
| @@ -1647,6 +1719,30 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { | ||||
|         }, | ||||
|         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, | ||||
|     }, | ||||
|     [AV_PIX_FMT_YUV422P12MSBLE] = { | ||||
|         .name = "yuv422p12msble", | ||||
|         .nb_components = 3, | ||||
|         .log2_chroma_w = 1, | ||||
|         .log2_chroma_h = 0, | ||||
|         .comp = { | ||||
|             { 0, 2, 0, 4, 12 },        /* Y */ | ||||
|             { 1, 2, 0, 4, 12 },        /* U */ | ||||
|             { 2, 2, 0, 4, 12 },        /* V */ | ||||
|         }, | ||||
|         .flags = AV_PIX_FMT_FLAG_PLANAR, | ||||
|     }, | ||||
|     [AV_PIX_FMT_YUV422P12MSBBE] = { | ||||
|         .name = "yuv422p12msbbe", | ||||
|         .nb_components = 3, | ||||
|         .log2_chroma_w = 1, | ||||
|         .log2_chroma_h = 0, | ||||
|         .comp = { | ||||
|             { 0, 2, 0, 4, 12 },        /* Y */ | ||||
|             { 1, 2, 0, 4, 12 },        /* U */ | ||||
|             { 2, 2, 0, 4, 12 },        /* V */ | ||||
|         }, | ||||
|         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, | ||||
|     }, | ||||
|     [AV_PIX_FMT_YUV422P14LE] = { | ||||
|         .name = "yuv422p14le", | ||||
|         .nb_components = 3, | ||||
|   | ||||
| @@ -503,6 +503,14 @@ enum AVPixelFormat { | ||||
|     AV_PIX_FMT_GRAY10MSBLE,   ///<        Y        , 10bpp, lowest bits zero, little-endian | ||||
|     AV_PIX_FMT_GRAY12MSBBE,   ///<        Y        , 12bpp, lowest bits zero, big-endian | ||||
|     AV_PIX_FMT_GRAY12MSBLE,   ///<        Y        , 12bpp, lowest bits zero, little-endian | ||||
|     AV_PIX_FMT_YUV420P10MSBBE, ///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), lowest bits zero, big-endian | ||||
|     AV_PIX_FMT_YUV420P10MSBLE, ///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), lowest bits zero, little-endian | ||||
|     AV_PIX_FMT_YUV420P12MSBBE, ///< planar YUV 4:2:0, 18bpp, (1 Cr & Cb sample per 2x2 Y samples), lowest bits zero, big-endian | ||||
|     AV_PIX_FMT_YUV420P12MSBLE, ///< planar YUV 4:2:0, 18bpp, (1 Cr & Cb sample per 2x2 Y samples), lowest bits zero, little-endian | ||||
|     AV_PIX_FMT_YUV422P10MSBBE, ///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), lowest bits zero, big-endian | ||||
|     AV_PIX_FMT_YUV422P10MSBLE, ///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), lowest bits zero, little-endian | ||||
|     AV_PIX_FMT_YUV422P12MSBBE, ///< planar YUV 4:2:2, 24bpp, (1 Cr & Cb sample per 2x1 Y samples), lowest bits zero, big-endian | ||||
|     AV_PIX_FMT_YUV422P12MSBLE, ///< planar YUV 4:2:2, 24bpp, (1 Cr & Cb sample per 2x1 Y samples), lowest bits zero, little-endian | ||||
|  | ||||
|     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 | ||||
| }; | ||||
| @@ -558,6 +566,10 @@ enum AVPixelFormat { | ||||
|  | ||||
| #define AV_PIX_FMT_GRAY10MSB AV_PIX_FMT_NE(GRAY10MSBBE, GRAY10MSBLE) | ||||
| #define AV_PIX_FMT_GRAY12MSB AV_PIX_FMT_NE(GRAY12MSBBE, GRAY12MSBLE) | ||||
| #define AV_PIX_FMT_YUV420P10MSB AV_PIX_FMT_NE(YUV420P10MSBBE, YUV420P10MSBLE) | ||||
| #define AV_PIX_FMT_YUV420P12MSB AV_PIX_FMT_NE(YUV420P12MSBBE, YUV420P12MSBLE) | ||||
| #define AV_PIX_FMT_YUV422P10MSB AV_PIX_FMT_NE(YUV422P10MSBBE, YUV422P10MSBLE) | ||||
| #define AV_PIX_FMT_YUV422P12MSB AV_PIX_FMT_NE(YUV422P12MSBBE, YUV422P12MSBLE) | ||||
| #define AV_PIX_FMT_YUV444P10MSB AV_PIX_FMT_NE(YUV444P10MSBBE, YUV444P10MSBLE) | ||||
| #define AV_PIX_FMT_YUV444P12MSB AV_PIX_FMT_NE(YUV444P12MSBBE, YUV444P12MSBLE) | ||||
|  | ||||
|   | ||||
| @@ -310,6 +310,14 @@ gray10msbbe     planes: 1, linesizes: 128   0   0   0, plane_sizes:  6144     0 | ||||
| gray10msble     planes: 1, linesizes: 128   0   0   0, plane_sizes:  6144     0     0     0, plane_offsets:     0     0     0, total_size: 6144 | ||||
| gray12msbbe     planes: 1, linesizes: 128   0   0   0, plane_sizes:  6144     0     0     0, plane_offsets:     0     0     0, total_size: 6144 | ||||
| gray12msble     planes: 1, linesizes: 128   0   0   0, plane_sizes:  6144     0     0     0, plane_offsets:     0     0     0, total_size: 6144 | ||||
| yuv420p10msbbe  planes: 3, linesizes: 128  64  64   0, plane_sizes:  6144  1536  1536     0, plane_offsets:  6144  1536     0, total_size: 9216 | ||||
| yuv420p10msble  planes: 3, linesizes: 128  64  64   0, plane_sizes:  6144  1536  1536     0, plane_offsets:  6144  1536     0, total_size: 9216 | ||||
| yuv420p12msbbe  planes: 3, linesizes: 128  64  64   0, plane_sizes:  6144  1536  1536     0, plane_offsets:  6144  1536     0, total_size: 9216 | ||||
| yuv420p12msble  planes: 3, linesizes: 128  64  64   0, plane_sizes:  6144  1536  1536     0, plane_offsets:  6144  1536     0, total_size: 9216 | ||||
| yuv422p10msbbe  planes: 3, linesizes: 128  64  64   0, plane_sizes:  6144  3072  3072     0, plane_offsets:  6144  3072     0, total_size: 12288 | ||||
| yuv422p10msble  planes: 3, linesizes: 128  64  64   0, plane_sizes:  6144  3072  3072     0, plane_offsets:  6144  3072     0, total_size: 12288 | ||||
| yuv422p12msbbe  planes: 3, linesizes: 128  64  64   0, plane_sizes:  6144  3072  3072     0, plane_offsets:  6144  3072     0, total_size: 12288 | ||||
| yuv422p12msble  planes: 3, linesizes: 128  64  64   0, plane_sizes:  6144  3072  3072     0, plane_offsets:  6144  3072     0, total_size: 12288 | ||||
|  | ||||
| image_fill_black tests | ||||
| yuv420p         total_size:   4608,  black_unknown_crc: 0xd00f6cc6,  black_tv_crc: 0xd00f6cc6,  black_pc_crc: 0x234969af | ||||
| @@ -567,3 +575,11 @@ gray10msbbe     total_size:   6144,  black_unknown_crc: 0x02d4a26f,  black_tv_cr | ||||
| gray10msble     total_size:   6144,  black_unknown_crc: 0xb93165c3,  black_tv_crc: 0xb93165c3,  black_pc_crc: 0x00000000 | ||||
| gray12msbbe     total_size:   6144,  black_unknown_crc: 0x02d4a26f,  black_tv_crc: 0x02d4a26f,  black_pc_crc: 0x00000000 | ||||
| gray12msble     total_size:   6144,  black_unknown_crc: 0xb93165c3,  black_tv_crc: 0xb93165c3,  black_pc_crc: 0x00000000 | ||||
| yuv420p10msbbe  total_size:   9216,  black_unknown_crc: 0x4d4d9903,  black_tv_crc: 0x4d4d9903,  black_pc_crc: 0x69c6fe01 | ||||
| yuv420p10msble  total_size:   9216,  black_unknown_crc: 0xfff85b60,  black_tv_crc: 0xfff85b60,  black_pc_crc: 0xc03cff93 | ||||
| yuv420p12msbbe  total_size:   9216,  black_unknown_crc: 0x4d4d9903,  black_tv_crc: 0x4d4d9903,  black_pc_crc: 0x69c6fe01 | ||||
| yuv420p12msble  total_size:   9216,  black_unknown_crc: 0xfff85b60,  black_tv_crc: 0xfff85b60,  black_pc_crc: 0xc03cff93 | ||||
| yuv422p10msbbe  total_size:  12288,  black_unknown_crc: 0x0bbe5df7,  black_tv_crc: 0x0bbe5df7,  black_pc_crc: 0x16a51378 | ||||
| yuv422p10msble  total_size:  12288,  black_unknown_crc: 0x6582d6cf,  black_tv_crc: 0x6582d6cf,  black_pc_crc: 0xc9dc3ddf | ||||
| yuv422p12msbbe  total_size:  12288,  black_unknown_crc: 0x0bbe5df7,  black_tv_crc: 0x0bbe5df7,  black_pc_crc: 0x16a51378 | ||||
| yuv422p12msble  total_size:  12288,  black_unknown_crc: 0x6582d6cf,  black_tv_crc: 0x6582d6cf,  black_pc_crc: 0xc9dc3ddf | ||||
|   | ||||
| @@ -115,16 +115,24 @@ isNBPS: | ||||
|   y212le | ||||
|   yuv420p10be | ||||
|   yuv420p10le | ||||
|   yuv420p10msbbe | ||||
|   yuv420p10msble | ||||
|   yuv420p12be | ||||
|   yuv420p12le | ||||
|   yuv420p12msbbe | ||||
|   yuv420p12msble | ||||
|   yuv420p14be | ||||
|   yuv420p14le | ||||
|   yuv420p9be | ||||
|   yuv420p9le | ||||
|   yuv422p10be | ||||
|   yuv422p10le | ||||
|   yuv422p10msbbe | ||||
|   yuv422p10msble | ||||
|   yuv422p12be | ||||
|   yuv422p12le | ||||
|   yuv422p12msbbe | ||||
|   yuv422p12msble | ||||
|   yuv422p14be | ||||
|   yuv422p14le | ||||
|   yuv422p9be | ||||
| @@ -234,12 +242,16 @@ isBE: | ||||
|   yaf16be | ||||
|   yaf32be | ||||
|   yuv420p10be | ||||
|   yuv420p10msbbe | ||||
|   yuv420p12be | ||||
|   yuv420p12msbbe | ||||
|   yuv420p14be | ||||
|   yuv420p16be | ||||
|   yuv420p9be | ||||
|   yuv422p10be | ||||
|   yuv422p10msbbe | ||||
|   yuv422p12be | ||||
|   yuv422p12msbbe | ||||
|   yuv422p14be | ||||
|   yuv422p16be | ||||
|   yuv422p9be | ||||
| @@ -327,8 +339,12 @@ isYUV: | ||||
|   yuv420p | ||||
|   yuv420p10be | ||||
|   yuv420p10le | ||||
|   yuv420p10msbbe | ||||
|   yuv420p10msble | ||||
|   yuv420p12be | ||||
|   yuv420p12le | ||||
|   yuv420p12msbbe | ||||
|   yuv420p12msble | ||||
|   yuv420p14be | ||||
|   yuv420p14le | ||||
|   yuv420p16be | ||||
| @@ -338,8 +354,12 @@ isYUV: | ||||
|   yuv422p | ||||
|   yuv422p10be | ||||
|   yuv422p10le | ||||
|   yuv422p10msbbe | ||||
|   yuv422p10msble | ||||
|   yuv422p12be | ||||
|   yuv422p12le | ||||
|   yuv422p12msbbe | ||||
|   yuv422p12msble | ||||
|   yuv422p14be | ||||
|   yuv422p14le | ||||
|   yuv422p16be | ||||
| @@ -430,8 +450,12 @@ isPlanarYUV: | ||||
|   yuv420p | ||||
|   yuv420p10be | ||||
|   yuv420p10le | ||||
|   yuv420p10msbbe | ||||
|   yuv420p10msble | ||||
|   yuv420p12be | ||||
|   yuv420p12le | ||||
|   yuv420p12msbbe | ||||
|   yuv420p12msble | ||||
|   yuv420p14be | ||||
|   yuv420p14le | ||||
|   yuv420p16be | ||||
| @@ -441,8 +465,12 @@ isPlanarYUV: | ||||
|   yuv422p | ||||
|   yuv422p10be | ||||
|   yuv422p10le | ||||
|   yuv422p10msbbe | ||||
|   yuv422p10msble | ||||
|   yuv422p12be | ||||
|   yuv422p12le | ||||
|   yuv422p12msbbe | ||||
|   yuv422p12msble | ||||
|   yuv422p14be | ||||
|   yuv422p14le | ||||
|   yuv422p16be | ||||
| @@ -1050,8 +1078,12 @@ Planar: | ||||
|   yuv420p | ||||
|   yuv420p10be | ||||
|   yuv420p10le | ||||
|   yuv420p10msbbe | ||||
|   yuv420p10msble | ||||
|   yuv420p12be | ||||
|   yuv420p12le | ||||
|   yuv420p12msbbe | ||||
|   yuv420p12msble | ||||
|   yuv420p14be | ||||
|   yuv420p14le | ||||
|   yuv420p16be | ||||
| @@ -1061,8 +1093,12 @@ Planar: | ||||
|   yuv422p | ||||
|   yuv422p10be | ||||
|   yuv422p10le | ||||
|   yuv422p10msbbe | ||||
|   yuv422p10msble | ||||
|   yuv422p12be | ||||
|   yuv422p12le | ||||
|   yuv422p12msbbe | ||||
|   yuv422p12msble | ||||
|   yuv422p14be | ||||
|   yuv422p14le | ||||
|   yuv422p16be | ||||
| @@ -1259,6 +1295,14 @@ DataInHighBits: | ||||
|   y210le | ||||
|   y212be | ||||
|   y212le | ||||
|   yuv420p10msbbe | ||||
|   yuv420p10msble | ||||
|   yuv420p12msbbe | ||||
|   yuv420p12msble | ||||
|   yuv422p10msbbe | ||||
|   yuv422p10msble | ||||
|   yuv422p12msbbe | ||||
|   yuv422p12msble | ||||
|   yuv444p10msbbe | ||||
|   yuv444p10msble | ||||
|   yuv444p12msbbe | ||||
|   | ||||
		Reference in New Issue
	
	Block a user