I ran a profiler against this complex app that I'm trying to opimize.
This is an application I'm doing to test image processing. Even
though it does a lot of computation, two simple lines take 30% of the
running times! Both these lines are from Intel's OpenCV library.
Note that mhi, mask8u, and mask are arrays with one entry per pixel in
a 640x480 image.
If anyone has any hints on how to optimize this, it would be greatly
appreciated.
Thanks,
John
const int cts = (int&)ts;
for( y = 0; y < mhi->rows; y++ )
{
int* mhi_row = (int*)(mhi->data.ptr + y*mhi->step);
uchar* mask8u_row = mask8u->data.ptr + (y+1)*mask8u->step + 1;
for( x = 0; x < mhi->cols; x++ )
{
>>> if( mhi_row[x] == cts && mask8u_row[x] == 0 ) THE LINE ABOVE TAKES 20% of the time
uchar* mask_row = mask->data.ptr + mask->step;
for( i = 1; i <= size.height; i++, mask_row += mask->step )
{>>> mask_row[0] = mask_row[size.width+1] = (uchar)1;
THE LINE ABOVE TAKES 10% of the time