more experiment...

This commit is contained in:
Tonton Th 2020-12-08 15:51:07 +01:00
parent ae7fdd49bc
commit b03e674056
8 changed files with 32 additions and 19 deletions

View File

@ -20,11 +20,18 @@ t: t.c Makefile ${OBJS}
gcc ${COPT} $< ${OBJS} ${LIBS} -o $@
# ---------------------------------------------------------
#
#
fonderie: fonderie.c ${DEPS} ${OBJS} Makefile
gcc ${COPT} $< ${OBJS} ${LIBS} -lz -o $@
# another way to brotch some pics...
interpolator: interpolator.c ${DEPS} ${OBJS} Makefile
gcc ${COPT} $< ${OBJS} ${LIBS} -lz -o $@
# ---------------------------------------------------------
crapulator.o: crapulator.c ${DEPS} Makefile
gcc ${COPT} -c $<
@ -37,18 +44,10 @@ sfx.o: sfx.c ${DEPS} Makefile
filterstack.o: filterstack.c ${DEPS} Makefile
gcc ${COPT} -c $<
# ---------------------------------------------------------
#
# another way to brotch some pics...
#
metriques.o: metriques.c metriques.h Makefile
gcc ${COPT} -c $<
glitches.o: glitches.c glitches.h Makefile
gcc ${COPT} -c $<
interpolator: interpolator.c ${DEPS} ${OBJS} Makefile
gcc ${COPT} $< ${OBJS} ${LIBS} -lz -o $@
# ---------------------------------------------------------

View File

@ -172,6 +172,10 @@ switch (idFx) {
case 14:
retval = desaturate(image);
break;
case 15:
retval = kill_a_few_lines(image, fval,
image->height/20);
break;
/* here are the glitches */
case 24: /* experiment ! */

View File

@ -10,4 +10,5 @@
int crapulator(FloatImg *image, int id_effect, float fparam);
char *crap_name_from_number(int num);
int crap_number_from_name(char *name);

View File

@ -1,6 +1,6 @@
#!/bin/bash
FILTRES="5:6:13 2:2 5:9:8 4:25 8:13:13:7 10:1 25:25:25:25 13:14:13"
FILTRES="5:6:13 15 2:2 5:9:8 4:25 8:13:13:7 10:1 25:25:25:25 13:14:13"
rm /tmp/fstack*.png
@ -8,7 +8,7 @@ for F in $FILTRES
do
I="/tmp/fstack-"$F".png"
echo ; echo $I
echo ; echo ==== $I
./t -F $F
txt=$(printf "[%-10s]" $F)
convert foo.png -pointsize 24 -kerning 0 \
@ -19,4 +19,6 @@ do
done
exit
convert -delay 100 /tmp/fstack*.png foo.gif

View File

@ -83,11 +83,12 @@ if (NULL==stack_slots) {
fprintf(stderr, "------- %-20s --------\n", txt);
fprintf(stderr, "stack at %p, size %d, current %d\n",
stack_slots, nbre_filters, idx_slot);
fprintf(stderr, "idx fx# ival fval\n");
fprintf(stderr, "idx fx# name ival fval\n");
for (idx=0; idx<idx_slot; idx++) {
fprintf(stderr, "%3d %3d %3d %f\n", idx,
fprintf(stderr, "%3d %3d %-10s %3d %f\n", idx,
stack_slots[idx].numero,
crap_name_from_number(stack_slots[idx].numero),
stack_slots[idx].ival,
stack_slots[idx].fval);

View File

@ -27,7 +27,7 @@ fprintf(stderr, ">>> %s ( %p %d )\n", __func__, pvictime, bits);
line = rand() % pvictime->height;
if (verbosity > 1) {
if (verbosity > 2) {
fprintf(stderr, "%s: try to kill line %d\n", __func__, line);
}
@ -52,9 +52,13 @@ int kill_a_few_lines(FloatImg *who, float fval, int number)
{
int idx, foo;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %f %d )\n", __func__, who, fval, number);
#endif
/* Frag the pixels */
for (idx=0; idx<number; idx++) {
foo = kill_a_random_line(who, fval, rand() & 0x0f);
foo = kill_a_random_line(who, fval, rand() & 0x07);
if (foo) abort();
}

View File

@ -163,7 +163,7 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
value = idx_values[idx].value;
/* here, insert the input filter */
foo = crapulator(&B, infx, value/2.0);
foo = crapulator(&B, infx, value);
if (foo) {
fprintf(stderr, "%s: input fx fail %d\n", __func__, foo);
exit(1);

View File

@ -33,15 +33,17 @@ return 0;
/* -------------------------------------------------------------- */
int get_float_metric_b(FloatImg *pimg, float *where)
{
int idx, size;
int idx, size, nbre;
double adder;
adder = 0.0;
nbre = 0;
size = pimg->width * pimg->height;
for (idx=20; idx < size; idx+=42) {
adder += (double)pimg->R[idx];
nbre++;
}
*where = (float)adder;
*where = (float)(adder/(nbre+1));
return 0;
}
/* -------------------------------------------------------------- */