reconfinement fonderie first release

This commit is contained in:
Tonton Th 2020-11-07 01:29:45 +01:00
parent e0d154c37e
commit 9febaea3ae
3 changed files with 25 additions and 4 deletions

View File

@ -1,4 +1,6 @@
#
# compilation de la fonderie
#
COPT = -g -no-pie -Wall -DDEBUG_LEVEL=0 -Werror=parentheses COPT = -g -no-pie -Wall -DDEBUG_LEVEL=0 -Werror=parentheses
LIBS = -lfloatimg -lpnglite -lm LIBS = -lfloatimg -lpnglite -lm
@ -11,7 +13,7 @@ fonderie: fonderie.c ${DEPS} ${OBJS} Makefile
crapulator.o: crapulator.c ${DEPS} Makefile crapulator.o: crapulator.c ${DEPS} Makefile
gcc ${COPT} -c $< gcc ${COPT} -c $<
fonctions.o: fonctions.c ${DEPS} Makefile fonctions.o: fonctions.c fonctions.h Makefile
gcc ${COPT} -c $< gcc ${COPT} -c $<
sfx.o: sfx.c ${DEPS} Makefile sfx.o: sfx.c ${DEPS} Makefile

View File

@ -23,7 +23,22 @@ extern int verbosity;
static A_Fifo g_fifo; static A_Fifo g_fifo;
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
static int big_adder(FloatImg *from, FloatImg *to)
{
int size, idx;
size = from->width * from->height;
for (idx=0; idx<size; idx++) to->R[idx] += from->R[idx];
for (idx=0; idx<size; idx++) to->G[idx] += from->G[idx];
for (idx=0; idx<size; idx++) to->B[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 faire_la_somme(A_Fifo *pfifo, FloatImg *destination, int step)
{ {
int idx, foo; int idx, foo;
@ -36,7 +51,11 @@ else {
fimg_clear(pdest); fimg_clear(pdest);
for (idx=0; idx<pfifo->nbslots; idx += step) { for (idx=0; idx<pfifo->nbslots; 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) if (foo)
{ {
fprintf(stderr, "%s: err %d on add_2\n", __func__, foo); fprintf(stderr, "%s: err %d on add_2\n", __func__, foo);

View File

@ -61,7 +61,7 @@ puts("");
return 0; return 0;
} }
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
#define BLANK 30 #define BLANK 50
int demarre_la_machine(char *pattern, char *outdir, int szfifo, int demarre_la_machine(char *pattern, char *outdir, int szfifo,
int infx, int outfx, int step) int infx, int outfx, int step)