图像处理算法大全(基于libyuv或IPP)----RGB24转YV12

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xjb2006/article/details/80826947

《周星星教你学ffmpeg》技巧

ipp源码:

static void RGB_2_YUV420_YV12(BYTE* pRGB24Ptr, BYTE* pYUYVPtr, int width,int height)//yuv420 //3/2:1+1/4+1/4----YU12
{
//libyuv::RGB24ToI420(pRGB24Ptr,width*3,pYUYVPtr,width,pYUYVPtr+height*width*5/4,width/2,pYUYVPtr+height*width,width/2,width,height);
DWORD dwTime=::GetTickCount();
IppiSize imgSize;
imgSize.width=width;
imgSize.height=height;
const Ipp8u* pSour[3]={pRGB24Ptr,pRGB24Ptr+height*width,pRGB24Ptr+height*width*2};
Ipp8u* pDes[3]={pYUYVPtr,pYUYVPtr+height*width*5/4,pYUYVPtr+height*width};
int Des[3]={width,width*1/2,width*1/2};//YUV420->1,1/4,1/4


int *pInt=Des;
IppStatus is =ippiBGRToYCbCr420_8u_C3P3R(pRGB24Ptr,width*3,pDes,Des,imgSize);
//IppStatus is =ippiRGBToYUV420_8u_C3P3(pRGB24Ptr,pDes,imgSize);
if(is != ippStsNoErr)
{
return;
//convert error
}
//TRACE("RGB_2_YUV422所需时间:%dms\n",::GetTickCount()-dwTime);

}


有问题联系作者QQ:35744025

猜你喜欢

转载自blog.csdn.net/xjb2006/article/details/80826947