Hi,
It's a bit tricky.
So, to elaborate the function is something as follows:
template<typename t="">
int fill_histogram(T *hist)
{
for (int i = 0; i < num_pixels; ++i)
{
valid = true;
for(int j = 0; j < someVal; ++j)
{
if (some_checks) { valid = false; break; }
index_1 += value * offset_1[j]);
}
for(int j = 0; j < someOtherVal; ++j)
{
if (some_checks) { valid = false; break; }
index_2 += value * offset_2[j]);
}
if (valid) hist[index_1 + (index_2 *some_offset)]++;
}
}
</typename>
I will try and do some simplifications but still quite surprised that these operations almost increase the computation time 3 fold. Was not expecting it to be that slow, somehow.
Cheers,
Keith