Compare commits
No commits in common. "e7c726320a73afe72c0422d1d60fdf4affdd9842" and "b73c25f470c7059141c2901df9120929d3332d86" have entirely different histories.
e7c726320a
...
b73c25f470
1
.gitignore
vendored
1
.gitignore
vendored
@ -65,5 +65,4 @@ tools/*.tiff
|
||||
|
||||
Fonderie/*.o
|
||||
Fonderie/fonderie
|
||||
Fonderie/interpolator
|
||||
|
||||
|
@ -4,17 +4,11 @@
|
||||
|
||||
COPT = -g -no-pie -Wall -DDEBUG_LEVEL=0 -Werror=parentheses
|
||||
LIBS = -lfloatimg -lpnglite -lm
|
||||
|
||||
OBJS = fonctions.o sfx.o crapulator.o glitches.o metriques.o
|
||||
DEPS = fonctions.h crapulator.h metriques.h glitches.h
|
||||
|
||||
all: fonderie interpolator
|
||||
|
||||
# ---------------------------------------------------------
|
||||
|
||||
OBJS = fonctions.o sfx.o crapulator.o
|
||||
DEPS = fonctions.h crapulator.h
|
||||
|
||||
fonderie: fonderie.c ${DEPS} ${OBJS} Makefile
|
||||
gcc ${COPT} $< ${OBJS} ${LIBS} -lz -o $@
|
||||
gcc ${COPT} $< ${OBJS} ${LIBS} -o $@
|
||||
|
||||
crapulator.o: crapulator.c ${DEPS} Makefile
|
||||
gcc ${COPT} -c $<
|
||||
@ -26,17 +20,11 @@ sfx.o: sfx.c ${DEPS} Makefile
|
||||
gcc ${COPT} -c $<
|
||||
|
||||
# ---------------------------------------------------------
|
||||
#
|
||||
# another way to brotch some pics...
|
||||
#
|
||||
|
||||
metriques.o: metriques.[hc] Makefile
|
||||
gcc ${COPT} -c $<
|
||||
TOTAR = *.c *.h Makefile \
|
||||
*.sh
|
||||
|
||||
glitches.o: glitches.[hc] Makefile
|
||||
gcc ${COPT} -c $<
|
||||
|
||||
interpolator: interpolator.c ${OBJS} Makefile
|
||||
gcc ${COPT} $< ${OBJS} ${LIBS} -lz -o $@
|
||||
|
||||
# ---------------------------------------------------------
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
# Fonderie et Interpolator
|
||||
# Fonderie
|
||||
|
||||
Avec toutes ces fonctions disponibles et `grabvidseq`, nous
|
||||
savons faire des images **floues***. L'étape suivante, les plus
|
||||
pervers d'entre vous le savent déja, est celle de la création
|
||||
de **films flous**.
|
||||
|
||||
## Fonderie
|
||||
## fonderie
|
||||
|
||||
Le programme principal, utilisé à partir de la ligne de commande
|
||||
avec une foule d'options aux mnémoniques abscons.
|
||||
@ -65,14 +65,5 @@ aussi bien en entrée qu'en sortie. Il est, à l'heure actuelle,
|
||||
assez rudimentaire, avec un paramétrage simpliste, et un manque
|
||||
criant de documentation...
|
||||
|
||||
## Interpolator
|
||||
|
||||
Un logiciel dont l'inspiration vient de Terre-Blanque, ça ne peut
|
||||
pas être complètement malsain :)
|
||||
|
||||
|
||||
## Conclusion
|
||||
|
||||
|
||||
**Use the source, Luke**
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "crapulator.h"
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
/* support function for the crapulator */
|
||||
static int effect_3(FloatImg *image)
|
||||
{
|
||||
float value;
|
||||
@ -75,6 +76,7 @@ if (666==count) {
|
||||
switch (idFx) {
|
||||
case 0: /* DO NOTHING */
|
||||
retval = 0; break;
|
||||
|
||||
case 1:
|
||||
fimg_cos_01(image, image,
|
||||
fimg_get_maxvalue(image));
|
||||
@ -97,12 +99,15 @@ switch (idFx) {
|
||||
case 6:
|
||||
fimg_killcolors_a(image, 0.0);
|
||||
break;
|
||||
|
||||
case 7:
|
||||
retval = fimg_colors_mixer_a(image, 2.0);
|
||||
break;
|
||||
|
||||
case 8:
|
||||
retval = insitu_ctr2x2(image);
|
||||
break;
|
||||
|
||||
case 9:
|
||||
retval = fimg_classif_trial(image, image, 0.37, 0);
|
||||
if (retval) {
|
||||
@ -110,13 +115,11 @@ switch (idFx) {
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
|
||||
case 10:
|
||||
retval = binarize(image, 0);
|
||||
break;
|
||||
case 11:
|
||||
retval = trinarize(image, 0);
|
||||
break;
|
||||
/* --- WTF -- */
|
||||
|
||||
default :
|
||||
fprintf(stderr, "%s : effect #%d invalid\n",
|
||||
__func__, idFx);
|
||||
|
@ -40,7 +40,6 @@ int create_fifo(int nbslot, int w, int h, int t);
|
||||
* funcs in 'sfx.c'
|
||||
*/
|
||||
|
||||
int trinarize(FloatImg *pimg, int notused);
|
||||
int binarize(FloatImg *pimg, int notused);
|
||||
|
||||
int brotche_rand48_a(FloatImg *fimg, float ratio, float mval);
|
||||
|
@ -155,7 +155,7 @@ else {
|
||||
fprintf(stderr, "\nelapsed %.2f seconds\n", fin);
|
||||
}
|
||||
|
||||
return 8; /* why 9 ? */
|
||||
return 8;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
void help(void)
|
||||
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* glitches.c
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
||||
extern int verbosity;
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
int kill_a_random_line(FloatImg *pvictime, float fval, int notused)
|
||||
{
|
||||
int line, xpos, offset;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %d )\n", __func__, pvictime, notused);
|
||||
#endif
|
||||
|
||||
line = rand() % pvictime->height;
|
||||
|
||||
if (verbosity > 1) {
|
||||
fprintf(stderr, "%s: try to kill line %d\n", __func__, line);
|
||||
}
|
||||
|
||||
offset = pvictime->width * line;
|
||||
|
||||
for (xpos=offset; xpos<pvictime->width; xpos++) {
|
||||
pvictime->R[offset] = fval;
|
||||
pvictime->G[offset] = 0.0;
|
||||
pvictime->B[offset] = fval;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
int kill_a_few_lines(FloatImg *who, float fval, int number)
|
||||
{
|
||||
int idx, foo;
|
||||
|
||||
/* Frag the pixels */
|
||||
for (idx=0; idx<number; idx++) {
|
||||
foo = kill_a_random_line(who, fval, 0);
|
||||
if (foo) abort();
|
||||
}
|
||||
|
||||
return foo;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
|
@ -1,9 +0,0 @@
|
||||
/*
|
||||
* glitches.h
|
||||
*/
|
||||
|
||||
int kill_a_random_line(FloatImg *pvictime, float level, int notused);
|
||||
int kill_a_few_lines(FloatImg *who, float fval, int number);
|
||||
|
||||
|
||||
/* this is a wtf file */
|
@ -1,151 +0,0 @@
|
||||
/*
|
||||
* INTERPOLATOR 2070
|
||||
*
|
||||
* Don't use that software in real life !
|
||||
*
|
||||
* imported in FloatImg Mon Nov 9 19:08:57 CET 2020
|
||||
*
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <glob.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
||||
#include "glitches.h"
|
||||
#include "crapulator.h"
|
||||
|
||||
// XXX #include "fonctions.h"
|
||||
|
||||
int verbosity;
|
||||
int convert_to_gray; /* needed by fonctions.c */
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
int interpolator(char *pattern, char *outdir, int Nsteps)
|
||||
{
|
||||
FloatImg A, B, Out, *pFirst, *pSecond;
|
||||
glob_t globbuf;
|
||||
int foo, idx, ipng, w, h, step;
|
||||
int iarray[3];
|
||||
char *cptr, line[200];
|
||||
float coef;
|
||||
|
||||
fprintf(stderr, "\nfrom %s to %s with %d steps.\n", pattern, outdir, Nsteps);
|
||||
|
||||
memset(&globbuf, 0, sizeof(glob_t));
|
||||
foo = glob(pattern, 0, NULL, &globbuf);
|
||||
fprintf(stderr, "globbing '%s' -> %d, %ld files found\n",
|
||||
pattern, foo, globbuf.gl_pathc);
|
||||
|
||||
if (0 == globbuf.gl_pathc) {
|
||||
fprintf(stderr, "%s : no file found, aborting\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
foo = fimg_fileinfos(globbuf.gl_pathv[0], iarray);
|
||||
w = iarray[0], h = iarray[1];
|
||||
fprintf(stderr, "\tfirst image size : %dx%d\n", w, h);
|
||||
|
||||
fimg_create(&A, w, h, 3); pFirst = &A;
|
||||
fimg_create(&B, w, h, 3); pSecond = &B;
|
||||
fimg_create(&Out, w, h, 3);
|
||||
|
||||
ipng = 0;
|
||||
for (idx=0; idx<globbuf.gl_pathc; idx++) {
|
||||
|
||||
cptr = globbuf.gl_pathv[idx];
|
||||
|
||||
/* read the next file in B */
|
||||
fprintf(stderr, "loading %s\r", cptr);
|
||||
foo = fimg_load_from_dump(cptr, &B);
|
||||
if (foo) {
|
||||
fprintf(stderr, "load #%d from dump -> %d\n", idx, foo);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* here, we can insert the input filter */
|
||||
/* OK try it ... */
|
||||
foo = crapulator(&B, 0, 256.7);
|
||||
if (foo) {
|
||||
fprintf(stderr, "crapulator failure %d\n", foo);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
for (step=0; step<Nsteps; step++) {
|
||||
coef = (float)step / (float)Nsteps;
|
||||
fimg_interpolate(pSecond, pFirst, &Out, coef);
|
||||
|
||||
/* here we can insert the output filter */
|
||||
kill_a_few_lines(&Out, 3.14159, 500);
|
||||
|
||||
sprintf(line, "%s/%05d.png", outdir, ipng);
|
||||
foo = fimg_save_as_png(&Out, line, 0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "err saving %s\n", line);
|
||||
return -8;
|
||||
}
|
||||
ipng++;
|
||||
}
|
||||
|
||||
#if 1
|
||||
/* temporary hack : move datas */
|
||||
fimg_copy_data(&B, &A);
|
||||
#else
|
||||
/* swap pointers to the two picz */
|
||||
pTmp = pSecond;
|
||||
pSecond = pFirst;
|
||||
pFirst = pTmp;
|
||||
/* XXX THIS CODE DON'T WORK !!! */
|
||||
#endif
|
||||
}
|
||||
|
||||
fprintf(stderr, "generated %d png files\n", ipng);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
void help(void)
|
||||
{
|
||||
puts("\tINTERPOLATOR\noptions:");
|
||||
|
||||
/* may be we can make options incoherent, like
|
||||
* the options of 'fonderie' software ?
|
||||
*/
|
||||
|
||||
exit(0);
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
int foo;
|
||||
int nbrsteps = 9;
|
||||
int opt;
|
||||
|
||||
fprintf(stderr, "*** %s : compiled by tTh, %s %s\n", __FILE__,
|
||||
__DATE__, __TIME__);
|
||||
fimg_print_version(2);
|
||||
|
||||
while ((opt = getopt(argc, argv, "v")) != -1) {
|
||||
switch(opt) {
|
||||
case 'v': verbosity++; break;
|
||||
}
|
||||
}
|
||||
|
||||
/* TO BE CONTINUED *****/
|
||||
|
||||
if (4 != argc) {
|
||||
fprintf(stderr, "args: <in globpattern> <out dir> <nbrsteep>\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
nbrsteps = atoi(argv[3]);
|
||||
|
||||
foo = interpolator(argv[1], argv[2], nbrsteps);
|
||||
|
||||
fprintf(stderr, "interpolator give a %d score\n", foo);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
@ -1,24 +0,0 @@
|
||||
/*
|
||||
* metriques.c
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
||||
extern int verbosity;
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
|
||||
int get_float_metric(FloatImg *pimg, float *where, int whot)
|
||||
{
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %f %d )\n", __func__, pimg, where, whot);
|
||||
#endif
|
||||
|
||||
*where = 0;
|
||||
|
||||
return -1;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
@ -1,9 +0,0 @@
|
||||
/*
|
||||
* metriques.h
|
||||
*/
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
|
||||
int get_float_metric(FloatImg *pimg, float *where, int whot)
|
||||
|
||||
/* -------------------------------------------------------------- */
|
@ -17,15 +17,6 @@
|
||||
*/
|
||||
extern int verbosity;
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
int trinarize(FloatImg *pimg, int notused)
|
||||
{
|
||||
|
||||
fprintf(stderr, "the function '%s' is not implemented\n", __func__);
|
||||
exit(2);
|
||||
|
||||
return -1;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
int binarize(FloatImg *pimg, int notused)
|
||||
{
|
||||
@ -109,3 +100,6 @@ return 0;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
* ugly code from tTh
|
||||
*/
|
||||
|
||||
#define FIMG_VERSION 113
|
||||
#define FIMG_VERSION 112
|
||||
|
||||
/*
|
||||
* in memory descriptor
|
||||
|
@ -56,7 +56,6 @@ int to_gray = 0;
|
||||
char *output_file = "out.fimg";
|
||||
FloatImg accu, temp;
|
||||
int src_loaded = 0;
|
||||
float vals[6];
|
||||
|
||||
g_width = g_height = 0;
|
||||
|
||||
@ -75,9 +74,11 @@ fprintf(stderr, "argc = %d, optind = %d\n", argc, optind);
|
||||
#endif
|
||||
|
||||
for (idx=optind; idx<argc; idx++) {
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "%5d %s\n", idx, argv[idx]);
|
||||
#endif
|
||||
|
||||
foo = testfile(argv[idx]);
|
||||
if (foo) {
|
||||
fprintf(stderr, "testfile %s -> %d\n", argv[idx],foo);
|
||||
@ -97,9 +98,12 @@ for (idx=optind; idx<argc; idx++) {
|
||||
}
|
||||
fimg_add_2(&temp, &accu);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (to_gray) {
|
||||
|
||||
foo = fimg_desaturate(&accu, &accu, 0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "desaturate: error %d\n", foo);
|
||||
@ -112,21 +116,6 @@ if (foo) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (verbosity) {
|
||||
/* show some numbers about resultant picture */
|
||||
foo = fimg_get_minmax_rgb(&accu, vals);
|
||||
if (foo) {
|
||||
fprintf(stderr, "err %d on fimg_get_minmax_rgb\n", foo);
|
||||
return foo;
|
||||
}
|
||||
printf("Rmin %12.4g Rmax %12.4g delta %12g\n",
|
||||
vals[0], vals[1], vals[1]-vals[0]);
|
||||
printf("Gmin %12.4g Gmax %12.4g %12g\n",
|
||||
vals[2], vals[3], vals[3]-vals[2]);
|
||||
printf("Bmin %12.4g Bmax %12.4g %12g\n",
|
||||
vals[4], vals[5], vals[5]-vals[4]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
@ -1,10 +1,5 @@
|
||||
/*
|
||||
* PNG ---> FIMG
|
||||
*
|
||||
* Attention : certains fichiers PNG ne passent pas cette
|
||||
* moulinette, mais le bug est dans la bibliotheque de
|
||||
* fonctions 'libpnglite'. Une solution de remplacement
|
||||
* devrait etre a l'etude un de ces jours...
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -22,10 +17,6 @@ int main(int argc, char *argv[])
|
||||
FloatImg fimg;
|
||||
int foo;
|
||||
|
||||
/*
|
||||
* pas de traitement des options ?
|
||||
*/
|
||||
|
||||
if (3 != argc) {
|
||||
fimg_print_version(1);
|
||||
fprintf(stderr, "usage:\n\t%s foo.png bar.fimg\n", argv[0]);
|
||||
@ -40,7 +31,7 @@ if (foo) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (verbosity) fimg_describe(&fimg, argv[2]);
|
||||
fimg_describe(&fimg, argv[2]);
|
||||
|
||||
foo = fimg_dump_to_file(&fimg, argv[2], 0);
|
||||
fprintf(stderr, "save as fimg -> %d\n", foo);
|
||||
|
Loading…
Reference in New Issue
Block a user