0

CVPixelBufferGetWidth(pixelbuffer)和和CVPixelBufferGetWidthOfPlane(pixelbuffer, 0)之间 有什么区别吗?CVPixelBufferGetHeight(pixelbuffer)CVPixelBufferGetHeightOfPlane(pixelbuffer, 0)

我搜索维基,它说:

As with most Y′UV formats, there are as many Y′ values as there are pixels.

它并没有说 y 的值对于所有格式都是相等的图像宽度。

因此,如果

CVPixelBufferGetWidth(pixelbuffer) == CVPixelBufferGetWidthOfPlane(pixelbuffer, 0)

CVPixelBufferGetHeight(pixelbuffer) == CVPixelBufferGetHeightOfPlane(pixelbuffer, 0)
4

1 回答 1

1

并非所有像素缓冲区都是平面的(也就是说,包含多个数据平面,就像 YUV 缓冲区的情况一样)。CVPixelBufferIsPlanar在决定使用哪个函数查询宽度/高度之前,请检查您的是否是。(当然,如果您从始终是平面的源获取缓冲区,您可以安全地跳过该检查。)

CVPixelBufferGetWidthOfPlane注意,当传递非平面缓冲区时,它总是返回零。在这种情况下,返回值(对于平面 0)不应等于 的返回值CVPixelBufferGetWidth

于 2019-04-30T06:58:10.070 回答