void CountIntegral(unsigned int *src, unsigned int *dst, int width, int height)
{
assert(src != NULL);
assert(dst != NULL);
assert(width >= 0);
assert(height >= 0);
dst[0] = src[0];
for (int x = 1; x < width; x++)
dst[x] = dst[x - 1] + src[x];
for (int y = 1; y < height; y++)
dst[y * width] = dst[(y - 1) * width] + src[y * width];
for (int y = 1; y < height; y++)
{
for (int x = 1; x < width; x++)
dst[y * width + x] = src[y * width + x] + dst[y * width + x - 1] +
dst[(y - 1) * width + x] - dst[(y - 1) * width + x - 1];
}
}