Re: Fast Image access for binarization
siddharth wrote:
for(i = 0; i < (width * height); i++)
{
if (image[i] > threshold)
image[i] = 1;
else
image[i] = 0;
}
Instead of indexing into the array on every iteration, use a pointer. I
don't know if your compiler will perform this optimization already (I
suspect not).
Cheers,
Nicholas Sherlock
.
Relevant Pages
- Re: Need help to port VAX code to Alpha and to Itaninum
... Not really, the original code was wrong, and the compiler was not ... pointer to the start of the array. ... So you are trying to pass a pointer to a pointer to an array where you ... Also start looking at where you can add the "const" modifier to function ... (comp.os.vms) - Re: Memory Leak Problem
... And each iteration I generated about 700000 random numbers. ... The variable that contains these random numbers is a pointer, ... compiler which does not allow REAL valued array indexes. ... to use rout, which has a pointer attribute, as an argument and then ... (comp.lang.fortran) - Re: decrement past beginning is valid?
... > What I meant by legal is that a compiler will compile it. ... > that an array is the same as a pointer. ... behave the same way on all platforms. ... (alt.comp.lang.learn.c-cpp) - Re: gdb not catching out-of-bounds pointer
... is also not defined by the C-standard, IOW: writing code in anything ... provided the library writer knows what the compiler writer guarantees ... etc.) that don't point into the same array than I would about the sort ... of pointer aliasing issue that started this sub-thread. ... (comp.unix.programmer) - Re: null terminated strings
... pointer + 1 will point to the next element in the array. ... What I don't understand is why such a thing was included in any language that's more than an assembler. ... of structures that are not 'natural' the compiler need to generate ADD instructions using sizeof. ... (comp.os.vms) |
|