问题描述
nRet = av_image_alloc(pSrcBuff,nLines,nSrcWidth,nSrcHeight,AV_PIX_FMT_YUV420P, 16 ); nDstBuffLen = av_image_alloc(pDstBuff,nDstLines,nSrcWidth,nSrcHeight,AV_PIX_FMT_RGB24, 1 ); if (nDstBuffLen< = 0 ) { return -1; } SwsContext * sws_ctx; sws_ctx = sws_getContext(nSrcWidth,nSrcHeight,AV_PIX_FMT_YUV420P, nSrcWidth,nSrcHeight,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)) { 返回 -1; } av_image_fill_arrays(pSrcBuff,nLines,pBuffer,AV_PIX_FMT_YUV420P,nSrcWidth,nSrcHeight, 16 ); int nTemp = sws_scale(sws_ctx,( const uint8_t * const *)pSrcBuff, nLines, 0 ,nSrcHeight,pDstBuff,nDstLines); BYTE * pTemp = NULL; dstFile.OpenFile( yrgb0.rgb,TRUE,NULL) ; dstFile.WriteFile(pDstBuff [ 0 ],nDstBuffLen,dRead,NULL);
i希望将颜色格式从yuv420p转换为rgb24 我用的是ffmpeg swscal.lib 结果有问题 图片显示蓝色