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
a66db67b
Commit
a66db67b
authored
Apr 07, 2014
by
Alexander Karsakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Attempt to improve performance
parent
c747426f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
9 deletions
+8
-9
filter.cpp
modules/imgproc/src/filter.cpp
+5
-5
filterSep_singlePass.cl
modules/imgproc/src/opencl/filterSep_singlePass.cl
+3
-4
No files found.
modules/imgproc/src/filter.cpp
View file @
a66db67b
...
...
@@ -3413,15 +3413,15 @@ static bool ocl_sepFilter2D_SinglePass(InputArray _src, OutputArray _dst,
String
opts
=
cv
::
format
(
"-D BLK_X=%d -D BLK_Y=%d -D RADIUSX=%d -D RADIUSY=%d%s%s"
" -D srcT=%s -D convertToWT=%s -D WT=%s -D dstT=%s -D convertToDstT=%s"
" -D %s -D srcT1=%s -D dstT1=%s -D
CN=%d -D SHIFT_BITS=%d%s"
,
" -D %s -D srcT1=%s -D dstT1=%s -D
WT1=%s -D CN=%d -D SHIFT_BITS=%d%s"
,
(
int
)
lt2
[
0
],
(
int
)
lt2
[
1
],
row_kernel
.
cols
/
2
,
col_kernel
.
cols
/
2
,
ocl
::
kernelToStr
(
row_kernel
,
wdepth
,
"KERNEL_MATRIX_X"
).
c_str
(),
ocl
::
kernelToStr
(
col_kernel
,
wdepth
,
"KERNEL_MATRIX_Y"
).
c_str
(),
ocl
::
typeToStr
(
stype
),
ocl
::
convertTypeStr
(
sdepth
,
wdepth
,
cn
,
cvt
[
0
]),
ocl
::
typeToStr
(
CV_MAKE_TYPE
(
wdepth
,
cn
)),
ocl
::
typeToStr
(
dtype
),
ocl
::
convertTypeStr
(
wdepth
,
ddepth
,
cn
,
cvt
[
1
]),
borderMap
[
borderType
],
ocl
::
typeToStr
(
sdepth
),
ocl
::
typeToStr
(
ddepth
),
cn
,
2
*
shift_bits
,
int_arithm
?
" -D INTEGER_ARITHMETIC"
:
""
);
ocl
::
typeToStr
(
sdepth
),
ocl
::
typeToStr
(
ddepth
),
ocl
::
typeToStr
(
wdepth
)
,
cn
,
2
*
shift_bits
,
int_arithm
?
" -D INTEGER_ARITHMETIC"
:
""
);
ocl
::
Kernel
k
(
"sep_filter"
,
ocl
::
imgproc
::
filterSep_singlePass_oclsrc
,
opts
);
if
(
k
.
empty
())
...
...
@@ -3481,8 +3481,8 @@ static bool ocl_sepFilter2D( InputArray _src, OutputArray _dst, int ddepth,
ctype
==
KERNEL_SMOOTH
+
KERNEL_SYMMETRICAL
)
{
bdepth
=
CV_32S
;
kernelX
.
convertTo
(
kernelX
,
CV_32S
,
1
<<
shift_bits
);
kernelY
.
convertTo
(
kernelY
,
CV_32S
,
1
<<
shift_bits
);
kernelX
.
convertTo
(
kernelX
,
bdepth
,
1
<<
shift_bits
);
kernelY
.
convertTo
(
kernelY
,
bdepth
,
1
<<
shift_bits
);
int_arithm
=
true
;
}
...
...
modules/imgproc/src/opencl/filterSep_singlePass.cl
View file @
a66db67b
...
...
@@ -100,8 +100,8 @@
//
horizontal
and
vertical
filter
kernels
//
should
be
defined
on
host
during
compile
time
to
avoid
overhead
#
define
DIG
(
a
)
a,
__constant
WT
mat_kernelX[]
=
{
KERNEL_MATRIX_X
}
;
__constant
WT
mat_kernelY[]
=
{
KERNEL_MATRIX_Y
}
;
__constant
WT
1
mat_kernelX[]
=
{
KERNEL_MATRIX_X
}
;
__constant
WT
1
mat_kernelY[]
=
{
KERNEL_MATRIX_Y
}
;
__kernel
void
sep_filter
(
__global
uchar*
Src,
int
src_step,
int
srcOffsetX,
int
srcOffsetY,
int
height,
int
width,
__global
uchar*
Dst,
int
dst_step,
int
dst_offset,
int
dst_rows,
int
dst_cols,
float
delta
)
...
...
@@ -124,8 +124,6 @@ __kernel void sep_filter(__global uchar* Src, int src_step, int srcOffsetX, int
//
calculate
pixel
position
in
source
image
taking
image
offset
into
account
int
srcX
=
x
+
srcOffsetX
-
RADIUSX
;
int
srcY
=
y
+
srcOffsetY
-
RADIUSY
;
int
xb
=
srcX
;
int
yb
=
srcY
;
//
extrapolate
coordinates,
if
needed
//
and
read
my
own
source
pixel
into
local
memory
...
...
@@ -191,6 +189,7 @@ __kernel void sep_filter(__global uchar* Src, int src_step, int srcOffsetX, int
sum
=
(
sum
+
(
1
<<
(
SHIFT_BITS-1
)))
>>
SHIFT_BITS
;
#
endif
//
store
result
into
destination
image
storepix
(
convertToDstT
(
sum
+
(
WT
)(
delta
))
,
Dst
+
mad24
(
y,
dst_step,
mad24
(
x,
DSTSIZE,
dst_offset
)))
;
}
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