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
bdfd4c30
Commit
bdfd4c30
authored
Dec 22, 2011
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored Tegra related macro usage
parent
48ea65e6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
74 deletions
+92
-74
matrix.cpp
modules/core/src/matrix.cpp
+87
-69
stat.cpp
modules/core/src/stat.cpp
+5
-5
No files found.
modules/core/src/matrix.cpp
View file @
bdfd4c30
...
...
@@ -1943,6 +1943,52 @@ typedef void (*ReduceFunc)( const Mat& src, Mat& dst );
}
#define reduceSumR8u32s reduceR_<uchar, int, OpAdd<int> >
#define reduceSumR8u32f reduceR_<uchar, float, OpAdd<int> >
#define reduceSumR8u64f reduceR_<uchar, double,OpAdd<int> >
#define reduceSumR16u32f reduceR_<ushort,float, OpAdd<float> >
#define reduceSumR16u64f reduceR_<ushort,double,OpAdd<double> >
#define reduceSumR16s32f reduceR_<short, float, OpAdd<float> >
#define reduceSumR16s64f reduceR_<short, double,OpAdd<double> >
#define reduceSumR32f32f reduceR_<float, float, OpAdd<float> >
#define reduceSumR32f64f reduceR_<float, double,OpAdd<double> >
#define reduceSumR64f64f reduceR_<double,double,OpAdd<double> >
#define reduceMaxR8u reduceR_<uchar, uchar, OpMax<uchar> >
#define reduceMaxR16u reduceR_<ushort,ushort,OpMax<ushort> >
#define reduceMaxR16s reduceR_<short, short, OpMax<short> >
#define reduceMaxR32f reduceR_<float, float, OpMax<float> >
#define reduceMaxR64f reduceR_<double,double,OpMax<double> >
#define reduceMinR8u reduceR_<uchar, uchar, OpMin<uchar> >
#define reduceMinR16u reduceR_<ushort,ushort,OpMin<ushort> >
#define reduceMinR16s reduceR_<short, short, OpMin<short> >
#define reduceMinR32f reduceR_<float, float, OpMin<float> >
#define reduceMinR64f reduceR_<double,double,OpMin<double> >
#define reduceSumC8u32s reduceC_<uchar, int, OpAdd<int> >
#define reduceSumC8u32f reduceC_<uchar, float, OpAdd<int> >
#define reduceSumC8u64f reduceC_<uchar, double,OpAdd<int> >
#define reduceSumC16u32f reduceC_<ushort,float, OpAdd<float> >
#define reduceSumC16u64f reduceC_<ushort,double,OpAdd<double> >
#define reduceSumC16s32f reduceC_<short, float, OpAdd<float> >
#define reduceSumC16s64f reduceC_<short, double,OpAdd<double> >
#define reduceSumC32f32f reduceC_<float, float, OpAdd<float> >
#define reduceSumC32f64f reduceC_<float, double,OpAdd<double> >
#define reduceSumC64f64f reduceC_<double,double,OpAdd<double> >
#define reduceMaxC8u reduceC_<uchar, uchar, OpMax<uchar> >
#define reduceMaxC16u reduceC_<ushort,ushort,OpMax<ushort> >
#define reduceMaxC16s reduceC_<short, short, OpMax<short> >
#define reduceMaxC32f reduceC_<float, float, OpMax<float> >
#define reduceMaxC64f reduceC_<double,double,OpMax<double> >
#define reduceMinC8u reduceC_<uchar, uchar, OpMin<uchar> >
#define reduceMinC16u reduceC_<ushort,ushort,OpMin<ushort> >
#define reduceMinC16s reduceC_<short, short, OpMin<short> >
#define reduceMinC32f reduceC_<float, float, OpMin<float> >
#define reduceMinC64f reduceC_<double,double,OpMin<double> >
void
cv
::
reduce
(
InputArray
_src
,
OutputArray
_dst
,
int
dim
,
int
op
,
int
dtype
)
{
Mat
src
=
_src
.
getMat
();
...
...
@@ -1977,75 +2023,51 @@ void cv::reduce(InputArray _src, OutputArray _dst, int dim, int op, int dtype)
if
(
op
==
CV_REDUCE_SUM
)
{
if
(
sdepth
==
CV_8U
&&
ddepth
==
CV_32S
)
#ifdef HAVE_TEGRA_OPTIMIZATION
func
=
tegra
::
getTegraOptimized_reduceR8uAdd
(
tegra
::
reduceR8uAdd
);
#else
func
=
reduceR_
<
uchar
,
int
,
OpAdd
<
int
>
>
;
#endif
func
=
GET_OPTIMIZED
(
reduceSumR8u32s
);
else
if
(
sdepth
==
CV_8U
&&
ddepth
==
CV_32F
)
func
=
reduce
R_
<
uchar
,
float
,
OpAdd
<
int
>
>
;
func
=
reduce
SumR8u32f
;
else
if
(
sdepth
==
CV_8U
&&
ddepth
==
CV_64F
)
func
=
reduce
R_
<
uchar
,
double
,
OpAdd
<
int
>
>
;
func
=
reduce
SumR8u64f
;
else
if
(
sdepth
==
CV_16U
&&
ddepth
==
CV_32F
)
func
=
reduce
R_
<
ushort
,
float
,
OpAdd
<
float
>
>
;
func
=
reduce
SumR16u32f
;
else
if
(
sdepth
==
CV_16U
&&
ddepth
==
CV_64F
)
func
=
reduce
R_
<
ushort
,
double
,
OpAdd
<
double
>
>
;
func
=
reduce
SumR16u64f
;
else
if
(
sdepth
==
CV_16S
&&
ddepth
==
CV_32F
)
func
=
reduce
R_
<
short
,
float
,
OpAdd
<
float
>
>
;
func
=
reduce
SumR16s32f
;
else
if
(
sdepth
==
CV_16S
&&
ddepth
==
CV_64F
)
func
=
reduce
R_
<
short
,
double
,
OpAdd
<
double
>
>
;
func
=
reduce
SumR16s64f
;
else
if
(
sdepth
==
CV_32F
&&
ddepth
==
CV_32F
)
#ifdef HAVE_TEGRA_OPTIMIZATION
func
=
tegra
::
getTegraOptimized_reduceR32fAdd
(
tegra
::
reduceR32fAdd
);
#else
func
=
reduceR_
<
float
,
float
,
OpAdd
<
float
>
>
;
#endif
func
=
GET_OPTIMIZED
(
reduceSumR32f32f
);
else
if
(
sdepth
==
CV_32F
&&
ddepth
==
CV_64F
)
func
=
reduce
R_
<
float
,
double
,
OpAdd
<
double
>
>
;
func
=
reduce
SumR32f64f
;
else
if
(
sdepth
==
CV_64F
&&
ddepth
==
CV_64F
)
func
=
reduce
R_
<
double
,
double
,
OpAdd
<
double
>
>
;
func
=
reduce
SumR64f64f
;
}
else
if
(
op
==
CV_REDUCE_MAX
)
{
if
(
sdepth
==
CV_8U
&&
ddepth
==
CV_8U
)
#ifdef HAVE_TEGRA_OPTIMIZATION
func
=
tegra
::
getTegraOptimized_reduceR8uMax
(
tegra
::
reduceR8uMax
);
#else
func
=
reduceR_
<
uchar
,
uchar
,
OpMax
<
uchar
>
>
;
#endif
func
=
GET_OPTIMIZED
(
reduceMaxR8u
);
else
if
(
sdepth
==
CV_16U
&&
ddepth
==
CV_16U
)
func
=
reduce
R_
<
ushort
,
ushort
,
OpMax
<
ushort
>
>
;
func
=
reduce
MaxR16u
;
else
if
(
sdepth
==
CV_16S
&&
ddepth
==
CV_16S
)
func
=
reduce
R_
<
short
,
short
,
OpMax
<
short
>
>
;
func
=
reduce
MaxR16s
;
else
if
(
sdepth
==
CV_32F
&&
ddepth
==
CV_32F
)
#ifdef HAVE_TEGRA_OPTIMIZATION
func
=
tegra
::
getTegraOptimized_reduceR32fMax
(
tegra
::
reduceR32fMax
);
#else
func
=
reduceR_
<
float
,
float
,
OpMax
<
float
>
>
;
#endif
func
=
GET_OPTIMIZED
(
reduceMaxR32f
);
else
if
(
sdepth
==
CV_64F
&&
ddepth
==
CV_64F
)
func
=
reduce
R_
<
double
,
double
,
OpMax
<
double
>
>
;
func
=
reduce
MaxR64f
;
}
else
if
(
op
==
CV_REDUCE_MIN
)
{
if
(
sdepth
==
CV_8U
&&
ddepth
==
CV_8U
)
#ifdef HAVE_TEGRA_OPTIMIZATION
func
=
tegra
::
getTegraOptimized_reduceR8uMin
(
tegra
::
reduceR8uMin
);
#else
func
=
reduceR_
<
uchar
,
uchar
,
OpMin
<
uchar
>
>
;
#endif
func
=
GET_OPTIMIZED
(
reduceMinR8u
);
else
if
(
sdepth
==
CV_16U
&&
ddepth
==
CV_16U
)
func
=
reduce
R_
<
ushort
,
ushort
,
OpMin
<
ushort
>
>
;
func
=
reduce
MinR16u
;
else
if
(
sdepth
==
CV_16S
&&
ddepth
==
CV_16S
)
func
=
reduce
R_
<
short
,
short
,
OpMin
<
short
>
>
;
func
=
reduce
MinR16s
;
else
if
(
sdepth
==
CV_32F
&&
ddepth
==
CV_32F
)
#ifdef HAVE_TEGRA_OPTIMIZATION
func
=
tegra
::
getTegraOptimized_reduceR32fMin
(
tegra
::
reduceR32fMin
);
#else
func
=
reduceR_
<
float
,
float
,
OpMin
<
float
>
>
;
#endif
func
=
GET_OPTIMIZED
(
reduceMinR32f
);
else
if
(
sdepth
==
CV_64F
&&
ddepth
==
CV_64F
)
func
=
reduce
R_
<
double
,
double
,
OpMin
<
double
>
>
;
func
=
reduce
MinR64f
;
}
}
else
...
...
@@ -2053,55 +2075,51 @@ void cv::reduce(InputArray _src, OutputArray _dst, int dim, int op, int dtype)
if
(
op
==
CV_REDUCE_SUM
)
{
if
(
sdepth
==
CV_8U
&&
ddepth
==
CV_32S
)
#ifdef HAVE_TEGRA_OPTIMIZATION
func
=
tegra
::
getTegraOptimized_reduceC8uAdd
(
tegra
::
reduceC8uAdd
);
#else
func
=
reduceC_
<
uchar
,
int
,
OpAdd
<
int
>
>
;
#endif
func
=
GET_OPTIMIZED
(
reduceSumC8u32s
);
else
if
(
sdepth
==
CV_8U
&&
ddepth
==
CV_32F
)
func
=
reduce
C_
<
uchar
,
float
,
OpAdd
<
int
>
>
;
func
=
reduce
SumC8u32f
;
else
if
(
sdepth
==
CV_8U
&&
ddepth
==
CV_64F
)
func
=
reduce
C_
<
uchar
,
double
,
OpAdd
<
int
>
>
;
func
=
reduce
SumC8u64f
;
else
if
(
sdepth
==
CV_16U
&&
ddepth
==
CV_32F
)
func
=
reduce
C_
<
ushort
,
float
,
OpAdd
<
float
>
>
;
func
=
reduce
SumC16u32f
;
else
if
(
sdepth
==
CV_16U
&&
ddepth
==
CV_64F
)
func
=
reduce
C_
<
ushort
,
double
,
OpAdd
<
double
>
>
;
func
=
reduce
SumC16u64f
;
else
if
(
sdepth
==
CV_16S
&&
ddepth
==
CV_32F
)
func
=
reduce
C_
<
short
,
float
,
OpAdd
<
float
>
>
;
func
=
reduce
SumC16s32f
;
else
if
(
sdepth
==
CV_16S
&&
ddepth
==
CV_64F
)
func
=
reduce
C_
<
short
,
double
,
OpAdd
<
double
>
>
;
func
=
reduce
SumC16s64f
;
else
if
(
sdepth
==
CV_32F
&&
ddepth
==
CV_32F
)
func
=
reduceC_
<
float
,
float
,
OpAdd
<
float
>
>
;
func
=
GET_OPTIMIZED
(
reduceSumC32f32f
)
;
else
if
(
sdepth
==
CV_32F
&&
ddepth
==
CV_64F
)
func
=
reduce
C_
<
float
,
double
,
OpAdd
<
double
>
>
;
func
=
reduce
SumC32f64f
;
else
if
(
sdepth
==
CV_64F
&&
ddepth
==
CV_64F
)
func
=
reduce
C_
<
double
,
double
,
OpAdd
<
double
>
>
;
func
=
reduce
SumC64f64f
;
}
else
if
(
op
==
CV_REDUCE_MAX
)
{
if
(
sdepth
==
CV_8U
&&
ddepth
==
CV_8U
)
func
=
reduceC_
<
uchar
,
uchar
,
OpMax
<
uchar
>
>
;
func
=
GET_OPTIMIZED
(
reduceMaxC8u
)
;
else
if
(
sdepth
==
CV_16U
&&
ddepth
==
CV_16U
)
func
=
reduce
C_
<
ushort
,
ushort
,
OpMax
<
ushort
>
>
;
func
=
reduce
MaxC16u
;
else
if
(
sdepth
==
CV_16S
&&
ddepth
==
CV_16S
)
func
=
reduce
C_
<
short
,
short
,
OpMax
<
short
>
>
;
func
=
reduce
MaxC16s
;
else
if
(
sdepth
==
CV_32F
&&
ddepth
==
CV_32F
)
func
=
reduceC_
<
float
,
float
,
OpMax
<
float
>
>
;
func
=
GET_OPTIMIZED
(
reduceMaxC32f
)
;
else
if
(
sdepth
==
CV_64F
&&
ddepth
==
CV_64F
)
func
=
reduce
C_
<
double
,
double
,
OpMax
<
double
>
>
;
func
=
reduce
MaxC64f
;
}
else
if
(
op
==
CV_REDUCE_MIN
)
{
if
(
sdepth
==
CV_8U
&&
ddepth
==
CV_8U
)
func
=
reduceC_
<
uchar
,
uchar
,
OpMin
<
uchar
>
>
;
func
=
GET_OPTIMIZED
(
reduceMinC8u
)
;
else
if
(
sdepth
==
CV_16U
&&
ddepth
==
CV_16U
)
func
=
reduce
C_
<
ushort
,
ushort
,
OpMin
<
ushort
>
>
;
func
=
reduce
MinC16u
;
else
if
(
sdepth
==
CV_16S
&&
ddepth
==
CV_16S
)
func
=
reduce
C_
<
short
,
short
,
OpMin
<
short
>
>
;
func
=
reduce
MinC16s
;
else
if
(
sdepth
==
CV_32F
&&
ddepth
==
CV_32F
)
func
=
reduceC_
<
float
,
float
,
OpMin
<
float
>
>
;
func
=
GET_OPTIMIZED
(
reduceMinC32f
)
;
else
if
(
sdepth
==
CV_64F
&&
ddepth
==
CV_64F
)
func
=
reduce
C_
<
double
,
double
,
OpMin
<
double
>
>
;
func
=
reduce
MinC64f
;
}
}
...
...
@@ -2113,7 +2131,7 @@ void cv::reduce(InputArray _src, OutputArray _dst, int dim, int op, int dtype)
if
(
op0
==
CV_REDUCE_AVG
)
temp
.
convertTo
(
dst
,
dst
.
type
(),
1.
/
(
dim
==
0
?
src
.
rows
:
src
.
cols
));
}
}
//////////////////////////////////////// sort ///////////////////////////////////////////
...
...
modules/core/src/stat.cpp
View file @
bdfd4c30
...
...
@@ -1140,16 +1140,16 @@ normDiffL2_(const T* src1, const T* src2, const uchar* mask, ST* _result, int le
#define CV_DEF_NORM_FUNC(L, suffix, type, ntype) \
static int norm##L##_##suffix(const type* src, const uchar* mask, ntype* r, int len, int cn) \
static int norm##L##_##suffix(const type* src, const uchar* mask, ntype* r, int len, int cn) \
{ return norm##L##_(src, mask, r, len, cn); } \
static int normDiff##L##_##suffix(const type* src1, const type* src2, \
static int normDiff##L##_##suffix(const type* src1, const type* src2, \
const uchar* mask, ntype* r, int len, int cn) \
{ return normDiff##L##_(src1, src2, mask, r, (int)len, cn); }
#define CV_DEF_NORM_ALL(suffix, type, inftype, l1type, l2type) \
CV_DEF_NORM_FUNC(Inf, suffix, type, inftype) \
CV_DEF_NORM_FUNC(L1, suffix, type, l1type) \
CV_DEF_NORM_FUNC(L2, suffix, type, l2type)
CV_DEF_NORM_FUNC(Inf, suffix, type, inftype) \
CV_DEF_NORM_FUNC(L1, suffix, type, l1type) \
CV_DEF_NORM_FUNC(L2, suffix, type, l2type)
CV_DEF_NORM_ALL
(
8u
,
uchar
,
int
,
int
,
int
)
CV_DEF_NORM_ALL
(
8
s
,
schar
,
int
,
int
,
int
)
...
...
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