diff --git a/debayer.cc b/debayer.cc index 0c0bf3b..7c65f5d 100644 --- a/debayer.cc +++ b/debayer.cc @@ -17,7 +17,7 @@ void debayer_grbg16_simple (uint16_t * src, int src_w, int src_h, for (xs = 0, xd = 0; xs < src_w; xs++) { /* read the pixel but only the higher 8bit, assuming data is little endian */ - t = *(src++) >> 8; + t = (*(src++) >> 8) & 0xff; if (xs & 1) { if (ys & 1) { @@ -63,7 +63,7 @@ void debayer_grbg16_simple (uint16_t * src, int src_w, int src_h, #define UPRI (*(src-src_w+1)) #define DNLE (*(src+src_w-1)) #define DNRI (*(src+src_w+1)) -#define STORE *(dst++) = r; *(dst++) = g; *(dst++) = b; src++; +#define STORE *(dst++) = (r>>8)&0xff; *(dst++) = (g>>8)&0xff; *(dst++) = (b>>8) & 0xff; src++; /* @@ -77,7 +77,7 @@ void debayer_grbg16_bilinear (uint16_t * src, int src_w, int src_h, // BB GG BB GG // GG RR GG RR // BB GG BB GG - uint8_t r, g, b; + uint32_t r, g, b; int xs, ys; // start with upper left pixel (green)