Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
79b1eec3
Commit
79b1eec3
authored
Dec 10, 2010
by
Alexey Spizhevoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor refactoring of gpu module
parent
9f80317f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
28 deletions
+32
-28
mathfunc.cu
modules/gpu/src/cuda/mathfunc.cu
+32
-28
No files found.
modules/gpu/src/cuda/mathfunc.cu
View file @
79b1eec3
...
...
@@ -1510,33 +1510,6 @@ namespace cv { namespace gpu { namespace mathfunc
}
template <typename T>
T sum_caller(const DevMem2D_<T> src, PtrStep buf)
{
dim3 threads, grid;
estimate_thread_cfg(src.cols, src.rows, threads, grid);
set_kernel_consts(src.cols, src.rows, threads, grid);
T* buf_ = (T*)buf.ptr(0);
sum_kernel<T, threads_x * threads_y><<<grid, threads>>>(src, buf_);
cudaSafeCall(cudaThreadSynchronize());
T sum;
cudaSafeCall(cudaMemcpy(&sum, buf_, sizeof(T), cudaMemcpyDeviceToHost));
return sum;
}
template unsigned char sum_caller<unsigned char>(const DevMem2D_<unsigned char>, PtrStep);
template char sum_caller<char>(const DevMem2D_<char>, PtrStep);
template unsigned short sum_caller<unsigned short>(const DevMem2D_<unsigned short>, PtrStep);
template short sum_caller<short>(const DevMem2D_<short>, PtrStep);
template int sum_caller<int>(const DevMem2D_<int>, PtrStep);
template float sum_caller<float>(const DevMem2D_<float>, PtrStep);
template double sum_caller<double>(const DevMem2D_<double>, PtrStep);
template <typename T, int nthreads>
__global__ void sum_pass2_kernel(T* result, int size)
{
...
...
@@ -1550,10 +1523,14 @@ namespace cv { namespace gpu { namespace mathfunc
result[0] = smem[0];
}
} // namespace sum
template <typename T>
T sum_multipass_caller(const DevMem2D_<T> src, PtrStep buf)
{
using namespace sum;
dim3 threads, grid;
estimate_thread_cfg(src.cols, src.rows, threads, grid);
set_kernel_consts(src.cols, src.rows, threads, grid);
...
...
@@ -1578,5 +1555,32 @@ namespace cv { namespace gpu { namespace mathfunc
template int sum_multipass_caller<int>(const DevMem2D_<int>, PtrStep);
template float sum_multipass_caller<float>(const DevMem2D_<float>, PtrStep);
} // namespace sum
template <typename T>
T sum_caller(const DevMem2D_<T> src, PtrStep buf)
{
using namespace sum;
dim3 threads, grid;
estimate_thread_cfg(src.cols, src.rows, threads, grid);
set_kernel_consts(src.cols, src.rows, threads, grid);
T* buf_ = (T*)buf.ptr(0);
sum_kernel<T, threads_x * threads_y><<<grid, threads>>>(src, buf_);
cudaSafeCall(cudaThreadSynchronize());
T sum;
cudaSafeCall(cudaMemcpy(&sum, buf_, sizeof(T), cudaMemcpyDeviceToHost));
return sum;
}
template unsigned char sum_caller<unsigned char>(const DevMem2D_<unsigned char>, PtrStep);
template char sum_caller<char>(const DevMem2D_<char>, PtrStep);
template unsigned short sum_caller<unsigned short>(const DevMem2D_<unsigned short>, PtrStep);
template short sum_caller<short>(const DevMem2D_<short>, PtrStep);
template int sum_caller<int>(const DevMem2D_<int>, PtrStep);
template float sum_caller<float>(const DevMem2D_<float>, PtrStep);
template double sum_caller<double>(const DevMem2D_<double>, PtrStep);
}}}
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