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 $@ gcc ${COPT} $< ${OBJS} ${LIBS} -o $@
# --------------------------------------------------------- # ---------------------------------------------------------
#
#
fonderie: fonderie.c ${DEPS} ${OBJS} Makefile fonderie: fonderie.c ${DEPS} ${OBJS} Makefile
gcc ${COPT} $< ${OBJS} ${LIBS} -lz -o $@ 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 crapulator.o: crapulator.c ${DEPS} Makefile
gcc ${COPT} -c $< gcc ${COPT} -c $<
@ -37,18 +44,10 @@ sfx.o: sfx.c ${DEPS} Makefile
filterstack.o: filterstack.c ${DEPS} Makefile filterstack.o: filterstack.c ${DEPS} Makefile
gcc ${COPT} -c $< gcc ${COPT} -c $<
# ---------------------------------------------------------
#
# another way to brotch some pics...
#
metriques.o: metriques.c metriques.h Makefile metriques.o: metriques.c metriques.h Makefile
gcc ${COPT} -c $< gcc ${COPT} -c $<
glitches.o: glitches.c glitches.h Makefile glitches.o: glitches.c glitches.h Makefile
gcc ${COPT} -c $< 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: case 14:
retval = desaturate(image); retval = desaturate(image);
break; break;
case 15:
retval = kill_a_few_lines(image, fval,
image->height/20);
break;
/* here are the glitches */ /* here are the glitches */
case 24: /* experiment ! */ case 24: /* experiment ! */

View File

@ -10,4 +10,5 @@
int crapulator(FloatImg *image, int id_effect, float fparam); 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 #!/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 rm /tmp/fstack*.png
@ -8,7 +8,7 @@ for F in $FILTRES
do do
I="/tmp/fstack-"$F".png" I="/tmp/fstack-"$F".png"
echo ; echo $I echo ; echo ==== $I
./t -F $F ./t -F $F
txt=$(printf "[%-10s]" $F) txt=$(printf "[%-10s]" $F)
convert foo.png -pointsize 24 -kerning 0 \ convert foo.png -pointsize 24 -kerning 0 \
@ -19,4 +19,6 @@ do
done done
exit
convert -delay 100 /tmp/fstack*.png foo.gif 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, "------- %-20s --------\n", txt);
fprintf(stderr, "stack at %p, size %d, current %d\n", fprintf(stderr, "stack at %p, size %d, current %d\n",
stack_slots, nbre_filters, idx_slot); 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++) { 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, stack_slots[idx].numero,
crap_name_from_number(stack_slots[idx].numero),
stack_slots[idx].ival, stack_slots[idx].ival,
stack_slots[idx].fval); stack_slots[idx].fval);

View File

@ -27,7 +27,7 @@ fprintf(stderr, ">>> %s ( %p %d )\n", __func__, pvictime, bits);
line = rand() % pvictime->height; line = rand() % pvictime->height;
if (verbosity > 1) { if (verbosity > 2) {
fprintf(stderr, "%s: try to kill line %d\n", __func__, line); 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; int idx, foo;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %f %d )\n", __func__, who, fval, number);
#endif
/* Frag the pixels */ /* Frag the pixels */
for (idx=0; idx<number; idx++) { 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(); if (foo) abort();
} }

View File

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

View File

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