Can anyone help in understanding AVFrame.linesize[]?

非 Y 不嫁゛ 提交于 2019-11-29 01:17:06
pogorskiy

In the case of planar data, such as YUV420, linesize[i] contains stride for the i-th plane.

For example, for frame 640x480 data[0] contains pointer to Y component, data[1] and data[2] contains pointers to U and V planes. In this case, linesize[0] == 640, linesize[1] == linesize[2] == 320 (because the U and V planes is less than Y plane half)

In the case of pixel data (RGB24), there is only one plane (data[0]) and linesize[0] == width * channels (640 * 3 for RGB24)

Have a look at description of video frame formats:

You will see that formats are split into two big groups: packed and planar, depending on whether the components are kept separately or interleaved. Strides have slightly different meaning for those, and basically they are number of bytes you need to skip to advance by a row.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!