Compare commits
2 Commits
44d2c9b744
...
29fff3c578
Author | SHA1 | Date | |
---|---|---|---|
29fff3c578 | |||
3712ef9efe |
@ -117,7 +117,7 @@ if (NULL==(fp = fopen(fname, "r"))) {
|
||||
}
|
||||
foo = fread(&filehead, sizeof(FimgFileHead), 1, fp);
|
||||
if (1 != foo) {
|
||||
fprintf(stderr, "%s : short read\n", fname);
|
||||
fprintf(stderr, "%s: short read on '%s'\n", __func__, fname);
|
||||
fclose(fp);
|
||||
return -1;
|
||||
}
|
||||
@ -127,15 +127,17 @@ if ( (filehead.w != where->width) ||
|
||||
(filehead.h != where->height) ||
|
||||
(filehead.t != where->type) ) {
|
||||
|
||||
fprintf(stderr, "file '%s' incompatible\n", fname);
|
||||
exit(3);
|
||||
fprintf(stderr, "%s: file '%s' incompatible\n", __func__, fname);
|
||||
fclose(fp);
|
||||
return -17;
|
||||
}
|
||||
|
||||
nbre = filehead.w*filehead.h*filehead.t; /* ugly quirk */
|
||||
foo = fread(where->R, sizeof(float), nbre, fp);
|
||||
if (nbre != foo) {
|
||||
fprintf(stderr, "err read '%s' : %d\n", fname, errno);
|
||||
exit(3);
|
||||
fprintf(stderr, "%s: err read '%s' : %d\n", __func__, fname, errno);
|
||||
fclose(fp);
|
||||
return -18;
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
@ -15,6 +15,10 @@
|
||||
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 idx, nbiter;
|
||||
@ -57,6 +61,9 @@ if (3 != a->type || 3 != b->type || 3 != d->type) {
|
||||
|
||||
nbiter = a->width * a->height;
|
||||
|
||||
/* maybe we can speedup this loop for
|
||||
* avoiding the cache strashing ?
|
||||
*/
|
||||
for (idx=0; idx<nbiter; idx++) {
|
||||
d->R[idx] = fabs(a->R[idx] - b->R[idx]);
|
||||
d->G[idx] = fabs(a->G[idx] - b->G[idx]);
|
||||
|
@ -41,6 +41,8 @@ for (y=0; y<h; y++) {
|
||||
r = (float)*src++;
|
||||
g = (float)*src++;
|
||||
b = (float)*src++;
|
||||
|
||||
/* may be, here, we can speed up the job */
|
||||
fimg_add_rgb(d, xx, yy, r, g, b);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user