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
949b96a5
Commit
949b96a5
authored
Mar 28, 2014
by
Gaurav Kukreja
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/gkernel/cuda_lab
parents
4b389e4c
7426c166
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
kernel.cu
miklos/project_integration/kernel.cu
+11
-9
No files found.
miklos/project_integration/kernel.cu
View file @
949b96a5
...
...
@@ -87,11 +87,13 @@ __global__ void update_Output(uchar4* output, float *U, int w, int h) {
int y = threadIdx.y + blockDim.y * blockIdx.y;
size_t i = x + (size_t)w*y;
size_t idx = x + (size_t) w*(h-1 - y);
unsigned char temp_res = roundf((U[i] * 255.f));
output[idx].x = temp_res;
output[idx].y = temp_res;
output[idx].z = temp_res;
output[idx].w = 255;
unsigned char temp = int(U[i] + 0.5f) * 255;
if (x < w && y < h) {
output[idx].x = temp;
output[idx].y = temp;
output[idx].z = temp;
output[idx].w = 255;
}
}
...
...
@@ -116,16 +118,16 @@ void allocate_device_memory(size_t w, size_t h)
cudaMalloc(&d_Xj, imageBytes);
// Define texture attributes
texRef_Xi.addressMode[0] = cudaAddressMode
Clamp
; // clamp x to border
texRef_Xi.addressMode[1] = cudaAddressMode
Clamp
; // clamp y to border
texRef_Xi.addressMode[0] = cudaAddressMode
Border
; // clamp x to border
texRef_Xi.addressMode[1] = cudaAddressMode
Border
; // clamp y to border
texRef_Xi.filterMode = cudaFilterModeLinear; // linear interpolation
texRef_Xi.normalized = false;
cudaChannelFormatDesc desc_Xi = cudaCreateChannelDesc<float>();
cudaBindTexture2D(NULL, &texRef_Xi, d_Xi, &desc_Xi, w, h, w*sizeof(d_Xi[0]));
// Define texture attributes
texRef_Xj.addressMode[0] = cudaAddressMode
Clamp
; // clamp x to border
texRef_Xj.addressMode[1] = cudaAddressMode
Clamp
; // clamp y to border
texRef_Xj.addressMode[0] = cudaAddressMode
Border
; // clamp x to border
texRef_Xj.addressMode[1] = cudaAddressMode
Border
; // clamp y to border
texRef_Xj.filterMode = cudaFilterModeLinear; // linear interpolation
texRef_Xj.normalized = false;
cudaChannelFormatDesc desc_Xj = cudaCreateChannelDesc<float>();
...
...
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