任何人都可以帮助理解AVFrame.linesize []? [英] Can anyone help in understanding AVFrame.linesize[]?
问题描述
我试图找到 AVFrame.linesize []
的每个单元格,但是我没有找到。
I tried to find what each cell of AVFrame.linesize[]
means, but I didn't found.
据了解, linesize [0]
是宽度, linesize [1] / code>是高度。
As I understood linesize[0]
is the width, linesize[1]
is the height.
- 如果我是对的其他单元格意味着什么?
- 为什么
avcodec_decode_video2(codecCtxDecode,frameDecoded,& frameFinished,& packet);
only linesize [0]具有值,其他单元格始终为0?
- If I'm right what does other cells mean?
- why after
avcodec_decode_video2(codecCtxDecode, frameDecoded, &frameFinished, &packet);
only linesize[0] has the value and other cells are always 0?
UPDATED
我认为AVFrame.data [i]和AVFrame.linesize [i]是行中特定颜色的数据和行的长度,我是否正确?
I think AVFrame.data[i] and AVFrame.linesize[i] are the data of specific color in the row and the length of the row, am I correct?
推荐答案
在平面的情况下数据,例如 YUV420
, linesize [i]
包含 i
-th plane。
In the case of planar data, such as YUV420
, linesize[i]
contains stride for the i
-th plane.
例如,对于框架 640x480
data [ 0]
包含指向 Y
组件的指针,数据[1]
和 data [2]
包含指向 U
和 V
飞机的指针。在这种情况下, linesize [0] == 640
, linesize [1] == linesize [2] == 320
(因为 U
和 V
飞机小于 Y
平面一半)
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)
在像素数据( RGB24
)的情况下,只有一个飞机( data [0]
)和 linesize [0] == width * channels
( 640 * 3
RGB24
)
In the case of pixel data (RGB24
), there is only one plane (data[0]
) and linesize[0] == width * channels
(640 * 3
for RGB24
)
这篇关于任何人都可以帮助理解AVFrame.linesize []?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!