Compare commits

...

3 Commits

Author SHA1 Message Date
tTh e9ca450584 little refactoring 2023-07-07 10:08:57 +02:00
tTh 3fd604b14a better message 2023-07-06 19:43:47 +02:00
tTh 0169fbade7 bla 2023-07-06 10:54:18 +02:00
3 changed files with 29 additions and 9 deletions

View File

@ -13,12 +13,34 @@
int verbosity;
/* ------------------------------------------------------------------- */
/* for debug purpose */
int printf_histo_gray(char *fname, int histo[], int nbre)
{
FILE *fp;
int idx;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( '%s' %p %d )\n", __func__,
fname, histo, nbre);
#endif
if (NULL == (fp = fopen(fname, "w"))) {
perror(fname);
exit(1);
}
for (idx=0; idx<nbre; idx++) {
fprintf(fp, "%6d %8d\n", idx, histo[idx]);
}
fclose(fp);
return -1;
}
/* ------------------------------------------------------------------- */
/* for debug purpose */
int calcul_histo_gray(FloatImg *img, char *fname, int nbslots, float *pmax)
{
int offset, nbpix, ival;
FILE *fp;
float pixel, minp, maxp;
int *counts;
@ -59,14 +81,10 @@ for (offset=0; offset<nbpix; offset++) {
// fprintf(stderr, "%6d %10.6f %i\n", offset, pixel, ival);
}
if (NULL == (fp = fopen(fname, "w"))) {
perror(fname);
exit(1);
if (NULL != fname)
{
printf_histo_gray(fname, counts, nbslots);
}
for (ival=0; ival<nbslots; ival++) {
fprintf(fp, "%6d %8d\n", ival, counts[ival]);
}
fclose(fp);
/* garbage collect stuff */
free(counts);

View File

@ -64,7 +64,7 @@ if (fimg_images_not_compatible(src, dst)) {
}
if (verbosity > 1) {
fimg_show_filter("essai", filtr);
fimg_show_filter(__func__, filtr);
}
/* aliasing some vars for cleaner code */

View File

@ -396,6 +396,8 @@ if (fi->type != FIMG_TYPE_RGB) {
return;
}
nbre = fi->width * fi->height;
// fprintf(stderr, "%s: %d pixels\n", __func__, nbre);
for (idx=0; idx<nbre; idx++) {
fi->R[idx] = drand48() * kmul;
fi->G[idx] = drand48() * kmul;