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
6b9c4519
Commit
6b9c4519
authored
Sep 10, 2013
by
Ilya Lavrenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added CV_16UC(1, 3, 4), CV_16SC(1, 3, 4) data types support in ocl::pyrUp and ocl::pyrDown
parent
747f7178
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
29 deletions
+26
-29
pyr_down.cl
modules/ocl/src/opencl/pyr_down.cl
+0
-0
pyr_up.cl
modules/ocl/src/opencl/pyr_up.cl
+0
-0
pyrdown.cpp
modules/ocl/src/pyrdown.cpp
+3
-14
pyrup.cpp
modules/ocl/src/pyrup.cpp
+5
-0
test_pyramids.cpp
modules/ocl/test/test_pyramids.cpp
+18
-15
No files found.
modules/ocl/src/opencl/pyr_down.cl
View file @
6b9c4519
This diff is collapsed.
Click to expand it.
modules/ocl/src/opencl/pyr_up.cl
View file @
6b9c4519
This diff is collapsed.
Click to expand it.
modules/ocl/src/pyrdown.cpp
View file @
6b9c4519
...
...
@@ -73,24 +73,11 @@ static void pyrdown_run(const oclMat &src, const oclMat &dst)
CV_Assert
(
src
.
depth
()
!=
CV_8S
);
Context
*
clCxt
=
src
.
clCxt
;
//int channels = dst.channels();
//int depth = dst.depth();
string
kernelName
=
"pyrDown"
;
//int vector_lengths[4][7] = {{4, 0, 4, 4, 1, 1, 1},
// {4, 0, 4, 4, 1, 1, 1},
// {4, 0, 4, 4, 1, 1, 1},
// {4, 0, 4, 4, 1, 1, 1}
//};
//size_t vector_length = vector_lengths[channels-1][depth];
//int offset_cols = (dst.offset / dst.elemSize1()) & (vector_length - 1);
size_t
localThreads
[
3
]
=
{
256
,
1
,
1
};
size_t
globalThreads
[
3
]
=
{
src
.
cols
,
dst
.
rows
,
1
};
//int dst_step1 = dst.cols * dst.elemSize();
vector
<
pair
<
size_t
,
const
void
*>
>
args
;
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
src
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_int
),
(
void
*
)
&
src
.
step
));
...
...
@@ -107,7 +94,9 @@ static void pyrdown_run(const oclMat &src, const oclMat &dst)
void
cv
::
ocl
::
pyrDown
(
const
oclMat
&
src
,
oclMat
&
dst
)
{
CV_Assert
(
src
.
depth
()
<=
CV_32F
&&
src
.
channels
()
<=
4
);
int
depth
=
src
.
depth
(),
channels
=
src
.
channels
();
CV_Assert
(
depth
==
CV_8U
||
depth
==
CV_16U
||
depth
==
CV_16S
||
depth
==
CV_32F
);
CV_Assert
(
channels
==
1
||
channels
==
3
||
channels
==
4
);
dst
.
create
((
src
.
rows
+
1
)
/
2
,
(
src
.
cols
+
1
)
/
2
,
src
.
type
());
...
...
modules/ocl/src/pyrup.cpp
View file @
6b9c4519
...
...
@@ -61,6 +61,11 @@ namespace cv
extern
const
char
*
pyr_up
;
void
pyrUp
(
const
cv
::
ocl
::
oclMat
&
src
,
cv
::
ocl
::
oclMat
&
dst
)
{
int
depth
=
src
.
depth
(),
channels
=
src
.
channels
();
CV_Assert
(
depth
==
CV_8U
||
depth
==
CV_16U
||
depth
==
CV_16S
||
depth
==
CV_32F
);
CV_Assert
(
channels
==
1
||
channels
==
3
||
channels
==
4
);
dst
.
create
(
src
.
rows
*
2
,
src
.
cols
*
2
,
src
.
type
());
Context
*
clCxt
=
src
.
clCxt
;
...
...
modules/ocl/test/test_pyramids.cpp
View file @
6b9c4519
...
...
@@ -57,60 +57,63 @@ using namespace std;
PARAM_TEST_CASE
(
PyrBase
,
MatType
,
int
)
{
int
type
;
int
depth
;
int
channels
;
Mat
dst_cpu
;
oclMat
gdst
;
virtual
void
SetUp
()
{
type
=
GET_PARAM
(
0
);
depth
=
GET_PARAM
(
0
);
channels
=
GET_PARAM
(
1
);
}
};
/////////////////////// PyrDown //////////////////////////
struct
PyrDown
:
PyrBase
{};
typedef
PyrBase
PyrDown
;
TEST_P
(
PyrDown
,
Mat
)
{
for
(
int
j
=
0
;
j
<
LOOP_TIMES
;
j
++
)
for
(
int
j
=
0
;
j
<
LOOP_TIMES
;
j
++
)
{
Size
size
(
MWIDTH
,
MHEIGHT
);
Mat
src
=
randomMat
(
size
,
CV_MAKETYPE
(
type
,
channels
));
Mat
src
=
randomMat
(
size
,
CV_MAKETYPE
(
depth
,
channels
));
oclMat
gsrc
(
src
);
pyrDown
(
src
,
dst_cpu
);
pyrDown
(
gsrc
,
gdst
);
EXPECT_MAT_NEAR
(
dst_cpu
,
Mat
(
gdst
),
type
==
CV_32F
?
1e-4
f
:
1.0
f
);
EXPECT_MAT_NEAR
(
dst_cpu
,
Mat
(
gdst
),
depth
==
CV_32F
?
1e-4
f
:
1.0
f
);
}
}
INSTANTIATE_TEST_CASE_P
(
OCL_ImgProc
,
PyrDown
,
Combine
(
Values
(
CV_8U
,
CV_32F
),
Values
(
1
,
3
,
4
)));
Values
(
CV_8U
,
CV_16U
,
CV_16S
,
CV_32F
),
Values
(
1
,
3
,
4
)));
/////////////////////// PyrUp //////////////////////////
struct
PyrUp
:
PyrBase
{}
;
typedef
PyrBase
PyrUp
;
TEST_P
(
PyrUp
,
Accuracy
)
{
for
(
int
j
=
0
;
j
<
LOOP_TIMES
;
j
++
)
for
(
int
j
=
0
;
j
<
LOOP_TIMES
;
j
++
)
{
Size
size
(
MWIDTH
,
MHEIGHT
);
Mat
src
=
randomMat
(
size
,
CV_MAKETYPE
(
type
,
channels
));
Mat
src
=
randomMat
(
size
,
CV_MAKETYPE
(
depth
,
channels
));
oclMat
gsrc
(
src
);
pyrUp
(
src
,
dst_cpu
);
pyrUp
(
gsrc
,
gdst
);
EXPECT_MAT_NEAR
(
dst_cpu
,
Mat
(
gdst
),
(
type
==
CV_32F
?
1e-4
f
:
1.0
));
EXPECT_MAT_NEAR
(
dst_cpu
,
Mat
(
gdst
),
(
depth
==
CV_32F
?
1e-4
f
:
1.0
));
}
}
INSTANTIATE_TEST_CASE_P
(
OCL_ImgProc
,
PyrUp
,
testing
::
Combine
(
Values
(
CV_8U
,
CV_32F
),
Values
(
1
,
3
,
4
)));
INSTANTIATE_TEST_CASE_P
(
OCL_ImgProc
,
PyrUp
,
Combine
(
Values
(
CV_8U
,
CV_16U
,
CV_16S
,
CV_32F
),
Values
(
1
,
3
,
4
)));
#endif // HAVE_OPENCL
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