summaryrefslogtreecommitdiff
path: root/libgphoto2/bayer.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgphoto2/bayer.c')
-rw-r--r--libgphoto2/bayer.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libgphoto2/bayer.c b/libgphoto2/bayer.c
index 3ba72ba6c..36414017e 100644
--- a/libgphoto2/bayer.c
+++ b/libgphoto2/bayer.c
@@ -31,6 +31,7 @@
#include "config.h"
#include "bayer.h"
+#include <gphoto2/gphoto2-port-log.h>
#include <gphoto2/gphoto2-result.h>
static const int tile_colours[8][4] = {
@@ -78,6 +79,7 @@ gp_bayer_expand (unsigned char *input, int w, int h, unsigned char *output,
int colour, bayer;
unsigned char *ptr = input;
+ gp_log (GP_LOG_DEBUG, "bayer", "w=%d, h=%d\n", w, h);
switch (tile) {
case BAYER_TILE_RGGB:
@@ -148,6 +150,8 @@ gp_bayer_interpolate (unsigned char *image, int w, int h, BayerTile tile)
int p0, p1, p2;
int value, div ;
+ if (w < 2 || h < 2) return GP_ERROR;
+
switch (tile) {
default:
case BAYER_TILE_RGGB: