gpt4 book ai didi

c++ - LibAV 中的 `linesize` 是什么

转载 作者:搜寻专家 更新时间:2023-10-31 00:52:02 25 4
gpt4 key购买 nike

我正在使用 LibAV 进行视频编码,无法理解 linesize 的用途。

例如,LibAV 中 av_image_alloc 函数的声明将行大小作为参数:

int av_image_alloc  (   uint8_t *   pointers[4],
int linesizes[4],
int w,
int h,
enum AVPixelFormat pix_fmt,
int align
)

我是 LibAV 和视频编码的新手。请随意提供任何链接,这也可以给我一些视频编码的背景知识。

最佳答案

linesize 是内存中每个颜色 channel 的图像宽度。对于内存对齐问题,它可能大于或等于 w

检查 ffmpeg av frame doc :

For video the linesizes should be multiples of the CPUs alignment preference, this is 16 or 32 for modern desktop CPUs. Some code requires such alignment other code can be slower without correct alignment, for yet other it makes no difference.

The linesize may be larger than the size of usable data – there may be extra padding present for performance reasons.

关于c++ - LibAV 中的 `linesize` 是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53257213/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com