Calculating integral images / cumulative add

Stefan Reich stefan.reich.maker.of.eye at googlemail.com
Tue Jan 5 01:31:28 UTC 2021


Hi,

I am trying to vectorize my routine that constructs an integral image
/ "summed-area
table" <https://en.wikipedia.org/wiki/Summed-area_table>.

    int i = 0;
    for (int y = 0; y < h; y++) {
      int sum = 0;
      for (int x = 0; x < w; x++) {
        sum += image[i];
        data[i] = y > 0 ? sum + data[i-w] : sum;
        i++;
      }
    }

In order to use the Vector API, I'd need an operation that does a
cumulative summing over the lanes, e.g. for a 4-component vector:

b[0] = a[0]
b[1] = a[0]+a[1]
b[2] = a[0]+a[1]+a[2]
b[3] = a[0]+a[1]+a[2]+a[3]

I don't think this is available in the current Vector API, is it?

Thanks,
Stefan

-- 
Stefan Reich
BotCompany.de // Java-based operating systems


More information about the panama-dev mailing list