YV12转RGB24

来源:互联网 发布:类似于朱炫的知乎 编辑:程序博客网 时间:2024/06/05 22:52
static void yv12_to_rgb24 (unsigned char *src, unsigned char *dest, int width, int height){register int i, j;register int y0, y1, u, v;register int r, g, b;register unsigned char *s[3];s[0] = src;s[1] = s[0] + width*height;s[2] = s[1] + width*height/4;for (i = 0; i < height; i++) {for (j = 0; j < width/2; j++) {y0 = *(s[0])++;y1 = *(s[0])++;if (i % 2 == 0 ) {u = *(s[1])++ - 128;v = *(s[2])++ - 128;}YUV2RGB (y0, u, v, r, g, b);*dest++ = r;*dest++ = g;*dest++ = b;YUV2RGB (y1, u, v, r, g, b);*dest++ = r;*dest++=g;*dest++=b;}}}

0 0
原创粉丝点击