[FFmpeg-user] AVFrame, AV_NUM_DATA_POINTERS

James Darnley james.darnley at gmail.com
Sun Sep 27 22:31:11 EEST 2020


On 27/09/2020, Mark Filipak (ffmpeg) <markfilipak at bog.us> wrote:
>  From https://www.ffmpeg.org/doxygen/trunk/frame_8h_source.html#l00309
> typedef struct AVFrame {
> #define AV_NUM_DATA_POINTERS 8
> /**
> * pointer to the picture/channel planes.
> * This might be different from the first allocated byte
> *
> * Some decoders access areas outside 0,0 - width,height...
>
> 1, Are samples & lines actually indexed from zero? I ask because, if so,
> then shouldn't the extents
> should be 0,0 - (width-1),(height-1)? -- the descrepancy makes me unsure how
> to interpret what I read.

Yes, from 0.  Everything in C is indexed from 0 because they are
pointer offsets.  Maybe that document should say what you suggest.

> 2, Are the width & height indexes in bytes or samples? If bytes, how are
> 8-bit v. 10-bit v. 12-bit
> pixel formats handled at the index generation end?

Width and height are given in pixels.  How that relates to bytes in
memory depends on the pixel format.  Different planes can have
different sizes like in the extremely common yuv420p.  Byte order
(endianess) of larger samples depends on the pixel format (but it is
usually native).  The number of bytes used for a sample is given in
the pixel format.  The bits are in the low N bits.


More information about the ffmpeg-user mailing list