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
1f8b41f3
Commit
1f8b41f3
authored
Apr 23, 2014
by
Aaron Kunze
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimizes filter2D for Intel GPUs
parent
dcc4d364
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
11 deletions
+17
-11
ocl.cpp
modules/core/src/ocl.cpp
+1
-1
filter.cpp
modules/imgproc/src/filter.cpp
+0
-0
filter2DSmall.cl
modules/imgproc/src/opencl/filter2DSmall.cl
+0
-0
test_filter2d.cpp
modules/imgproc/test/ocl/test_filter2d.cpp
+16
-10
No files found.
modules/core/src/ocl.cpp
View file @
1f8b41f3
...
...
@@ -4379,7 +4379,7 @@ String kernelToStr(InputArray _kernel, int ddepth, const char * name)
typedef
std
::
string
(
*
func_t
)(
const
Mat
&
);
static
const
func_t
funcs
[]
=
{
kerToStr
<
uchar
>
,
kerToStr
<
char
>
,
kerToStr
<
ushort
>
,
kerToStr
<
short
>
,
kerToStr
<
int
>
,
kerToStr
<
float
>
,
kerToStr
<
double
>
,
0
};
const
func_t
func
=
funcs
[
depth
];
const
func_t
func
=
funcs
[
d
d
epth
];
CV_Assert
(
func
!=
0
);
return
cv
::
format
(
" -D %s=%s"
,
name
?
name
:
"COEFF"
,
func
(
kernel
).
c_str
());
...
...
modules/imgproc/src/filter.cpp
View file @
1f8b41f3
This diff is collapsed.
Click to expand it.
modules/imgproc/src/opencl/filter2DSmall.cl
0 → 100755
View file @
1f8b41f3
This diff is collapsed.
Click to expand it.
modules/imgproc/test/ocl/test_filter2d.cpp
View file @
1f8b41f3
...
...
@@ -51,7 +51,7 @@ namespace ocl {
/////////////////////////////////////////////////////////////////////////////////////////////////
// Filter2D
PARAM_TEST_CASE
(
Filter2D
,
MatDepth
,
Channels
,
BorderType
,
bool
,
bool
)
PARAM_TEST_CASE
(
Filter2D
,
MatDepth
,
Channels
,
int
,
int
,
BorderType
,
bool
,
bool
)
{
static
const
int
kernelMinSize
=
2
;
static
const
int
kernelMaxSize
=
10
;
...
...
@@ -60,6 +60,7 @@ PARAM_TEST_CASE(Filter2D, MatDepth, Channels, BorderType, bool, bool)
Size
dsize
;
Point
anchor
;
int
borderType
;
int
widthMultiple
;
bool
useRoi
;
Mat
kernel
;
double
delta
;
...
...
@@ -70,27 +71,30 @@ PARAM_TEST_CASE(Filter2D, MatDepth, Channels, BorderType, bool, bool)
virtual
void
SetUp
()
{
type
=
CV_MAKE_TYPE
(
GET_PARAM
(
0
),
GET_PARAM
(
1
));
borderType
=
GET_PARAM
(
2
)
|
(
GET_PARAM
(
3
)
?
BORDER_ISOLATED
:
0
);
useRoi
=
GET_PARAM
(
4
);
Size
ksize
(
GET_PARAM
(
2
),
GET_PARAM
(
2
));
widthMultiple
=
GET_PARAM
(
3
);
borderType
=
GET_PARAM
(
4
)
|
(
GET_PARAM
(
5
)
?
BORDER_ISOLATED
:
0
);
useRoi
=
GET_PARAM
(
6
);
Mat
temp
=
randomMat
(
ksize
,
CV_MAKE_TYPE
(((
CV_64F
==
CV_MAT_DEPTH
(
type
))
?
CV_64F
:
CV_32F
),
1
),
-
MAX_VALUE
,
MAX_VALUE
);
cv
::
normalize
(
temp
,
kernel
,
1.0
,
0.0
,
NORM_L1
);
}
void
random_roi
()
{
dsize
=
randomSize
(
1
,
MAX_VALUE
);
// Make sure the width is a multiple of the requested value, and no more.
dsize
.
width
&=
~
((
widthMultiple
*
2
)
-
1
);
dsize
.
width
+=
widthMultiple
;
Size
ksize
=
randomSize
(
kernelMinSize
,
kernelMaxSize
);
Mat
temp
=
randomMat
(
ksize
,
CV_MAKE_TYPE
(((
CV_64F
==
CV_MAT_DEPTH
(
type
))
?
CV_64F
:
CV_32F
),
1
),
-
MAX_VALUE
,
MAX_VALUE
);
cv
::
normalize
(
temp
,
kernel
,
1.0
,
0.0
,
NORM_L1
);
Size
roiSize
=
randomSize
(
ksize
.
width
,
MAX_VALUE
,
ksize
.
height
,
MAX_VALUE
);
Size
roiSize
=
randomSize
(
kernel
.
size
[
0
],
MAX_VALUE
,
kernel
.
size
[
1
],
MAX_VALUE
);
Border
srcBorder
=
randomBorder
(
0
,
useRoi
?
MAX_VALUE
:
0
);
randomSubMat
(
src
,
src_roi
,
roiSize
,
srcBorder
,
type
,
-
MAX_VALUE
,
MAX_VALUE
);
Border
dstBorder
=
randomBorder
(
0
,
useRoi
?
MAX_VALUE
:
0
);
randomSubMat
(
dst
,
dst_roi
,
dsize
,
dstBorder
,
type
,
-
MAX_VALUE
,
MAX_VALUE
);
anchor
.
x
=
randomInt
(
-
1
,
k
size
.
width
);
anchor
.
y
=
randomInt
(
-
1
,
k
size
.
height
);
anchor
.
x
=
randomInt
(
-
1
,
k
ernel
.
size
[
0
]
);
anchor
.
y
=
randomInt
(
-
1
,
k
ernel
.
size
[
1
]
);
delta
=
randomDouble
(
-
100
,
100
);
...
...
@@ -122,6 +126,8 @@ OCL_INSTANTIATE_TEST_CASE_P(ImageProc, Filter2D,
Combine
(
Values
(
CV_8U
,
CV_16U
,
CV_32F
),
OCL_ALL_CHANNELS
,
Values
(
3
,
5
,
9
),
// Kernel size
Values
(
1
,
4
,
8
),
// Width mutiple
Values
((
BorderType
)
BORDER_CONSTANT
,
(
BorderType
)
BORDER_REPLICATE
,
(
BorderType
)
BORDER_REFLECT
,
...
...
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