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
a2f8a93b
Commit
a2f8a93b
authored
Mar 26, 2014
by
Andrey Pavlenko
Committed by
OpenCV Buildbot
Mar 26, 2014
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2529 from ilya-lavrenov:tapi_filter2D
parents
6c12f203
f7d6d3cf
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
20 deletions
+22
-20
system.cpp
modules/core/src/system.cpp
+12
-13
filter.cpp
modules/imgproc/src/filter.cpp
+6
-6
filter2D.cl
modules/imgproc/src/opencl/filter2D.cl
+4
-1
No files found.
modules/core/src/system.cpp
View file @
a2f8a93b
...
...
@@ -414,24 +414,23 @@ const String& getBuildInformation()
String
format
(
const
char
*
fmt
,
...
)
{
char
buf
[
1024
]
;
AutoBuffer
<
char
,
1024
>
buf
;
va_list
va
;
va_start
(
va
,
fmt
);
int
len
=
vsnprintf
(
buf
,
sizeof
(
buf
),
fmt
,
va
);
va_end
(
va
);
if
(
len
>=
(
int
)
sizeof
(
buf
))
for
(
;
;
)
{
String
s
(
len
,
'\0'
)
;
va_list
va
;
va_start
(
va
,
fmt
);
len
=
vsnprintf
((
char
*
)
s
.
c_str
(),
len
+
1
,
fmt
,
va
);
(
void
)
len
;
int
bsize
=
static_cast
<
int
>
(
buf
.
size
()),
len
=
vsnprintf
((
char
*
)
buf
,
bsize
,
fmt
,
va
)
;
va_end
(
va
);
return
s
;
}
return
String
(
buf
,
len
);
if
(
len
<
0
||
len
>=
bsize
)
{
buf
.
resize
(
std
::
max
(
bsize
<<
1
,
len
+
1
));
continue
;
}
return
String
((
char
*
)
buf
,
len
);
}
}
String
tempfile
(
const
char
*
suffix
)
...
...
modules/imgproc/src/filter.cpp
View file @
a2f8a93b
...
...
@@ -42,7 +42,6 @@
#include "precomp.hpp"
#include "opencl_kernels.hpp"
#include <sstream>
/****************************************************************************************\
Base Image Filter
...
...
@@ -3197,6 +3196,8 @@ static bool ocl_filter2D( InputArray _src, OutputArray _dst, int ddepth,
size_t
tryWorkItems
=
maxWorkItemSizes
[
0
];
char
cvt
[
2
][
40
];
String
kerStr
=
ocl
::
kernelToStr
(
kernelMatDataFloat
,
CV_32F
);
for
(
;
;
)
{
size_t
BLOCK_SIZE
=
tryWorkItems
;
...
...
@@ -3226,14 +3227,14 @@ static bool ocl_filter2D( InputArray _src, OutputArray _dst, int ddepth,
String
opts
=
format
(
"-D LOCAL_SIZE=%d -D BLOCK_SIZE_Y=%d -D cn=%d "
"-D ANCHOR_X=%d -D ANCHOR_Y=%d -D KERNEL_SIZE_X=%d -D KERNEL_SIZE_Y=%d "
"-D KERNEL_SIZE_Y2_ALIGNED=%d -D %s -D %s -D %s%s "
"-D KERNEL_SIZE_Y2_ALIGNED=%d -D %s -D %s -D %s%s
%s
"
"-D srcT=%s -D srcT1=%s -D dstT=%s -D dstT1=%s -D WT=%s -D WT1=%s "
"-D convertToWT=%s -D convertToDstT=%s"
,
(
int
)
BLOCK_SIZE
,
(
int
)
BLOCK_SIZE_Y
,
cn
,
anchor
.
x
,
anchor
.
y
,
ksize
.
width
,
ksize
.
height
,
kernel_size_y2_aligned
,
borderMap
[
borderType
],
extra_extrapolation
?
"EXTRA_EXTRAPOLATION"
:
"NO_EXTRA_EXTRAPOLATION"
,
isolated
?
"BORDER_ISOLATED"
:
"NO_BORDER_ISOLATED"
,
doubleSupport
?
" -D DOUBLE_SUPPORT"
:
""
,
doubleSupport
?
" -D DOUBLE_SUPPORT"
:
""
,
kerStr
.
c_str
(),
ocl
::
typeToStr
(
type
),
ocl
::
typeToStr
(
sdepth
),
ocl
::
typeToStr
(
dtype
),
ocl
::
typeToStr
(
ddepth
),
ocl
::
typeToStr
(
wtype
),
ocl
::
typeToStr
(
wdepth
),
ocl
::
convertTypeStr
(
sdepth
,
wdepth
,
cn
,
cvt
[
0
]),
...
...
@@ -3255,7 +3256,7 @@ static bool ocl_filter2D( InputArray _src, OutputArray _dst, int ddepth,
}
_dst
.
create
(
sz
,
dtype
);
UMat
dst
=
_dst
.
getUMat
()
,
kernalDataUMat
(
kernelMatDataFloat
,
true
)
;
UMat
dst
=
_dst
.
getUMat
();
int
srcOffsetX
=
(
int
)((
src
.
offset
%
src
.
step
)
/
src
.
elemSize
());
int
srcOffsetY
=
(
int
)(
src
.
offset
/
src
.
step
);
...
...
@@ -3263,8 +3264,7 @@ static bool ocl_filter2D( InputArray _src, OutputArray _dst, int ddepth,
int
srcEndY
=
(
isolated
?
(
srcOffsetY
+
sz
.
height
)
:
wholeSize
.
height
);
k
.
args
(
ocl
::
KernelArg
::
PtrReadOnly
(
src
),
(
int
)
src
.
step
,
srcOffsetX
,
srcOffsetY
,
srcEndX
,
srcEndY
,
ocl
::
KernelArg
::
WriteOnly
(
dst
),
ocl
::
KernelArg
::
PtrReadOnly
(
kernalDataUMat
),
(
float
)
delta
);
srcEndX
,
srcEndY
,
ocl
::
KernelArg
::
WriteOnly
(
dst
),
(
float
)
delta
);
return
k
.
run
(
2
,
globalsize
,
localsize
,
false
);
}
...
...
modules/imgproc/src/opencl/filter2D.cl
View file @
a2f8a93b
...
...
@@ -200,8 +200,11 @@ inline WT readSrcPixel(int2 pos, __global const uchar * srcptr, int src_step, co
}
}
#
define
DIG
(
a
)
a,
__constant
WT1
kernelData[]
=
{
COEFF
}
;
__kernel
void
filter2D
(
__global
const
uchar
*
srcptr,
int
src_step,
int
srcOffsetX,
int
srcOffsetY,
int
srcEndX,
int
srcEndY,
__global
uchar
*
dstptr,
int
dst_step,
int
dst_offset,
int
rows,
int
cols,
__constant
WT1
*
kernelData,
float
delta
)
__global
uchar
*
dstptr,
int
dst_step,
int
dst_offset,
int
rows,
int
cols,
float
delta
)
{
const
struct
RectCoords
srcCoords
=
{
srcOffsetX,
srcOffsetY,
srcEndX,
srcEndY
}
; // for non-isolated border: offsetX, offsetY, wholeX, wholeY
...
...
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