diff --git a/Fonderie/Makefile b/Fonderie/Makefile index ccf71eb..89bfead 100644 --- a/Fonderie/Makefile +++ b/Fonderie/Makefile @@ -1,4 +1,6 @@ - +# +# compilation de la fonderie +# COPT = -g -no-pie -Wall -DDEBUG_LEVEL=0 -Werror=parentheses LIBS = -lfloatimg -lpnglite -lm @@ -11,7 +13,7 @@ fonderie: fonderie.c ${DEPS} ${OBJS} Makefile crapulator.o: crapulator.c ${DEPS} Makefile gcc ${COPT} -c $< -fonctions.o: fonctions.c ${DEPS} Makefile +fonctions.o: fonctions.c fonctions.h Makefile gcc ${COPT} -c $< sfx.o: sfx.c ${DEPS} Makefile diff --git a/Fonderie/fonctions.c b/Fonderie/fonctions.c index 5544e2e..0ee6a19 100644 --- a/Fonderie/fonctions.c +++ b/Fonderie/fonctions.c @@ -23,7 +23,22 @@ extern int verbosity; static A_Fifo g_fifo; /* -------------------------------------------------------------- */ +static int big_adder(FloatImg *from, FloatImg *to) +{ +int size, idx; +size = from->width * from->height; + +for (idx=0; idxR[idx] += from->R[idx]; +for (idx=0; idxG[idx] += from->G[idx]; +for (idx=0; idxB[idx] += from->B[idx]; + +return 0; +} +/* -------------------------------------------------------------- */ +/* + * 97% of the total run time was in that function \o_ + */ int faire_la_somme(A_Fifo *pfifo, FloatImg *destination, int step) { int idx, foo; @@ -36,7 +51,11 @@ else { fimg_clear(pdest); for (idx=0; idxnbslots; idx += step) { - foo = fimg_add_2(&(pfifo->slots[idx]), pdest); + /*************************************** + * Here was the giant bootleneck * + ***************************************/ + // HERE -> foo = fimg_add_2(&(pfifo->slots[idx]), pdest); + foo = big_adder(&(pfifo->slots[idx]), pdest); if (foo) { fprintf(stderr, "%s: err %d on add_2\n", __func__, foo); diff --git a/Fonderie/fonderie.c b/Fonderie/fonderie.c index b4a7a22..fb316e0 100644 --- a/Fonderie/fonderie.c +++ b/Fonderie/fonderie.c @@ -61,7 +61,7 @@ puts(""); return 0; } /* -------------------------------------------------------------- */ -#define BLANK 30 +#define BLANK 50 int demarre_la_machine(char *pattern, char *outdir, int szfifo, int infx, int outfx, int step)