forked from tTh/FloatImg
optimize cumul videograb
This commit is contained in:
parent
4ea5294009
commit
d11947bd7c
@ -8,6 +8,8 @@ int init_device(int notused);
|
|||||||
|
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
int x_add_rgb2fimg(unsigned char *src, int w, int h, FloatImg *d);
|
||||||
|
|
||||||
int x_rgb2fimg(unsigned char *src, int w, int h, FloatImg *d);
|
int x_rgb2fimg(unsigned char *src, int w, int h, FloatImg *d);
|
||||||
int x_rgb2file(unsigned char *src, int w, int h, char *fname);
|
int x_rgb2file(unsigned char *src, int w, int h, char *fname);
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ for (i = 0; i < nbre_capt; i++) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(verbosity > 1) {
|
if(verbosity > 1) {
|
||||||
printf("%6d %5.3f\n", i, fimg_timer_get(0));
|
printf("%6d %9.3f\n", i, fimg_timer_get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -246,9 +246,15 @@ for (i = 0; i < nbre_capt; i++) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SAVE_AS_CUMUL
|
#if SAVE_AS_CUMUL
|
||||||
|
/**
|
||||||
x_rgb2fimg(buffers[buf.index].start,
|
x_rgb2fimg(buffers[buf.index].start,
|
||||||
fmt.fmt.pix.width, fmt.fmt.pix.height, &grab);
|
fmt.fmt.pix.width, fmt.fmt.pix.height, &grab);
|
||||||
fimg_add(&grab, &cumul, &cumul);
|
fimg_add(&grab, &cumul, &cumul);
|
||||||
|
**/
|
||||||
|
x_add_rgb2fimg(buffers[buf.index].start,
|
||||||
|
fmt.fmt.pix.width, fmt.fmt.pix.height, &cumul);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SAVE_AS_FIMG
|
#if SAVE_AS_FIMG
|
||||||
|
@ -9,11 +9,11 @@
|
|||||||
int x_upscaler(unsigned char *src, int w, int h, FloatImg *d)
|
int x_upscaler(unsigned char *src, int w, int h, FloatImg *d)
|
||||||
{
|
{
|
||||||
int x, y, xx, yy;
|
int x, y, xx, yy;
|
||||||
float *rp, *gp, *bp;
|
// float *rp, *gp, *bp;
|
||||||
float r, g, b;
|
float r, g, b;
|
||||||
static unsigned short modz;
|
static unsigned short modz;
|
||||||
|
|
||||||
rp = d->R, gp = d->G, bp = d->B;
|
// rp = d->R, gp = d->G, bp = d->B;
|
||||||
|
|
||||||
for (y=0; y<h; y++) {
|
for (y=0; y<h; y++) {
|
||||||
yy = (y*2) + ! (modz & 1);
|
yy = (y*2) + ! (modz & 1);
|
||||||
@ -49,6 +49,23 @@ for (iter=0; iter<size; iter++) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
|
/* --------------------------------------------------------------------- */
|
||||||
|
int x_add_rgb2fimg(unsigned char *src, int w, int h, FloatImg *d)
|
||||||
|
{
|
||||||
|
int iter, size;
|
||||||
|
float *rp, *gp, *bp;
|
||||||
|
|
||||||
|
size = w * h;
|
||||||
|
rp = d->R, gp = d->G, bp = d->B;
|
||||||
|
|
||||||
|
for (iter=0; iter<size; iter++) {
|
||||||
|
*rp++ += (float)*src++;
|
||||||
|
*gp++ += (float)*src++;
|
||||||
|
*bp++ += (float)*src++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
int x_rgb2file(unsigned char *src, int w, int h, char *fname)
|
int x_rgb2file(unsigned char *src, int w, int h, char *fname)
|
||||||
{
|
{
|
||||||
FloatImg buff;
|
FloatImg buff;
|
||||||
|
Loading…
Reference in New Issue
Block a user