Compare commits

..

No commits in common. "29fff3c5785e0e88578c56f9bee1b456c0ca2b46" and "44d2c9b7446817601d6db724bf9aa2d770153869" have entirely different histories.

3 changed files with 5 additions and 16 deletions

View File

@ -117,7 +117,7 @@ if (NULL==(fp = fopen(fname, "r"))) {
} }
foo = fread(&filehead, sizeof(FimgFileHead), 1, fp); foo = fread(&filehead, sizeof(FimgFileHead), 1, fp);
if (1 != foo) { if (1 != foo) {
fprintf(stderr, "%s: short read on '%s'\n", __func__, fname); fprintf(stderr, "%s : short read\n", fname);
fclose(fp); fclose(fp);
return -1; return -1;
} }
@ -127,17 +127,15 @@ if ( (filehead.w != where->width) ||
(filehead.h != where->height) || (filehead.h != where->height) ||
(filehead.t != where->type) ) { (filehead.t != where->type) ) {
fprintf(stderr, "%s: file '%s' incompatible\n", __func__, fname); fprintf(stderr, "file '%s' incompatible\n", fname);
fclose(fp); exit(3);
return -17;
} }
nbre = filehead.w*filehead.h*filehead.t; /* ugly quirk */ nbre = filehead.w*filehead.h*filehead.t; /* ugly quirk */
foo = fread(where->R, sizeof(float), nbre, fp); foo = fread(where->R, sizeof(float), nbre, fp);
if (nbre != foo) { if (nbre != foo) {
fprintf(stderr, "%s: err read '%s' : %d\n", __func__, fname, errno); fprintf(stderr, "err read '%s' : %d\n", fname, errno);
fclose(fp); exit(3);
return -18;
} }
fclose(fp); fclose(fp);

View File

@ -15,10 +15,6 @@
extern int verbosity; /* must be declared around main() */ extern int verbosity; /* must be declared around main() */
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
/*
* A + B -> D
* why is this func so slow ?
*/
int fimg_add(FloatImg *a, FloatImg *b, FloatImg *d) int fimg_add(FloatImg *a, FloatImg *b, FloatImg *d)
{ {
int idx, nbiter; int idx, nbiter;
@ -61,9 +57,6 @@ if (3 != a->type || 3 != b->type || 3 != d->type) {
nbiter = a->width * a->height; nbiter = a->width * a->height;
/* maybe we can speedup this loop for
* avoiding the cache strashing ?
*/
for (idx=0; idx<nbiter; idx++) { for (idx=0; idx<nbiter; idx++) {
d->R[idx] = fabs(a->R[idx] - b->R[idx]); d->R[idx] = fabs(a->R[idx] - b->R[idx]);
d->G[idx] = fabs(a->G[idx] - b->G[idx]); d->G[idx] = fabs(a->G[idx] - b->G[idx]);

View File

@ -41,8 +41,6 @@ for (y=0; y<h; y++) {
r = (float)*src++; r = (float)*src++;
g = (float)*src++; g = (float)*src++;
b = (float)*src++; b = (float)*src++;
/* may be, here, we can speed up the job */
fimg_add_rgb(d, xx, yy, r, g, b); fimg_add_rgb(d, xx, yy, r, g, b);
} }
} }