diff --git a/Fonderie/crapulator.c b/Fonderie/crapulator.c index 05f2767..be28913 100644 --- a/Fonderie/crapulator.c +++ b/Fonderie/crapulator.c @@ -203,6 +203,9 @@ switch (idFx) { retval = octotree_classif(image, 0.500, 0); break; + case CR_trinitron: + retval = trinitron(image, 0); + break; /* here are the glitches */ case CR_bsombra: /* experiment ! */ @@ -228,6 +231,10 @@ switch (idFx) { retval = 0; break; + case CR_nothing: + retval = do_something(image, 3); + break; + default : fprintf(stderr, "%s : effect #%d invalid\n", __func__, idFx); diff --git a/Fonderie/crapulors.liste b/Fonderie/crapulors.liste index 5df72fe..a4660b3 100644 --- a/Fonderie/crapulors.liste +++ b/Fonderie/crapulors.liste @@ -19,9 +19,11 @@ 18 updown 1 1.0 19 hipass 1 1.0 20 octotree 1 1.0 +21 trinitron 3, 0.0 24 bsombra 1 1.0 25 vsglitch 1 1.0 26 rndblks 1 1.0 27 shiftln0 1 1.0 +42 nothing 42 3.14159 99 message 1 1.0 -1 end 1 1.0 diff --git a/Fonderie/filterstack.c b/Fonderie/filterstack.c index 1ac2baf..10d8705 100644 --- a/Fonderie/filterstack.c +++ b/Fonderie/filterstack.c @@ -125,8 +125,9 @@ for (idx=0; idx>> %s ( %p %d )\n", __func__, pimg, notused); +#endif + +ypos = rand() % pimg->width; + +for (idx=0; idx < pimg->height; idx++) { + sline = idx * pimg->width; + pos = sline + ypos; + // fprintf(stderr, "%6d %6d\n", idx, sline); + pimg->R[pos] = pimg->G[pos]; + pimg->B[pos] = pimg->G[pos]; + } + +return 0; +} /* -------------------------------------------------------------- */ int kill_a_random_line(FloatImg *pvictime, float fval, int bits) { diff --git a/Fonderie/glitches.h b/Fonderie/glitches.h index 965a5d9..deb1295 100644 --- a/Fonderie/glitches.h +++ b/Fonderie/glitches.h @@ -2,6 +2,8 @@ * glitches.h */ +int do_something(FloatImg *pimg, int notused); + int kill_a_random_line(FloatImg *pvictime, float level, int bits); int kill_a_few_lines(FloatImg *who, float fval, int number); int random_blocks(FloatImg *picture, int percent); diff --git a/Fonderie/metriques.c b/Fonderie/metriques.c index c336d01..eb65b71 100644 --- a/Fonderie/metriques.c +++ b/Fonderie/metriques.c @@ -9,6 +9,38 @@ extern int verbosity; +/* -------------------------------------------------------------- */ +int stat_zone(FloatImg *pimg, int geom[4], float v3[3]) +{ +int x, y, xe, ye; +int off; +double accus[3], divisor; + +xe = geom[0] + geom[2]; +ye = geom[1] + geom[3]; + +#if DEBUG_LEVEL +fprintf(stdout, "geom: %5d %5d %5d %5d\n", + geom[0], geom[1], geom[2], geom[3]); +#endif + +accus[0] = accus[1] = accus[2] = 0.0; +for (y=geom[1]; ywidth) + x; + accus[0] += (double) pimg->R[off]; + accus[1] += (double) pimg->G[off]; + accus[2] += (double) pimg->B[off]; + } + } + +divisor = (double)(geom[2] * geom[3]); /* array of zone */ +v3[0] = (float)(accus[0] / divisor); +v3[1] = (float)(accus[1] / divisor); +v3[2] = (float)(accus[2] / divisor); + +return 0; +} /* -------------------------------------------------------------- */ /* * premier essai... diff --git a/Fonderie/metriques.h b/Fonderie/metriques.h index ce7aa81..4a270e6 100644 --- a/Fonderie/metriques.h +++ b/Fonderie/metriques.h @@ -4,6 +4,9 @@ /* -------------------------------------------------------------- */ +int stat_zone(FloatImg *pimg, int geom[4], float v3[3]); + + /* first experiments */ int get_float_metric_a(FloatImg *pimg, float *where); diff --git a/Fonderie/sfx.c b/Fonderie/sfx.c index b9acac1..964631b 100644 --- a/Fonderie/sfx.c +++ b/Fonderie/sfx.c @@ -12,6 +12,7 @@ #include "../floatimg.h" #include "fonctions.h" +#include "metriques.h" #include "sfx.h" /* -------------------------------------------------------------- */ @@ -20,12 +21,50 @@ extern int verbosity; /* -------------------------------------------------------------- */ -/* nouveau du 27 decembre 2020, un soir de grand froid... */ +/* nouveau du premier dimanche de 2020 'nextgen' */ +static int pixel_trinitron(FloatImg *pimg, int pos[4], float *fvals) +{ +int x, y, off; +for (y=pos[1]; ywidth) + x; + pimg->R[off] = fvals[0]; + } + } +return 0; +} +int trinitron(FloatImg *pimg, int notused) +{ +int x, y, coo[4], foo; +float vals[3]; + +#if DEBUG_LEVEL +fprintf(stderr, ">>> %s ( %p %d )\n", __func__, pimg, notused); +#endif + +#define STP 16 /* stepd for x & y axex */ +coo[2] = coo[3] = STP; + +for (y=0; yheight; y+=STP) { + coo[1] = y; + for (x=0; xwidth; x+=STP) { + coo[0] = x; + foo = stat_zone(pimg, coo, vals); + if (foo) abort(); + /* next step : plot the datas */ + pixel_trinitron(pimg, coo, vals); + } + } +#undef STP +return 0; +} +/* -------------------------------------------------------------- */ +/* nouveau du 27 decembre 2020, un soir de grand froid... */ int octotree_classif(FloatImg *pimg, float kdist, int notused) { int foo; -float mm[6], means[4], delta[3]; +float mm[6], delta[3]; float r, g, b, kr, kg, kb, dp, trig; int idx, sz, n8, count; typedef struct { @@ -38,16 +77,6 @@ fprintf(stderr, ">>> %s ( %p %f %d )\n", __func__, pimg, kdist, notused); #endif -#if 0 -foo = fimg_meanvalues(pimg, means); -if (foo) { - fprintf(stderr, "oups %d in meanvalues\n", foo); - return foo; - } -fprintf(stderr, "means: %11f %11f %11f\n", - means[0], means[1], means[2]); -#endif - foo = fimg_get_minmax_rgb(pimg, mm); if (foo) { fprintf(stderr, "oups %d in get minmax\n", foo); diff --git a/Fonderie/sfx.h b/Fonderie/sfx.h index 91ebefd..62617c0 100644 --- a/Fonderie/sfx.h +++ b/Fonderie/sfx.h @@ -3,6 +3,8 @@ * --------------------------------------------------- */ +int trinitron(FloatImg *pimg, int notused); + int bouger_les_pixels(FloatImg *pimg, int kaboo); int octotree_classif(FloatImg *pimg, float fk, int notused);