From e1f9d581c442134fc67bf465f5e5e22a8013020f Mon Sep 17 00:00:00 2001 From: Stefan Jahn Date: Wed, 30 Nov 2022 20:57:24 +0100 Subject: [PATCH] Enable files >2GB on 32bit systems; some fix for simple debayering --- debayer.cc | 8 ++++---- videodev-dumpfile.cc | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/debayer.cc b/debayer.cc index 73fe9d8..2bd919a 100644 --- a/debayer.cc +++ b/debayer.cc @@ -16,8 +16,8 @@ void debayer_grbg16_simple (uint16_t * src, int src_w, int src_h, 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 */ - t = *(src++) & 0x00FF; + /* read the pixel but only the higher 8bit, assuming data is little endian */ + t = *(src++) >> 8; if (xs & 1) { if (ys & 1) { @@ -40,9 +40,9 @@ void debayer_grbg16_simple (uint16_t * src, int src_w, int src_h, /* only paint the image if the source is within the destination */ if (xd < dst_w) { /* set the pixel */ - *(dst++) = b; - *(dst++) = g; *(dst++) = r; + *(dst++) = g; + *(dst++) = b; xd++; } } diff --git a/videodev-dumpfile.cc b/videodev-dumpfile.cc index fa4ac55..0859820 100644 --- a/videodev-dumpfile.cc +++ b/videodev-dumpfile.cc @@ -7,6 +7,10 @@ * This is needed only for debugging. ************************************************************************************/ +/* enable files > 2GB on 32 bit systems */ +#define _LARGEFILE64_SOURCE 1 +#define _FILE_OFFSET_BITS 64 + #include #include #include