现在的位置: 首页 > 综合 > 正文

Yuv420转换成Yuv422算法源代码

2018年01月29日 ⁄ 综合 ⁄ 共 628字 ⁄ 字号 评论关闭

void convert_yuv420p_to_yuv422_my(unsigned char *src,\
    unsigned char *dst, int width,int height)
{
 int i, j;
 unsigned char *pY420_0 = src;
 unsigned char *pY420_1 = src +width;
 unsigned char *pU420 = src + width*height;
 unsigned char *pV420 = src + width*height*5/4;
 unsigned char *pY422_0 = dst;
 unsigned char *pY422_1 = dst+width*2;

 
 for (i = 0; i < height/2; i++)
 {

  for (j = 0; j < width*2; j +=4)
  {
   *pY422_0++ = *pV420;
   *pY422_1++ = *pV420++;
   *pY422_0++ = *pY420_0++;
   *pY422_1++ = *pY420_1++;
   
   *pY422_0++ = *pU420;
   *pY422_1++ = *pU420++;
   *pY422_0++ = *pY420_0++;
   *pY422_1++ = *pY420_1++;   
  }

  pY420_0 +=width;
  pY420_1 +=width;
  pY422_0+=width*2;
  pY422_1+=width*2; 
  
 } 
 } 

抱歉!评论已关闭.