Compare commits
No commits in common. "6e6433368c07765fa014af4397cbc0053d691edb" and "ad58bf521d7093e0afa1913e8aa454a74ab52d66" have entirely different histories.
6e6433368c
...
ad58bf521d
@ -6,11 +6,11 @@
|
||||
COPT = -g -fpic -no-pie -Wall -DDEBUG_LEVEL=0 -Werror=parentheses
|
||||
LIBS = ../libfloatimg.a -ltiff -lpnglite -lm -lz -lcfitsio
|
||||
|
||||
OBJS = fifo.o sfx.o crapulator.o glitches.o metriques.o \
|
||||
OBJS = fonctions.o sfx.o crapulator.o glitches.o metriques.o \
|
||||
filterstack.o single.o
|
||||
|
||||
DEPS = ../floatimg.h \
|
||||
fifo.h crapulator.h metriques.h glitches.h sfx.h \
|
||||
fonctions.h crapulator.h metriques.h glitches.h sfx.h \
|
||||
filterstack.h crapdef.h crapstr.h single.h
|
||||
|
||||
all: fonderie interpolator singlepass t
|
||||
@ -52,7 +52,7 @@ crapstr.h: crapulors.liste Makefile craplist2str.awk
|
||||
crapulator.o: crapulator.c ${DEPS} Makefile
|
||||
gcc ${COPT} -c $<
|
||||
|
||||
fifo.o: fifo.c fifo.h Makefile
|
||||
fonctions.o: fonctions.c fonctions.h Makefile
|
||||
gcc ${COPT} -c $<
|
||||
|
||||
sfx.o: sfx.c ${DEPS} Makefile
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
||||
#include "fifo.h"
|
||||
#include "fonctions.h"
|
||||
#include "crapulator.h"
|
||||
#include "glitches.h"
|
||||
#include "sfx.h"
|
||||
@ -157,7 +157,7 @@ return retval;
|
||||
* processor.
|
||||
*/
|
||||
|
||||
#define DEBUG_THIS_CRAP 0
|
||||
#define DEBUG_THIS_CRAP 60
|
||||
|
||||
int crapulator(FloatImg *image, int idFx, float fval)
|
||||
{
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
||||
#include "fifo.h"
|
||||
#include "fonctions.h"
|
||||
#include "crapulator.h"
|
||||
#include "filterstack.h"
|
||||
|
||||
@ -19,8 +19,7 @@
|
||||
*/
|
||||
extern int verbosity;
|
||||
|
||||
/* private vars of this module - it was very dirty,
|
||||
* but simple and efficient.
|
||||
/* private vars of this module - it was very dirty
|
||||
*/
|
||||
static A_Fifo g_fifo;
|
||||
|
||||
@ -46,11 +45,6 @@ int faire_la_somme(A_Fifo *pfifo, FloatImg *destination, int step)
|
||||
int idx, foo;
|
||||
FloatImg *pdest;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__,
|
||||
pfifo, destination, step);
|
||||
#endif
|
||||
|
||||
if (NULL==destination) {
|
||||
pdest = &(pfifo->total); }
|
||||
else {
|
||||
@ -68,26 +62,24 @@ for (idx=0; idx<pfifo->nbslots; idx += step) {
|
||||
}
|
||||
}
|
||||
|
||||
/* XXX
|
||||
fprintf(stderr, "*** %s:%s writing debugB file ***\n",
|
||||
fprintf(stderr, "*** %s %s writing debug file ***\n",
|
||||
__FILE__, __func__);
|
||||
fimg_dump_to_file(&g_fifo.total, "debugB.fimg", 0);
|
||||
XXX */
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
/* called by 'fonderie.c'
|
||||
* this func save the fifo content as
|
||||
* - float FIMG
|
||||
* - 16 bits PNM
|
||||
* - 8 bits PNG
|
||||
*/
|
||||
int export_fifo(char *fname, int step)
|
||||
{
|
||||
int foo, type;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, fname, step);
|
||||
#endif
|
||||
|
||||
foo = faire_la_somme(&g_fifo, NULL, 1);
|
||||
foo = faire_la_somme(&g_fifo, NULL, step);
|
||||
|
||||
foo = filterstack_run(1, &g_fifo.total, 0);
|
||||
if (foo) {
|
||||
@ -96,7 +88,24 @@ if (foo) {
|
||||
return foo;
|
||||
}
|
||||
|
||||
foo = fimg_export_picture(&g_fifo.total, fname, 0);
|
||||
type = format_from_extension(fname);
|
||||
switch (type) {
|
||||
case FILE_TYPE_PNG:
|
||||
foo = fimg_save_as_png(&g_fifo.total, fname, 0);
|
||||
break;
|
||||
case FILE_TYPE_PNM:
|
||||
foo = fimg_save_as_pnm(&g_fifo.total, fname, 0);
|
||||
break;
|
||||
case FILE_TYPE_FIMG:
|
||||
foo = fimg_dump_to_file(&g_fifo.total, fname, 0);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "%s : type of '%s' unknow\n",
|
||||
__func__, fname);
|
||||
foo = 888;
|
||||
break;
|
||||
}
|
||||
|
||||
if (foo) {
|
||||
fprintf(stderr, "ERR EXPORT '%s' is %d\n", fname, foo);
|
||||
exit(3);
|
||||
@ -108,11 +117,7 @@ return 0;
|
||||
int insert_picture(FloatImg *src)
|
||||
{
|
||||
FloatImg *dst;
|
||||
int nbre, foo;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p )\n", __func__, src);
|
||||
#endif
|
||||
int nbre;
|
||||
|
||||
dst = &g_fifo.slots[g_fifo.next];
|
||||
|
||||
@ -121,12 +126,9 @@ memcpy(dst->R, src->R, nbre);
|
||||
memcpy(dst->G, src->G, nbre);
|
||||
memcpy(dst->B, src->B, nbre);
|
||||
|
||||
/* XXX
|
||||
fprintf(stderr, "*** %s:%s writing debugA file ***\n",
|
||||
fprintf(stderr, "*** %s %s writing debug file ***\n",
|
||||
__FILE__, __func__);
|
||||
foo = fimg_dump_to_file(dst, "debugA.fimg", 0);
|
||||
fprintf(stderr, " ok file dumped %d\n", foo);
|
||||
XXX */
|
||||
fimg_dump_to_file(dst, "debugA.fimg", 0);
|
||||
|
||||
g_fifo.next++; g_fifo.next %= g_fifo.nbslots;
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <glob.h>
|
||||
#include "../floatimg.h"
|
||||
|
||||
#include "fifo.h"
|
||||
#include "fonctions.h"
|
||||
#include "glitches.h"
|
||||
#include "crapulator.h"
|
||||
#include "filterstack.h"
|
||||
@ -17,19 +17,12 @@
|
||||
int verbosity;
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
/*
|
||||
* this is the real worker ? or just a wrapper ?
|
||||
*/
|
||||
int traite_une_image(FloatImg *image, char *outd)
|
||||
int traite_une_image(FloatImg *image, int step, char *outd)
|
||||
{
|
||||
static int numero;
|
||||
int foo;
|
||||
char ligne[200];
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "\n>>> %s ( %p '%s' )\n", __func__, image, outd);
|
||||
#endif
|
||||
|
||||
/* here, we put the picz in the fifo machinery */
|
||||
foo = insert_picture(image);
|
||||
if (foo) {
|
||||
@ -37,33 +30,46 @@ if (foo) {
|
||||
return foo;
|
||||
}
|
||||
|
||||
/* and now, we pull the result on the magic computation
|
||||
*/
|
||||
sprintf(ligne, "%s/%05d.png", outd, numero);
|
||||
if (verbosity > 1) fprintf(stderr, " exporting to '%s'\n", ligne);
|
||||
|
||||
foo = export_fifo(ligne, 1);
|
||||
foo = export_fifo(ligne, step);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s: err %d on export\n", __func__, foo);
|
||||
return foo;
|
||||
}
|
||||
numero++; /* VERY IMPORTANT :) */
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
int insert_blank(FloatImg *image, int nbre, char *outd)
|
||||
int insert_blank(FloatImg *image, int nbre, float fval, char *outd)
|
||||
{
|
||||
int idx, foo;
|
||||
int preloaded = 0;
|
||||
FloatImg blank;
|
||||
char *fname;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %d '%s' )\n", __func__,
|
||||
image, nbre, outd);
|
||||
fprintf(stderr, ">>> %s ( %p %d %d %f '%s' )\n", __func__,
|
||||
image, nbre, pproc, fval, outd);
|
||||
#endif
|
||||
|
||||
if (NULL != (fname=getenv("BLANK_FIMG"))) {
|
||||
fprintf(stderr,"%s: try to load %s\n", __func__, fname);
|
||||
fimg_clone(image, &blank, 1);
|
||||
foo = fimg_load_from_dump(fname, &blank);
|
||||
if (foo) {
|
||||
fprintf(stderr, "epic fail %d on %s\n", foo, fname);
|
||||
exit(1);
|
||||
}
|
||||
if (verbosity) fimg_describe(&blank, "Blank pic");
|
||||
preloaded = 1;
|
||||
}
|
||||
|
||||
fimg_clear(image);
|
||||
for (idx=0; idx<nbre; idx++) {
|
||||
if ((foo=traite_une_image(image, outd))) {
|
||||
if (preloaded) {
|
||||
fimg_copy_data(&blank, image);
|
||||
}
|
||||
if ((foo=traite_une_image(image, 1, outd))) {
|
||||
fprintf(stderr, "%s : err %d from 'traite_une_image'\n",
|
||||
__func__, foo);
|
||||
break;
|
||||
@ -72,6 +78,10 @@ for (idx=0; idx<nbre; idx++) {
|
||||
}
|
||||
puts("");
|
||||
|
||||
if (preloaded) {
|
||||
fimg_destroy(&blank);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
@ -88,8 +98,8 @@ float maxvalue;
|
||||
int datas[3];
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "\n>>> %s ( '%s' -> '%s' %d )\n", __func__,
|
||||
pattern, outdir, szfifo);
|
||||
fprintf(stderr, ">>> %s ( '%s' -> '%s' %d eff:%d:%d)\n", __func__,
|
||||
pattern, outdir, szfifo, infx, outfx);
|
||||
#endif
|
||||
|
||||
if (1 != step) fprintf(stderr, "\tstep is %d\n", step);
|
||||
@ -127,14 +137,12 @@ foo = create_fifo(szfifo, width, height, FIMG_TYPE_RGB);
|
||||
fprintf(stderr, "init fifo (%d slots) --> %d\n", szfifo, foo);
|
||||
|
||||
/* XXX inject a few strange pics in the fifo */
|
||||
insert_blank(&input, blk, outdir);
|
||||
insert_blank(&input, blk, maxvalue, outdir);
|
||||
|
||||
for (idx=0; idx<globbuf.gl_pathc; idx++) {
|
||||
|
||||
cptr = globbuf.gl_pathv[idx];
|
||||
/* first step : read the current grabed picz from disk,
|
||||
and put it in our private buffer */
|
||||
// fprintf(stderr, "\n######### loading '%s'\n", cptr);
|
||||
foo = fimg_load_from_dump(cptr, &input);
|
||||
if (foo) {
|
||||
fprintf(stderr, "load #%d from dump -> %d\n", idx, foo);
|
||||
@ -147,7 +155,7 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
|
||||
fprintf(stderr, "%s: input filter -> %d\n", __func__, foo);
|
||||
exit(1);
|
||||
}
|
||||
foo = traite_une_image(&input, outdir);
|
||||
foo = traite_une_image(&input, step, outdir);
|
||||
|
||||
if (foo) {
|
||||
fprintf(stderr, "traitement %s -> %d WTF?\n", cptr, foo);
|
||||
@ -158,7 +166,7 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
|
||||
|
||||
fputs("\n", stderr);
|
||||
|
||||
insert_blank(&input, blk, outdir);
|
||||
insert_blank(&input, blk, maxvalue, outdir);
|
||||
|
||||
/*
|
||||
* PLEASE, FLUSH THE FIFO !
|
||||
|
@ -45,7 +45,7 @@ int kill_a_random_line(FloatImg *pvictime, float fval, int bits)
|
||||
int line, xpos, offset;
|
||||
float ftmp;
|
||||
|
||||
#if DEBUG_LEVEL > 1
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %d )\n", __func__, pvictime, bits);
|
||||
#endif
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
||||
#include "fifo.h"
|
||||
#include "fonctions.h"
|
||||
#include "glitches.h"
|
||||
#include "crapulator.h"
|
||||
#include "metriques.h"
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
||||
#include "fifo.h"
|
||||
#include "fonctions.h"
|
||||
#include "metriques.h"
|
||||
#include "sfx.h"
|
||||
|
||||
|
3
build.sh
3
build.sh
@ -14,7 +14,7 @@ cd ${curdir}
|
||||
if [ ${error} -ne 0 ]
|
||||
then
|
||||
echo === error on $1 = ${error}
|
||||
exit 1
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
@ -24,7 +24,6 @@ build lib
|
||||
build funcs
|
||||
build tools
|
||||
build v4l2
|
||||
build Fonderie
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
\setlength \parskip {0.35em}
|
||||
|
||||
\makeatletter
|
||||
% exlication de ce truc ?
|
||||
% exlpication de ce truc ?
|
||||
\def\verbatim@font{\normalfont\ttfamily\small}
|
||||
\makeatother
|
||||
|
||||
@ -125,8 +125,7 @@ Dynamique, précision et \textsl{macheps} ?
|
||||
\subsection{Pixel négatif ?}
|
||||
|
||||
Il est très difficle d'imaginer une lumière négative. Sauf peut-être
|
||||
si nous songeons à des coefficients d'absorption, ou un canal
|
||||
\textsl{alpha} qui inverserait les valeurs ?
|
||||
si nous songeons à des coefficients d'absorption ?
|
||||
|
||||
% -------------------------------------------------------------------
|
||||
|
||||
@ -1312,9 +1311,8 @@ devez mettre ce bout de XML\index{XML} dans le fichier
|
||||
|
||||
C'est juste un hack rapide, qui ne fonctionne pas très bien avec
|
||||
d'autres commande de IM, comme identify, qui a tendance à
|
||||
raconter un peu n'importe quoi, puisqu'elle se base sur le
|
||||
résultat de la conversion\dots
|
||||
Je compte donc sur le bouquin de \textsl{Brunus} pour avancer\dots
|
||||
raconter un peu n'importe quoi... Je compte donc sur le bouquin
|
||||
de \textsl{Brunus} pour avancer...
|
||||
|
||||
\subsection{Gimp}\index{Gimp}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* http://la.buvette.org/photos/cumul
|
||||
*/
|
||||
|
||||
#define FIMG_VERSION 130
|
||||
#define FIMG_VERSION 128
|
||||
|
||||
/*
|
||||
* in memory descriptor
|
||||
|
@ -12,10 +12,6 @@ cp tools/mkfimg tools/fimg2pnm tools/fimgops \
|
||||
cp v4l2/grabvidseq v4l2/video-infos \
|
||||
/usr/local/bin
|
||||
|
||||
cp Fonderie/interpolator Fonderie/fonderie \
|
||||
Fonderie/singlepass \
|
||||
/usr/local/bin
|
||||
|
||||
A="tools/addtga2fimg"
|
||||
if [ -r $A ] ; then
|
||||
cp $A /usr/local/bin
|
||||
|
@ -79,7 +79,8 @@ if( ! fimg_type_is_valid(head->type) ) {
|
||||
}
|
||||
|
||||
printf(" type %d %s\n", head->type, fimg_str_type(head->type));
|
||||
printf(" dims %d x %d\n", head->width, head->height);
|
||||
printf(" dims %d x %d\n",
|
||||
head->width, head->height);
|
||||
printf(" fval/count %f %d\n", head->fval, head->count);
|
||||
|
||||
printf(" pixels@ %p %p %p %p\n",
|
||||
@ -248,8 +249,6 @@ if ( ! fimg_type_is_valid(fimg->type) ) {
|
||||
|
||||
size = fimg->width * fimg->height * sizeof(float);
|
||||
memset(fimg->R, 0, size);
|
||||
memset(fimg->G, 0, size);
|
||||
memset(fimg->B, 0, size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ if (foo) {
|
||||
}
|
||||
|
||||
if (verbosity) {
|
||||
fprintf(stderr, "%s: image '%s' is %dx%d %s\n",
|
||||
fprintf(stderr, "%s: image '%s' is %d x %d %s\n",
|
||||
__func__,
|
||||
srcname, infos[0], infos[1],
|
||||
fimg_str_type(infos[2]));
|
||||
|
@ -66,8 +66,8 @@ static void help(int lj)
|
||||
puts("usage:\n\tfimgops [options] A.fimg B.fimg operator D.fimg");
|
||||
puts("options:");
|
||||
// puts("\t-g convert output to gray");
|
||||
printf("\t-k N.N\t\tset float value (def=%.3f)\n", global_fvalue);
|
||||
puts("\t-v\t\tincrease verbosity");
|
||||
puts("\t-k N.N set float value");
|
||||
puts("\t-v increase verbosity");
|
||||
pr_opcodes();
|
||||
if (verbosity) fimg_print_version(1);
|
||||
exit(0);
|
||||
@ -107,9 +107,8 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
int foo, opt, action;
|
||||
char *operator;
|
||||
FloatImg srcA, srcB, dest;
|
||||
|
||||
global_fvalue = 0.5;
|
||||
FloatImg srcA, srcB, dest;
|
||||
|
||||
while ((opt = getopt(argc, argv, "hk:v")) != -1) {
|
||||
switch(opt) {
|
||||
|
Loading…
Reference in New Issue
Block a user