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
7fbcc1ec
Commit
7fbcc1ec
authored
May 23, 2011
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor SURF_GPU optimization (descriptor calculation, change block size to 6x6)
parent
44e9fdaa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
15 deletions
+14
-15
surf.cu
modules/gpu/src/cuda/surf.cu
+14
-15
No files found.
modules/gpu/src/cuda/surf.cu
View file @
7fbcc1ec
...
@@ -770,25 +770,24 @@ namespace cv { namespace gpu { namespace surf
...
@@ -770,25 +770,24 @@ namespace cv { namespace gpu { namespace surf
// since grids are 2D, need to compute xBlock and yBlock indices
// since grids are 2D, need to compute xBlock and yBlock indices
const int xBlock = (blockIdx.y & 3); // blockIdx.y % 4
const int xBlock = (blockIdx.y & 3); // blockIdx.y % 4
const int yBlock = (blockIdx.y >> 2); // floor(blockIdx.y/4)
const int yBlock = (blockIdx.y >> 2); // floor(blockIdx.y/4)
const int xIndex = xBlock *
blockDim.x
+ threadIdx.x;
const int xIndex = xBlock *
5
+ threadIdx.x;
const int yIndex = yBlock *
blockDim.y
+ threadIdx.y;
const int yIndex = yBlock *
5
+ threadIdx.y;
s_PATCH[threadIdx.y][threadIdx.x] = calcPATCH(yIndex, xIndex, centerX, centerY, win_offset, cos_dir, sin_dir, win_size);
s_PATCH[threadIdx.y][threadIdx.x] = calcPATCH(yIndex, xIndex, centerX, centerY, win_offset, cos_dir, sin_dir, win_size);
if (threadIdx.x == 0)
s_PATCH[threadIdx.y][5] = calcPATCH(yIndex, xBlock * blockDim.x + 5, centerX, centerY, win_offset, cos_dir, sin_dir, win_size);
if (threadIdx.y == 0)
s_PATCH[5][threadIdx.x] = calcPATCH(yBlock * blockDim.y + 5, xIndex, centerX, centerY, win_offset, cos_dir, sin_dir, win_size);
if (threadIdx.x == 0 && threadIdx.y == 0)
s_PATCH[5][5] = calcPATCH(yBlock * blockDim.y + 5, xBlock * blockDim.x + 5, centerX, centerY, win_offset, cos_dir, sin_dir, win_size);
__syncthreads();
__syncthreads();
const float dw = c_DW[yIndex * PATCH_SZ + xIndex];
if (threadIdx.x < 5 && threadIdx.y < 5)
{
tid = threadIdx.y * 5 + threadIdx.x;
const float dw = c_DW[yIndex * PATCH_SZ + xIndex];
const float vx = (s_PATCH[threadIdx.y ][threadIdx.x + 1] - s_PATCH[threadIdx.y][threadIdx.x] + s_PATCH[threadIdx.y + 1][threadIdx.x + 1] - s_PATCH[threadIdx.y + 1][threadIdx.x ]) * dw;
const float vx = (s_PATCH[threadIdx.y ][threadIdx.x + 1] - s_PATCH[threadIdx.y][threadIdx.x] + s_PATCH[threadIdx.y + 1][threadIdx.x + 1] - s_PATCH[threadIdx.y + 1][threadIdx.x ]) * dw;
const float vy = (s_PATCH[threadIdx.y + 1][threadIdx.x ] - s_PATCH[threadIdx.y][threadIdx.x] + s_PATCH[threadIdx.y + 1][threadIdx.x + 1] - s_PATCH[threadIdx.y ][threadIdx.x + 1]) * dw;
const float vy = (s_PATCH[threadIdx.y + 1][threadIdx.x ] - s_PATCH[threadIdx.y][threadIdx.x] + s_PATCH[threadIdx.y + 1][threadIdx.x + 1] - s_PATCH[threadIdx.y ][threadIdx.x + 1]) * dw;
s_dx_bin[tid] = vx;
s_dx_bin[tid] = vx;
s_dy_bin[tid] = vy;
s_dy_bin[tid] = vy;
}
}
}
__device__ void reduce_sum25(volatile float* sdata1, volatile float* sdata2, volatile float* sdata3, volatile float* sdata4, int tid)
__device__ void reduce_sum25(volatile float* sdata1, volatile float* sdata2, volatile float* sdata3, volatile float* sdata4, int tid)
...
@@ -986,7 +985,7 @@ namespace cv { namespace gpu { namespace surf
...
@@ -986,7 +985,7 @@ namespace cv { namespace gpu { namespace surf
if (descriptors.cols == 64)
if (descriptors.cols == 64)
{
{
compute_descriptors64<<<dim3(nFeatures, 16, 1), dim3(
5, 5
, 1)>>>(descriptors, featureX, featureY, featureSize, featureDir);
compute_descriptors64<<<dim3(nFeatures, 16, 1), dim3(
6, 6
, 1)>>>(descriptors, featureX, featureY, featureSize, featureDir);
cudaSafeCall( cudaGetLastError() );
cudaSafeCall( cudaGetLastError() );
cudaSafeCall( cudaThreadSynchronize() );
cudaSafeCall( cudaThreadSynchronize() );
...
@@ -998,7 +997,7 @@ namespace cv { namespace gpu { namespace surf
...
@@ -998,7 +997,7 @@ namespace cv { namespace gpu { namespace surf
}
}
else
else
{
{
compute_descriptors128<<<dim3(nFeatures, 16, 1), dim3(
5, 5
, 1)>>>(descriptors, featureX, featureY, featureSize, featureDir);
compute_descriptors128<<<dim3(nFeatures, 16, 1), dim3(
6, 6
, 1)>>>(descriptors, featureX, featureY, featureSize, featureDir);
cudaSafeCall( cudaGetLastError() );
cudaSafeCall( cudaGetLastError() );
cudaSafeCall( cudaThreadSynchronize() );
cudaSafeCall( cudaThreadSynchronize() );
...
...
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