I am playing with video encoding using LibAV and unable to understand the purpose of linesize
.
For e.g., declaration of av_image_alloc
function in LibAV takes linesizes as arguments:
int av_image_alloc ( uint8_t * pointers[4],
int linesizes[4],
int w,
int h,
enum AVPixelFormat pix_fmt,
int align
)
I am new to LibAV and video encoding. Feel free to provide any link which can also give me little background of video encoding.
This function will allocate a buffer large enough to hold image data splitting it into one or more component arrays (planes). Depending on format, size of the line of the each picture component will have its own width (in bytes) (which may be much smaller or much larger than image width) and will also be padded to achieve the specified alignment (16 bytes typically to make vector instructions work). For example with typical YCbCr image with 4:2:0 subsampling there will be 3 planes (that is 3 non-null pointers stored in pointers
) and width of the luma plane line will be (padded) image width, width of the each chroma component lines will be (padded) half image width.
Also note that both pointers
and linesizes
in this function are out pointer parameters, not arrays.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With