+ multidots glitcher

This commit is contained in:
Tonton Th 2021-01-16 11:29:40 +01:00
parent d3dfd6de0a
commit 3778e75399
7 changed files with 50 additions and 16 deletions

View File

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

View File

@ -25,6 +25,7 @@
26 rndblks 1 1.0
27 shiftln0 1 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
-1 end 1 1.0

View File

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

View File

@ -120,6 +120,24 @@ for (y=0; y<8; y++) {
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 x, y;
@ -212,16 +230,26 @@ for (y=BB; y<h-BB; y++) {
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++) {
fd[krkr] = fs[(krkr+w)%nbr];
/* move the pixels */
for (xpos=0; xpos<largeur; xpos++) {
fd[xpos] = fs[(xpos+stp)%largeur];
}
/* 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)
{
float *buffline, *sptr;
@ -242,15 +270,18 @@ for (idx=0; idx<nombre; idx++) {
sptr = picz->R + (ypos * 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);
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);
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;

View File

@ -3,6 +3,7 @@
*/
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_few_lines(FloatImg *who, float fval, int number);

View File

@ -89,7 +89,7 @@ for (idx=0; idx<nombre; idx++) {
if (method) {
/* 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);
}
@ -128,7 +128,7 @@ IdxValue *idx_values; /* gni? */
fprintf(stderr, " interpolate from '%s' to '%s' with %d steps.\n",
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));
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-i\tinfile.fimg");
puts("\t-L\tlist available filters");
puts("\t-o\tinfile.xxx");
puts("\t-o\toutfile.xxx");
puts("\t-O\t/output/directory");
puts("\t-s\tdo single test");