From 14801857906fe449754df4d8fc8dacf35738d5fb Mon Sep 17 00:00:00 2001 From: Carsten Weinholz Date: Thu, 25 Oct 2001 22:04:12 +0000 Subject: [PATCH] 2001-10-26 added function to create thumbnail from raw data git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@2743 67ed7778-7388-44ab-90cf-0a291f65f57c --- camlibs/stv0680/bayer.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/camlibs/stv0680/bayer.c b/camlibs/stv0680/bayer.c index e7816adaf..9494c75bd 100644 --- a/camlibs/stv0680/bayer.c +++ b/camlibs/stv0680/bayer.c @@ -47,6 +47,24 @@ void bayer_unshuffle(int w, int h, unsigned char *raw, unsigned char *output) } } +void bayer_unshuffle_preview(int w, int h, int scale, unsigned char *raw, unsigned char *output) +{ + int x, y, i, p; + int yincr = scale ? scale<<1 : 1; + + for(y = 0; y < h; y+=yincr) { + for(x = 0; x < w; ++x) { + p = (x & 1 ? raw[(y*w) + (x >> 1)] : raw[(y*w) + (x>>1) + (w >> 1)])>>scale; + + i = (((y>>scale) * w + x) * 3)>>scale; + + output[i] += p; + output[i+1] += p; + output[i+2] += p; + } + } +} + #define ISEVEN(a) (((a)&1)!=1) #define GETADD(x, y) ((3*(x))+(356*3*(y))) #define RED 0 @@ -86,3 +104,5 @@ void bayer_demosaic(int w, int h, unsigned char *image) } } + +