Ios CVPixelBufferGetWidth(pixelbuffer)和CVPixelBufferGetWidthOfPlane(pixelbuffer,0)之间有什么区别?
Ios CVPixelBufferGetWidth(pixelbuffer)和CVPixelBufferGetWidthOfPlane(pixelbuffer,0)之间有什么区别?,ios,swift,yuv,cvpixelbuffer,Ios,Swift,Yuv,Cvpixelbuffer,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. 它并没
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)
及
并非所有像素缓冲区都是平面的(即,与YUV缓冲区一样,包含多个数据平面)。在决定使用哪个函数查询宽度/高度之前,请检查您的函数是否正确。(当然,如果从始终是平面的源获取缓冲区,则可以安全地跳过该检查。)
docs for注意到,当传递非平面缓冲区时,它总是返回零。在这种情况下,返回值(对于平面0)不应等于。如果像素缓冲区是平面的,则在iOS平台中为CVPixelBufferGetWidth(pixelbuffer)==CVPixelBufferGetWidthOfPlane(pixelbuffer,0)
CVPixelBufferGetHeight(pixelbuffer) == CVPixelBufferGetHeightOfPlane(pixelbuffer, 0)