+ upside-down

This commit is contained in:
tonton th 2020-12-18 10:18:09 +01:00
parent 0def451bf4
commit d369babbb3
6 changed files with 66 additions and 6 deletions

View File

@ -183,6 +183,9 @@ switch (idFx) {
case 17: case 17:
retval = mirror_split(image, 0); retval = mirror_split(image, 0);
break; break;
case 18:
retval = upside_down(image);
break;
/* here are the glitches */ /* here are the glitches */
case 24: /* experiment ! */ case 24: /* experiment ! */
@ -217,6 +220,7 @@ switch (num) {
case 0: return "none"; case 0: return "none";
case 8: return "ctr2x2"; case 8: return "ctr2x2";
case 13: return "fltr3x3"; case 13: return "fltr3x3";
case 18: return "updown";
} }
return "???"; return "???";

View File

@ -76,7 +76,7 @@ if (numid < 0 || numid > NUMBER_OF_STACK) {
fprintf(stderr, "--- %2d -- %-20s --------\n", numid, txt); fprintf(stderr, "--- %2d -- %-20s --------\n", numid, txt);
// fprintf(stderr, "stack at %p, size %d, current %d\n", // fprintf(stderr, "stack at %p, size %d, current %d\n",
// f_slots, nbre_filters, idx_slot); // f_slots, nbre_filters, idx_slot);
fprintf(stderr, "idx fx# name ival fval\n"); fprintf(stderr, "idx ___ fx# _ name ________ ival _ fval ___\n");
for (idx=0; idx<f_stacks[numid].count; idx++) { for (idx=0; idx<f_stacks[numid].count; idx++) {
@ -122,7 +122,9 @@ for (idx=0; idx<f_stacks[numid].count; idx++) {
foo = crapulator(target, eff, fv); foo = crapulator(target, eff, fv);
if (foo) { if (foo) {
fprintf(stderr, "crapulator error %d\n", foo); fprintf(stderr,
"crapulator give me error %d on effect %d\n",
foo, eff);
return foo; return foo;
} }
} }

View File

@ -76,7 +76,8 @@ for (idx=0; idx<nombre; idx++) {
return -1; return -1;
} }
if (verbosity) if (verbosity)
fprintf(stderr, "%5d %s %f\r", idx, filename, metrique); fprintf(stderr, "%5d %s %10.3f\r",
idx, filename, metrique);
idxvalues[idx].idx = idx; idxvalues[idx].idx = idx;
idxvalues[idx].value = metrique; idxvalues[idx].value = metrique;
average += (double)metrique; average += (double)metrique;

View File

@ -18,6 +18,58 @@
*/ */
extern int verbosity; extern int verbosity;
/* -------------------------------------------------------------- */
/* nouveau du 19 decembre 2020, pour le grand ecran de da Scritch */
int upside_down(FloatImg *pimg)
{
float *rowpix;
float *Ps, *Pd;
int Os, Od; /* offset of lines */
int wsz;
int ya, y2;
fprintf(stderr, "%s: image width is %d\n", __func__, pimg->width);
rowpix = calloc(pimg->width, sizeof(float));
if (NULL==rowpix) {
fprintf(stderr, "%s : memory full\n", __func__);
exit(1);
}
wsz = pimg->width * sizeof(float);
fprintf(stderr, "%s: wsx = %d\n", __func__, wsz);
for (ya=0; ya<pimg->height/2; ya++) {
y2 = pimg->height - (ya+1);
Os = (pimg->width * ya);
Od = (pimg->width * y2);
/* let's go, crash coredumping... */
Ps = pimg->R + Os;
Pd = pimg->R + Od;
memcpy(rowpix, Ps, wsz);
memcpy(Ps, Pd, wsz);
memcpy(Pd, rowpix, wsz);
Ps = pimg->G + Os;
Pd = pimg->G + Od;
memcpy(rowpix, Ps, wsz);
memcpy(Ps, Pd, wsz);
memcpy(Pd, rowpix, wsz);
Ps = pimg->B + Os;
Pd = pimg->B + Od;
memcpy(rowpix, Ps, wsz);
memcpy(Ps, Pd, wsz);
memcpy(Pd, rowpix, wsz);
}
free(rowpix);
return 0;
}
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
/* nouveau du 9 decembre 2020, en ecoutant le Fermion raconter du /* nouveau du 9 decembre 2020, en ecoutant le Fermion raconter du
superbe portnawak */ superbe portnawak */
@ -113,7 +165,7 @@ return 0;
int trinarize(FloatImg *pimg, int notused) int trinarize(FloatImg *pimg, int notused)
{ {
float mm[6], mRa, mGa, mBa, mRb, mGb, mBb; float mm[6], mRa, mGa, mBa, mRb, mGb, mBb;
float val, *fptr; float *fptr;
int foo, size; int foo, size;
#if DEBUG_LEVEL #if DEBUG_LEVEL

View File

@ -6,6 +6,7 @@
int bouger_les_pixels(FloatImg *pimg, int kaboo); int bouger_les_pixels(FloatImg *pimg, int kaboo);
int mirror_split(FloatImg *pimg, int kaboo); int mirror_split(FloatImg *pimg, int kaboo);
int upside_down(FloatImg *pimg);
int des_bords_sombres_a(FloatImg *pimg, int offset); int des_bords_sombres_a(FloatImg *pimg, int offset);

View File

@ -76,7 +76,7 @@ int main(int argc, char *argv[])
{ {
int foo; int foo;
int opt; int opt;
char *filterchain = "0"; char *filterchain = "18";
fprintf(stderr, "*** %s : compiled by tTh, %s %s\n", __FILE__, fprintf(stderr, "*** %s : compiled by tTh, %s %s\n", __FILE__,
__DATE__, __TIME__); __DATE__, __TIME__);
@ -100,7 +100,7 @@ if (foo) {
exit(1); exit(1);
} }
foo = essai_filterstack("mire.fimg"); foo = essai_filterstack("01137.fimg");
if (foo) { if (foo) {
fprintf(stderr, "err %d in essai_filterstack\n", foo); fprintf(stderr, "err %d in essai_filterstack\n", foo);
exit(1); exit(1);