is trinarize really ok ?

This commit is contained in:
tonton th 2020-12-02 19:55:06 +01:00
parent a450ac4291
commit 8f29cb0db0
6 changed files with 29 additions and 21 deletions

1
.gitignore vendored
View File

@ -66,6 +66,7 @@ tools/*.tiff
Fonderie/*.o Fonderie/*.o
Fonderie/*.png Fonderie/*.png
Fonderie/*.pnm Fonderie/*.pnm
Fonderie/*.gif
Fonderie/fonderie Fonderie/fonderie
Fonderie/interpolator Fonderie/interpolator
Fonderie/t Fonderie/t

View File

@ -7,7 +7,7 @@ COPT = -g -fpic -no-pie -Wall -DDEBUG_LEVEL=0 -Werror=parentheses
LIBS = ../libfloatimg.a -lpnglite -lm LIBS = ../libfloatimg.a -lpnglite -lm
OBJS = fonctions.o sfx.o crapulator.o glitches.o metriques.o OBJS = fonctions.o sfx.o crapulator.o glitches.o metriques.o
DEPS = fonctions.h crapulator.h metriques.h glitches.h DEPS = fonctions.h crapulator.h metriques.h glitches.h sfx.h
all: fonderie interpolator t all: fonderie interpolator t

View File

@ -10,6 +10,7 @@
#include "fonctions.h" #include "fonctions.h"
#include "crapulator.h" #include "crapulator.h"
#include "glitches.h" #include "glitches.h"
#include "sfx.h"
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
static int effect_3(FloatImg *image) static int effect_3(FloatImg *image)
@ -122,13 +123,16 @@ switch (idFx) {
case 11: case 11:
retval = trinarize(image, 0); retval = trinarize(image, 0);
break; break;
case 12:
retval = fimg_lissage_2x2(image);
break;
case 24: /* experiment ! */ case 24: /* experiment ! */
retval = des_bords_sombres_a(image, 160); retval = des_bords_sombres_a(image, 160);
break; break;
case 25: case 25:
/* please make this function more tweakable */ /* please make this function more tweakable */
retval = vertical_singlitch(image, 290+rand()%35, retval = vertical_singlitch(image, 290+rand()%45,
fval, 0.18, 0); fval, 0.19, 0);
break; break;
default : default :
fprintf(stderr, "%s : effect #%d invalid\n", fprintf(stderr, "%s : effect #%d invalid\n",

View File

@ -37,16 +37,5 @@ int create_fifo(int nbslot, int w, int h, int t);
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
/* /*
* funcs in 'sfx.c' * funcs in 'sfx.c' ---> sfx.h
*/ */
int des_bords_sombres_a(FloatImg *pimg, int offset);
int trinarize(FloatImg *pimg, int notused);
int binarize(FloatImg *pimg, int notused);
int brotche_rand48_a(FloatImg *fimg, float ratio, float mval);
int brotche_rand48_b(FloatImg *fimg, float ratio, float mval);
int colors_brotcher(FloatImg *fimg, float fval);
/* -------------------------------------------------------------- */

View File

@ -8,9 +8,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <malloc.h> #include <malloc.h>
#include <floatimg.h> #include "../floatimg.h"
#include "fonctions.h" #include "fonctions.h"
#include "sfx.h"
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
/* here are global vars exported by the main module /* here are global vars exported by the main module
@ -72,25 +73,23 @@ mBb = (mm[5] - mm[4]) * 0.66666;
size = pimg->width * pimg->height; size = pimg->width * pimg->height;
#define VAL (255.0)
for (foo=0; foo<size; foo++) { for (foo=0; foo<size; foo++) {
fptr = pimg->R; fptr = pimg->R;
if (fptr[foo] < mRa || fptr[foo] > mRb) if (fptr[foo] < mRa || fptr[foo] > mRb)
fptr[foo] = 0.0; fptr[foo] = mm[0];
else else
fptr[foo] = mm[1]; fptr[foo] = mm[1];
fptr = pimg->G; fptr = pimg->G;
if (fptr[foo] < mGa || fptr[foo] > mGb) if (fptr[foo] < mGa || fptr[foo] > mGb)
fptr[foo] = 0.0; fptr[foo] = mm[2];
else else
fptr[foo] = mm[3]; fptr[foo] = mm[3];
fptr = pimg->B; fptr = pimg->B;
if (fptr[foo] < mBa || fptr[foo] > mBb) if (fptr[foo] < mBa || fptr[foo] > mBb)
fptr[foo] = 0.0; fptr[foo] = mm[4];
else else
fptr[foo] = mm[5]; fptr[foo] = mm[5];

15
Fonderie/sfx.h Normal file
View File

@ -0,0 +1,15 @@
/*
* sfx.h - special effects for fonderie & interpolator
*/
int des_bords_sombres_a(FloatImg *pimg, int offset);
int trinarize(FloatImg *pimg, int notused); // in sfx.c
int binarize(FloatImg *pimg, int notused);
int brotche_rand48_a(FloatImg *fimg, float ratio, float mval);
int brotche_rand48_b(FloatImg *fimg, float ratio, float mval);
int colors_brotcher(FloatImg *fimg, float fval);