我们要测试的文件foreman_part_qcif.yuv它包含三帧彩色图像。
以及文件foreman_part_qcif.y 注意后缀,它包含三帧灰度图像(只有y信号)
qicf文件的分辨率为176*144,并且每个分量用一个字节存储 则对于foreman_part_qcif.yuv文件,用于表达颜色的字节大小应该为:
3[帧数]*{176*144[亮度]+(1/4)*176*144[u色度信号]+(1/4)*176*144[v色度信号]}= 114048 查看该文件的大小后发现确为114,048 字节
说明该文件不同于其他图像格式的文件(bmp,jpeg等),它没有文件头,没有任何与表达颜色信号无关的内容。
用十六进制编辑器打开两个文件进行比对,如下图:
它们开始的内容是一样的。
从下面的两幅图可以看出: 两个文件从6300h(十六进制)之后开始出现不同,6300h转化为十进制是176*144=25344 刚好是y信号所占用的字节的大小。 对于文件foreman_part_qcif.yuv 它从6301h起开始排列第一帧的u信号。 对于文件foreman_part_qcif.y 它从6301h起开始排列第二帧的y信号。
由以上分析可以得出4:2:0的qcif.yuv文件的格式如下图: cif文件的分辨率为352*288, qcif即1/4的cif为176*144,
4:2:0的qcif.yuv文件结构
yuv文件不能直接在windows底下打开,通过工具YUVview可以显示该文件
|
YUV文件的具体格式:
A video sequence stored in the YUV format is stored by concatenating
consecutive frames into a single big file. Each frame contains the Y pixels
for that frame first, followed by the U pixels (actually Cr pixel), followed
by V pixels (actually Cb pixels). Each component is raster-scanned from
the top left corner down to the bottom right corner.
Each pixel value is stored as a 8 bit unsigned character.
For example, a frame in a QCIF sequence with 176x144 Y pixels and
88x72 U and V pixels is stored in the following order:
176
+-------------+
| |
| Y | 144
| |
| |
+-------------+
88
+------+
| U |
| |72
+------+
| V |
| |72
+------+