Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
cuda_lab
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gaurav Kukreja
cuda_lab
Commits
06d27721
Commit
06d27721
authored
Mar 05, 2014
by
Gaurav Kukreja
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Indentation
Signed-off-by:
Gaurav Kukreja
<
gmkukreja@gmail.com
>
parent
b44f67ad
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
main.cu
gaurav/1_Assign/ex6/main.cu
+9
-9
No files found.
gaurav/1_Assign/ex6/main.cu
View file @
06d27721
...
@@ -66,18 +66,18 @@ __device__ void convolveImage(float* imgIn, float* kernel, float* imgOut, int ra
...
@@ -66,18 +66,18 @@ __device__ void convolveImage(float* imgIn, float* kernel, float* imgOut, int ra
if (idx < w * h * nc)
if (idx < w * h * nc)
{
{
imgOut[idx] = 0; // initialize
imgOut[idx] = 0; // initialize
float value = 0;
float value = 0;
for(int j = -rad; j <= rad; j++) // for each row in kernel
for(int j = -rad; j <= rad; j++) // for each row in kernel
{
{
int iny = gpu_max(0, gpu_min(iy+j, h-1));
int iny = gpu_max(0, gpu_min(iy+j, h-1));
for(int i = -rad; i <= rad; i++) // for each element in the kernel row
for(int i = -rad; i <= rad; i++) // for each element in the kernel row
{
{
int inx = gpu_max(0, gpu_min(ix+i, w-1));
int inx = gpu_max(0, gpu_min(ix+i, w-1));
int inIdx = inx + (iny * w) + (iz * w * h); // Index of Input Image to be multiplied by corresponding element in kernel
int inIdx = inx + (iny * w) + (iz * w * h); // Index of Input Image to be multiplied by corresponding element in kernel
value += imgIn[inIdx] * kernel[i+rad + ((j+rad) * (2 * rad + 1))];
value += imgIn[inIdx] * kernel[i+rad + ((j+rad) * (2 * rad + 1))];
}
}
}
}
imgOut[idx] = value;
imgOut[idx] = value;
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment