[vlc-devel] pixel_bits and pixel_size ?

Laurent Aimar fenrir at elivagar.org
Sat Mar 17 19:54:38 CET 2012

On Sat, Mar 17, 2012 at 08:33:22PM +0200, Rémi Denis-Courmont wrote:
> 	Hello,
> I don't understand what pixel_bits and pixel_size are supposed to represent. 
> Is it the number of bits per pixel on the first plane? Shouldn't it be a per-
> plane rather than per-chroma value?
The names are not perfect, suggestions are welcome :)

In vlc_chroma_description_t:
pixel_bits is the number of bits per pixel (on a line) for a given plane
pixels_size is the number of bytes per pixel (on a line) for a given plane
given that the number of pixels on a line is the same as the width (scaled
by the sampling ratio for the plane).

For standard I420: pixel_bits = 8, pixels_size 1
For 10 bit I420: pixel_bits = 10, pixels_size 2
For YUY2: pixel_bits = 16, pixels_size = 2
Thoses are pretty logical in my opinion (given the definition).

For NV12: pixel_bits = 8, pixels_size = 1
This one is buggy, but the picture allocation works as the UV plane
is declared as not sub sampled. I think it should be changed to:

Y: pixel_bits = 8, pixels_size = 1
UV: pixel_bits = 16, pixels_size = 2, w_num = 1, w_den = 2
but it would force to move the pixel_bits/pixels_size per plane just for this
one, which make use of them more complicated.

So, the current definitions/values work for the picture allocation.
For a user (eg: when implementing a filter), thoses values are only usefull
for planar formats IMHO as packed/semi-packed format usually need dedicated
code :(


More information about the vlc-devel mailing list