added a setter, wtf ?

This commit is contained in:
tth 2021-04-23 23:54:47 +02:00
parent 0632bc288d
commit 0f2b0ec916
2 changed files with 36 additions and 8 deletions

View File

@ -79,7 +79,7 @@ return 0;
/* -------------------------------------------------------------- */
/* called by 'fonderie.c'
*/
int export_fifo(char *fname, int step)
int export_fifo(char *fname, int notused)
{
int foo, type;
@ -136,13 +136,18 @@ if (verbosity > 2) fprintf(stderr, "%s : next slot %d\n",
return 0;
}
/* -------------------------------------------------------------- */
int create_fifo(int nbslot, int w, int h, int t)
/*
* this function must have a lot of new parameters,
* -- filetype of exported pictures...
*/
int create_fifo(int nbslot, int w, int h, int imgtype)
{
int foo, idx;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %d %dx%d %d )\n", __func__,
nbslot, w, h, t);
nbslot, w, h, imgtype);
#endif
memset(&g_fifo, 0, sizeof(A_Fifo));
@ -152,17 +157,32 @@ g_fifo.nbslots = nbslot;
g_fifo.slots = calloc(nbslot, sizeof(FloatImg));
if (NULL==g_fifo.slots) abort();
for (idx=0; idx<nbslot; idx++) {
foo = fimg_create(&g_fifo.slots[idx], w, h, t);
foo = fimg_create(&g_fifo.slots[idx], w, h, imgtype);
if (foo) {
fprintf(stderr, "%s idx %d err%d\n", __func__, idx, foo);
return foo;
}
fimg_clear(&g_fifo.slots[idx]);
}
foo = fimg_create(&g_fifo.total, w, h, t);
foo = fimg_create(&g_fifo.total, w, h, imgtype);
g_fifo.next = 0;
g_fifo.magic = MAGIC_FIFO;
return 0;
}
/* -------------------------------------------------------------- */
/*
* omfg ! I've write a setter !
*/
int set_fifo_output_format(int filetype)
{
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %d )\n", __func__, filetype);
#endif
g_fifo.export_type = filetype;
return -1;
}

View File

@ -1,15 +1,21 @@
/*
* Machine qui fait des fils flous
* Machine qui fait des fils flous par la
* méthode de la moyenne mobile.
*/
/* -------------------------------------------------------------- */
typedef struct {
unsigned long magic;
int nbslots; /* how many pics used ? */
FloatImg total; /* computing workspace */
FloatImg wspace; /* computing workspace */
FloatImg *slots; /* circular buffer */
int next; /* incremented with modulo */
int export_type; /* fimg/png/pnm/... */
} A_Fifo;
#define MAGIC_FIFO 0xabcd9876
@ -29,11 +35,13 @@ typedef struct {
/* -------------------------------------------------------------- */
int export_fifo(char *fname, int step);
int create_fifo(int nbslot, int w, int h, int t);
int set_fifo_output_format(int filetype);
int export_fifo(char *fname, int notused);
int insert_picture(FloatImg *src);
int create_fifo(int nbslot, int w, int h, int t);
/* -------------------------------------------------------------- */
/*