Compare commits
No commits in common. "d11947bd7ce77bf1ebb4f5fb603c5e11b702c69b" and "db037c5d12681cda2d9a53bbbd0ef1aabbb4b6fa" have entirely different histories.
d11947bd7c
...
db037c5d12
@ -3,13 +3,3 @@
|
||||
-------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
<paulk-leonov> tth: en faisant de la revue de patch sur V4L2, j'apprends
|
||||
que V4L2_FMT_FLAG et V4L2_PIX_FMT_FLAG n'ont rien à voir:
|
||||
le premier concerne le champ flags de la structure de l'ioctl enum_fmt
|
||||
et le second le champ flag de la structure de g_fmt.
|
||||
|
||||
|
@ -8,8 +8,6 @@ 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_rgb2file(unsigned char *src, int w, int h, char *fname);
|
||||
|
||||
|
@ -91,15 +91,15 @@ struct timeval tv;
|
||||
int r, fd = -1;
|
||||
unsigned int i, n_buffers;
|
||||
char *dev_name = "/dev/video0";
|
||||
|
||||
char out_name[256];
|
||||
FILE *fout;
|
||||
struct buffer *buffers;
|
||||
|
||||
int foo, bar;
|
||||
double period = 10.0; /* delai entre les captures */
|
||||
int period = 10; /* delai entre les captures */
|
||||
int nbre_capt = 1; /* nombre de captures */
|
||||
int opt;
|
||||
double t_final;
|
||||
double t_debut, t_final;
|
||||
char *dest_dir = "."; /* no trailing slash */
|
||||
char *outfile = "out.pnm";
|
||||
|
||||
@ -114,14 +114,13 @@ while ((opt = getopt(argc, argv, "d:hn:o:O:p:v")) != -1) {
|
||||
case 'n': nbre_capt = atoi(optarg); break;
|
||||
case 'O': dest_dir = optarg; break;
|
||||
case 'o': outfile = optarg; break;
|
||||
case 'p': period = 1e6*atof(optarg); break;
|
||||
case 'p': period = atoi(optarg); break;
|
||||
case 'v': verbosity++; break;
|
||||
}
|
||||
}
|
||||
|
||||
if (verbosity) {
|
||||
fprintf(stderr, "running %s pid=%d\n", argv[0], getpid());
|
||||
fprintf(stderr, "period is %.3f microseconds\n", period);
|
||||
}
|
||||
|
||||
fd = v4l2_open(dev_name, O_RDWR | O_NONBLOCK, 0);
|
||||
@ -173,7 +172,7 @@ for (n_buffers = 0; n_buffers < req.count; ++n_buffers) {
|
||||
}
|
||||
}
|
||||
|
||||
(void)fimg_timer_set(0);
|
||||
t_debut = fimg_timer_set(0);
|
||||
|
||||
for (i = 0; i < n_buffers; ++i) {
|
||||
CLEAR(buf);
|
||||
@ -219,11 +218,6 @@ for (i = 0; i < nbre_capt; i++) {
|
||||
return errno;
|
||||
}
|
||||
|
||||
if(verbosity > 1) {
|
||||
printf("%6d %9.3f\n", i, fimg_timer_get(0));
|
||||
}
|
||||
|
||||
|
||||
CLEAR(buf);
|
||||
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
buf.memory = V4L2_MEMORY_MMAP;
|
||||
@ -246,15 +240,9 @@ for (i = 0; i < nbre_capt; i++) {
|
||||
#endif
|
||||
|
||||
#if SAVE_AS_CUMUL
|
||||
/**
|
||||
x_rgb2fimg(buffers[buf.index].start,
|
||||
fmt.fmt.pix.width, fmt.fmt.pix.height, &grab);
|
||||
fimg_add(&grab, &cumul, &cumul);
|
||||
**/
|
||||
x_add_rgb2fimg(buffers[buf.index].start,
|
||||
fmt.fmt.pix.width, fmt.fmt.pix.height, &cumul);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#if SAVE_AS_FIMG
|
||||
@ -265,8 +253,8 @@ for (i = 0; i < nbre_capt; i++) {
|
||||
out_name);
|
||||
#endif
|
||||
|
||||
if (nbre_capt > 1 && period > 1.0) {
|
||||
usleep(period);
|
||||
if (nbre_capt > 1 && period) {
|
||||
sleep(period);
|
||||
}
|
||||
|
||||
xioctl(fd, VIDIOC_QBUF, &buf);
|
||||
|
@ -9,11 +9,11 @@
|
||||
int x_upscaler(unsigned char *src, int w, int h, FloatImg *d)
|
||||
{
|
||||
int x, y, xx, yy;
|
||||
// float *rp, *gp, *bp;
|
||||
float *rp, *gp, *bp;
|
||||
float r, g, b;
|
||||
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++) {
|
||||
yy = (y*2) + ! (modz & 1);
|
||||
@ -49,23 +49,6 @@ for (iter=0; iter<size; iter++) {
|
||||
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)
|
||||
{
|
||||
FloatImg buff;
|
||||
|
Loading…
Reference in New Issue
Block a user