I was asked in the test on what will be the size of the video of 10 seconds displayed at 25fps assuming each chroma sample takes 4 bits, luminance component takes 8 bits and 4:2:0 chroma sampling is used in image object of 32x32 pixels?
This was my solution: 10 x 25 x (8 x 2) x (8 x 4) x 32 x 32
Was my solution correct? If not how could it be rectified?
Sorry, but your answer is wrong!
YUV420 format means that each 2x2 pixels has 2 chroma components (one U
and one V
), and 4 lumma components.
List of components of 2x2 pixels (4 pixels):
4 Y
Elements
1 U
Element
1 V
Element
A drawing may help you count:
Y Y
U,V
Y Y
Size of Y (lumma) data size in bits is:
10 x 25 x 32 x 32 x 8
= 2048000
bits
Size of U chroma data size in bits is:
(10 x 25 x 32 x 32 x 4)/4
= 256000
bits (we need to divide by 4, because each 4 pixels has only one U
element).
Size of V chroma data size in bits is the same a U: 256000
bits
Total size in bits:
10 x 25 x 32 x 32 x 8
+ 2 x (10 x 25 x 32 x 32 x 4)/4
= 2560000
bits.
Most of the time size is measured in bytes (not in bits).
Size in bytes is 2560000 / 8
= 320000
Bytes.
Other way to look at the problem is computing the average bits per pixel:
Each pixel has a Y element (8 bits).
Each 4 pixels have 1 U (4 bits) and 1 V (4 bits)
8 bits per 4 pixels, gives an average of 2 bits per pixel for chroma.
Average: 10 bits per pixel.
Total size in bits: 10 x 25 x 32 x 32 x 10
= 2560000
bits = 320000
Bytes.