以640x480_420.yuv为例,正确的存储格式为一大片Y,跟着一大片U,最后是一大片V:
-------------------------640x480 point
Y(0,0) Y(0,1)... Y(0,639)
...
Y(479,0) Y(479,1)... Y(479,639)
-------------------------640x480 point
-------------------------320x240 point
U(0,0) U(0,1)... U(0,319)
...
U((239,0) U((239,1)... U((239,319)
-------------------------320x240 point
-------------------------320x240 point
V(0,0) V(0,1)... V(0,319)
...
V((239,0) V((239,1)... V((239,319)
-------------------------320x240 point
video codec design里面是这样说的:
the luminance samples for the current frame are stored in sequence,followed by the Cr samples and then the Cb samples.
下面讲的存放码流的方式不对!!!
下面八个像素为:[Y0 U0 V0] [Y1 U1 V1] [Y2 U2 V2] [Y3 U3 V3]
[Y5 U5 V5] [Y6 U6 V6] [Y7U7 V7] [Y8 U8 V8]
存放的码流为:Y0 U0 Y1 Y2 U2 Y3
Y5 V5 Y6 Y7 V7 Y8
映射出的像素点为:[Y0 U0 V5] [Y1 U0 V5] [Y2 U2 V7] [Y3 U2 V7]
[Y5 U0 V5] [Y6 U0 V5] [Y7U2 V7] [Y8 U2 V7]
(HelloPigg) |