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
124ede61
Commit
124ede61
authored
Aug 14, 2013
by
peng xiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update with apavlenko's suggestions.
parent
7fe84030
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
8 deletions
+10
-8
ocl.hpp
modules/ocl/include/opencv2/ocl/ocl.hpp
+1
-1
filtering.cpp
modules/ocl/src/filtering.cpp
+9
-6
filtering_laplacian.cl
modules/ocl/src/opencl/filtering_laplacian.cl
+0
-1
No files found.
modules/ocl/include/opencv2/ocl/ocl.hpp
View file @
124ede61
...
...
@@ -691,7 +691,7 @@ namespace cv
//! returns 2D filter with the specified kernel
// supports CV_8UC1 and CV_8UC4 types
CV_EXPORTS
Ptr
<
BaseFilter_GPU
>
getLinearFilter_GPU
(
int
srcType
,
int
dstType
,
const
Mat
&
kernel
,
const
Size
&
ksize
,
Point
anchor
=
Point
(
-
1
,
-
1
),
int
borderType
=
BORDER_DEFAULT
);
const
Point
&
anchor
=
Point
(
-
1
,
-
1
),
int
borderType
=
BORDER_DEFAULT
);
//! returns the non-separable linear filter engine
CV_EXPORTS
Ptr
<
FilterEngine_GPU
>
createLinearFilter_GPU
(
int
srcType
,
int
dstType
,
const
Mat
&
kernel
,
...
...
modules/ocl/src/filtering.cpp
View file @
124ede61
...
...
@@ -572,7 +572,7 @@ void cv::ocl::morphologyEx(const oclMat &src, oclMat &dst, int op, const Mat &ke
namespace
{
typedef
void
(
*
GPUFilter2D_t
)(
const
oclMat
&
,
oclMat
&
,
oclMat
&
,
Size
&
,
const
Point
,
const
int
);
typedef
void
(
*
GPUFilter2D_t
)(
const
oclMat
&
,
oclMat
&
,
const
oclMat
&
,
const
Size
&
,
const
Point
&
,
const
int
);
class
LinearFilter_GPU
:
public
BaseFilter_GPU
{
...
...
@@ -591,8 +591,8 @@ public:
};
}
static
void
GPUFilter2D
(
const
oclMat
&
src
,
oclMat
&
dst
,
oclMat
&
mat_kernel
,
Size
&
ksize
,
const
Point
anchor
,
const
int
borderType
)
static
void
GPUFilter2D
(
const
oclMat
&
src
,
oclMat
&
dst
,
const
oclMat
&
mat_kernel
,
const
Size
&
ksize
,
const
Point
&
anchor
,
const
int
borderType
)
{
CV_Assert
(
src
.
clCxt
==
dst
.
clCxt
);
CV_Assert
((
src
.
cols
==
dst
.
cols
)
&&
...
...
@@ -614,7 +614,7 @@ static void GPUFilter2D(const oclMat &src, oclMat &dst, oclMat &mat_kernel,
size_t
dst_offset_x
=
(
dst
.
offset
%
dst
.
step
)
/
dst
.
elemSize
();
size_t
dst_offset_y
=
dst
.
offset
/
dst
.
step
;
int
paddingPixels
=
(
int
)(
filterWidth
/
2
)
*
2
;
int
paddingPixels
=
filterWidth
&
(
-
2
)
;
size_t
localThreads
[
3
]
=
{
ksize_3x3
?
256
:
16
,
ksize_3x3
?
1
:
16
,
1
};
size_t
globalThreads
[
3
]
=
{
src
.
wholecols
,
src
.
wholerows
,
1
};
...
...
@@ -626,6 +626,8 @@ static void GPUFilter2D(const oclMat &src, oclMat &dst, oclMat &mat_kernel,
int
localWidth
=
localThreads
[
0
]
+
paddingPixels
;
int
localHeight
=
localThreads
[
1
]
+
paddingPixels
;
// 260 = divup((localThreads[0] + filterWidth * 2), 4) * 4
// 6 = (ROWS_PER_GROUP_WHICH_IS_4 + filterWidth * 2)
size_t
localMemSize
=
ksize_3x3
?
260
*
6
*
src
.
elemSize
()
:
(
localWidth
*
localHeight
)
*
src
.
elemSize
();
int
vector_lengths
[
4
][
7
]
=
{{
4
,
4
,
4
,
4
,
4
,
4
,
4
},
...
...
@@ -677,15 +679,16 @@ static void GPUFilter2D(const oclMat &src, oclMat &dst, oclMat &mat_kernel,
}
Ptr
<
BaseFilter_GPU
>
cv
::
ocl
::
getLinearFilter_GPU
(
int
srcType
,
int
dstType
,
const
Mat
&
kernel
,
const
Size
&
ksize
,
Point
anchor
,
int
borderType
)
const
Point
&
anchor
,
int
borderType
)
{
static
const
GPUFilter2D_t
GPUFilter2D_callers
[]
=
{
0
,
GPUFilter2D
,
0
,
GPUFilter2D
,
GPUFilter2D
};
CV_Assert
((
srcType
==
CV_8UC1
||
srcType
==
CV_8UC3
||
srcType
==
CV_8UC4
||
srcType
==
CV_32FC1
||
srcType
==
CV_32FC3
||
srcType
==
CV_32FC4
)
&&
dstType
==
srcType
);
oclMat
gpu_krnl
;
Point
norm_archor
=
anchor
;
normalizeKernel
(
kernel
,
gpu_krnl
,
CV_32FC1
);
normalizeAnchor
(
an
chor
,
ksize
);
normalizeAnchor
(
norm_ar
chor
,
ksize
);
return
Ptr
<
BaseFilter_GPU
>
(
new
LinearFilter_GPU
(
ksize
,
anchor
,
gpu_krnl
,
GPUFilter2D_callers
[
CV_MAT_CN
(
srcType
)],
borderType
));
...
...
modules/ocl/src/opencl/filtering_laplacian.cl
View file @
124ede61
...
...
@@ -44,7 +44,6 @@
//
the
use
of
this
software,
even
if
advised
of
the
possibility
of
such
damage.
//
//M*/
//#define
BORDER_REFLECT_101
///////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////Macro
for
border
type////////////////////////////////////////////
...
...
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