Compare commits

..

No commits in common. "71205d4ab08bbedb0e922f7e5687a6d50ffea607" and "db0590744750b9775be798eec62c5352bb612c5f" have entirely different histories.

3 changed files with 27 additions and 38 deletions

View File

@ -100,7 +100,7 @@ int random_blocks(FloatImg *picture, int percent)
{ {
int x, y; int x, y;
if ( (picture->width%16) || (picture->height%16) ) if ( (picture->width%16) || (picture->height%8) )
{ {
fprintf(stderr, "%s: %d%d bad dims\n", __func__, fprintf(stderr, "%s: %d%d bad dims\n", __func__,
picture->width, picture->height); picture->width, picture->height);
@ -173,7 +173,9 @@ h = picz->height; w = picz->width;
for (y=BB; y<h-BB; y++) { for (y=BB; y<h-BB; y++) {
dy = (float)y * omega; /* normalize vertical position */ dy = (float)y * omega; /* normalize vertical position */
x = xpos + x_delta(dy, phi); /* add sinus deviation */ x = xpos + x_delta(dy, phi); /* add sinus deviation */
/* compute bounding box */ /* compute bounding box */
if ( (x>BB) && (x<w-BB) ) { if ( (x>BB) && (x<w-BB) ) {
/* an make the glitch */ /* an make the glitch */
@ -182,6 +184,7 @@ for (y=BB; y<h-BB; y++) {
if (rand() & 8) if (rand() & 8)
fimg_plot_rgb(picz, x-1, y, fv, fv, fv); fimg_plot_rgb(picz, x-1, y, fv, fv, fv);
if (rand() & 8) if (rand() & 8)
// XXX else
fimg_plot_rgb(picz, x+1, y, fv, fv, fv); fimg_plot_rgb(picz, x+1, y, fv, fv, fv);
} }
} }

View File

@ -33,6 +33,7 @@
/* compilation control */ /* compilation control */
#define SAVE_AS_CUMUL 1 #define SAVE_AS_CUMUL 1
#define SAVE_AS_PNM 0
#define SAVE_AS_FIMG 0 #define SAVE_AS_FIMG 0
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
@ -189,8 +190,6 @@ if ((fmt.fmt.pix.width != width) || (fmt.fmt.pix.height != height)) {
fmt.fmt.pix.width, fmt.fmt.pix.height); fmt.fmt.pix.width, fmt.fmt.pix.height);
} }
fprintf(stderr,"--- Ok 1\n");
CLEAR(req); CLEAR(req);
req.count = 2; req.count = 2;
req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
@ -243,20 +242,19 @@ else {
fimg_clear(&cumul); fimg_clear(&cumul);
cumul.fval = 255.0; /* must be read from camera XXX */ cumul.fval = 255.0; /* must be read from camera XXX */
cumul.count = 0; cumul.count = 0;
to_save = &cumul; to_save = &cumul;
#endif #endif
type = V4L2_BUF_TYPE_VIDEO_CAPTURE; type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
xioctl(fd, VIDIOC_STREAMON, &type); xioctl(fd, VIDIOC_STREAMON, &type);
#if 1 #if 0
if (verbosity) fprintf(stderr,"pid %d is going to grab %d picz...\n", if (verbosity) fprintf(stderr,"pid %d grabbing %d picz...\n",
getpid(), nbre_capt); getpid(), nbre_capt);
#endif #endif
/*
* START ON THE GRABBING LOOP
*/
for (i = 0; i < nbre_capt; i++) { for (i = 0; i < nbre_capt; i++) {
do { do {
FD_ZERO(&fds); FD_ZERO(&fds);
@ -271,22 +269,35 @@ for (i = 0; i < nbre_capt; i++) {
if (r == -1) { if (r == -1) {
perror("select"); perror("select");
return errno; /* WTF ? a rogue return return errno;
from the main() ? */
} }
if(verbosity > 1) { if(verbosity > 1) {
fprintf(stderr, "%6d / %6d %9.3f\n", i, nbre_capt, printf("%6d / %6d %9.3f\r", i, nbre_capt,
fimg_timer_get(0)); fimg_timer_get(0));
fflush(stderr);
} }
CLEAR(buf); CLEAR(buf);
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory = V4L2_MEMORY_MMAP; buf.memory = V4L2_MEMORY_MMAP;
xioctl(fd, VIDIOC_DQBUF, &buf); xioctl(fd, VIDIOC_DQBUF, &buf);
fprintf(stderr, "xioctl VIDIOC_DQBUF done\n"); fflush(stderr); #if SAVE_AS_PNM
/* at this time,we'v got a picture in-memory,
so we can blast in on storage */
sprintf(out_name, "%s/%05d.ppm", dest_dir, i);
if (verbosity > 1) fprintf(stderr, "--> %s\n", out_name);
fout = fopen(out_name, "w");
if (!fout) {
perror("Cannot open image");
exit(EXIT_FAILURE);
}
fprintf(fout, "P6\n%d %d 255\n",
fmt.fmt.pix.width, fmt.fmt.pix.height);
fwrite(buffers[buf.index].start, buf.bytesused, 1, fout);
fclose(fout);
#endif
#if SAVE_AS_CUMUL #if SAVE_AS_CUMUL
if (upscaling) { if (upscaling) {

View File

@ -1,25 +0,0 @@
Heisenbug dans la capture d'image
=================================
Contexte : Debian 10 32 bits sur Sony Vaio,
webcam Logitech classique.
Mon soft 'grabvidseq' part _parfois_ en torche oo, à la louche une
fois sur cent. Mais toujours au même endroit, au début de la boucle
de capture des images, précisément dans cet appel système :
CLEAR(buf);
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory = V4L2_MEMORY_MMAP;
xioctl(fd, VIDIOC_DQBUF, &buf);
Quand le programme semble figé, un strace -p <pi> sort le même
message en rafale _très_ féroce :
ioctl(3, VIDIOC_DQBUF, {type=V4L2_BUF_TYPE_VIDEO_CAPTURE}) = -1 EAGAIN (Resource temporarily unavailable)
ioctl(3, VIDIOC_DQBUF, {type=V4L2_BUF_TYPE_VIDEO_CAPTURE}) = -1 EAGAIN (Resource temporarily unavailable)
ioctl(3, VIDIOC_DQBUF, {type=V4L2_BUF_TYPE_VIDEO_CAPTURE^Cstrace: Process 11181 detached
WTF ?