forked from tTh/FloatImg
commit du soir, espoir
This commit is contained in:
@@ -111,7 +111,7 @@ if (NULL==fptr) {
|
||||
}
|
||||
|
||||
#if DEBUG_LEVEL > 1
|
||||
fprintf(stderr, " got %d bytes at %p\n", size, fptr);
|
||||
fprintf(stderr, " %s: got %d bytes at %p\n", __func__, size, fptr);
|
||||
#endif
|
||||
|
||||
fimg->width = w; fimg->height = h;
|
||||
|
||||
@@ -19,7 +19,7 @@ extern int verbosity; /* must be declared around main() */
|
||||
float fimg_get_maxvalue(FloatImg *head)
|
||||
{
|
||||
float maxval;
|
||||
int foo;
|
||||
int foo, surface;
|
||||
|
||||
if (head->type != FIMG_TYPE_RGB && head->type != FIMG_TYPE_GRAY) {
|
||||
fprintf(stderr, "%s : type %d invalide\n",
|
||||
@@ -29,15 +29,17 @@ if (head->type != FIMG_TYPE_RGB && head->type != FIMG_TYPE_GRAY) {
|
||||
|
||||
maxval = 0.0; /* no negative values allowed */
|
||||
|
||||
surface = head->width*head->height;
|
||||
|
||||
switch (head->type) {
|
||||
case FIMG_TYPE_RGB:
|
||||
for (foo=0; foo<(head->width*head->height); foo++) {
|
||||
for (foo=0; foo<surface; foo++) {
|
||||
if (head->R[foo] > maxval) maxval = head->R[foo];
|
||||
if (head->G[foo] > maxval) maxval = head->G[foo];
|
||||
if (head->B[foo] > maxval) maxval = head->B[foo];
|
||||
}
|
||||
case FIMG_TYPE_GRAY:
|
||||
for (foo=0; foo<(head->width*head->height); foo++) {
|
||||
for (foo=0; foo<surface; foo++) {
|
||||
if (head->R[foo] > maxval) maxval = head->R[foo];
|
||||
}
|
||||
}
|
||||
@@ -209,6 +211,19 @@ for (idx=0; idx<nbre; idx++) {
|
||||
}
|
||||
}
|
||||
|
||||
/* WTF 12 avril 2020, valgrind me cause mal ?
|
||||
==28943== Conditional jump or move depends on uninitialised value(s)
|
||||
==28943== at 0x4045E9: fimg_clamp_negativ (fimg-math.c:208)
|
||||
==28943== by 0x4018C9: essai_filtrage_3x3 (t.c:128)
|
||||
==28943== by 0x4024D5: main (t.c:444)
|
||||
==28943== Uninitialised value was created by a heap allocation
|
||||
==28943== at 0x483577F: malloc (vg_replace_malloc.c:299)
|
||||
==28943== by 0x40284D: fimg_create (fimg-core.c:107)
|
||||
==28943== by 0x402AB3: fimg_clone (fimg-core.c:174)
|
||||
==28943== by 0x401861: essai_filtrage_3x3 (t.c:118)
|
||||
==28943== by 0x4024D5: main (t.c:444)
|
||||
*/
|
||||
|
||||
return count;
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user