//pYUV为422,yuv为420
int YUV422To420(unsigned char *pYUV, unsigned char*yuv, int lWidth, int lHeight)
{
int i,j;
unsigned char*pY = yuv;
unsigned char *pU = yuv + lWidth*lHeight;
unsigned char *pV = pU + (lWidth*lHeight)/4;
unsigned char *pYUVTemp = pYUV;
unsigned char *pYUVTempNext = pYUV+lWidth*2;
for(i=0; i
{
for(j=0; j
{
pY[j] = *pYUVTemp++;
pY[j+lWidth] = *pYUVTempNext++;
pU[j/2] =(*(pYUVTemp) + *(pYUVTempNext))/2;
pYUVTemp++;
pYUVTempNext++;
pY[j+1] = *pYUVTemp++;
pY[j+1+lWidth] = *pYUVTempNext++;
pV[j/2] =(*(pYUVTemp) + *(pYUVTempNext))/2;
pYUVTemp++;
pYUVTempNext++;
}
pYUVTemp+=lWidth*2;
pYUVTempNext+=lWidth*2;
pY+=lWidth*2;
pU+=lWidth/2;
pV+=lWidth/2;
}
return 1;
}
阅读(5331) | 评论(0) | 转发(1) |