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
This commit is contained in:
Carsten Weinholz
2001-10-25 22:04:12 +00:00
parent 19ab908721
commit 1480185790

View File

@@ -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)
}
}