this is a big mess

This commit is contained in:
tth 2021-10-15 23:21:02 +02:00
parent bc864a6acb
commit 6c92cca12c
15 changed files with 434 additions and 19 deletions

View File

@ -102,9 +102,9 @@ FimgFilter3x3 hipass = {
FimgFilter3x3 diagonal = { FimgFilter3x3 diagonal = {
{ {
2.0, 1.0, 0.0, 4.0, 1.0, 0.0,
1.0, 0.0, -1.0, 1.0, 0.0, -1.0,
0.0, -1.0, -2.0, 0.0, -1.0, -4.0,
}, },
1.0, 0.0 1.0, 0.0
}; };
@ -168,6 +168,62 @@ fimg_destroy(&tmp);
// fprintf(stderr, "%s ---->\n", __func__); // fprintf(stderr, "%s ---->\n", __func__);
return ret;
}
/* -------------------------------------------------------------- */
static int run_pixelize_0(FloatImg *img, int k)
{
FloatImg tmp;
int ret;
memset(&tmp, 0, sizeof(FloatImg));
fimg_clone(img, &tmp, 0);
ret = fimg_pixelize_h_0(img, &tmp, k);
fimg_copy_data(&tmp, img);
fimg_destroy(&tmp);
return ret;
}
/* -------------------------------------------------------------- */
static int run_pixelize_random(FloatImg *img, int k)
{
FloatImg tmp;
int ret;
memset(&tmp, 0, sizeof(FloatImg));
fimg_clone(img, &tmp, 0);
ret = fimg_pixelize_h_rnd(img, &tmp, k);
fimg_copy_data(&tmp, img);
fimg_destroy(&tmp);
return ret;
}
/* -------------------------------------------------------------- */
static int run_decomprgbz_color(FloatImg *img, int k)
{
FloatImg tmp;
int ret;
memset(&tmp, 0, sizeof(FloatImg));
fimg_clone(img, &tmp, 0);
ret = fimg_decomp_rgbz_color(img, &tmp, k);
fimg_copy_data(&tmp, img);
fimg_destroy(&tmp);
return ret;
}
/* -------------------------------------------------------------- */
static int run_decomprgbz_gray(FloatImg *img, int k)
{
FloatImg tmp;
int ret;
memset(&tmp, 0, sizeof(FloatImg));
fimg_clone(img, &tmp, 0);
ret = fimg_decomp_rgbz_gray(img, &tmp, k);
fimg_copy_data(&tmp, img);
fimg_destroy(&tmp);
return ret; return ret;
} }
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
@ -342,6 +398,25 @@ switch (idFx) {
retval = run_killrgb_0(image, 0); retval = run_killrgb_0(image, 0);
break; break;
case CR_pixelizh:
retval = run_pixelize_0(image, 8);
break;
case CR_pixelrand:
retval = run_pixelize_random(image, -1);
break;
case CR_splitlevel:
retval = fimg_split_level(image, image, 0);
break;
case CR_decrgbzc:
retval = run_decomprgbz_color(image, -1);
break;
case CR_decrgbzg:
retval = run_decomprgbz_gray(image, -1);
break;
case CR_hilightr: case CR_hilightr:
retval = fimg_highlight_color(image, image, 'R', 1.717); retval = fimg_highlight_color(image, image, 'R', 1.717);
break; break;

View File

@ -35,5 +35,11 @@
42 nothing 42 3.1415926 42 nothing 42 3.1415926
43 killrgb0 1 9 43 killrgb0 1 9
45 hilightr 1 1.717 45 hilightr 1 1.717
46 pixelizh 1 1.111
47 pixelizv 1 1.111
48 pixelrand 1 1
49 splitlevel 1 1
50 decrgbzc 1 99
51 decrgbzg 1 99
99 message 1 1.0 99 message 1 1.0
-1 end 1 1.0 -1 end 1 1.0

View File

@ -47,6 +47,9 @@ return -1;
} }
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
/* nouveau du premier dimanche de 2020 'nextgen' */ /* nouveau du premier dimanche de 2020 'nextgen' */
/* CE TRUC NE MARCHE PAS COMME PRÉVU */
static int pixel_trinitron(FloatImg *pimg, int pos[4], float *fvals) static int pixel_trinitron(FloatImg *pimg, int pos[4], float *fvals)
{ {
int x, y, pline, off; int x, y, pline, off;
@ -65,7 +68,7 @@ return 0;
} }
/* /*
* need more explanation, need more worg * need more explanation, need more work
*/ */
int trinitron(FloatImg *pimg, int notused) int trinitron(FloatImg *pimg, int notused)
{ {

View File

@ -66,6 +66,8 @@ for (foo=0; foo<argc; foo++) {
} }
#endif #endif
fprintf(stderr, "*** Extracteur %s %s\n", __DATE__, __TIME__);
while ((opt = getopt(argc, argv, "hv")) != -1) { while ((opt = getopt(argc, argv, "hv")) != -1) {
switch(opt) { switch(opt) {
case 'h': help(0), exit(0); break; case 'h': help(0), exit(0); break;

View File

@ -46,7 +46,7 @@ int try_this_muxplane(char *fr, char *fg, char *fb, char *dst, int flags)
int foo; int foo;
FloatImg imr, img, imb, dest; FloatImg imr, img, imb, dest;
fprintf(stderr, "muxing: %s %s %s --> %s\n", fr, fg, fb, dst); fprintf(stderr, "muxing: %s %s %s -> %s\n", fr, fg, fb, dst);
foo = fimg_create_from_dump(fr, &imr); foo = fimg_create_from_dump(fr, &imr);
if (foo) { if (foo) {
@ -82,7 +82,8 @@ int main(int argc, char *argv[])
int foo; int foo;
if (5 != argc) { if (5 != argc) {
fprintf(stderr, "ERROR: %s need four fimg files arguments\n", argv[0]); fprintf(stderr, "ERROR: %s need four fimg files arguments\n",
argv[0]);
return 1; return 1;
} }

View File

@ -4,7 +4,7 @@
* http://la.buvette.org/photos/cumul * http://la.buvette.org/photos/cumul
*/ */
#define FIMG_VERSION 155 #define FIMG_VERSION 157
/* /*
* in memory descriptor * in memory descriptor
@ -28,6 +28,9 @@ typedef struct {
char magic[8]; char magic[8];
int32_t w, h, t; int32_t w, h, t;
} FimgFileHead; } FimgFileHead;
/*
* we MUST look at packing and endianess problems NOW */
#define MAGIC_AREA51 0xA5EA0051 #define MAGIC_AREA51 0xA5EA0051
typedef struct { typedef struct {
@ -128,12 +131,15 @@ int fimg_crump_hard(FloatImg *src, FloatImg *dst, float kval, int notused);
/* module sfx4.c */ /* module sfx4.c */
int fimg_sfx_triplemul(FloatImg *s, FloatImg *d, int notused); int fimg_sfx_triplemul(FloatImg *s, FloatImg *d, int notused);
int fimg_split_level(FloatImg *src, FloatImg *dst, int notused);
/* funcs/rotate.c module */ /* funcs/rotate.c module */
/* #coronamaison */ /* #coronamaison */
int fimg_rotate_90(FloatImg *src, FloatImg *dst, int notused); int fimg_rotate_90(FloatImg *src, FloatImg *dst, int notused);
int fimg_killrgb_v(FloatImg *src, FloatImg *dst, int k); int fimg_killrgb_v(FloatImg *src, FloatImg *dst, int k);
int fimg_decomp_rgbz_color(FloatImg *psrc, FloatImg *pdst, int k);
int fimg_decomp_rgbz_gray(FloatImg *psrc, FloatImg *pdst, int k);
/* universal exporter XXX */ /* universal exporter XXX */
int fimg_export_picture(FloatImg *pic, char *fname, int flags); int fimg_export_picture(FloatImg *pic, char *fname, int flags);
@ -160,8 +166,10 @@ int fimg_auto_shift_to_zero(FloatImg *s, FloatImg *d);
/* --> funcs/plasmas.c */ /* --> funcs/plasmas.c */
int fimg_prototype_plasma(FloatImg *img, double time, int type); int fimg_prototype_plasma(FloatImg *img, double time, int type);
/* --> funcs/pixelize.c
voir fimg_pixelize_h_rnd() */
int fimg_pixelize_h_0(FloatImg *psrc, FloatImg *pdst, int k); int fimg_pixelize_h_0(FloatImg *psrc, FloatImg *pdst, int k);
int fimg_pixelize_h_rnd(FloatImg *psrc, FloatImg *pdst, int largeur);
/* * * * experimental ! */ /* * * * experimental ! */
int fimg_classif_trial(FloatImg *src, FloatImg*dst, float fval, int notused); int fimg_classif_trial(FloatImg *src, FloatImg*dst, float fval, int notused);
@ -234,6 +242,7 @@ int fimg_multirandom(FloatImg *fimg, long nbpass);
void fimg_print_minmax(float minmax[6], char *titre); void fimg_print_minmax(float minmax[6], char *titre);
int parse_WxH(char *str, int *pw, int *ph); int parse_WxH(char *str, int *pw, int *ph);
int parse_double(char *str, double *dptr); int parse_double(char *str, double *dptr);
int irand2(int offset, int modulo);
int print_rectangle(char *str, FimgArea51 *rect); int print_rectangle(char *str, FimgArea51 *rect);
int parse_rectangle(char *str, FimgArea51 *r, int notused); int parse_rectangle(char *str, FimgArea51 *r, int notused);
int format_from_extension(char *fname); int format_from_extension(char *fname);

View File

@ -13,7 +13,7 @@ OBJS = fimg-png.o fimg-tiff.o misc-plots.o filtrage.o utils.o \
equalize.o fimg-fits.o saturation.o histogram.o \ equalize.o fimg-fits.o saturation.o histogram.o \
hsv.o classif.o contour2x2.o qsortrgb.o exporter.o \ hsv.o classif.o contour2x2.o qsortrgb.o exporter.o \
displacement.o dithering.o plasmas.o incrustator.o \ displacement.o dithering.o plasmas.o incrustator.o \
killrgb.o recurse.o pixelize.o killrgb.o recurse.o pixelize.o decomprgb.o
#--------------------------------------------------------------- #---------------------------------------------------------------
@ -37,6 +37,9 @@ tests.o: tests.c tests.h $(DEPS)
# ### # ###
decomprgb.o: decomprgb.c $(DEPS)
gcc $(COPT) -c $<
pixelize.o: pixelize.c $(DEPS) pixelize.o: pixelize.c $(DEPS)
gcc $(COPT) -c $< gcc $(COPT) -c $<

149
funcs/decomprgb.c Normal file
View File

@ -0,0 +1,149 @@
/*
* DECOMPOSITION RGB
*/
#include <stdio.h>
#include <stdint.h>
#include "../floatimg.h"
extern int verbosity;
/* == ---------------------------------------------------- == */
/* some dirty macros */
#define pixidx(fi,x,y) (((y)*fi->width)+(x))
#define getRpix(fi,x,y) (fi->R[ pixidx(fi,(x),(y)) ])
#define getGpix(fi,x,y) (fi->G[ pixidx(fi,(x),(y)) ])
#define getBpix(fi,x,y) (fi->B[ pixidx(fi,(x),(y)) ])
/* A lot of strange and usefull parenthesis */
/* == ---------------------------------------------------- == */
static float compute_z_value(float r, float g, float b)
{
double dval;
return 42.0;
}
/* == ---------------------------------------------------- == */
int fimg_decomp_rgbz_color(FloatImg *psrc, FloatImg *pdst, int k)
{
int x, y, x2, y2;
int w2, h2, idx;
float cumul, vgray;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__,
psrc, pdst, k);
#endif
fimg_clear(pdst);
w2 = psrc->width/2; h2 = psrc->height/2;
for (y=0; y<h2; y++)
{
y2 = y * 2;
for (x=0; x<w2; x++) {
x2 = x * 2;
cumul = getRpix(psrc, x2, y2) +
getRpix(psrc, x2, y2+1) +
getRpix(psrc, x2+1, y2) +
getRpix(psrc, x2+1, y2+1);
cumul /= 4, vgray = cumul;
pdst->R[pixidx(pdst,x,y)] = cumul;
cumul = getGpix(psrc, x2, y2) +
getGpix(psrc, x2, y2+1) +
getGpix(psrc, x2+1, y2) +
getGpix(psrc, x2+1, y2+1);
cumul /= 4, vgray += cumul;
pdst->G[pixidx(pdst,x+w2,y)] = cumul;
cumul = getBpix(psrc, x2, y2) +
getBpix(psrc, x2, y2+1) +
getBpix(psrc, x2+1, y2) +
getBpix(psrc, x2+1, y2+1);
cumul /= 4, vgray += cumul;
pdst->B[pixidx(pdst,x,y+h2)] = cumul;
idx = pixidx(pdst,x+w2,y+h2);
pdst->R[idx] = pdst->G[idx] = \
pdst->B[idx] = vgray / 3.0;
}
}
return 0;
}
/* == ---------------------------------------------------- == */
/* PUTAIN LE COPIER/COLLÉ DE BATARD !!! */
int fimg_decomp_rgbz_gray(FloatImg *psrc, FloatImg *pdst, int k)
{
int x, y, x2, y2;
int w2, h2, idx;
float cumul, vgray;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__,
psrc, pdst, k);
#endif
fimg_clear(pdst);
w2 = psrc->width/2; h2 = psrc->height/2;
for (y=0; y<h2; y++)
{
y2 = y * 2;
for (x=0; x<w2; x++) {
x2 = x * 2;
cumul = getRpix(psrc, x2, y2) +
getRpix(psrc, x2, y2+1) +
getRpix(psrc, x2+1, y2) +
getRpix(psrc, x2+1, y2+1);
cumul /= 4, vgray = cumul;
idx = pixidx(pdst,x,y);
pdst->R[idx] = pdst->G[idx] = pdst->B[idx] = cumul;
cumul = getGpix(psrc, x2, y2) +
getGpix(psrc, x2, y2+1) +
getGpix(psrc, x2+1, y2) +
getGpix(psrc, x2+1, y2+1);
cumul /= 4, vgray += cumul;
idx = pixidx(pdst,x+w2,y);
pdst->R[idx] = pdst->G[idx] = pdst->B[idx] = cumul;
cumul = getBpix(psrc, x2, y2) +
getBpix(psrc, x2, y2+1) +
getBpix(psrc, x2+1, y2) +
getBpix(psrc, x2+1, y2+1);
cumul /= 4, vgray += cumul;
idx = pixidx(pdst,x,y+h2);
pdst->R[idx] = pdst->G[idx] = pdst->B[idx] = cumul;
idx = pixidx(pdst,x+w2,y+h2);
pdst->R[idx] = pdst->G[idx] = \
pdst->B[idx] = vgray / 3.0;
}
}
return 0;
}
/* == ---------------------------------------------------- == */

View File

@ -44,6 +44,7 @@ if (verbosity) {
tiff = TIFFOpen(fname, "w"); tiff = TIFFOpen(fname, "w");
if (NULL==tiff) { if (NULL==tiff) {
fprintf(stderr, "erreur TIFFOpen\n");
return -6; return -6;
} }

View File

@ -3,37 +3,52 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h>
#include "../floatimg.h" #include "../floatimg.h"
extern int verbosity; extern int verbosity;
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
int fimg_pixelize_h_0(FloatImg *psrc, FloatImg *pdst, int k) /* nouveau 10 octobre 2021 dans la roulotte de Terreblanque */
#define LARGEUR 16
int fimg_pixelize_h_0(FloatImg *psrc, FloatImg *pdst, int largeur)
{ {
int line, col, loop, idx; int line, col, loop, idx;
float cr, cg, cb; /* cumuls */ float cr, cg, cb; /* cumuls */
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, psrc, pdst, k); #if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, psrc, pdst, largeur);
#endif
if (fimg_images_not_compatible(psrc, pdst)) { if (fimg_images_not_compatible(psrc, pdst)) {
fprintf(stderr, "%s: err compatibility\n", __func__); fprintf(stderr, "%s: err compatibility\n", __func__);
return -8; return -8;
} }
switch(largeur) {
case 8: case 16: case 32:
break;
default:
fprintf(stderr, "pixeliz bad width %d\n", largeur);
return -77;
}
for (line=0; line<psrc->height; line++) { for (line=0; line<psrc->height; line++) {
for (col=0; col<psrc->width; col+=8) { for (col=0; col<psrc->width; col+=largeur) {
cr = cg = cb = 0.0; cr = cg = cb = 0.0;
idx = line * psrc->width + col; idx = line * psrc->width + col;
for (loop=0; loop<8; loop++) { for (loop=0; loop<largeur; loop++) {
cr += psrc->R[idx+loop]; cr += psrc->R[idx+loop];
cg += psrc->G[idx+loop]; cg += psrc->G[idx+loop];
cb += psrc->B[idx+loop]; cb += psrc->B[idx+loop];
} }
for (loop=0; loop<8; loop++) { for (loop=0; loop<largeur; loop++) {
pdst->R[idx+loop] = cr / 8.0; pdst->R[idx+loop] = cr / (float)largeur;
pdst->G[idx+loop] = cg / 8.0; pdst->G[idx+loop] = cg / (float)largeur;
pdst->B[idx+loop] = cb / 8.0; pdst->B[idx+loop] = cb / (float)largeur;
} }
} }
} }
@ -41,7 +56,47 @@ for (line=0; line<psrc->height; line++) {
return 0; return 0;
} }
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
/*
* un essai dans la roulotte :)
* 11 oct 2021 : premier jet, essai concluant, mais nécessite
* du travail sur les rand() pour être plus 'noisy'
*
*/
int fimg_pixelize_h_rnd(FloatImg *psrc, FloatImg *pdst, int largeur)
{
static int count = 0;
static int flag = 0;
int foo;
if (0==count) {
if (flag) {
count = irand2(5, 10);
flag = ! flag;
}
else {
count = irand2(20, 40);
flag = ! flag;
}
if (verbosity) {
fprintf(stderr, "%s c=%d f=%c\n", __func__,
count, flag?'T':'F');
}
}
if (verbosity) {
fprintf(stderr, "%s: count=%d flag=%d\n", __func__, count, flag);
}
foo = fimg_pixelize_h_0(psrc, pdst, flag ? 8 : 32);
if (foo) {
fprintf(stderr, "PANIC in %s\n", __func__);
abort();
}
count--; /* nice trick bro */
return 0;
}
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */

View File

@ -40,5 +40,36 @@ for (y=0; y<src->height; y++) {
return 0; return 0;
} }
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
/*
* see also:
sfx3.c:fimg_crump_hard()
*/
int fimg_split_level(FloatImg *src, FloatImg *dst, int notused)
{
float means[4];
float in[3], out[3];
int foo, idx, surface;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p 0x%04x )\n", __func__, src, dst, notused);
#endif
foo = fimg_meanvalues(src, means);
if (foo) {
return -66;
}
surface = src->width*src->height;
for(idx=0; idx<surface; idx++) {
if (src->R[idx]<means[0]) dst->R[idx]=src->R[idx]*2.0;
else dst->R[idx]=(src->R[idx]-means[0])*2.0;
if (src->G[idx]<means[1]) dst->G[idx]=src->G[idx]*2.0;
else dst->G[idx]=(src->G[idx]-means[1])*2.0;
if (src->B[idx]<means[2]) dst->B[idx]=src->B[idx]*2.0;
else dst->B[idx]=(src->B[idx]-means[2])*2.0;
}
return 0;
}
/* -------------------------------------------------------------- */
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */

View File

@ -24,7 +24,7 @@ enum nCmd { Equalize=1, Rotate, Sfx0, F3x3, MIRE, Wfits, Wpng, Wtiff,
Histo, Hsv, Classif, Ctr2x2, Qsortrgb, Histo, Hsv, Classif, Ctr2x2, Qsortrgb,
Displace, ReadPNG, Plasmas, Hilight, OpenEXR, Displace, ReadPNG, Plasmas, Hilight, OpenEXR,
Geometrie, FileType, Mirror, KillRGB, Geometrie, FileType, Mirror, KillRGB,
Pixelize }; Pixelize,SplitLevel,DecompRgbz };
typedef struct { typedef struct {
char *name; char *name;
int Cmd; int Cmd;
@ -54,6 +54,8 @@ Command commands[] = {
{ "mirror", Mirror }, { "mirror", Mirror },
{ "killrgb", KillRGB }, { "killrgb", KillRGB },
{ "pixelize", Pixelize }, { "pixelize", Pixelize },
{ "spltlvl", SplitLevel },
{ "decomprgbz", DecompRgbz },
{ NULL, 0 } { NULL, 0 }
} ; } ;
@ -225,7 +227,12 @@ switch(opt) {
case Pixelize: case Pixelize:
foo = essai_pixelize(filename, outfile); foo = essai_pixelize(filename, outfile);
break; break;
case SplitLevel:
foo = essai_split_level(filename, outfile, 0);
break;
case DecompRgbz:
foo = essai_decomprgb(filename, outfile);
break;
default: default:
fprintf(stderr, "'%s' is a bad command\n", command); fprintf(stderr, "'%s' is a bad command\n", command);
exit(1); exit(1);

View File

@ -46,6 +46,40 @@ if (foo) {
return foo; return foo;
} }
return 0;
}
/* --------------------------------------------------------------------- */
/* --------------------------------------------------------------------- */
int essai_decomprgb(char *inf, char *outf)
{
int foo;
FloatImg src, dst;
fprintf(stderr, ">>> %s ( %s %s )\n", __func__, inf, outf);
foo = fimg_create_from_dump(inf, &src);
if (0 != foo) {
fprintf(stderr, "%s: err %d loading image '%s'\n", __func__,
foo, inf);
return foo;
}
fimg_clone(&src, &dst, 1);
foo = fimg_decomp_rgbz_gray(&src, &dst, 0);
if (foo) {
fprintf(stderr, "%s:%s(): fail %d line %d\n",
__FILE__, __func__, foo, __LINE__);
return foo;
}
foo = fimg_export_picture(&dst, outf, 0);
if (foo) {
fprintf(stderr, "%s : err %d saving result\n", __func__, foo);
return foo;
}
fimg_destroy(&src); fimg_destroy(&dst);
return 0; return 0;
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
@ -104,7 +138,7 @@ fimg_clone(&src, &dst, 0);
/* run the crappy code */ /* run the crappy code */
foo = fimg_mirror(&src, &dst, 0); foo = fimg_mirror(&src, &dst, 0);
if (foo) { if (foo) {
fprintf(stderr, "err %d in fimg_mirrot\n", foo); fprintf(stderr, "err %d in fimg_mirror\n", foo);
return -6; return -6;
} }
@ -114,6 +148,36 @@ if (foo) {
return foo; return foo;
} }
return 0;
}
/* --------------------------------------------------------------------- */
/* --------------------------------------------------------------------- */
int essai_split_level(char *inf, char *outf, int flags)
{
int foo;
FloatImg src, dst;
fprintf(stderr, ">>> %s ( '%s' '%s' 0x%X )\n", __func__,
inf, outf, flags);
foo = fimg_create_from_dump(inf, &src);
if (0 != foo) {
fprintf(stderr, "%s: err %d loading image '%s'\n", __func__,
foo, inf);
return foo;
}
fimg_clone(&src, &dst, 0);
foo = fimg_split_level(&src, &dst, 0);
if (foo) {
fprintf(stderr, "err %d in split_level\n", foo);
return -6;
}
foo = fimg_export_picture(&dst, outf, 0);
if (foo) {
fprintf(stderr, "%s : err %d saving result\n", __func__, foo);
return foo;
}
return 0; return 0;
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */

View File

@ -6,6 +6,8 @@
int essai_plasma(char *infile, char *outfile, int ikoef, float fkoef); int essai_plasma(char *infile, char *outfile, int ikoef, float fkoef);
int essai_miroir(char *inf, char *outf, int flags); int essai_miroir(char *inf, char *outf, int flags);
int essai_killrgb(char *inf, char *outf); int essai_killrgb(char *inf, char *outf);
int essai_decomprgb(char *inf, char *outf);
int essai_split_level(char *inf, char *outf, int flags);
int essai_displacement(char *infile, char *outfile); int essai_displacement(char *infile, char *outfile);
int essai_qsort_rgb(char *infile, char *outfile); int essai_qsort_rgb(char *infile, char *outfile);

View File

@ -3,6 +3,7 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdint.h> #include <stdint.h>
@ -53,6 +54,12 @@ if (1 == foo) {
return -1; return -1;
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
/* new Mon 11 Oct 2021 08:28:27 PM CEST */
int irand2(int offset, int modulo)
{
return offset + (rand() % modulo);
}
/* --------------------------------------------------------------------- */
int file_type_from_name(char *name) int file_type_from_name(char *name)
{ {