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
02ced7b4
Commit
02ced7b4
authored
Sep 25, 2010
by
Anatoly Baksheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring npp tests
parent
21e22962
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
123 additions
and
225 deletions
+123
-225
arithm.cpp
tests/gpu/src/arithm.cpp
+123
-225
No files found.
tests/gpu/src/arithm.cpp
View file @
02ced7b4
...
@@ -54,8 +54,8 @@ using namespace gpu;
...
@@ -54,8 +54,8 @@ using namespace gpu;
class
CV_GpuArithmTest
:
public
CvTest
class
CV_GpuArithmTest
:
public
CvTest
{
{
public
:
public
:
CV_GpuArithmTest
(
const
char
*
test_name
,
const
char
*
test_funcs
)
;
CV_GpuArithmTest
(
const
char
*
test_name
,
const
char
*
test_funcs
)
:
CvTest
(
test_name
,
test_funcs
)
{}
virtual
~
CV_GpuArithmTest
()
;
virtual
~
CV_GpuArithmTest
()
{}
protected
:
protected
:
void
run
(
int
);
void
run
(
int
);
...
@@ -69,12 +69,6 @@ protected:
...
@@ -69,12 +69,6 @@ protected:
int
CheckNorm
(
double
d1
,
double
d2
);
int
CheckNorm
(
double
d1
,
double
d2
);
};
};
CV_GpuArithmTest
::
CV_GpuArithmTest
(
const
char
*
test_name
,
const
char
*
test_funcs
)
:
CvTest
(
test_name
,
test_funcs
)
{
}
CV_GpuArithmTest
::~
CV_GpuArithmTest
()
{}
int
CV_GpuArithmTest
::
test
(
int
type
)
int
CV_GpuArithmTest
::
test
(
int
type
)
{
{
cv
::
Size
sz
(
200
,
200
);
cv
::
Size
sz
(
200
,
200
);
...
@@ -91,14 +85,10 @@ int CV_GpuArithmTest::CheckNorm(const Mat& m1, const Mat& m2)
...
@@ -91,14 +85,10 @@ int CV_GpuArithmTest::CheckNorm(const Mat& m1, const Mat& m2)
double
ret
=
norm
(
m1
,
m2
,
NORM_INF
);
double
ret
=
norm
(
m1
,
m2
,
NORM_INF
);
if
(
ret
<
std
::
numeric_limits
<
double
>::
epsilon
())
if
(
ret
<
std
::
numeric_limits
<
double
>::
epsilon
())
{
return
CvTS
::
OK
;
return
CvTS
::
OK
;
}
else
{
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Norm: %f
\n
"
,
ret
);
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Norm: %f
\n
"
,
ret
);
return
CvTS
::
FAIL_GENERIC
;
return
CvTS
::
FAIL_GENERIC
;
}
}
}
int
CV_GpuArithmTest
::
CheckNorm
(
const
Scalar
&
s1
,
const
Scalar
&
s2
)
int
CV_GpuArithmTest
::
CheckNorm
(
const
Scalar
&
s1
,
const
Scalar
&
s2
)
...
@@ -113,14 +103,10 @@ int CV_GpuArithmTest::CheckNorm(double d1, double d2)
...
@@ -113,14 +103,10 @@ int CV_GpuArithmTest::CheckNorm(double d1, double d2)
double
ret
=
::
fabs
(
d1
-
d2
);
double
ret
=
::
fabs
(
d1
-
d2
);
if
(
ret
<
std
::
numeric_limits
<
double
>::
epsilon
())
if
(
ret
<
std
::
numeric_limits
<
double
>::
epsilon
())
{
return
CvTS
::
OK
;
return
CvTS
::
OK
;
}
else
{
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Norm: %f
\n
"
,
ret
);
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Norm: %f
\n
"
,
ret
);
return
CvTS
::
FAIL_GENERIC
;
return
CvTS
::
FAIL_GENERIC
;
}
}
}
void
CV_GpuArithmTest
::
run
(
int
)
void
CV_GpuArithmTest
::
run
(
int
)
...
@@ -128,8 +114,28 @@ void CV_GpuArithmTest::run( int )
...
@@ -128,8 +114,28 @@ void CV_GpuArithmTest::run( int )
int
testResult
=
CvTS
::
OK
;
int
testResult
=
CvTS
::
OK
;
try
try
{
{
const
int
types
[]
=
{
CV_8UC1
,
CV_8UC3
,
CV_8UC4
,
CV_32FC1
};
const
char
*
type_names
[]
=
{
"CV_8UC1"
,
"CV_8UC3"
,
"CV_8UC4"
,
"CV_32FC1"
};
const
int
type_count
=
sizeof
(
types
)
/
sizeof
(
types
[
0
]);
//run tests
//run tests
ts
->
printf
(
CvTS
::
LOG
,
"
\n
========Start test 8UC1========
\n
"
);
for
(
int
t
=
0
;
t
<
type_count
;
++
t
)
{
ts
->
printf
(
CvTS
::
LOG
,
"========Start test %s========
\n
"
,
type_names
[
t
]);
if
(
CvTS
::
OK
==
test
(
types
[
t
]))
ts
->
printf
(
CvTS
::
LOG
,
"SUCCESS
\n
"
);
else
{
ts
->
printf
(
CvTS
::
LOG
,
"FAIL
\n
"
);
testResult
=
CvTS
::
FAIL_MISMATCH
;
}
}
///!!! author, please remove commented code if loop above is equivalent.
/*ts->printf(CvTS::LOG, "\n========Start test 8UC1========\n");
if (test(CV_8UC1) == CvTS::OK)
if (test(CV_8UC1) == CvTS::OK)
ts->printf(CvTS::LOG, "\nSUCCESS\n");
ts->printf(CvTS::LOG, "\nSUCCESS\n");
else
else
...
@@ -163,7 +169,7 @@ void CV_GpuArithmTest::run( int )
...
@@ -163,7 +169,7 @@ void CV_GpuArithmTest::run( int )
{
{
ts->printf(CvTS::LOG, "\nFAIL\n");
ts->printf(CvTS::LOG, "\nFAIL\n");
testResult = CvTS::FAIL_GENERIC;
testResult = CvTS::FAIL_GENERIC;
}
}
*/
}
}
catch
(
const
cv
::
Exception
&
e
)
catch
(
const
cv
::
Exception
&
e
)
{
{
...
@@ -177,21 +183,13 @@ void CV_GpuArithmTest::run( int )
...
@@ -177,21 +183,13 @@ void CV_GpuArithmTest::run( int )
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Add
// Add
class
CV_GpuNppImageAddTest
:
public
CV_GpuArithmTest
{
public
:
CV_GpuNppImageAddTest
();
protected
:
virtual
int
test
(
const
Mat
&
mat1
,
const
Mat
&
mat2
);
};
CV_GpuNppImageAddTest
::
CV_GpuNppImageAddTest
()
:
CV_GpuArithmTest
(
"GPU-NppImageAdd"
,
"add"
)
struct
CV_GpuNppImageAddTest
:
public
CV_GpuArithmTest
{
{
}
CV_GpuNppImageAddTest
()
:
CV_GpuArithmTest
(
"GPU-NppImageAdd"
,
"add"
)
{
}
int
CV_GpuNppImageAddTest
::
test
(
const
Mat
&
mat1
,
const
Mat
&
mat2
)
virtual
int
test
(
const
Mat
&
mat1
,
const
Mat
&
mat2
)
{
{
if
(
mat1
.
type
()
!=
CV_8UC1
&&
mat1
.
type
()
!=
CV_8UC4
&&
mat1
.
type
()
!=
CV_32FC1
)
if
(
mat1
.
type
()
!=
CV_8UC1
&&
mat1
.
type
()
!=
CV_8UC4
&&
mat1
.
type
()
!=
CV_32FC1
)
{
{
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Unsupported type
\n
"
);
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Unsupported type
\n
"
);
...
@@ -207,27 +205,17 @@ int CV_GpuNppImageAddTest::test( const Mat& mat1, const Mat& mat2 )
...
@@ -207,27 +205,17 @@ int CV_GpuNppImageAddTest::test( const Mat& mat1, const Mat& mat2 )
cv
::
gpu
::
add
(
gpu1
,
gpu2
,
gpuRes
);
cv
::
gpu
::
add
(
gpu1
,
gpu2
,
gpuRes
);
return
CheckNorm
(
cpuRes
,
gpuRes
);
return
CheckNorm
(
cpuRes
,
gpuRes
);
}
}
};
CV_GpuNppImageAddTest
CV_GpuNppImageAdd_test
;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Sub
// Sub
class
CV_GpuNppImageSubtractTest
:
public
CV_GpuArithmTest
struct
CV_GpuNppImageSubtractTest
:
public
CV_GpuArithmTest
{
{
public
:
CV_GpuNppImageSubtractTest
()
:
CV_GpuArithmTest
(
"GPU-NppImageSubtract"
,
"subtract"
)
{}
CV_GpuNppImageSubtractTest
();
protected
:
int
test
(
const
Mat
&
mat1
,
const
Mat
&
mat2
)
virtual
int
test
(
const
Mat
&
mat1
,
const
Mat
&
mat2
);
{
};
CV_GpuNppImageSubtractTest
::
CV_GpuNppImageSubtractTest
()
:
CV_GpuArithmTest
(
"GPU-NppImageSubtract"
,
"subtract"
)
{
}
int
CV_GpuNppImageSubtractTest
::
test
(
const
Mat
&
mat1
,
const
Mat
&
mat2
)
{
if
(
mat1
.
type
()
!=
CV_8UC1
&&
mat1
.
type
()
!=
CV_8UC4
&&
mat1
.
type
()
!=
CV_32FC1
)
if
(
mat1
.
type
()
!=
CV_8UC1
&&
mat1
.
type
()
!=
CV_8UC4
&&
mat1
.
type
()
!=
CV_32FC1
)
{
{
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Unsupported type
\n
"
);
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Unsupported type
\n
"
);
...
@@ -243,27 +231,17 @@ int CV_GpuNppImageSubtractTest::test( const Mat& mat1, const Mat& mat2 )
...
@@ -243,27 +231,17 @@ int CV_GpuNppImageSubtractTest::test( const Mat& mat1, const Mat& mat2 )
cv
::
gpu
::
subtract
(
gpu1
,
gpu2
,
gpuRes
);
cv
::
gpu
::
subtract
(
gpu1
,
gpu2
,
gpuRes
);
return
CheckNorm
(
cpuRes
,
gpuRes
);
return
CheckNorm
(
cpuRes
,
gpuRes
);
}
}
};
CV_GpuNppImageSubtractTest
CV_GpuNppImageSubtract_test
;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// multiply
// multiply
class
CV_GpuNppImageMultiplyTest
:
public
CV_GpuArithmTest
struct
CV_GpuNppImageMultiplyTest
:
public
CV_GpuArithmTest
{
public
:
CV_GpuNppImageMultiplyTest
();
protected
:
virtual
int
test
(
const
Mat
&
mat1
,
const
Mat
&
mat2
);
};
CV_GpuNppImageMultiplyTest
::
CV_GpuNppImageMultiplyTest
()
:
CV_GpuArithmTest
(
"GPU-NppImageMultiply"
,
"multiply"
)
{
{
}
CV_GpuNppImageMultiplyTest
()
:
CV_GpuArithmTest
(
"GPU-NppImageMultiply"
,
"multiply"
)
{
}
int
CV_GpuNppImageMultiplyTest
::
test
(
const
Mat
&
mat1
,
const
Mat
&
mat2
)
int
CV_GpuNppImageMultiplyTest
::
test
(
const
Mat
&
mat1
,
const
Mat
&
mat2
)
{
{
if
(
mat1
.
type
()
!=
CV_8UC1
&&
mat1
.
type
()
!=
CV_8UC4
&&
mat1
.
type
()
!=
CV_32FC1
)
if
(
mat1
.
type
()
!=
CV_8UC1
&&
mat1
.
type
()
!=
CV_8UC4
&&
mat1
.
type
()
!=
CV_32FC1
)
{
{
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Unsupported type
\n
"
);
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Unsupported type
\n
"
);
...
@@ -279,27 +257,17 @@ int CV_GpuNppImageMultiplyTest::test( const Mat& mat1, const Mat& mat2 )
...
@@ -279,27 +257,17 @@ int CV_GpuNppImageMultiplyTest::test( const Mat& mat1, const Mat& mat2 )
cv
::
gpu
::
multiply
(
gpu1
,
gpu2
,
gpuRes
);
cv
::
gpu
::
multiply
(
gpu1
,
gpu2
,
gpuRes
);
return
CheckNorm
(
cpuRes
,
gpuRes
);
return
CheckNorm
(
cpuRes
,
gpuRes
);
}
}
};
CV_GpuNppImageMultiplyTest
CV_GpuNppImageMultiply_test
;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// divide
// divide
class
CV_GpuNppImageDivideTest
:
public
CV_GpuArithmTest
struct
CV_GpuNppImageDivideTest
:
public
CV_GpuArithmTest
{
public
:
CV_GpuNppImageDivideTest
();
protected
:
virtual
int
test
(
const
Mat
&
mat1
,
const
Mat
&
mat2
);
};
CV_GpuNppImageDivideTest
::
CV_GpuNppImageDivideTest
()
:
CV_GpuArithmTest
(
"GPU-NppImageDivide"
,
"divide"
)
{
{
}
CV_GpuNppImageDivideTest
()
:
CV_GpuArithmTest
(
"GPU-NppImageDivide"
,
"divide"
)
{
}
int
CV_GpuNppImageDivideTest
::
test
(
const
Mat
&
mat1
,
const
Mat
&
mat2
)
int
CV_GpuNppImageDivideTest
::
test
(
const
Mat
&
mat1
,
const
Mat
&
mat2
)
{
{
if
(
mat1
.
type
()
!=
CV_8UC1
&&
mat1
.
type
()
!=
CV_8UC4
&&
mat1
.
type
()
!=
CV_32FC1
)
if
(
mat1
.
type
()
!=
CV_8UC1
&&
mat1
.
type
()
!=
CV_8UC4
&&
mat1
.
type
()
!=
CV_32FC1
)
{
{
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Unsupported type
\n
"
);
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Unsupported type
\n
"
);
...
@@ -315,27 +283,17 @@ int CV_GpuNppImageDivideTest::test( const Mat& mat1, const Mat& mat2 )
...
@@ -315,27 +283,17 @@ int CV_GpuNppImageDivideTest::test( const Mat& mat1, const Mat& mat2 )
cv
::
gpu
::
divide
(
gpu1
,
gpu2
,
gpuRes
);
cv
::
gpu
::
divide
(
gpu1
,
gpu2
,
gpuRes
);
return
CheckNorm
(
cpuRes
,
gpuRes
);
return
CheckNorm
(
cpuRes
,
gpuRes
);
}
}
};
CV_GpuNppImageDivideTest
CV_GpuNppImageDivide_test
;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// transpose
// transpose
class
CV_GpuNppImageTransposeTest
:
public
CV_GpuArithmTest
struct
CV_GpuNppImageTransposeTest
:
public
CV_GpuArithmTest
{
{
public
:
CV_GpuNppImageTransposeTest
()
:
CV_GpuArithmTest
(
"GPU-NppImageTranspose"
,
"transpose"
)
{}
CV_GpuNppImageTransposeTest
();
protected
:
int
CV_GpuNppImageTransposeTest
::
test
(
const
Mat
&
mat1
,
const
Mat
&
)
virtual
int
test
(
const
Mat
&
mat1
,
const
Mat
&
mat2
);
{
};
CV_GpuNppImageTransposeTest
::
CV_GpuNppImageTransposeTest
()
:
CV_GpuArithmTest
(
"GPU-NppImageTranspose"
,
"transpose"
)
{
}
int
CV_GpuNppImageTransposeTest
::
test
(
const
Mat
&
mat1
,
const
Mat
&
)
{
if
(
mat1
.
type
()
!=
CV_8UC1
)
if
(
mat1
.
type
()
!=
CV_8UC1
)
{
{
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Unsupported type
\n
"
);
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Unsupported type
\n
"
);
...
@@ -350,27 +308,17 @@ int CV_GpuNppImageTransposeTest::test( const Mat& mat1, const Mat& )
...
@@ -350,27 +308,17 @@ int CV_GpuNppImageTransposeTest::test( const Mat& mat1, const Mat& )
cv
::
gpu
::
transpose
(
gpu1
,
gpuRes
);
cv
::
gpu
::
transpose
(
gpu1
,
gpuRes
);
return
CheckNorm
(
cpuRes
,
gpuRes
);
return
CheckNorm
(
cpuRes
,
gpuRes
);
}
}
};
CV_GpuNppImageTransposeTest
CV_GpuNppImageTranspose_test
;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// absdiff
// absdiff
class
CV_GpuNppImageAbsdiffTest
:
public
CV_GpuArithmTest
struct
CV_GpuNppImageAbsdiffTest
:
public
CV_GpuArithmTest
{
{
public
:
CV_GpuNppImageAbsdiffTest
()
:
CV_GpuArithmTest
(
"GPU-NppImageAbsdiff"
,
"absdiff"
)
{}
CV_GpuNppImageAbsdiffTest
();
protected
:
int
CV_GpuNppImageAbsdiffTest
::
test
(
const
Mat
&
mat1
,
const
Mat
&
mat2
)
virtual
int
test
(
const
Mat
&
mat1
,
const
Mat
&
mat2
);
{
};
CV_GpuNppImageAbsdiffTest
::
CV_GpuNppImageAbsdiffTest
()
:
CV_GpuArithmTest
(
"GPU-NppImageAbsdiff"
,
"absdiff"
)
{
}
int
CV_GpuNppImageAbsdiffTest
::
test
(
const
Mat
&
mat1
,
const
Mat
&
mat2
)
{
if
(
mat1
.
type
()
!=
CV_8UC1
&&
mat1
.
type
()
!=
CV_32FC1
)
if
(
mat1
.
type
()
!=
CV_8UC1
&&
mat1
.
type
()
!=
CV_32FC1
)
{
{
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Unsupported type
\n
"
);
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Unsupported type
\n
"
);
...
@@ -386,27 +334,17 @@ int CV_GpuNppImageAbsdiffTest::test( const Mat& mat1, const Mat& mat2 )
...
@@ -386,27 +334,17 @@ int CV_GpuNppImageAbsdiffTest::test( const Mat& mat1, const Mat& mat2 )
cv
::
gpu
::
absdiff
(
gpu1
,
gpu2
,
gpuRes
);
cv
::
gpu
::
absdiff
(
gpu1
,
gpu2
,
gpuRes
);
return
CheckNorm
(
cpuRes
,
gpuRes
);
return
CheckNorm
(
cpuRes
,
gpuRes
);
}
}
};
CV_GpuNppImageAbsdiffTest
CV_GpuNppImageAbsdiff_test
;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// compare
// compare
class
CV_GpuNppImageCompareTest
:
public
CV_GpuArithmTest
struct
CV_GpuNppImageCompareTest
:
public
CV_GpuArithmTest
{
{
public
:
CV_GpuNppImageCompareTest
()
:
CV_GpuArithmTest
(
"GPU-NppImageCompare"
,
"compare"
)
{}
CV_GpuNppImageCompareTest
();
protected
:
virtual
int
test
(
const
Mat
&
mat1
,
const
Mat
&
mat2
);
};
CV_GpuNppImageCompareTest
::
CV_GpuNppImageCompareTest
()
:
CV_GpuArithmTest
(
"GPU-NppImageCompare"
,
"compare"
)
{
}
int
CV_GpuNppImageCompareTest
::
test
(
const
Mat
&
mat1
,
const
Mat
&
mat2
)
int
CV_GpuNppImageCompareTest
::
test
(
const
Mat
&
mat1
,
const
Mat
&
mat2
)
{
{
if
(
mat1
.
type
()
!=
CV_32FC1
)
if
(
mat1
.
type
()
!=
CV_32FC1
)
{
{
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Unsupported type
\n
"
);
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Unsupported type
\n
"
);
...
@@ -436,27 +374,17 @@ int CV_GpuNppImageCompareTest::test( const Mat& mat1, const Mat& mat2 )
...
@@ -436,27 +374,17 @@ int CV_GpuNppImageCompareTest::test( const Mat& mat1, const Mat& mat2 )
}
}
return
test_res
;
return
test_res
;
}
}
};
CV_GpuNppImageCompareTest
CV_GpuNppImageCompare_test
;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// meanStdDev
// meanStdDev
class
CV_GpuNppImageMeanStdDevTest
:
public
CV_GpuArithmTest
struct
CV_GpuNppImageMeanStdDevTest
:
public
CV_GpuArithmTest
{
{
public
:
CV_GpuNppImageMeanStdDevTest
()
:
CV_GpuArithmTest
(
"GPU-NppImageMeanStdDev"
,
"meanStdDev"
)
{}
CV_GpuNppImageMeanStdDevTest
();
protected
:
virtual
int
test
(
const
Mat
&
mat1
,
const
Mat
&
mat2
);
};
CV_GpuNppImageMeanStdDevTest
::
CV_GpuNppImageMeanStdDevTest
()
:
CV_GpuArithmTest
(
"GPU-NppImageMeanStdDev"
,
"meanStdDev"
)
{
}
int
CV_GpuNppImageMeanStdDevTest
::
test
(
const
Mat
&
mat1
,
const
Mat
&
)
int
CV_GpuNppImageMeanStdDevTest
::
test
(
const
Mat
&
mat1
,
const
Mat
&
)
{
{
if
(
mat1
.
type
()
!=
CV_8UC1
)
if
(
mat1
.
type
()
!=
CV_8UC1
)
{
{
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Unsupported type
\n
"
);
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Unsupported type
\n
"
);
...
@@ -487,27 +415,17 @@ int CV_GpuNppImageMeanStdDevTest::test( const Mat& mat1, const Mat& )
...
@@ -487,27 +415,17 @@ int CV_GpuNppImageMeanStdDevTest::test( const Mat& mat1, const Mat& )
}
}
return
test_res
;
return
test_res
;
}
}
};
CV_GpuNppImageMeanStdDevTest
CV_GpuNppImageMeanStdDev_test
;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// norm
// norm
class
CV_GpuNppImageNormTest
:
public
CV_GpuArithmTest
struct
CV_GpuNppImageNormTest
:
public
CV_GpuArithmTest
{
{
public
:
CV_GpuNppImageNormTest
()
:
CV_GpuArithmTest
(
"GPU-NppImageNorm"
,
"norm"
)
{}
CV_GpuNppImageNormTest
();
protected
:
virtual
int
test
(
const
Mat
&
mat1
,
const
Mat
&
mat2
);
};
CV_GpuNppImageNormTest
::
CV_GpuNppImageNormTest
()
:
CV_GpuArithmTest
(
"GPU-NppImageNorm"
,
"norm"
)
{
}
int
CV_GpuNppImageNormTest
::
test
(
const
Mat
&
mat1
,
const
Mat
&
mat2
)
int
CV_GpuNppImageNormTest
::
test
(
const
Mat
&
mat1
,
const
Mat
&
mat2
)
{
{
if
(
mat1
.
type
()
!=
CV_8UC1
)
if
(
mat1
.
type
()
!=
CV_8UC1
)
{
{
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Unsupported type
\n
"
);
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Unsupported type
\n
"
);
...
@@ -535,27 +453,17 @@ int CV_GpuNppImageNormTest::test( const Mat& mat1, const Mat& mat2 )
...
@@ -535,27 +453,17 @@ int CV_GpuNppImageNormTest::test( const Mat& mat1, const Mat& mat2 )
}
}
return
test_res
;
return
test_res
;
}
}
};
CV_GpuNppImageNormTest
CV_GpuNppImageNorm_test
;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// flip
// flip
class
CV_GpuNppImageFlipTest
:
public
CV_GpuArithmTest
struct
CV_GpuNppImageFlipTest
:
public
CV_GpuArithmTest
{
{
public
:
CV_GpuNppImageFlipTest
()
:
CV_GpuArithmTest
(
"GPU-NppImageFlip"
,
"flip"
)
{}
CV_GpuNppImageFlipTest
();
protected
:
virtual
int
test
(
const
Mat
&
mat1
,
const
Mat
&
mat2
);
};
CV_GpuNppImageFlipTest
::
CV_GpuNppImageFlipTest
()
:
CV_GpuArithmTest
(
"GPU-NppImageFlip"
,
"flip"
)
{
}
int
CV_GpuNppImageFlipTest
::
test
(
const
Mat
&
mat1
,
const
Mat
&
)
int
CV_GpuNppImageFlipTest
::
test
(
const
Mat
&
mat1
,
const
Mat
&
)
{
{
if
(
mat1
.
type
()
!=
CV_8UC1
&&
mat1
.
type
()
!=
CV_8UC4
)
if
(
mat1
.
type
()
!=
CV_8UC1
&&
mat1
.
type
()
!=
CV_8UC4
)
{
{
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Unsupported type
\n
"
);
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Unsupported type
\n
"
);
...
@@ -584,27 +492,17 @@ int CV_GpuNppImageFlipTest::test( const Mat& mat1, const Mat& )
...
@@ -584,27 +492,17 @@ int CV_GpuNppImageFlipTest::test( const Mat& mat1, const Mat& )
}
}
return
test_res
;
return
test_res
;
}
}
};
CV_GpuNppImageFlipTest
CV_GpuNppImageFlip_test
;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// sum
// sum
class
CV_GpuNppImageSumTest
:
public
CV_GpuArithmTest
struct
CV_GpuNppImageSumTest
:
public
CV_GpuArithmTest
{
public
:
CV_GpuNppImageSumTest
();
protected
:
virtual
int
test
(
const
Mat
&
mat1
,
const
Mat
&
mat2
);
};
CV_GpuNppImageSumTest
::
CV_GpuNppImageSumTest
()
:
CV_GpuArithmTest
(
"GPU-NppImageSum"
,
"sum"
)
{
{
}
CV_GpuNppImageSumTest
()
:
CV_GpuArithmTest
(
"GPU-NppImageSum"
,
"sum"
)
{
}
int
CV_GpuNppImageSumTest
::
test
(
const
Mat
&
mat1
,
const
Mat
&
)
int
CV_GpuNppImageSumTest
::
test
(
const
Mat
&
mat1
,
const
Mat
&
)
{
{
if
(
mat1
.
type
()
!=
CV_8UC1
&&
mat1
.
type
()
!=
CV_8UC4
)
if
(
mat1
.
type
()
!=
CV_8UC1
&&
mat1
.
type
()
!=
CV_8UC4
)
{
{
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Unsupported type
\n
"
);
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Unsupported type
\n
"
);
...
@@ -617,27 +515,17 @@ int CV_GpuNppImageSumTest::test( const Mat& mat1, const Mat& )
...
@@ -617,27 +515,17 @@ int CV_GpuNppImageSumTest::test( const Mat& mat1, const Mat& )
Scalar
gpures
=
cv
::
gpu
::
sum
(
gpu1
);
Scalar
gpures
=
cv
::
gpu
::
sum
(
gpu1
);
return
CheckNorm
(
cpures
,
gpures
);
return
CheckNorm
(
cpures
,
gpures
);
}
}
};
CV_GpuNppImageSumTest
CV_GpuNppImageSum_test
;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// minNax
// minNax
class
CV_GpuNppImageMinNaxTest
:
public
CV_GpuArithmTest
struct
CV_GpuNppImageMinNaxTest
:
public
CV_GpuArithmTest
{
{
public
:
CV_GpuNppImageMinNaxTest
()
:
CV_GpuArithmTest
(
"GPU-NppImageMinNax"
,
"minNax"
)
{}
CV_GpuNppImageMinNaxTest
();
protected
:
virtual
int
test
(
const
Mat
&
mat1
,
const
Mat
&
mat2
);
};
CV_GpuNppImageMinNaxTest
::
CV_GpuNppImageMinNaxTest
()
:
CV_GpuArithmTest
(
"GPU-NppImageMinNax"
,
"minNax"
)
{
}
int
CV_GpuNppImageMinNaxTest
::
test
(
const
Mat
&
mat1
,
const
Mat
&
)
int
CV_GpuNppImageMinNaxTest
::
test
(
const
Mat
&
mat1
,
const
Mat
&
)
{
{
if
(
mat1
.
type
()
!=
CV_8UC1
)
if
(
mat1
.
type
()
!=
CV_8UC1
)
{
{
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Unsupported type
\n
"
);
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Unsupported type
\n
"
);
...
@@ -652,27 +540,17 @@ int CV_GpuNppImageMinNaxTest::test( const Mat& mat1, const Mat& )
...
@@ -652,27 +540,17 @@ int CV_GpuNppImageMinNaxTest::test( const Mat& mat1, const Mat& )
cv
::
gpu
::
minMax
(
gpu1
,
&
gpumin
,
&
gpumax
);
cv
::
gpu
::
minMax
(
gpu1
,
&
gpumin
,
&
gpumax
);
return
(
CheckNorm
(
cpumin
,
gpumin
)
==
CvTS
::
OK
&&
CheckNorm
(
cpumax
,
gpumax
)
==
CvTS
::
OK
)
?
CvTS
::
OK
:
CvTS
::
FAIL_GENERIC
;
return
(
CheckNorm
(
cpumin
,
gpumin
)
==
CvTS
::
OK
&&
CheckNorm
(
cpumax
,
gpumax
)
==
CvTS
::
OK
)
?
CvTS
::
OK
:
CvTS
::
FAIL_GENERIC
;
}
}
};
CV_GpuNppImageMinNaxTest
CV_GpuNppImageMinNax_test
;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// LUT
// LUT
class
CV_GpuNppImageLUTTest
:
public
CV_GpuArithmTest
struct
CV_GpuNppImageLUTTest
:
public
CV_GpuArithmTest
{
public
:
CV_GpuNppImageLUTTest
();
protected
:
virtual
int
test
(
const
Mat
&
mat1
,
const
Mat
&
mat2
);
};
CV_GpuNppImageLUTTest
::
CV_GpuNppImageLUTTest
()
:
CV_GpuArithmTest
(
"GPU-NppImageLUT"
,
"LUT"
)
{
{
}
CV_GpuNppImageLUTTest
()
:
CV_GpuArithmTest
(
"GPU-NppImageLUT"
,
"LUT"
)
{
}
int
CV_GpuNppImageLUTTest
::
test
(
const
Mat
&
mat1
,
const
Mat
&
)
int
CV_GpuNppImageLUTTest
::
test
(
const
Mat
&
mat1
,
const
Mat
&
)
{
{
if
(
mat1
.
type
()
!=
CV_8UC1
)
if
(
mat1
.
type
()
!=
CV_8UC1
)
{
{
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Unsupported type
\n
"
);
ts
->
printf
(
CvTS
::
LOG
,
"
\n
Unsupported type
\n
"
);
...
@@ -691,6 +569,25 @@ int CV_GpuNppImageLUTTest::test( const Mat& mat1, const Mat& )
...
@@ -691,6 +569,25 @@ int CV_GpuNppImageLUTTest::test( const Mat& mat1, const Mat& )
cv
::
gpu
::
LUT
(
GpuMat
(
mat1
),
lut
,
gpuRes
);
cv
::
gpu
::
LUT
(
GpuMat
(
mat1
),
lut
,
gpuRes
);
return
CheckNorm
(
cpuRes
,
gpuRes
);
return
CheckNorm
(
cpuRes
,
gpuRes
);
}
}
};
// If we comment some tests, we may foget/miss to uncomment it after.
// Placing all test definitions in one place
// makes us know about what tests are commented.
CV_GpuNppImageAddTest
CV_GpuNppImageAdd_test
;
CV_GpuNppImageSubtractTest
CV_GpuNppImageSubtract_test
;
CV_GpuNppImageMultiplyTest
CV_GpuNppImageMultiply_test
;
CV_GpuNppImageDivideTest
CV_GpuNppImageDivide_test
;
CV_GpuNppImageTransposeTest
CV_GpuNppImageTranspose_test
;
CV_GpuNppImageAbsdiffTest
CV_GpuNppImageAbsdiff_test
;
CV_GpuNppImageCompareTest
CV_GpuNppImageCompare_test
;
CV_GpuNppImageMeanStdDevTest
CV_GpuNppImageMeanStdDev_test
;
CV_GpuNppImageNormTest
CV_GpuNppImageNorm_test
;
CV_GpuNppImageFlipTest
CV_GpuNppImageFlip_test
;
//CV_GpuNppImageSumTest CV_GpuNppImageSum_test;
CV_GpuNppImageMinNaxTest
CV_GpuNppImageMinNax_test
;
CV_GpuNppImageLUTTest
CV_GpuNppImageLUT_test
;
CV_GpuNppImageLUTTest
CV_GpuNppImageLUT_test
;
\ No newline at end of file
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