Reputation: 8176
This is the exerpt from the famous V4l2 Api specification.But I am not able to understand the YUYV also known as YUV422 format representation. Can some one plz explain this here.
Here is the excerpt :
Example 2-1. V4L2_PIX_FMT_YUYV 4 × 4 pixel image
Byte Order. Each cell is one byte.
start + 0: Y’00 Cb00 Y’01 Cr00 Y’02 Cb01 Y’03 Cr01
start + 8: Y’10 Cb10 Y’11 Cr10 Y’12 Cb11 Y’13 Cr11
start + 16: Y’20 Cb20 Y’21 Cr20 Y’22 Cb21 Y’23 Cr21
start + 24: Y’30 Cb30 Y’31 Cr30 Y’32 Cb31 Y’33 Cr31
Each Y goes to one of the pixels, and the Cb and Cr belong to both pixels. What is the representation of Cell and Pixel here. How is the pixel being represented here. How we can represent it programmatically.
Plz explain. Rgds, Softy
Upvotes: 1
Views: 3396
Reputation: 31304
YUV422 is an interleaved format that stores Y-information at a higher (double) resolution than the U&V (Cb&Cr) channels. each cell consists of 4 bytes, that stores Y/U/V vaLues for 2 pixels:
unsigned char*cell={127, 52, 139, 170};
unsigned char pixel0[3], pixel1[3];
pixel0[0]=cell[0]; // Y0
pixel0[1]=cell[1]; // U
pixel0[2]=cell[3]; // V
pixel1[0]=cell[2]; // Y1
pixel1[1]=cell[1]; // U
pixel1[2]=cell[3]; // V
as you can see, there is no direct representation of a single pixel.
Upvotes: 2