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
6409a4b1
Commit
6409a4b1
authored
Feb 27, 2013
by
yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix the compile warnings
parent
e3a71588
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
110 additions
and
167 deletions
+110
-167
performance.cpp
samples/ocl/performance.cpp
+110
-167
No files found.
samples/ocl/performance.cpp
View file @
6409a4b1
...
@@ -24,13 +24,26 @@ using namespace std;
...
@@ -24,13 +24,26 @@ using namespace std;
using
namespace
cv
;
using
namespace
cv
;
// This program test most of the functions in ocl module and generate data metrix of x-factor in .csv files
// This program test most of the functions in ocl module and generate data metrix of x-factor in .csv files
// All images needed in this test are in samples/gpu folder.
// All images needed in this test are in samples/gpu folder.
// For haar template, please rename it to facedetect.xml
// For haar template, please rename it to facedetect.xml
void
gen
(
Mat
&
mat
,
int
rows
,
int
cols
,
int
type
,
Scalar
low
,
Scalar
high
);
string
abspath
(
const
string
&
relpath
);
int
CV_CDECL
cvErrorCallback
(
int
,
const
char
*
,
const
char
*
,
const
char
*
,
int
,
void
*
);
typedef
struct
{
short
x
;
short
y
;
}
COOR
;
COOR
do_meanShift
(
int
x0
,
int
y0
,
uchar
*
sptr
,
uchar
*
dptr
,
int
sstep
,
cv
::
Size
size
,
int
sp
,
int
sr
,
int
maxIter
,
float
eps
,
int
*
tab
);
void
meanShiftProc_
(
const
Mat
&
src_roi
,
Mat
&
dst_roi
,
Mat
&
dstCoor_roi
,
int
sp
,
int
sr
,
cv
::
TermCriteria
crit
);
class
Runnable
class
Runnable
{
{
public
:
public
:
explicit
Runnable
(
const
std
::
string
&
name
)
:
name_
(
name
)
{}
explicit
Runnable
(
const
std
::
string
&
runname
)
:
name_
(
run
name
)
{}
virtual
~
Runnable
()
{}
virtual
~
Runnable
()
{}
const
std
::
string
&
name
()
const
const
std
::
string
&
name
()
const
...
@@ -44,8 +57,6 @@ private:
...
@@ -44,8 +57,6 @@ private:
std
::
string
name_
;
std
::
string
name_
;
};
};
class
TestSystem
class
TestSystem
{
{
public
:
public
:
...
@@ -209,11 +220,11 @@ private:
...
@@ -209,11 +220,11 @@ private:
TestSystem
()
:
TestSystem
()
:
cur_subtest_is_empty_
(
true
),
cpu_elapsed_
(
0
),
cur_subtest_is_empty_
(
true
),
cpu_elapsed_
(
0
),
gpu_elapsed_
(
0
),
gpu_full_elapsed_
(
0
),
speedup_total_
(
0.0
),
gpu_elapsed_
(
0
),
gpu_full_elapsed_
(
0
),
speedup_total_
(
0.0
),
num_subtests_called_
(
0
),
is_list_mode_
(
false
),
num_subtests_called_
(
0
),
num_iters_
(
10
),
cur_iter_idx_
(
0
),
cpu_num_iters_
(
2
),
gpu_warmup_iters_
(
1
),
cur_warmup_idx_
(
0
),
speedup_faster_count_
(
0
),
speedup_slower_count_
(
0
),
speedup_equal_count_
(
0
),
speedup_faster_count_
(
0
),
speedup_slower_count_
(
0
),
speedup_equal_count_
(
0
),
speedup_full_faster_count_
(
0
),
speedup_full_slower_count_
(
0
),
speedup_full_equal_count_
(
0
),
speedup_full_faster_count_
(
0
),
speedup_full_slower_count_
(
0
),
speedup_full_equal_count_
(
0
),
is_list_mode_
(
false
),
num_iters_
(
10
),
cpu_num_iters_
(
2
),
gpu_warmup_iters_
(
1
),
cur_iter_idx_
(
0
),
cur_warmup_idx_
(
0
),
record_
(
0
),
recordname_
(
"performance"
),
itname_changed_
(
true
)
record_
(
0
),
recordname_
(
"performance"
),
itname_changed_
(
true
)
{
{
cpu_times_
.
reserve
(
num_iters_
);
cpu_times_
.
reserve
(
num_iters_
);
...
@@ -456,9 +467,9 @@ void TestSystem::finishCurrentSubtest()
...
@@ -456,9 +467,9 @@ void TestSystem::finishCurrentSubtest()
{
{
double
sum
=
0
;
double
sum
=
0
;
for
(
in
t
i
=
0
;
i
<
gpu_times_
.
size
();
i
++
)
for
(
size_
t
i
=
0
;
i
<
gpu_times_
.
size
();
i
++
)
{
{
int64
diff
=
gpu_times_
[
i
]
-
gpu_elapsed_
;
int64
diff
=
gpu_times_
[
i
]
-
static_cast
<
int64
>
(
gpu_elapsed_
)
;
double
diff_time
=
diff
*
1000
/
getTickFrequency
();
double
diff_time
=
diff
*
1000
/
getTickFrequency
();
sum
+=
diff_time
*
diff_time
;
sum
+=
diff_time
*
diff_time
;
}
}
...
@@ -672,17 +683,15 @@ int CV_CDECL cvErrorCallback(int /*status*/, const char * /*func_name*/,
...
@@ -672,17 +683,15 @@ int CV_CDECL cvErrorCallback(int /*status*/, const char * /*func_name*/,
}
}
/////////// matchTemplate ////////////////////////
/////////// matchTemplate ////////////////////////
void
InitMatchTemplate
()
//void InitMatchTemplate()
{
//{
Mat
src
;
// Mat src; gen(src, 500, 500, CV_32F, 0, 1);
gen
(
src
,
500
,
500
,
CV_32F
,
0
,
1
);
// Mat templ; gen(templ, 500, 500, CV_32F, 0, 1);
Mat
templ
;
//#ifdef USE_OPENCL
gen
(
templ
,
500
,
500
,
CV_32F
,
0
,
1
);
// ocl::oclMat d_src(src), d_templ(templ), d_dst;
#ifdef USE_OPENCL
// ocl::matchTemplate(d_src, d_templ, d_dst, CV_TM_CCORR);
ocl
::
oclMat
d_src
(
src
),
d_templ
(
templ
),
d_dst
;
//#endif
ocl
::
matchTemplate
(
d_src
,
d_templ
,
d_dst
,
CV_TM_CCORR
);
//}
#endif
}
TEST
(
matchTemplate
)
TEST
(
matchTemplate
)
{
{
//InitMatchTemplate();
//InitMatchTemplate();
...
@@ -696,7 +705,7 @@ TEST(matchTemplate)
...
@@ -696,7 +705,7 @@ TEST(matchTemplate)
int
all_type
[]
=
{
CV_32FC1
,
CV_32FC4
};
int
all_type
[]
=
{
CV_32FC1
,
CV_32FC4
};
std
::
string
type_name
[]
=
{
"CV_32FC1"
,
"CV_32FC4"
};
std
::
string
type_name
[]
=
{
"CV_32FC1"
,
"CV_32FC4"
};
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
for
(
templ_size
=
5
;
templ_size
<
200
;
templ_size
*=
5
)
for
(
templ_size
=
5
;
templ_size
<
200
;
templ_size
*=
5
)
{
{
...
@@ -738,7 +747,7 @@ TEST(matchTemplate)
...
@@ -738,7 +747,7 @@ TEST(matchTemplate)
int
all_type_8U
[]
=
{
CV_8UC1
};
int
all_type_8U
[]
=
{
CV_8UC1
};
std
::
string
type_name_8U
[]
=
{
"CV_8UC1"
};
std
::
string
type_name_8U
[]
=
{
"CV_8UC1"
};
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type_8U
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type_8U
)
/
sizeof
(
int
);
j
++
)
{
{
for
(
templ_size
=
5
;
templ_size
<
200
;
templ_size
*=
5
)
for
(
templ_size
=
5
;
templ_size
<
200
;
templ_size
*=
5
)
{
{
...
@@ -784,7 +793,7 @@ TEST(PyrLKOpticalFlow)
...
@@ -784,7 +793,7 @@ TEST(PyrLKOpticalFlow)
std
::
string
images1
[]
=
{
"rubberwhale1.png"
,
"aloeL.jpg"
};
std
::
string
images1
[]
=
{
"rubberwhale1.png"
,
"aloeL.jpg"
};
std
::
string
images2
[]
=
{
"rubberwhale2.png"
,
"aloeR.jpg"
};
std
::
string
images2
[]
=
{
"rubberwhale2.png"
,
"aloeR.jpg"
};
for
(
in
t
i
=
0
;
i
<
sizeof
(
images1
)
/
sizeof
(
std
::
string
);
i
++
)
for
(
size_
t
i
=
0
;
i
<
sizeof
(
images1
)
/
sizeof
(
std
::
string
);
i
++
)
{
{
Mat
frame0
=
imread
(
abspath
(
images1
[
i
]),
i
==
0
?
IMREAD_COLOR
:
IMREAD_GRAYSCALE
);
Mat
frame0
=
imread
(
abspath
(
images1
[
i
]),
i
==
0
?
IMREAD_COLOR
:
IMREAD_GRAYSCALE
);
...
@@ -887,7 +896,7 @@ TEST(pyrDown)
...
@@ -887,7 +896,7 @@ TEST(pyrDown)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
...
@@ -930,7 +939,7 @@ TEST(pyrUp)
...
@@ -930,7 +939,7 @@ TEST(pyrUp)
for
(
int
size
=
500
;
size
<=
2000
;
size
*=
2
)
for
(
int
size
=
500
;
size
<=
2000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
...
@@ -1028,6 +1037,7 @@ public:
...
@@ -1028,6 +1037,7 @@ public:
Size
minSize
=
Size
(),
Size
minSize
=
Size
(),
Size
maxSize
=
Size
())
Size
maxSize
=
Size
())
{
{
(
void
)
maxSize
;
MemStorage
storage
(
cvCreateMemStorage
(
0
));
MemStorage
storage
(
cvCreateMemStorage
(
0
));
//CvMat img=image;
//CvMat img=image;
CvSeq
*
objs
=
oclHaarDetectObjects
(
image
,
storage
,
scaleFactor
,
minNeighbors
,
flags
,
minSize
);
CvSeq
*
objs
=
oclHaarDetectObjects
(
image
,
storage
,
scaleFactor
,
minNeighbors
,
flags
,
minSize
);
...
@@ -1133,7 +1143,7 @@ TEST(blend)
...
@@ -1133,7 +1143,7 @@ TEST(blend)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
<<
" and CV_32FC1"
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
<<
" and CV_32FC1"
;
...
@@ -1440,7 +1450,7 @@ TEST(lut)
...
@@ -1440,7 +1450,7 @@ TEST(lut)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
];
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
];
...
@@ -1569,7 +1579,7 @@ TEST(Add)
...
@@ -1569,7 +1579,7 @@ TEST(Add)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
];
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
];
...
@@ -1616,7 +1626,7 @@ TEST(Mul)
...
@@ -1616,7 +1626,7 @@ TEST(Mul)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
...
@@ -1666,7 +1676,7 @@ TEST(Div)
...
@@ -1666,7 +1676,7 @@ TEST(Div)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
];
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
];
...
@@ -1716,7 +1726,7 @@ TEST(Absdiff)
...
@@ -1716,7 +1726,7 @@ TEST(Absdiff)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
...
@@ -1766,7 +1776,7 @@ TEST(CartToPolar)
...
@@ -1766,7 +1776,7 @@ TEST(CartToPolar)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
];
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
];
...
@@ -1818,7 +1828,7 @@ TEST(PolarToCart)
...
@@ -1818,7 +1828,7 @@ TEST(PolarToCart)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
...
@@ -1870,7 +1880,7 @@ TEST(magnitude)
...
@@ -1870,7 +1880,7 @@ TEST(magnitude)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
];
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
];
...
@@ -1918,7 +1928,7 @@ TEST(Transpose)
...
@@ -1918,7 +1928,7 @@ TEST(Transpose)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
];
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
];
...
@@ -1964,7 +1974,7 @@ TEST(Flip)
...
@@ -1964,7 +1974,7 @@ TEST(Flip)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
<<
" ; FLIP_BOTH"
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
<<
" ; FLIP_BOTH"
;
...
@@ -2012,7 +2022,7 @@ TEST(minMax)
...
@@ -2012,7 +2022,7 @@ TEST(minMax)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
];
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
];
...
@@ -2056,7 +2066,7 @@ TEST(minMaxLoc)
...
@@ -2056,7 +2066,7 @@ TEST(minMaxLoc)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
...
@@ -2098,7 +2108,7 @@ TEST(Sum)
...
@@ -2098,7 +2108,7 @@ TEST(Sum)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
...
@@ -2133,7 +2143,6 @@ TEST(Sum)
...
@@ -2133,7 +2143,6 @@ TEST(Sum)
TEST
(
countNonZero
)
TEST
(
countNonZero
)
{
{
Mat
src
;
Mat
src
;
int
cpures
,
gpures
;
#ifdef USE_OPENCL
#ifdef USE_OPENCL
ocl
::
oclMat
d_src
;
ocl
::
oclMat
d_src
;
#endif
#endif
...
@@ -2142,31 +2151,31 @@ TEST(countNonZero)
...
@@ -2142,31 +2151,31 @@ TEST(countNonZero)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
gen
(
src
,
size
,
size
,
all_type
[
j
],
0
,
256
);
gen
(
src
,
size
,
size
,
all_type
[
j
],
0
,
256
);
c
pures
=
c
ountNonZero
(
src
);
countNonZero
(
src
);
CPU_ON
;
CPU_ON
;
c
pures
=
c
ountNonZero
(
src
);
countNonZero
(
src
);
CPU_OFF
;
CPU_OFF
;
#ifdef USE_OPENCL
#ifdef USE_OPENCL
d_src
.
upload
(
src
);
d_src
.
upload
(
src
);
WARMUP_ON
;
WARMUP_ON
;
gpures
=
ocl
::
countNonZero
(
d_src
);
ocl
::
countNonZero
(
d_src
);
WARMUP_OFF
;
WARMUP_OFF
;
GPU_ON
;
GPU_ON
;
gpures
=
ocl
::
countNonZero
(
d_src
);
ocl
::
countNonZero
(
d_src
);
GPU_OFF
;
GPU_OFF
;
GPU_FULL_ON
;
GPU_FULL_ON
;
d_src
.
upload
(
src
);
d_src
.
upload
(
src
);
gpures
=
ocl
::
countNonZero
(
d_src
);
ocl
::
countNonZero
(
d_src
);
GPU_FULL_OFF
;
GPU_FULL_OFF
;
#endif
#endif
}
}
...
@@ -2185,7 +2194,7 @@ TEST(Phase)
...
@@ -2185,7 +2194,7 @@ TEST(Phase)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
...
@@ -2235,7 +2244,7 @@ TEST(bitwise_and)
...
@@ -2235,7 +2244,7 @@ TEST(bitwise_and)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
...
@@ -2284,7 +2293,7 @@ TEST(bitwise_or)
...
@@ -2284,7 +2293,7 @@ TEST(bitwise_or)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
];
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
];
...
@@ -2333,7 +2342,7 @@ TEST(bitwise_xor)
...
@@ -2333,7 +2342,7 @@ TEST(bitwise_xor)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
];
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
];
...
@@ -2382,7 +2391,7 @@ TEST(bitwise_not)
...
@@ -2382,7 +2391,7 @@ TEST(bitwise_not)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
...
@@ -2430,7 +2439,7 @@ TEST(compare)
...
@@ -2430,7 +2439,7 @@ TEST(compare)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
...
@@ -2480,7 +2489,7 @@ TEST(pow)
...
@@ -2480,7 +2489,7 @@ TEST(pow)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
...
@@ -2527,13 +2536,13 @@ TEST(MagnitudeSqr)
...
@@ -2527,13 +2536,13 @@ TEST(MagnitudeSqr)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
int
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_t
t
=
0
;
t
<
sizeof
(
all_type
)
/
sizeof
(
int
);
t
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
];
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
t
];
gen
(
src1
,
size
,
size
,
all_type
[
j
],
0
,
256
);
gen
(
src1
,
size
,
size
,
all_type
[
t
],
0
,
256
);
gen
(
src2
,
size
,
size
,
all_type
[
j
],
0
,
256
);
gen
(
src2
,
size
,
size
,
all_type
[
t
],
0
,
256
);
gen
(
dst
,
size
,
size
,
all_type
[
j
],
0
,
256
);
gen
(
dst
,
size
,
size
,
all_type
[
t
],
0
,
256
);
for
(
int
i
=
0
;
i
<
src1
.
rows
;
++
i
)
for
(
int
i
=
0
;
i
<
src1
.
rows
;
++
i
)
...
@@ -2597,7 +2606,7 @@ TEST(AddWeighted)
...
@@ -2597,7 +2606,7 @@ TEST(AddWeighted)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
...
@@ -2648,7 +2657,7 @@ TEST(Blur)
...
@@ -2648,7 +2657,7 @@ TEST(Blur)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
...
@@ -2695,7 +2704,7 @@ TEST(Laplacian)
...
@@ -2695,7 +2704,7 @@ TEST(Laplacian)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
...
@@ -2730,66 +2739,6 @@ TEST(Laplacian)
...
@@ -2730,66 +2739,6 @@ TEST(Laplacian)
}
}
}
}
/////////////stereo match///////////////
/*
TEST(Stereo)
{
Mat left_src, right_src;
Mat left, right, disp;
ocl::StereoBM_GPU bm_gpu;
StereoBM bm_cpu;
#ifdef USE_OPENCL
ocl::oclMat d_left,d_right;
//please make sure that you set currect directory path
string left_str = "..\\..\\..\\samples\\gpu\\tsucuba_left.png";
string right_str = "..\\..\\..\\samples\\gpu\\tsucuba_right.png";
#endif
std::vector<cv::ocl::Info> oclinfo;
cv::ocl::getDevice(oclinfo);
//set the correct argument
bm_cpu.state->numberOfDisparities = 32;
bm_cpu.state->SADWindowSize = 5;
bm_gpu.ndisp = 32;
bm_gpu.winSize = 5;
left_src = imread(left_str);
right_src = imread(right_str);
if (left_src.empty()) throw runtime_error("can't open file \"" + left_str + "\"");
if (right_src.empty()) throw runtime_error("can't open file \"" + right_str + "\"");
cvtColor(left_src, left, CV_BGR2GRAY);
cvtColor(right_src, right, CV_BGR2GRAY);
bm_cpu(left,right,disp);
CPU_ON;
bm_cpu(left,right,disp);
CPU_OFF;
#ifdef USE_OPENCL
d_left.upload(left);
d_right.upload(right);
ocl::oclMat d_disp(left.size(), CV_8U);
WARMUP_ON;
bm_gpu(d_left, d_right, d_disp);
WARMUP_OFF;
GPU_ON;
bm_gpu(d_left, d_right, d_disp);
GPU_OFF;
GPU_FULL_ON;
d_left.upload(left);
d_right.upload(right);
bm_gpu(d_left, d_right, d_disp);
d_left.download(left);
d_right.download(right);
GPU_FULL_OFF;
#endif
}
*/
///////////// Erode ////////////////////
///////////// Erode ////////////////////
TEST
(
Erode
)
TEST
(
Erode
)
{
{
...
@@ -2802,7 +2751,7 @@ TEST(Erode)
...
@@ -2802,7 +2751,7 @@ TEST(Erode)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
...
@@ -2850,7 +2799,7 @@ TEST(Sobel)
...
@@ -2850,7 +2799,7 @@ TEST(Sobel)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
...
@@ -2896,7 +2845,7 @@ TEST(Scharr)
...
@@ -2896,7 +2845,7 @@ TEST(Scharr)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
...
@@ -2938,7 +2887,7 @@ TEST(GaussianBlur)
...
@@ -2938,7 +2887,7 @@ TEST(GaussianBlur)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
...
@@ -2981,7 +2930,7 @@ TEST(equalizeHist)
...
@@ -2981,7 +2930,7 @@ TEST(equalizeHist)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
...
@@ -3021,7 +2970,7 @@ TEST(CopyMakeBorder)
...
@@ -3021,7 +2970,7 @@ TEST(CopyMakeBorder)
{
{
Mat
src
,
dst
;
Mat
src
,
dst
;
#ifdef USE_OPENCL
#ifdef USE_OPENCL
ocl
::
oclMat
d_
src
,
d_
dst
;
ocl
::
oclMat
d_dst
;
#endif
#endif
int
bordertype
=
BORDER_CONSTANT
;
int
bordertype
=
BORDER_CONSTANT
;
int
all_type
[]
=
{
CV_8UC1
,
CV_8UC4
};
int
all_type
[]
=
{
CV_8UC1
,
CV_8UC4
};
...
@@ -3029,7 +2978,7 @@ TEST(CopyMakeBorder)
...
@@ -3029,7 +2978,7 @@ TEST(CopyMakeBorder)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
...
@@ -3067,7 +3016,7 @@ TEST(cornerMinEigenVal)
...
@@ -3067,7 +3016,7 @@ TEST(cornerMinEigenVal)
{
{
Mat
src
,
dst
;
Mat
src
,
dst
;
#ifdef USE_OPENCL
#ifdef USE_OPENCL
ocl
::
oclMat
d_
src
,
d_
dst
;
ocl
::
oclMat
d_dst
;
#endif
#endif
int
blockSize
=
7
,
apertureSize
=
1
+
2
*
(
rand
()
%
4
);
int
blockSize
=
7
,
apertureSize
=
1
+
2
*
(
rand
()
%
4
);
int
borderType
=
BORDER_REFLECT
;
int
borderType
=
BORDER_REFLECT
;
...
@@ -3076,7 +3025,7 @@ TEST(cornerMinEigenVal)
...
@@ -3076,7 +3025,7 @@ TEST(cornerMinEigenVal)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
...
@@ -3121,7 +3070,7 @@ TEST(cornerHarris)
...
@@ -3121,7 +3070,7 @@ TEST(cornerHarris)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
<<
" ; BORDER_REFLECT"
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
<<
" ; BORDER_REFLECT"
;
...
@@ -3166,7 +3115,7 @@ TEST(integral)
...
@@ -3166,7 +3115,7 @@ TEST(integral)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
...
@@ -3219,7 +3168,7 @@ TEST(WarpAffine)
...
@@ -3219,7 +3168,7 @@ TEST(WarpAffine)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
...
@@ -3274,7 +3223,7 @@ TEST(WarpPerspective)
...
@@ -3274,7 +3223,7 @@ TEST(WarpPerspective)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
...
@@ -3322,7 +3271,7 @@ TEST(resize)
...
@@ -3322,7 +3271,7 @@ TEST(resize)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
<<
" ; up"
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
<<
" ; up"
;
...
@@ -3356,7 +3305,7 @@ TEST(resize)
...
@@ -3356,7 +3305,7 @@ TEST(resize)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
<<
" ; down"
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
<<
" ; down"
;
...
@@ -3499,11 +3448,6 @@ TEST(meanShiftFiltering)
...
@@ -3499,11 +3448,6 @@ TEST(meanShiftFiltering)
}
}
}
}
///////////// meanShiftProc////////////////////////
///////////// meanShiftProc////////////////////////
typedef
struct
{
short
x
;
short
y
;
}
COOR
;
COOR
do_meanShift
(
int
x0
,
int
y0
,
uchar
*
sptr
,
uchar
*
dptr
,
int
sstep
,
cv
::
Size
size
,
int
sp
,
int
sr
,
int
maxIter
,
float
eps
,
int
*
tab
)
COOR
do_meanShift
(
int
x0
,
int
y0
,
uchar
*
sptr
,
uchar
*
dptr
,
int
sstep
,
cv
::
Size
size
,
int
sp
,
int
sr
,
int
maxIter
,
float
eps
,
int
*
tab
)
{
{
...
@@ -3647,12 +3591,11 @@ COOR do_meanShift(int x0, int y0, uchar *sptr, uchar *dptr, int sstep, cv::Size
...
@@ -3647,12 +3591,11 @@ COOR do_meanShift(int x0, int y0, uchar *sptr, uchar *dptr, int sstep, cv::Size
break
;
break
;
}
}
double
icount
=
1.0
/
count
;
int
x1
=
sx
/
count
;
int
x1
=
cvFloor
(
sx
*
icount
);
int
y1
=
sy
/
count
;
int
y1
=
cvFloor
(
sy
*
icount
);
s0
=
s0
/
count
;
s0
=
cvFloor
(
s0
*
icount
);
s1
=
s1
/
count
;
s1
=
cvFloor
(
s1
*
icount
);
s2
=
s2
/
count
;
s2
=
cvFloor
(
s2
*
icount
);
bool
stopFlag
=
(
x0
==
x1
&&
y0
==
y1
)
||
(
abs
(
x1
-
x0
)
+
abs
(
y1
-
y0
)
+
bool
stopFlag
=
(
x0
==
x1
&&
y0
==
y1
)
||
(
abs
(
x1
-
x0
)
+
abs
(
y1
-
y0
)
+
tab
[
s0
-
c0
+
255
]
+
tab
[
s1
-
c1
+
255
]
+
tab
[
s2
-
c2
+
255
]
<=
eps
);
tab
[
s0
-
c0
+
255
]
+
tab
[
s1
-
c1
+
255
]
+
tab
[
s2
-
c2
+
255
]
<=
eps
);
...
@@ -3679,8 +3622,8 @@ COOR do_meanShift(int x0, int y0, uchar *sptr, uchar *dptr, int sstep, cv::Size
...
@@ -3679,8 +3622,8 @@ COOR do_meanShift(int x0, int y0, uchar *sptr, uchar *dptr, int sstep, cv::Size
dptr
[
3
]
=
(
uchar
)
c3
;
dptr
[
3
]
=
(
uchar
)
c3
;
COOR
coor
;
COOR
coor
;
coor
.
x
=
x0
;
coor
.
x
=
static_cast
<
short
>
(
x0
)
;
coor
.
y
=
y0
;
coor
.
y
=
static_cast
<
short
>
(
y0
)
;
return
coor
;
return
coor
;
}
}
...
@@ -3794,7 +3737,7 @@ TEST(ConvertTo)
...
@@ -3794,7 +3737,7 @@ TEST(ConvertTo)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
<<
" to 32FC1"
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
<<
" to 32FC1"
;
...
@@ -3841,7 +3784,7 @@ TEST(copyTo)
...
@@ -3841,7 +3784,7 @@ TEST(copyTo)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
...
@@ -3890,7 +3833,7 @@ TEST(setTo)
...
@@ -3890,7 +3833,7 @@ TEST(setTo)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
...
@@ -3934,7 +3877,7 @@ TEST(Merge)
...
@@ -3934,7 +3877,7 @@ TEST(Merge)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
Size
size1
=
Size
(
size
,
size
);
Size
size1
=
Size
(
size
,
size
);
...
@@ -3992,7 +3935,7 @@ TEST(Split)
...
@@ -3992,7 +3935,7 @@ TEST(Split)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
];
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
];
Size
size1
=
Size
(
size
,
size
);
Size
size1
=
Size
(
size
,
size
);
...
@@ -4085,11 +4028,11 @@ TEST(remap)
...
@@ -4085,11 +4028,11 @@ TEST(remap)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
int
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_t
t
=
0
;
t
<
sizeof
(
all_type
)
/
sizeof
(
int
);
t
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; src "
<<
type_name
[
j
]
<<
"; map CV_32FC1"
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; src "
<<
type_name
[
t
]
<<
"; map CV_32FC1"
;
gen
(
src
,
size
,
size
,
all_type
[
j
],
0
,
256
);
gen
(
src
,
size
,
size
,
all_type
[
t
],
0
,
256
);
xmap
.
create
(
size
,
size
,
CV_32FC1
);
xmap
.
create
(
size
,
size
,
CV_32FC1
);
dst
.
create
(
size
,
size
,
CV_32FC1
);
dst
.
create
(
size
,
size
,
CV_32FC1
);
...
@@ -4150,7 +4093,7 @@ TEST(cvtColor)
...
@@ -4150,7 +4093,7 @@ TEST(cvtColor)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
gen
(
src
,
size
,
size
,
all_type
[
j
],
0
,
256
);
gen
(
src
,
size
,
size
,
all_type
[
j
],
0
,
256
);
SUBTEST
<<
size
<<
"x"
<<
size
<<
"; "
<<
type_name
[
j
]
<<
" ; CV_RGBA2GRAY"
;
SUBTEST
<<
size
<<
"x"
<<
size
<<
"; "
<<
type_name
[
j
]
<<
" ; CV_RGBA2GRAY"
;
...
@@ -4195,7 +4138,7 @@ TEST(filter2D)
...
@@ -4195,7 +4138,7 @@ TEST(filter2D)
int
all_type
[]
=
{
CV_8UC1
,
CV_8UC4
};
int
all_type
[]
=
{
CV_8UC1
,
CV_8UC4
};
std
::
string
type_name
[]
=
{
"CV_8UC1"
,
"CV_8UC4"
};
std
::
string
type_name
[]
=
{
"CV_8UC1"
,
"CV_8UC4"
};
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
gen
(
src
,
size
,
size
,
all_type
[
j
],
0
,
256
);
gen
(
src
,
size
,
size
,
all_type
[
j
],
0
,
256
);
...
@@ -4252,7 +4195,7 @@ TEST(dft)
...
@@ -4252,7 +4195,7 @@ TEST(dft)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
{
for
(
in
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
for
(
size_
t
j
=
0
;
j
<
sizeof
(
all_type
)
/
sizeof
(
int
);
j
++
)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
<<
" ; complex-to-complex"
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
<<
" ; complex-to-complex"
;
...
@@ -4346,9 +4289,9 @@ int main(int argc, const char *argv[])
...
@@ -4346,9 +4289,9 @@ int main(int argc, const char *argv[])
int
devidx
=
0
;
int
devidx
=
0
;
for
(
in
t
i
=
0
;
i
<
oclinfo
.
size
();
i
++
)
for
(
size_
t
i
=
0
;
i
<
oclinfo
.
size
();
i
++
)
{
{
for
(
in
t
j
=
0
;
j
<
oclinfo
[
i
].
DeviceName
.
size
();
j
++
)
for
(
size_
t
j
=
0
;
j
<
oclinfo
[
i
].
DeviceName
.
size
();
j
++
)
{
{
printf
(
"device %d: %s
\n
"
,
devidx
++
,
oclinfo
[
i
].
DeviceName
[
j
].
c_str
());
printf
(
"device %d: %s
\n
"
,
devidx
++
,
oclinfo
[
i
].
DeviceName
[
j
].
c_str
());
}
}
...
@@ -4365,8 +4308,8 @@ int main(int argc, const char *argv[])
...
@@ -4365,8 +4308,8 @@ int main(int argc, const char *argv[])
"{ d | device | 0 | device id }"
"{ d | device | 0 | device id }"
"{ i | iters | 10 | iteration count }"
"{ i | iters | 10 | iteration count }"
"{ m | warmup | 1 | gpu warm up iteration count}"
"{ m | warmup | 1 | gpu warm up iteration count}"
"{ t | xtop | 1.1
| xfactor top boundary}"
"{ t | xtop | 1.1
| xfactor top boundary}"
"{ b | xbottom | 0.9
| xfactor bottom boundary}"
"{ b | xbottom | 0.9
| xfactor bottom boundary}"
"{ v | verify | false | only run gpu once to verify if problems occur}"
;
"{ v | verify | false | only run gpu once to verify if problems occur}"
;
CommandLineParser
cmd
(
argc
,
argv
,
keys
);
CommandLineParser
cmd
(
argc
,
argv
,
keys
);
...
@@ -4396,9 +4339,9 @@ int main(int argc, const char *argv[])
...
@@ -4396,9 +4339,9 @@ int main(int argc, const char *argv[])
devidx
=
0
;
devidx
=
0
;
for
(
in
t
i
=
0
;
i
<
oclinfo
.
size
();
i
++
)
for
(
size_
t
i
=
0
;
i
<
oclinfo
.
size
();
i
++
)
{
{
for
(
in
t
j
=
0
;
j
<
oclinfo
[
i
].
DeviceName
.
size
();
j
++
,
devidx
++
)
for
(
size_
t
j
=
0
;
j
<
oclinfo
[
i
].
DeviceName
.
size
();
j
++
,
devidx
++
)
{
{
if
(
device
==
devidx
)
if
(
device
==
devidx
)
{
{
...
...
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