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:
parent
0162726719
commit
00d632a25a
1 changed files with 4 additions and 2 deletions
|
@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue