[Libav-user] linesizes

Stefano Sabatini stefasab at gmail.com
Sat Oct 5 01:06:35 CEST 2013


On date Friday 2013-10-04 20:43:39 +0200, MXWendler LibAV encoded:
> 
> Hi All,
> 
> i had a look at AVPicture, and it is a tiny structure
> 
> typedef struct AVPicture {
>     uint8_t *data[4];
>     int linesize[4];       ///< number of bytes per line
> } AVPicture;
> 
> For further image processing i need the linesize, but passing the
> full struct is unhandy, since it will be passed through various api
> layers ( opengl .. opencl .. ). It would help very much in my case
> since a short calculation takes less resources than passing multiple
> parameters around.
> 

> Is there a reliable way to derive the line size from eg. resolution
> and / or pixel format? Like eg. PIX_FMT_YUV420P has three line
> entries (ycbcr), and the Y stride is XX and the cb/cr stride is half
> of that?

Of course there is, check av_image_fill_linesizes() in
libavutil/imgutils.h for example.

[...]


More information about the Libav-user mailing list