[基础] YUV 格式简介

【音视频基础系列】
YUV格式简介 (本文)
色彩空间简介(YUV与RGB转换)


分类

YUV格式按照存储可分为packed formats和planar formats两类。
- packed formats
指Y,U(Cb),V(Cr) packed,图像以像素为单位存储;
- planar formats
指每个分量分开存储,三个分量依次存储。

YUV格式按照存储精度(bpp),又可分为4:2:0, 4:2:2, 4:4:4等。

因为人眼对于色度分量较为不敏感,所以视频编码使用的原始序列多是YUV 4:2:0格式。

定义

  • packed yuv
LabelFOURCC in HexBits per pixelDescription
AYUV0x5655594132Combined YUV and alpha
CLJR0x524A4C438Cirrus 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.
cyuv0x7675796316Essentially a copy of UYVY except that the sense of the height is reversed - the image is upside down with respect to the UYVY version.
GREY0x594552478Apparently a duplicate of Y800 (and also, presumably, “Y8 “)
IRAW0x57615349?Intel uncompressed YUV. I have no information on this format - can you help?
IUYV0x5659554916Interlaced version of UYVY (line order 0, 2, 4,….,1, 3, 5….) registered by Silviu Brinzei of Lead Technologies.
IY410x3134594912Interlaced version of Y41P (line order 0, 2, 4,….,1, 3, 5….) registered by Silviu Brinzei of Lead Technologies.
IYU10x315559491212 bit format used in mode 2 of the IEEE 1394 Digital Camera 1.04 spec. This is equivalent to Y411
IYU20x325559492424 bit format used in mode 0 of the IEEE 1394 Digital Camera 1.04 spec
UYNV0x564E595516A 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.
UYVP0x5056595524?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)
UYVY0x5956595516YUV 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.
V2100x303132563210-bit 4:2:2 YCrCb equivalent to the Quicktime format of the same name.
V4220x3232345616I am told that this is an upside down version of UYVY.
V6550x3535365616?16 bit YUV 4:2:2 format registered by Vitec Multimedia. I have no information on the component ordering or packing.
VYUY0x59555956?ATI Packed YUV Data (format unknown but you can get hold of a codec supporting it here)
Y4220x3232345916Direct copy of UYVY as used by ADS Technologies Pyro WebCam firewire camera.
YUY20x3259555916YUV 4:2:2 as for UYVY but with different component ordering within the u_int32 macropixel.
YUYV0x5659555916Duplicate of YUY2
YUNV0x564E555916A 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.
YVYU0x5559565916YUV 4:2:2 as for UYVY but with different component ordering within the u_int32 macropixel.
Y41P0x5031345912YUV 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.
Y4110x3131345912YUV 4:1:1 with a packed, 6 byte/4 pixel macroblock structure.
Y2110x313132598Packed YUV format with Y sampled at every second pixel across each line and U and V sampled at every fourth pixel.
Y41T0x5431345912Format as for Y41P but the lsb of each Y component is used to signal pixel transparency .
Y42T0x5432345916Format as for UYVY but the lsb of each Y component is used to signal pixel transparency .
YUVP0x5056555924?YCbCr 4:2:2 extended precision 10-bits per component in Y0U0Y1V0 order. Registered by Rich Ehlers of Evans & Sutherland.
Y8000x303038598Simple, single Y plane for monochrome images.
Y80x202038598Duplicate of Y800 as far as I can see.

  • planar formats
LabelFOURCC in HexBits per pixelDescription
YVU90x3955565998 bit Y plane followed by 8 bit 4x4 subsampled V and U planes. Registered by Intel.
YUV90x395655599?Registered by Intel. I have no other information on this format. Probably a copy of YVU9.
IF090x393046499.5As YVU9 but an additional 4x4 subsampled plane is appended containing delta information relative to the last frame. (Bpp is reported as 9)
YV160x36315659168 bit Y plane followed by 8 bit 2x1 subsampled V and U planes.
YV120x32315659128 bit Y plane followed by 8 bit 2x2 subsampled V and U planes.
I4200x30323449128 bit Y plane followed by 8 bit 2x2 subsampled U and V planes.
IYUV0x5655594912Duplicate FOURCC, identical to I420.
NV120x3231564E128-bit Y plane followed by an interleaved U/V plane with 2x2 subsampling
NV210x3132564E12As NV12 with U and V reversed in the interleaved plane
IMC10x31434D4912As YV12 except the U and V planes each have the same stride as the Y plane
IMC20x32434D4912Similar to IMC1 except that the U and V lines are interleaved at half stride boundaries
IMC30x33434D4912As IMC1 except that U and V are swapped
IMC40x34434D4912As IMC2 except that U and V are swapped
CLPL0x4C504C4312Format similar to YV12 but including a level of indirection.
Y41B0x4231345912?Weitek format listed as “YUV 4:1:1 planar”. I have no other information on this format.
Y42B0x4232345916?Weitek format listed as “YUV 4:2:2 planar”. I have no other information on this format.
Y8000x303038598Simple, single Y plane for monochrome images.
Y80x202038598Duplicate of Y800 as far as I can see.

特别关注

4:2:0中的:I420,YV12;NV12和NV21

其实planar formats里描述已经说得非常清楚。
- I420 就是我们最常接触到的yuv420格式,Y plane + (1/2宽, 1/2高)U + (1/2宽, 1/2高)V;
- YV12 是 Y + V + U;
- NV12 是 Y plane + 交织的(interleaved) UV;
- NV21 是 Y plane + 交织的VU。

x264

# x264 x264.h
/* Colorspace type */
#define X264_CSP_MASK           0x00ff  /* */
#define X264_CSP_NONE           0x0000  /* Invalid mode     */
---------------------1
#define X264_CSP_I420           0x0001  /* yuv 4:2:0 planar */
#define X264_CSP_YV12           0x0002  /* yvu 4:2:0 planar */
#define X264_CSP_NV12           0x0003  /* yuv 4:2:0, with one y plane and one packed u+v */
#define X264_CSP_NV21           0x0004  /* yuv 4:2:0, with one y plane and one packed v+u */
---------------------2
#define X264_CSP_I422           0x0005  /* yuv 4:2:2 planar */
#define X264_CSP_YV16           0x0006  /* yvu 4:2:2 planar */
#define X264_CSP_NV16           0x0007  /* yuv 4:2:2, with one y plane and one packed u+v */
#define X264_CSP_V210           0x0008  /* 10-bit yuv 4:2:2 packed in 32 */
---------------------3
#define X264_CSP_I444           0x0009  /* yuv 4:4:4 planar */
#define X264_CSP_YV24           0x000a  /* yvu 4:4:4 planar */
#define X264_CSP_BGR            0x000b  /* packed bgr 24bits   */
#define X264_CSP_BGRA           0x000c  /* packed bgr 32bits   */
#define X264_CSP_RGB            0x000d  /* packed rgb 24bits   */
---------------------4
#define X264_CSP_MAX            0x000e  /* end of list */
#define X264_CSP_VFLIP          0x1000  /* the csp is vertically flipped */
#define X264_CSP_HIGH_DEPTH     0x2000  /* the csp has a depth of 16 bits per pixel component */

编码器内部按4大类型处理:invalid,yuv420, yuv422,yuv444

参考

YUV formats


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值