在iOS中,如何将y平面,u平面和uv平面与yuv双平面分开? [英] How seperate y-planar, u-planar and uv-planar from yuv bi planar in ios?

查看:123
本文介绍了在iOS中,如何将y平面,u平面和uv平面与yuv双平面分开?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在应用程序中,我使用了AVCaptureVideo.我获得了kCVPixelFormatType_420YpCbCr8BiPlanarFullRange格式的视频.

In application i used AVCaptureVideo. i got video in kCVPixelFormatType_420YpCbCr8BiPlanarFullRange format.

现在我从imagebuffer获得y平面和uv平面.

now i am getting y-planar and uv-planar from imagebuffer.

  CVPlanarPixelBufferInfo_YCbCrBiPlanar *planar = CVPixelBufferGetBaseAddress(imageBuffer);

    size_t y-offset = NSSwapBigLongToHost(planar->componentInfoY.offset);
    size_t uv-offset = NSSwapBigLongToHost(planar->componentInfoCbCr.offset);

这里yuv是双平面格式(y + UV).

here yuv is biplanar format(y+UV).

什么是紫外线平面?是uuuu,yyyy格式还是uvuvuvuv格式? 如何分别获得u平面和y平面?

what is UV-planar? is this uuuu,yyyy format or uvuvuvuv format? How to i get u-planar and y-planar seperatly?

有人可以帮助我吗?

推荐答案

Y平面表示亮度分量,而UV平面表示Cb和Cr色度分量.

The Y plane represents the luminance component, and the UV plane represents the Cb and Cr chroma components.

对于kCVPixelFormatType_420YpCbCr8BiPlanarFullRange格式,您会发现亮度平面为8bpp,与视频尺寸相同,色度平面为16bpp,但仅为原始视频尺寸的四分之一.在此平面上,每个像素将具有一个Cb和一个Cr成分.

In the case of kCVPixelFormatType_420YpCbCr8BiPlanarFullRange format, you will find the luma plane is 8bpp with the same dimensions as your video, your chroma plane will be 16bpp, but only a quarter of the size of the original video. You will have one Cb and one Cr component per pixel on this plane.

因此,如果您输入的视频为352x288,则Y平面将为352x288 8bpp,而CbCr为176x144 16bpp.得出的数据量与12bpp 352x288图像大约相同,仅为RGB888的一半,但仍小于RGB565.

so if your input video is 352x288, your Y plane will be 352x288 8bpp, and your CbCr 176x144 16bpp. This works out to be about the same amount of data as a 12bpp 352x288 image, half what would be required for RGB888 and still less than RGB565.

因此在缓冲区中,Y看起来像这样 [YYYYY . . . ] 和紫外线 [UVUVUVUVUV . . .]

So in the buffer, Y will look like this [YYYYY . . . ] and UV [UVUVUVUVUV . . .]

vs RGB当然是 [RGBRGBRGB . . . ]

vs RGB being, of course, [RGBRGBRGB . . . ]

这篇关于在iOS中,如何将y平面,u平面和uv平面与yuv双平面分开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆