From 5758f1c932297dd039356dc510a810254f52e04b Mon Sep 17 00:00:00 2001 From: tonton Th Date: Tue, 3 Sep 2019 19:35:45 +0200 Subject: [PATCH] killed a mega bug in the upscaling --- floatimg.h | 2 +- lib/fimg-core.c | 8 ++++++++ v4l2/rgb2fimg.c | 3 +-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/floatimg.h b/floatimg.h index 35e9a17..790448e 100644 --- a/floatimg.h +++ b/floatimg.h @@ -2,7 +2,7 @@ * floatimg.h */ -#define FIMG_VERSION 67 +#define FIMG_VERSION 71 /* * in memory descriptor diff --git a/lib/fimg-core.c b/lib/fimg-core.c index 421c730..c07301d 100644 --- a/lib/fimg-core.c +++ b/lib/fimg-core.c @@ -197,6 +197,14 @@ return 0; int fimg_add_rgb(FloatImg *head, int x, int y, float r, float g, float b) { int offset; + +if (head->type != FIMG_TYPE_RGB) { +#if DEBUG_LEVEL > 1 + fprintf(stderr, "%s : type %d is bad.\n", __func__, head->type); +#endif + return -1; + } + offset = x + (y * head->width); head->R[offset] += r; head->G[offset] += g; diff --git a/v4l2/rgb2fimg.c b/v4l2/rgb2fimg.c index 7cd6ba8..9e839d7 100644 --- a/v4l2/rgb2fimg.c +++ b/v4l2/rgb2fimg.c @@ -41,9 +41,8 @@ for (y=0; y