YUV格式转换---YUV420p转YUV422

void yuv420p_to_yuv422(uint8_t * yuv420[3], uint8_t * dest, int width,
                        int height)
{
    unsigned int x, y;
 
 
     for (y = 0; y < height; ++y) {
       uint8_t *Y = yuv420[0] + y * width;
        uint8_t *Cb = yuv420[1] + (y / 2) * (width / 2);
       uint8_t *Cr = yuv420[2] + (y / 2) * (width / 2);
        for (x = 0; x < width; x += 2) {
             *(dest + 0) = Y[0];
           *(dest + 1) = Cb[0];
           *(dest + 2) = Y[1];
            *(dest + 3) = Cr[0];
             dest += 4;
             Y += 2;
             ++Cb;
             ++Cr;
         }
     }
}


你可能感兴趣的:(嵌入式)