1
Fork 0
mirror of https://github.com/Steffo99/unimore-hpc-assignments.git synced 2024-11-22 08:04:25 +00:00

Create independent address variable

Co-authored-by: Fabio Zanichelli <274956@studenti.unimore.it>
Co-authored-by: Stefano Pigozzi <256895@studenti.unimore.it>
This commit is contained in:
Gattopandacorno 2022-12-19 10:17:14 +01:00
parent 0162726719
commit 00d632a25a

View file

@ -25,8 +25,10 @@ void sobel(uint8_t *__restrict__ out, uint8_t *__restrict__ in, const int width,
{
for (int z = 0; z < 3; z++)
{
dx += sobelFilter[k][z] * in[(y + k - 1) * width + x + z - 1];
dy += sobelFilter[z][k] * in[(y + k - 1) * width + x + z - 1];
const int address = (y + k - 1) * width + x + z - 1;
dx += sobelFilter[k][z] * in[address];
dy += sobelFilter[z][k] * in[address];
}
}