'디지탈 TV 관련 > 렌더링 관련' 카테고리의 다른 글

UYVY 에 대한 잡담 ...  (0) 2010.01.03
다이렉트쇼 필터구성 ...  (0) 2009.11.07

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];
}
}




MEDC 세미나 자료를 발췌했읍니다 ...


+ Recent posts