Compare commits

..

3 Commits

Author SHA1 Message Date
3778e75399 + multidots glitcher 2021-01-16 11:29:40 +01:00
d3dfd6de0a ajout dépendances 2021-01-16 11:28:54 +01:00
ffda756fde tracking a non existant bug 2021-01-15 13:44:54 +01:00
9 changed files with 67 additions and 31 deletions

View File

@ -97,7 +97,6 @@ FimgFilter3x3 hipass = {
1.0, 0.0 1.0, 0.0
}; };
switch (typef) { switch (typef) {
case 0: pfiltre = &lowpass; break; case 0: pfiltre = &lowpass; break;
case 1: pfiltre = &hipass; break; case 1: pfiltre = &hipass; break;
@ -248,11 +247,13 @@ switch (idFx) {
break; break;
case CR_qsortrgb: case CR_qsortrgb:
// fprintf(stderr, "!!! %d !!!\n", idFx);
// retval = fimg_qsort_rgb_b(image, image, 0);
retval = trier_les_pixels(image); retval = trier_les_pixels(image);
break; break;
case CR_multidots:
retval = plot_multidots(image, 42);
break;
case CR_message: case CR_message:
fprintf(stderr, "### msg from pid %d, fval=%f ###\n", fprintf(stderr, "### msg from pid %d, fval=%f ###\n",
getpid(), fval); getpid(), fval);

View File

@ -25,6 +25,7 @@
26 rndblks 1 1.0 26 rndblks 1 1.0
27 shiftln0 1 1.0 27 shiftln0 1 1.0
28 qsortrgb 2 1.0 28 qsortrgb 2 1.0
42 nothing 42 3.14159 30 multidots 100 1.333
42 nothing 42 3.1415926
99 message 1 1.0 99 message 1 1.0
-1 end 1 1.0 -1 end 1 1.0

View File

@ -31,8 +31,8 @@ convert -delay 200 /tmp/fstack*.png foo.gif
essai_singlepass () essai_singlepass ()
{ {
MP4="/home/tth/Essais/FondageDePlomb/foo.mp4" MP4="/home/tth/Essais/FondageDePlomb/foo.mp4"
INPUT="/home/tth/Essais/FondageDePlomb/capture/00???.fimg" INPUT="/home/tth/Essais/FondageDePlomb/capture/02[0123]??.fimg"
FILTRE="trinitron" FILTRE="multidots:liss3x3:liss3x3"
OUTDIR="/tmp/x8/" OUTDIR="/tmp/x8/"
echo '********* essai single *********' echo '********* essai single *********'

View File

@ -120,6 +120,24 @@ for (y=0; y<8; y++) {
return 0; return 0;
} }
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
int plot_multidots(FloatImg *picture, int notused)
{
int pass, szimg, osrc, odst;
szimg = picture->width * picture->height;
for (pass=0; pass<szimg/32; pass++) {
osrc = rand() % szimg;
odst = rand() % szimg;
picture->R[odst] = (picture->R[osrc] + picture->R[odst]) / 2.0;
picture->G[odst] = (picture->G[osrc] + picture->G[odst]) / 2.0;
picture->B[odst] = (picture->B[osrc] + picture->B[odst]) / 2.0;
}
return 0;
}
int random_blocks(FloatImg *picture, int percent) int random_blocks(FloatImg *picture, int percent)
{ {
int x, y; int x, y;
@ -212,16 +230,26 @@ for (y=BB; y<h-BB; y++) {
return 0; return 0;
} }
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
static void shifter(float *fs, float *fd, int w, int nbr) static void shifter(float *fs, float *fd, int stp, int largeur)
{ {
int krkr; int xpos;
for (krkr=0; krkr<nbr; krkr++) { /* move the pixels */
fd[krkr] = fs[(krkr+w)%nbr]; for (xpos=0; xpos<largeur; xpos++) {
fd[xpos] = fs[(xpos+stp)%largeur];
} }
/* take your sixpack, film at 11 */ /* take your sixpack, film at 11 */
} }
static void smooth_line(float *fs, float *fd, int sz)
{
int xpos;
for (xpos=1; xpos<(sz-1); xpos++) {
fd[xpos] = (fs[xpos-1]+fs[xpos]+fs[xpos+1]) / 3.0;
}
fd[0] = fd[sz-1] = 0.0;
}
int multilines_shift_0(FloatImg *picz, int step, int nombre) int multilines_shift_0(FloatImg *picz, int step, int nombre)
{ {
float *buffline, *sptr; float *buffline, *sptr;
@ -242,15 +270,18 @@ for (idx=0; idx<nombre; idx++) {
sptr = picz->R + (ypos * picz->width); sptr = picz->R + (ypos * picz->width);
shifter(sptr, buffline, step, picz->width); shifter(sptr, buffline, step, picz->width);
memcpy(sptr, buffline, picz->width*sizeof(float)); smooth_line(buffline, sptr, picz->width);
// XXX memcpy (sptr, buffline, picz->width*sizeof(float));
sptr = picz->G + (ypos * picz->width); sptr = picz->G + (ypos * picz->width);
shifter(sptr, buffline, step, picz->width); shifter(sptr, buffline, step, picz->width);
memcpy(sptr, buffline, picz->width*sizeof(float)); smooth_line(buffline, sptr, picz->width);
// XXX memcpy (sptr, buffline, picz->width*sizeof(float));
sptr = picz->B + (ypos * picz->width); sptr = picz->B + (ypos * picz->width);
shifter(sptr, buffline, step, picz->width); shifter(sptr, buffline, step, picz->width);
memcpy(sptr, buffline, picz->width*sizeof(float)); smooth_line(buffline, sptr, picz->width);
// XXX memcpy (sptr, buffline, picz->width*sizeof(float));
} }
return 0; return 0;

View File

@ -3,6 +3,7 @@
*/ */
int do_something(FloatImg *pimg, int notused); int do_something(FloatImg *pimg, int notused);
int plot_multidots(FloatImg *picture, int notused);
int kill_a_random_line(FloatImg *pvictime, float level, int bits); int kill_a_random_line(FloatImg *pvictime, float level, int bits);
int kill_a_few_lines(FloatImg *who, float fval, int number); int kill_a_few_lines(FloatImg *who, float fval, int number);

View File

@ -89,7 +89,7 @@ for (idx=0; idx<nombre; idx++) {
if (method) { if (method) {
/* and now, we can massage all our datas */ /* and now, we can massage all our datas */
// fprintf(stderr, "sorting %d ...\n", method); fprintf(stderr, "sorting method = %d ...\n", method);
qsort(idxvalues, nombre, sizeof(IdxValue), cmp_idxvalues); qsort(idxvalues, nombre, sizeof(IdxValue), cmp_idxvalues);
} }
@ -128,7 +128,7 @@ IdxValue *idx_values; /* gni? */
fprintf(stderr, " interpolate from '%s' to '%s' with %d steps.\n", fprintf(stderr, " interpolate from '%s' to '%s' with %d steps.\n",
pattern, outdir, Nsteps); pattern, outdir, Nsteps);
if (negative) fprintf(stderr, "%s: negative on\n", __func__); if (negative) fprintf(stderr, "%s: negative ON\n", __func__);
memset(&globbuf, 0, sizeof(glob_t)); memset(&globbuf, 0, sizeof(glob_t));
foo = glob(pattern, 0, NULL, &globbuf); foo = glob(pattern, 0, NULL, &globbuf);

View File

@ -153,7 +153,7 @@ puts("\t-F\tdefine:the:filter:chain");
puts("\t-g\tinput glob pattern"); puts("\t-g\tinput glob pattern");
puts("\t-i\tinfile.fimg"); puts("\t-i\tinfile.fimg");
puts("\t-L\tlist available filters"); puts("\t-L\tlist available filters");
puts("\t-o\tinfile.xxx"); puts("\t-o\toutfile.xxx");
puts("\t-O\t/output/directory"); puts("\t-O\t/output/directory");
puts("\t-s\tdo single test"); puts("\t-s\tdo single test");

View File

@ -30,10 +30,14 @@ Bien entendu, avant tout, il faut installer quelques outils et
dépendances. Je vais tenter de les lister dans le plus grand dépendances. Je vais tenter de les lister dans le plus grand
désordre (à la sauce Debian) : désordre (à la sauce Debian) :
- libtiff-dev ```
- libpnglite-dev apt install libtiff-dev
- liblo-dev apt install libpnglite-dev
- libv4l2-dev apt install liblo-dev
apt install libv4l2-dev
apt install libcfitsio-dev
apt install libnetpbm-dev
```
Certains outils externes sont aussi utiles : Certains outils externes sont aussi utiles :

View File

@ -106,8 +106,9 @@ char *dev_name = "/dev/video0";
struct buffer *buffers; struct buffer *buffers;
int foo; int foo;
double period = 10.0; /* delai entre les captures */ double period = 10.0; /* delai entre les captures
int nbre_capt = 1; /* nombre de captures */ en secondes */
int nbre_capt = 1; /* nombre de captures */
int opt; int opt;
int width = 640; int width = 640;
int height = 480; int height = 480;
@ -144,7 +145,6 @@ while ((opt = getopt(argc, argv, "c:d:ghn:o:O:p:r:s:uv")) != -1) {
optarg); optarg);
exit(1); exit(1);
} }
period *= 1e6;
break; break;
case 'r': rotfactor = atoi(optarg); break; case 'r': rotfactor = atoi(optarg); break;
case 's': parse_WxH(optarg, &width, &height); case 's': parse_WxH(optarg, &width, &height);
@ -162,7 +162,7 @@ if (verbosity > 1) {
fprintf(stderr, "*** GrabVidSeq (%s, %s) libv %d, pid=%d\n", fprintf(stderr, "*** GrabVidSeq (%s, %s) libv %d, pid=%d\n",
__DATE__, __TIME__, FIMG_VERSION, getpid()); __DATE__, __TIME__, FIMG_VERSION, getpid());
fprintf(stderr, "grabing %d picz, ", nbre_capt); fprintf(stderr, "grabing %d picz, ", nbre_capt);
fprintf(stderr, "period is %.3f milliseconds\n", period/1e3); fprintf(stderr, "period is %.3f seconds\n", period);
fprintf(stderr, "framesize is %dx%d\n", width, height); fprintf(stderr, "framesize is %dx%d\n", width, height);
// fprintf(stderr, "destdir is '%s'\n", dest_dir); // fprintf(stderr, "destdir is '%s'\n", dest_dir);
if (upscaling) fprintf(stderr, "upscaling is on\n"); if (upscaling) fprintf(stderr, "upscaling is on\n");
@ -277,7 +277,7 @@ for (i = 0; i < nbre_capt; i++) {
} }
if(verbosity > 1) { if(verbosity > 1) {
fprintf(stderr, "%6d / %6d %9.3f\n", i, nbre_capt, fprintf(stderr, "%6d / %6d %9.3f\r", i, nbre_capt,
fimg_timer_get(0)); fimg_timer_get(0));
fflush(stderr); fflush(stderr);
} }
@ -309,15 +309,15 @@ for (i = 0; i < nbre_capt; i++) {
out_name); out_name);
#endif #endif
if (nbre_capt > 1 && period > 1.0) { if (nbre_capt > 1 && period > 0.001) {
usleep(period); /* suspend execution for
microsecond intervals */
usleep((int)(period*1E6));
} }
xioctl(fd, VIDIOC_QBUF, &buf); xioctl(fd, VIDIOC_QBUF, &buf);
} }
fflush(stdout);
if (verbosity) { if (verbosity) {
t_final = fimg_timer_get(0); t_final = fimg_timer_get(0);
fprintf(stderr, "pid %d : elapsed %.3g s -> %.2f fps\n", getpid(), fprintf(stderr, "pid %d : elapsed %.3g s -> %.2f fps\n", getpid(),
@ -398,8 +398,6 @@ switch (foo) {
} }
// free buffers // free buffers
fimg_destroy(&cumul); fimg_destroy(&cumul);
#endif #endif