딥 네트워크 - 딥러닝 모델 분석/네트웍 통신/카메라 3A 튜닝 분야

UYVY 에 대한 잡담 ... 본문

디지탈 TV 관련/렌더링 관련

UYVY 에 대한 잡담 ...

파란새 2010. 1. 3. 17:51

UYVY

This format is the same as YUY2, except the byte order is reversed — that is, the chroma and luma bytes are flipped (Figure 7). If the image is addressed as an array of two little-endian WORD values, the first WORD contains U in the LSBs and Y0 in the MSBs, and the second WORD contains V in the LSBs and Y1 in the MSBs.

Figure 7. UYVY memory layout

Figure 7. UYVY memory layout


void yuv2yuv422(uchar *Y, uchar *U, uchar *V, uchar *output_ptr, int width, int height)
{
uint i,j;
uint pos0, pos1;

 for(i=0;i<height;i+=1)
    for(j=0;j<width;j+=2)
   {
        pos0 = i*width + j;
       pos1 = pos0 + 1;
       *output_ptr++ = Y[pos0];
       *output_ptr++ = U[pos0];
       *output_ptr++ = Y[pos1];
      *output_ptr++ = V[pos0];
    }
}




void yuv2yuv420(uchar *Y, uchar *U, uchar *V, uchar *output_ptr, int width, int height)
{
uint i,j;
uint pos0, pos1, pos2, pos3;

  for(i=0;i<height;i+=2)
for(j=0;j<width;j+=2)
{
     pos0 = i*width + j;
     pos1 = pos0 + 1;
     pos2 = pos0 + width;
     pos3 = pos2 + 1;
     *output_ptr++ = Y[pos0];
     *output_ptr++ = Y[pos1];
     *output_ptr++ = Y[pos2];
     *output_ptr++ = Y[pos3];
     *output_ptr++ = U[pos0];
     *output_ptr++ = V[pos0];
}
}