以前在解码indeo video的时候,用到了yvu9,这个比较少见,一般输出驱动都是yuv420或者yuv422,需要转化下:
#include
void yvu9_to_yuv422(uint8_t * yvu90,uint8_t *yvu91, uint8_t *yvu92, uint8_t * dest, int width, int height)
{
unsigned int x, y;
for (y = 0; y < height; ++y) {
uint8_t *Y = yvu90 + y * width;
uint8_t *Cb = yvu91 + (y >> 2) * (width >> 2);
uint8_t *Cr = yvu92 + (y >> 2) * (width >> 2);
for (x = 0; x < width; x += 4) {
*(dest + 0) = Y[0];
*(dest + 1) = Cb[0];
*(dest + 2) = Y[1];
*(dest + 3) = Cr[0];
*(dest + 4) = Y[2];
*(dest + 5) = Cb[0];
*(dest + 6) = Y[3];
*(dest + 7) = Cr[0];
dest += 8;
Y += 4;
++Cb;
++Cr;
}
}
}
阅读(879) | 评论(0) | 转发(0) |