diff --git a/debayer.cc b/debayer.cc index 4c6f2bd..73fe9d8 100644 --- a/debayer.cc +++ b/debayer.cc @@ -13,7 +13,7 @@ void debayer_grbg16_simple (uint16_t * src, int src_w, int src_h, uint8_t r, g, b; int ys, yd, xs, xd; - for (ys = 0, yd = 0; ys < src_h; ys++) { + for (ys = 0, yd = 0; ys < src_h && yd < dst_h; ys++, yd++) { for (xs = 0, xd = 0; xs < src_w; xs++) { /* read the pixel but only the lower 8bit */ @@ -50,7 +50,6 @@ void debayer_grbg16_simple (uint16_t * src, int src_w, int src_h, /* if the source image is too small ignore the other places */ if (xd < dst_w) dst += 3 * (dst_w - xd); - yd++; } }