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
dd942df0
Commit
dd942df0
authored
Nov 01, 2013
by
Andrey Pavlenko
Committed by
OpenCV Buildbot
Nov 01, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1736 from alalek:ocl_fix_corner_memory_access
parents
2767be9a
99ae9d9c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
24 deletions
+30
-24
imgproc_calcHarris.cl
modules/ocl/src/opencl/imgproc_calcHarris.cl
+8
-10
imgproc_calcMinEigenVal.cl
modules/ocl/src/opencl/imgproc_calcMinEigenVal.cl
+8
-8
test_imgproc.cpp
modules/ocl/test/test_imgproc.cpp
+14
-6
No files found.
modules/ocl/src/opencl/imgproc_calcHarris.cl
View file @
dd942df0
...
...
@@ -119,18 +119,16 @@ __kernel void calcHarris(__global const float *Dx, __global const float *Dy, __g
__local
float
temp[6][THREADS]
;
#
ifdef
BORDER_CONSTANT
bool
dx_con,dy_con
;
float
dx_s,
dy_s
;
for
(
int
i=0
; i < ksY+1; i++)
{
dx_con
=
dx_startX+col
>=
0
&&
dx_startX+col
<
dx_whole_cols
&&
dx_startY+i
>=
0
&&
dx_startY+i
<
dx_whole_rows
;
dx_s
=
Dx[
(
dx_startY+i
)
*
(
dx_step>>2
)
+
(
dx_startX+col
)
]
;
dx_data[i]
=
dx_con
?
dx_s
:
0.0f
;
dy_con
=
dy_startX+col
>=
0
&&
dy_startX+col
<
dy_whole_cols
&&
dy_startY+i
>=
0
&&
dy_startY+i
<
dy_whole_rows
;
dy_s
=
Dy[
(
dy_startY+i
)
*
(
dy_step>>2
)
+
(
dy_startX+col
)
]
;
dy_data[i]
=
dy_con
?
dy_s
:
0.0f
;
bool
dx_con
=
dx_startX+col
>=
0
&&
dx_startX+col
<
dx_whole_cols
&&
dx_startY+i
>=
0
&&
dx_startY+i
<
dx_whole_rows
;
int
indexDx
=
(
dx_startY+i
)
*
(
dx_step>>2
)
+
(
dx_startX+col
)
;
float
dx_s
=
dx_con
?
Dx[indexDx]
:
0.0f
;
dx_data[i]
=
dx_s
;
bool
dy_con
=
dy_startX+col
>=
0
&&
dy_startX+col
<
dy_whole_cols
&&
dy_startY+i
>=
0
&&
dy_startY+i
<
dy_whole_rows
;
int
indexDy
=
(
dy_startY+i
)
*
(
dy_step>>2
)
+
(
dy_startX+col
)
;
float
dy_s
=
dx_con
?
Dy[indexDy]
:
0.0f
;
dy_data[i]
=
dy_s
;
data[0][i]
=
dx_data[i]
*
dx_data[i]
;
data[1][i]
=
dx_data[i]
*
dy_data[i]
;
data[2][i]
=
dy_data[i]
*
dy_data[i]
;
...
...
modules/ocl/src/opencl/imgproc_calcMinEigenVal.cl
View file @
dd942df0
...
...
@@ -118,16 +118,16 @@ __kernel void calcMinEigenVal(__global const float *Dx,__global const float *Dy,
__local
float
temp[6][THREADS]
;
#
ifdef
BORDER_CONSTANT
bool
dx_con,
dy_con
;
float
dx_s,
dy_s
;
for
(
int
i=0
; i < ksY+1; i++)
{
dx_con
=
dx_startX+col
>=
0
&&
dx_startX+col
<
dx_whole_cols
&&
dx_startY+i
>=
0
&&
dx_startY+i
<
dx_whole_rows
;
dx_s
=
Dx[
(
dx_startY+i
)
*
(
dx_step>>2
)
+
(
dx_startX+col
)
]
;
dx_data[i]
=
dx_con
?
dx_s
:
0.0f
;
dy_con
=
dy_startX+col
>=
0
&&
dy_startX+col
<
dy_whole_cols
&&
dy_startY+i
>=
0
&&
dy_startY+i
<
dy_whole_rows
;
dy_s
=
Dy[
(
dy_startY+i
)
*
(
dy_step>>2
)
+
(
dy_startX+col
)
]
;
dy_data[i]
=
dy_con
?
dy_s
:
0.0f
;
bool
dx_con
=
dx_startX+col
>=
0
&&
dx_startX+col
<
dx_whole_cols
&&
dx_startY+i
>=
0
&&
dx_startY+i
<
dx_whole_rows
;
int
indexDx
=
(
dx_startY+i
)
*
(
dx_step>>2
)
+
(
dx_startX+col
)
;
float
dx_s
=
dx_con
?
Dx[indexDx]
:
0.0f
;
dx_data[i]
=
dx_s
;
bool
dy_con
=
dy_startX+col
>=
0
&&
dy_startX+col
<
dy_whole_cols
&&
dy_startY+i
>=
0
&&
dy_startY+i
<
dy_whole_rows
;
int
indexDy
=
(
dy_startY+i
)
*
(
dy_step>>2
)
+
(
dy_startX+col
)
;
float
dy_s
=
dx_con
?
Dy[indexDy]
:
0.0f
;
dy_data[i]
=
dy_s
;
data[0][i]
=
dx_data[i]
*
dx_data[i]
;
data[1][i]
=
dx_data[i]
*
dy_data[i]
;
data[2][i]
=
dy_data[i]
*
dy_data[i]
;
...
...
modules/ocl/test/test_imgproc.cpp
View file @
dd942df0
...
...
@@ -93,14 +93,22 @@ PARAM_TEST_CASE(ImgprocTestBase, MatType,
generateOclMat
(
gdst_whole
,
gdst_roi
,
dst_whole
,
roiSize
,
dstBorder
);
}
void
Near
(
double
threshold
=
0.0
)
void
Near
(
double
threshold
=
0.0
,
bool
relative
=
false
)
{
Mat
whole
,
roi
;
Mat
roi
,
whole
;
gdst_whole
.
download
(
whole
);
gdst_roi
.
download
(
roi
);
EXPECT_MAT_NEAR
(
dst_whole
,
whole
,
threshold
);
EXPECT_MAT_NEAR
(
dst_roi
,
roi
,
threshold
);
if
(
relative
)
{
EXPECT_MAT_NEAR_RELATIVE
(
dst_whole
,
whole
,
threshold
);
EXPECT_MAT_NEAR_RELATIVE
(
dst_roi
,
roi
,
threshold
);
}
else
{
EXPECT_MAT_NEAR
(
dst_whole
,
whole
,
threshold
);
EXPECT_MAT_NEAR
(
dst_roi
,
roi
,
threshold
);
}
}
};
...
...
@@ -228,7 +236,7 @@ OCL_TEST_P(CornerMinEigenVal, Mat)
cornerMinEigenVal
(
src_roi
,
dst_roi
,
blockSize
,
apertureSize
,
borderType
);
ocl
::
cornerMinEigenVal
(
gsrc_roi
,
gdst_roi
,
blockSize
,
apertureSize
,
borderType
);
Near
(
0.02
);
Near
(
1e-5
,
true
);
}
}
...
...
@@ -248,7 +256,7 @@ OCL_TEST_P(CornerHarris, Mat)
cornerHarris
(
src_roi
,
dst_roi
,
blockSize
,
apertureSize
,
k
,
borderType
);
ocl
::
cornerHarris
(
gsrc_roi
,
gdst_roi
,
blockSize
,
apertureSize
,
k
,
borderType
);
Near
(
0.02
);
Near
(
1e-5
,
true
);
}
}
...
...
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