From 0b7a1c267eb02c1a7d2d5775b498e1de392a04b5 Mon Sep 17 00:00:00 2001 From: Steffen Date: Tue, 20 Jan 2026 17:21:50 +0000 Subject: [PATCH] uhh it is not working --- debayer.cc | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/debayer.cc b/debayer.cc index 04028ea..a2a3e99 100644 --- a/debayer.cc +++ b/debayer.cc @@ -206,7 +206,7 @@ void debayer_grbg8_simple (uint8_t * src, int src_w, int src_h, // GG RR // BB GG uint8_t t; - uint8_t r, g, b; + uint16_t r, g, b; int ys, yd, xs, xd; for (ys = 0, yd = 0; ys < src_h && yd < dst_h; ys++, yd++) { @@ -370,6 +370,7 @@ void debayer_grbg8_bilinear (uint8_t * src, int src_w, int src_h, STORE8; } +int MAX(int a, int m) { if (a > m) return m; else return a; }; void debayer_rggb10packet_simple (uint8_t * src, int src_w, int src_h, uint8_t * dst, int dst_w, int dst_h) { @@ -383,10 +384,10 @@ void debayer_rggb10packet_simple (uint8_t * src, int src_w, int src_h, printf ("%s:%d src size:%dx%d dst size:%dx%d\n", __FILE__, __LINE__, src_w, src_h, dst_w, dst_h); - // RR GG RR GG RR - // GG BB GG BB GG - // RR GG RR GG RR - // GG BB GG BB GG + // RR GG RR GG HH RR + // GG BB GG BB HH GG + // RR GG RR GG HH RR + // GG BB GG BB HH GG for (ys = 0, yd = 0, psrc = src, pdst = dst; ys < dst_h; ys++, yd++) { @@ -425,12 +426,18 @@ void debayer_rggb10packet_simple (uint8_t * src, int src_w, int src_h, printf ("debayer error. dpst out of bounds size:%dx%d pos:%dx%d \n", dst_w, dst_h, xd, yd); } if ((ys == 10 || ys == 11) && xs < 10) printf ("%dx%d - %d, %d, %d\n", xs, ys, r, g, b); - pdst[0] = r; - pdst[1] = g; - pdst[2] = b; + pdst[0] = MAX(r, 0xff); + pdst[1] = MAX(g, 0xff); + pdst[2] = MAX(b, 0xff); + + if (yd < 100 && xd < 300) { + pdst[0] = 0; if (xd < 100) pdst[0] = 255; + pdst[1] = 0; if (xd > 100 && xd < 200) pdst[1] = 255; + pdst[2] = 0; if (xd > 200 && xd < 300) pdst[2] = 255; + } + pdst += 3; psrc++; - // if (xs >= src_w -1) psrc += src_w / 4; if (xs && (xs % 4 == 0)) psrc++; } } */