116
edits
Changes
TeamDS
,→The Kernel
int size = width * height;
int i = blockIdx.x * blockDim.x + threadIdx.x;
if(i >= size)
return;
float shortestDist = MAX_FLOAT_VALUE;
float pixelVal = src[i];
{
// Calculate distance
//Vector2 targetVec(j - ((j / width) * width), j / width); //float dist = localVec.CalcDistance(targetVec); float tx = j - ((j / width) * width); float ty = j / width; float dx = tx - lx; float dy = ty - ly; float dist = sqrtf(dx * dx + dy * dy);
if (dist < shortestDist) shortestDist = dist;
}
{
// Calculate distance
//Vector2 targetVec(j - ((j / width) * width), j / width); //float dist = localVec.CalcDistance(targetVec); float tx = j - ((j / width) * width); float ty = j / width; float dx = tx - lx; float dy = ty - ly; float dist = sqrtf(dx * dx + dy * dy);
if (dist < shortestDist) shortestDist = dist;
}
dst[i] = (1 - spread01) *.5f;
}
}