diff -Naur camorama-0.16/src/filter.c camorama-0.16.new/src/filter.c --- camorama-0.16/src/filter.c 2003-01-16 13:18:47.000000000 -0500 +++ camorama-0.16.new/src/filter.c 2006-04-20 00:44:12.000000000 -0400 @@ -6,34 +6,6 @@ /* LIMIT: convert a 16.16 fixed-point value to a byte, with clipping. */ #define LIMIT(x) ((x)>0xffffff?0xff: ((x)<=0xffff?0:((x)>>16))) -unsigned char yuv420p_to_rgb(unsigned char *image, unsigned char *temp, int x, int y, int z) -{ - const int numpix = x * y; - const int bytes = z; // (z*8) >> 3; - int i, j, y00, y01, y10, y11, u, v; - unsigned char *pY = image; - unsigned char *pU = pY + numpix; - unsigned char *pV = pU + numpix / 4; - unsigned char *image2 = temp; - - for(j = 0; j <= y - 2; j += 2) { - for(i = 0; i <= x - 2; i += 2) { - y00 = *pY; - y01 = *(pY + 1); - y10 = *(pY + x); - y11 = *(pY + x + 1); - u = (*pU++) - 128; - v = (*pV++) - 128; - - move_420_block(y00, y01, y10, y11, u, v, x, image2, z * 8); - - pY += 2; - image2 += 2 * bytes; - } - pY += x; - image2 += x * bytes; - } -} static inline void move_420_block(int yTL, int yTR, int yBL, int yBR, int u, int v, int rowPixels, unsigned char *rgb, int bits) { @@ -103,6 +75,34 @@ | (LIMIT(r + yBR) & 0xF8); } } +unsigned char yuv420p_to_rgb(unsigned char *image, unsigned char *temp, int x, int y, int z) +{ + const int numpix = x * y; + const int bytes = z; // (z*8) >> 3; + int i, j, y00, y01, y10, y11, u, v; + unsigned char *pY = image; + unsigned char *pU = pY + numpix; + unsigned char *pV = pU + numpix / 4; + unsigned char *image2 = temp; + + for(j = 0; j <= y - 2; j += 2) { + for(i = 0; i <= x - 2; i += 2) { + y00 = *pY; + y01 = *(pY + 1); + y10 = *(pY + x); + y11 = *(pY + x + 1); + u = (*pU++) - 128; + v = (*pV++) - 128; + + move_420_block(y00, y01, y10, y11, u, v, x, image2, z * 8); + + pY += 2; + image2 += 2 * bytes; + } + pY += x; + image2 += x * bytes; + } +} void fix_colour(char *image, int x, int y) {