Allocation of energy matrix

The comments decribing the procedure calculate_energy(uint32_t* const energy, struct image* const img, int const w) in energy.c state that

@p energy is expected to have allocated enough space
to represent the energy for every pixel of the whole image @p img.

Does this mean that I need to allocate energy within the function or can I expect to have an allocated array available on function call?

Well, it means that you don’t have to allocate memory, because you can expect it to have allocated enough space.

hope this helped
Lisa :slight_smile:


2 posts were split to a new topic: Where does the energy pointer come from?