From 36b734d58bdf6dc99e1c71b360162a9937af3d9c Mon Sep 17 00:00:00 2001 From: Stefan Jahn Date: Wed, 30 Nov 2022 21:05:40 +0100 Subject: [PATCH] Small fix for bilinear debayering --- debayer.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/debayer.cc b/debayer.cc index 2bd919a..0c0bf3b 100644 --- a/debayer.cc +++ b/debayer.cc @@ -60,9 +60,9 @@ void debayer_grbg16_simple (uint16_t * src, int src_w, int src_h, #define LE (*(src-1)) #define RI (*(src+1)) #define UPLE (*(src-src_w-1)) -#define UPRI (*(src-src_w+11)) +#define UPRI (*(src-src_w+1)) #define DNLE (*(src+src_w-1)) -#define DNRI (*(src+src_w+11)) +#define DNRI (*(src+src_w+1)) #define STORE *(dst++) = r; *(dst++) = g; *(dst++) = b; src++; @@ -106,7 +106,7 @@ void debayer_grbg16_bilinear (uint16_t * src, int src_w, int src_h, b = DNLE; STORE; - // got through the "body" of the image + // go through the "body" of the image for (ys = 1; ys < src_h - 1; ys+=2) { // every second line with BB GG BB GG (start at 2nd line) @@ -151,6 +151,7 @@ void debayer_grbg16_bilinear (uint16_t * src, int src_w, int src_h, r = (LE + RI) / 2; g = CE; b = (UP + DN) / 2; + STORE; } // last pixel in line (red) r = CE;