本来想使用ffmpeg的  swscale进行色彩空间的转换的
使用时候发现对于其他色彩空间的转换问题都不是很大,
唯独进行yuv420p转rgb24的时候转出来的图像为蓝色,但是直接转化为rgb32则色彩空间是正确的
没搞懂 真的很困惑
贴出代码        int nRet = 0 ;
nRet = av_image_alloc(pSrcBuff,nLines,nSrcWidth,nSrcHeight,AV_PIX_FMT_YUV420P,1) ; nDstBuffLen = av_image_alloc(pDstBuff,nDstLines,176,144,AV_PIX_FMT_RGB24,1) ;
if (nDstBuffLen<=0)
{
return -1 ;
} SwsContext *sws_ctx;
sws_ctx = sws_getContext(nSrcWidth, nSrcHeight, AV_PIX_FMT_YUV420P,
176, 144, AV_PIX_FMT_RGB24,
SWS_BILINEAR, NULL, NULL, NULL); HGFile srcFile,dstFile;
bFlag = srcFile.OpenFile("yuv800600.yuv",FALSE,&dError) ;
srcFile.ReadFile(pBuffer,nSrcHeight*nSrcWidth*3/2,dRead,NULL) ;
if (dRead!=(nSrcWidth*nSrcHeight*3/2))
{
return -1 ;
}
av_image_fill_arrays(pSrcBuff,nLines,pBuffer,AV_PIX_FMT_YUV420P,nSrcWidth,nSrcHeight,1) ;
int nTemp = sws_scale(sws_ctx,pSrcBuff,
nLines, 0, nSrcHeight, pDstBuff,nDstLines); dstFile.OpenFile("yrgb8.yuv",TRUE,NULL) ;
dstFile.WriteFile(pDstBuff[0],nDstBuffLen,dRead,NULL) ;
dstFile.CloseFile() ;ffmpeg