`
love19820823
  • 浏览: 934181 次
文章分类
社区版块
存档分类
最新评论

YUV pixel formats

 
阅读更多
9/21/2010 7:46:59 PM

http://www.fourcc.org/yuv.php(摘自此页面)

YUV formats fall into two distinct groups, the packed formats where Y, U (Cb) and V (Cr) samples are packed together into macropixels which are stored in a single array, and the planar formats where each component is stored as a separate array, the final image being a fusing of the three separate planes. (眨眼分为两种形式packed formatsplanar formatspacked formats 降YUV都压缩进一个数组,而planar formats将YUV分别压缩为一个数组,即Y数组、U数组、V数组分别存放)。

In the diagrams below, the numerical suffix attached to each Y, U or V sample indicates the sampling position across the image line, so, for example, V0 indicates the leftmost V sample and Yn indicates the Y sample at the (n+1)th pixel from the left.

Subsampling intervals in the horizontal and vertical directions may merit some explanation. The horizontal subsampling interval describes how frequently across a line a sample of that component is taken while the vertical interval describes on which lines samples are taken. For example, UYVY format has a horizontal subsampling period of 2 for both the U and V components indicating that U and V samples are taken for every second pixel across a line.(UYVY 意思是针对一个像素取一个U和Y,然后下一个像素取一个V和Y,这样相对于整个行就是Y是每个像素都取值,而U和V都是隔一个像素取一次) Their vertical subsampling period is 1 indicating that U and V samples are taken on each line of the image. (UYVY 则每一行都是按这个规则,也就是每行都是按上面的规则取。)

For YVU9, though, the vertical subsampling interval is 4. This indicates that U and V samples are only taken on every fourth line of the original image. Since the horizontal sampling period is also 4, a single U and a single V sample are taken for each square block of 16 image pixels.

Also, if you are interested in YCrCb to RGB conversion, you may find this page helpful.

People reading this page may be interested in a freeware codec眨眼codec 的意思是compress and decompress)from Drastic Technologies which allegedly handles the vast majority of YUV formats listed here. I've not tried it but you can find it here.

Packed YUV Formats

Label FOURCC in Hex Bits per pixel Description
AYUV 0x56555941 32 Combined YUV and alpha
CLJR 0x524A4C43 8 Cirrus Logic format with 4 pixels packed into a u_int32. A form of YUV 4:1:1 wiht less than 8 bits per Y, U and V sample.
cyuv 0x76757963 16 Essentially a copy of UYVY except that the sense of the height is reversed - the image is upside down with respect to the UYVY version.
GREY 0x59455247 8 Apparently a duplicate of Y800 (and also, presumably, "Y8 ")
IRAW 0x57615349 ? Intel uncompressed YUV. I have no information on this format - can you help?
IUYV 0x56595549 16 Interlaced version of UYVY (line order 0, 2, 4,....,1, 3, 5....) registered by Silviu Brinzei of LEAD Technologies.
IY41 0x31345949 12 Interlaced version of Y41P (line order 0, 2, 4,....,1, 3, 5....) registered by Silviu Brinzei of LEAD Technologies.
IYU1 0x31555949 12 12 bit format used in mode 2 of the IEEE 1394 Digital Camera 1.04 spec. This is equivalent to Y411
IYU2 0x32555949 24 24 bit format used in mode 0 of the IEEE 1394 Digital Camera 1.04 spec
HDYC 0x43594448 16 YUV 4:2:2 (眨眼Y sample at every pixel, U and V sampled at every second pixel horizontally on each line). A macropixel contains 2 pixels in 1 u_int32. This is a suplicate of UYVY except that the color components use the BT709 color space (as used in HD video).
UYNV 0x564E5955 16 A direct copy of UYVY registered by NVidia to work around problems in some old codecs which did not like hardware which offered more than 2 UYVY surfaces.
UYVP 0x50565955 24? YCbCr 4:2:2 extended precision 10-bits per component in U0Y0V0Y1 order. Registered by Rich Ehlers of Evans & Sutherland. (Awaiting confirmation of component packing structure)
UYVY 0x59565955 16 YUV 4:2:2 (Y sample at every pixel, U and V sampled at every second pixel horizontally on each line). A macropixel (JUN:眨眼像素宏单元可以认为是一个最小的非重复的单元)contains 2 pixels in 1 u_int32.
V210 0x30313256 32 10-bit 4:2:2 YCrCb equivalent to the Quicktime format of the same name.
V422 0x32323456 16 I am told that this is an upside down version of UYVY.
V655 0x35353656 16? 16 bit YUV 4:2:2 (JUN:眨眼16-bit 是指一个packed像素占用的位数,而4:2:2指的是下采样比例)format registered by Vitec Multimedia. I have no information on the component ordering or packing.
VYUY 0x59555956 ? ATI Packed YUV Data (format unknown but you can get hold of a codec supporting it here)
Y422 0x32323459 16 Direct copy of UYVY as used by ADS Technologies Pyro WebCam firewire camera.
YUY2 0x32595559 16 YUV 4:2:2 as for UYVY but with different component ordering within the u_int32 macropixel.
YUYV 0x56595559 16 Duplicate of YUY2
YUNV 0x564E5559 16 A direct copy of YUY2 registered by NVidia to work around problems in some old codecs which did not like hardware which offered more than 2 YUY2 surfaces.
YVYU 0x55595659 16 YUV 4:2:2 as for UYVY but with different component ordering within the u_int32 macropixel.
Y41P 0x50313459 12 YUV 4:1:1 (Y sample at every pixel, U and V sampled at every fourth pixel horizontally on each line). A macropixel contains 8 pixels in 3 u_int32s.
Y411 0x31313459 12 YUV 4:1:1 with a packed, 6 byte/4 pixel macroblock structure.
Y211 0x31313259 8 Packed YUV format with Y sampled at every second pixel across each line and U and V sampled at every fourth pixel.
Y41T 0x54313459 12 Format as for Y41P but the lsb of each Y component is used to signal pixel transparency .
Y42T 0x54323459 16 Format as for UYVY but the lsb of each Y component is used to signal pixel transparency .
YUVP 0x50565559 24? YCbCr 4:2:2 extended precision 10-bits per component in Y0U0Y1V0 order. Registered by Rich Ehlers of Evans & Sutherland.
Y800 0x30303859 8 Simple, single Y plane for monochrome images.
Y8 0x20203859 8 Duplicate of Y800 as far as I can see.
Y16 0x20363159 16 16-bit uncompressed greyscale image.

Planar YUV Formats

Label FOURCC in Hex Bits per pixel

Description

YVU9 0x39555659 9 8 bit Y plane followed by 8 bit 4x4 subsampled V and U planes. Registered by Intel.
YUV9 0x39565559 9? Registered by Intel., this is the format used internally by Indeo video code
IF09 0x39304649 9.5 As YVU9 but an additional 4x4 subsampled plane is appended containing delta information relative to the last frame. (Bpp is reported as 9)
YV16 0x36315659 16 8 bit Y plane followed by 8 bit 2x1 subsampled V and U planes.
YV12 0x32315659 12 8 bit Y plane followed by 8 bit 2x2 subsampled V and U planes.
I420 0x30323449 12 8 bit Y plane followed by 8 bit 2x2 subsampled U and V planes.
IYUV 0x56555949 12 Duplicate FOURCC, identical to I420.
NV12 0x3231564E 12 8-bit Y plane followed by an interleaved U/V plane with 2x2 subsampling
NV21 0x3132564E 12 As NV12 with U and V reversed in the interleaved plane
IMC1 0x31434D49 12 As YV12 except the U and V planes each have the same stride as the Y plane
IMC2 0x32434D49 12 Similar to IMC1 except that the U and V lines are interleaved at half stride boundaries
IMC3 0x33434D49 12 As IMC1 except that U and V are swapped
IMC4 0x34434D49 12 As IMC2 except that U and V are swapped
CLPL 0x4C504C43 12 Format similar to YV12 but including a level of indirection.
Y41B 0x42313459 12? Weitek format listed as "YUV 4:1:1 planar". I have no other information on this format.
Y42B 0x42323459 16? Weitek format listed as "YUV 4:2:2 planar". I have no other information on this format.
Y800 0x30303859 8 Simple, single Y plane for monochrome images.
Y8 0x20203859 8 Duplicate of Y800 as far as I can see.
CXY1 0x31595843 12 Awaiting clarification of format.
CXY2 0x32595842 16 Awaiting clarification of format.

IF09

A derivative of YVU9, IF09 contains the basic 3 planes for Y, V and U followed by an additional (N/4)x(N/4) plane of "skip blocks". This final plane forms a basic delta encoding scheme which can be used by a displayer to decide which pixels in the image are unchanged from the previous displayed frame. The strange number of bits per pixel listed for the format results from the fact that an NxN image is described using N2+3(N/4)2 bytes.

This format is generated by Intel's Indeo codecs though users should beware - the original 32 bit Indeo 3.2 shipped with Windows 95 and the beta levels of Indeo 4.1 contain bugs which cause them to generate protection faults when using IF09. Fixed versions of these codecs are available from Intel.

Horizontal Vertical
Y Sample Period 1 1
V Sample Period 4 4
U Sample Period 4 4

Positive biHeight implies top-down image (top line first)

Delta plane definition

To be completed...

YV12

This is the format of choice for many software MPEG codecs. It comprises an NxM Y plane followed by (N/2)x(M/2) V and U planes.

Horizontal Vertical
Y Sample Period 1 1
V Sample Period 2 2
U Sample Period 2 2

Positive biHeight implies top-down image (top line first)

ATI says they have a download which contains this codec but I can't find it on their site. If you would like something similar for Quicktime, try here.

YV16

This format is basically a version of YV12 with higher chroma resolution. It comprises an NxM Y plane followed by (N/2)xM U and V planes.

Horizontal Vertical
Y Sample Period 1 1
V Sample Period 2 1
U Sample Period 2 1

IYUV and I420

These formats are identical to YV12 except that the U and V plane order is reversed. They comprise an NxN Y plane followed by (N/2)x(N/2) U and V planes. Full marks to Intel for registering the same format twice and full marks to Microsoft for not picking up on this and rejecting the second registration.

(Note:There is some confusion over these formats thanks to the definitions on Microsoft's site which tend to suggest that the two FOURCCs are different. One is described as a 4:2:0 format while the other is described as 4:1:1. Later, however, the same page states that YV12 is the same as both of these with the U and V plane order reversed. I would consider 4:2:0 to imply 1 chroma sample for every 2x2 luma block and 4:1:1 to imply 1 chroma sample for every 4x1 luma block but it seems as if the Microsoft writer may have been using the terms interchangeably. If you know these formats, please could you let me know whether the definition here is correct or whether Ineed to update one or other?)

Horizontal Vertical
Y Sample Period 1 1
V Sample Period 2 2
U Sample Period 2 2

Positive biHeight implies top-down image (top line first)

Y16

This format contains only a single, 16 bit Y plane for monochrome images. Each pixel is represented by a 16 bit, little endian luminance sample.

Horizontal Vertical
Y Sample Period 1 1
V Sample Period N/A N/A
U Sample Period N/A N/A

NV12

YUV 惊讶惊讶惊讶惊讶惊讶惊讶惊讶4:2:0 image with a plane of 8 bit Y samples followed by an interleaved U/V plane containing 8 bit 2x2 subsampled colour difference samples.

Horizontal Vertical
Y Sample Period 1 1
V (Cr) Sample Period 2 2
U (Cb) Sample Period 2 2

Microsoft defines this format as follows:

"A format in which all Y samples are found first in memory as an array of unsigned char with an even number of lines (possibly with a larger stride for memory alignment), followed immediately by an array of unsigned char containing interleaved Cb and Cr samples (such that if addressed as a little-endian WORD type, Cb would be in the LSBs and Cr would be in the MSBs) with the same total stride as the Y samples. This is the preferred 4:2:0 pixel format."

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics