It has the luma "luminance" plane Y first, then the U chroma plane and last the V chroma plane.
The two chroma planes (blue and red projections) are sub-sampled in both the horizontal and vertical dimensions by a factor of 2. That is to say, for a 2×2 square of pixels, there are 4 Y samples but only 1 U sample and 1 V sample.
This format requires 4×8+8+8=48 bits per 4 pixels, so its depth is 12 bits per pixel.
I420 is by far the most common format in VLC. Most video decoders output raw pictures in I420 format.
A graphical illustration: Each letter represents one bit.
For a single I420 pixel: YYYYYYYY UU VV
For a 50-pixel I420 frame: YYYYYYYY×50 UU×50 VV×50 (or Y×8×50 U×2×50 V×2×50 for short)
For an n-pixel I420 frame: Y×8×n U×2×n V×2×n
The NV12
Related to I420, NV12 has one luma "luminance" plane Y and one plane with U and V values interleaved.
In NV12, chroma planes (blue and red) are subsampled in both the horizontal and vertical dimensions by a factor of 2.
For a 2×2 group of pixels, you have 4 Y samples and 1 U and 1 V sample.
It can be helpful to think of NV12 as I420 with the U and V planes interleaved.
Here is a graphical representation of NV12. Each letter represents one bit:
For 1 NV12 pixel: YYYYYYYY UVUV
For a 2-pixel NV12 frame: YYYYYYYYYYYYYYYY UVUVUVUV
For a 50-pixel NV12 frame: Y×8×50 (UV)×2×50
For a n-pixel NV12 frame: Y×8×n (UV)×2×n
Hello Umezawatakeshi!
I realized that ULH0 codec has an NV12 input support, however I suprised that it can not handle the I420. Can you add support for it?
Thank you!
I think the difference between I420 and NV12 is well known for you.
https://wiki.videolan.org/YUV
The I420:
It has the luma "luminance" plane Y first, then the U chroma plane and last the V chroma plane.
The two chroma planes (blue and red projections) are sub-sampled in both the horizontal and vertical dimensions by a factor of 2. That is to say, for a 2×2 square of pixels, there are 4 Y samples but only 1 U sample and 1 V sample.
This format requires 4×8+8+8=48 bits per 4 pixels, so its depth is 12 bits per pixel.
I420 is by far the most common format in VLC. Most video decoders output raw pictures in I420 format.
A graphical illustration: Each letter represents one bit.
The NV12
Related to I420, NV12 has one luma "luminance" plane Y and one plane with U and V values interleaved.
In NV12, chroma planes (blue and red) are subsampled in both the horizontal and vertical dimensions by a factor of 2.
For a 2×2 group of pixels, you have 4 Y samples and 1 U and 1 V sample.
It can be helpful to think of NV12 as I420 with the U and V planes interleaved.
Here is a graphical representation of NV12. Each letter represents one bit: