[Quto from H.261 specification]
The standard supports two video frame sizes: CIF(352x288 luma with 176x144 chroma) and QCIF (176x144 with 88x72 chroma) using a 4:2:0
352x288 luma with 176x144 chroma<----- 这个怎么理解 ?
1, 4:2:0的采样方法表示在水平方向上采用 2:1(明度 比 色度)的水平采样,垂直方向上采用 2:1(明度 比 色度)的采样。
2,所以,luma的resolution(352*288)可以理解成图像的大小(尺寸),而chroma的resolution(176*144 in this)指的是在luma resoltuion一定的情况下,色度信息的size。
YUV specification
由上面的知识点我们引出了 YUV的概念,下面我们将单独讲解一下YUV的相关知识。
YUV 是一种颜色编码方式,它较RGB的优势是,YUV在颜色编码的过程中,将人的视觉感知纳入考虑。
YUV is a color space typically used as part of a color image pipeline. It encodes a color image or video taking human perception into account, allowing reduced bandwidth for chrominance components, thereby typically enabling transmission errors or compression artifacts to be more efficiently masked by the human perception than using a "direct" RGB-representation. Other color spaces have similar properties, and the main reason to implement or investigate properties of Y'UV would be for interfacing with analog or digital television or photographic equipment that conforms to certain Y'UV standards.
(其中 Y‘ 表示经过 Gamma 矫正后的 Y数据)
Y'UV was invented when engineers wanted color television in a black-and-white infrastructure.
下面的图展示了,U-V 在 y=0.5情况下的调色板
一副图片中,对应的 Y‘ ,U, V数据示例:
YUV数据的抽样,色度抽样,Sampling systems and ratios:
The subsampling scheme is commonly expressed as a three part ratio J:a:b (e.g. 4:2:2), although sometimes expressed as four parts (e.g. 4:2:2:4), that describe the number of luminance and chrominance samples in a conceptual region that is J pixels wide, and 2 pixels high. The parts are (in their respective order):
• J: horizontal sampling reference (width of the conceptual region). Usually, 4.
• a: number of chrominance samples (Cr, Cb) in the first row of J pixels.
• b: number of (additional) chrominance samples (Cr, Cb) in the second row of J pixels.
• Alpha: horizontal factor (relative to first digit). May be omitted if alpha component is not present, and is equal to J when present.
An explanatory image of different chroma subsampling schemes can be seen at the following link: http://lea.hamradio.si/~s51kq/subsample.gif (source: "Basics of Video":http://lea.hamradio.si/~s51kq/V-BAS.HTM) or in details in Chrominance Subsampling in Digital Images, by Douglas Kerr.
The mapping examples given are only theoretical and for illustration. Also note that the diagram does not indicate any chroma filtering, which should be applied to avoid aliasing.
To calculate required bandwidth factor relative to 4:4:4 (or 4:4:4:4), one needs to sum all the factors and divide the result by 12 (or 16, if alpha is present).
YUV 4:2:0
4:2:0又稱I420。I420是YUV格式的一種,屬於
planar format。4:2:0并不意味着只有Y,Cb而没有Cr分量。它指的是对每行扫描线来说,只有一种色度分量以2:1的抽样率存储。相邻的扫描行存储不同的色度分量,也就是说,如果一行是4:2:0的话,下一行就是4:0:2,再下一行是4:2:0...以此类推。对每个色度分量来说,水平方向和竖直方向的抽样率都是2:1,所以可以说色度的抽样率是4:1。 PAL制式和 SECAM制式的色彩系统特别适合于用这种方式来存储。绝大多数 视频编解码器都采用这种格式作为标准的输入格式。
映射:
码流
Yo0
Uo0 Yo1 Yo2
Uo2 Yo3
Ye0
Ve0 Ye1 Ye2
Ve2 Ye3
将被映射为下面的两行各四个像素:
[Yo0
Uo0 Ve0] [Yo1
Uo0 Ve0] [Yo2 Uo2 Ve2] [Yo3 Uo2 Ve2]
[Ye0
Uo0 Ve0] [Ye1
Uo0 Ve0] [Ye2 Uo2 Ve2] [Ye3 Uo2 Ve2]
YUV 4:2:0的采样周期和存放方式:
YUV数据的存放方式
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 YUV Formats
click me |
click me |
click me |
click me |
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 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 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. |
YUY2 (and YUNV and V422 and YUYV)YUY2 is another in the family of YUV 4:2:2 formats and appears to be used by all the same codecs as UYVY.
click me |
click me |
click me |
|
Horizontal |
Vertical |
Y Sample Period |
1 |
1 |
V Sample Period |
2 |
1 |
U Sample Period |
2 |
1 |
Effective bits per pixel : 16
Positive biHeight implies top-down image (top line first)
Planar YUV Formats
click me |
click me |
click me |
click me |
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. |
关于YUV 420 平面存储方式,上面有提到过,这里不赘述。思考,彩色电视机-->黑白电视机的转变?
答:由于 YUV 420被应用于电视信号的传播,而又由于起平面存储方式(planar mode),所以彩色的信号传递给黑白电视机,黑白电视机只需要处理Y分量上的数据就可以了,而忽略掉其后的色度信息。
什么是MP3
MP3并不是指 MPEG-3,事实上MPEG标准里,MPEG-3的方案制定已经终止,废弃了。因为,Moving Picture Experts Group在准备指定MPEG-3的时候,发现MPEG-2的标准已经足够强大,所以MPEG-3被废弃了。
现在的MP3通常指,MPEG-1 or MPEG-2 Audio Layer III,对应标准号分别为,ISO/IEC 11172-3, ISO/IEC 13818-3。
MPEG-1/Audio/Layer3:
MPEG-1 Layer 3 (or MP3) is a 1- or 2-channel perceptual audio coder that provides excellent compression of music signals. Compared to Layer 1 and Layer 2 it provides a higher compression efficiency. It can typically compress high quality audio CD data by a factor of 12 while maintaining a high audio quality. In general MP3 is appropriate for applications involving storage or transmission of mono or stereo music or other audio signals. Since it is implemented on virtually all digital audio devices playback is always ensured.
MPEG-2/Audio/Layer3:
与MPEG-1该部分完全向后兼容.
MP3的常见bit rate:
MP3的常见采样频率:
MP3各个Layer的采样个数:
思考如何计算一帧MP3数据的时长?
一帧数据的时间长度 = 帧的采样个数(1152) * 采样频率(1/44100Hz)
思考如何计算mp3文件的duration,在CBR/VBR(固定bit率/可变bit率)的情况下?