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
58e47275
Commit
58e47275
authored
Jun 03, 2013
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed norm diff function (it uses pre-allocated buffer now)
parent
0521e890
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
4 deletions
+23
-4
matrix_reductions.cpp
modules/gpu/src/matrix_reductions.cpp
+23
-4
No files found.
modules/gpu/src/matrix_reductions.cpp
View file @
58e47275
...
...
@@ -187,10 +187,20 @@ double cv::gpu::norm(const GpuMat& src1, const GpuMat& src2, int normType)
CV_Assert
(
src1
.
size
()
==
src2
.
size
()
&&
src1
.
type
()
==
src2
.
type
());
CV_Assert
(
normType
==
NORM_INF
||
normType
==
NORM_L1
||
normType
==
NORM_L2
);
typedef
NppStatus
(
*
npp_norm_diff_func_t
)(
const
Npp8u
*
pSrc1
,
int
nSrcStep1
,
const
Npp8u
*
pSrc2
,
int
nSrcStep2
,
NppiSize
oSizeROI
,
Npp64f
*
pRetVal
);
#if CUDA_VERSION < 5050
typedef
NppStatus
(
*
func_t
)(
const
Npp8u
*
pSrc1
,
int
nSrcStep1
,
const
Npp8u
*
pSrc2
,
int
nSrcStep2
,
NppiSize
oSizeROI
,
Npp64f
*
pRetVal
);
static
const
npp_norm_diff_func_t
npp_norm_diff_func
[]
=
{
nppiNormDiff_Inf_8u_C1R
,
nppiNormDiff_L1_8u_C1R
,
nppiNormDiff_L2_8u_C1R
};
static
const
func_t
funcs
[]
=
{
nppiNormDiff_Inf_8u_C1R
,
nppiNormDiff_L1_8u_C1R
,
nppiNormDiff_L2_8u_C1R
};
#else
typedef
NppStatus
(
*
func_t
)(
const
Npp8u
*
pSrc1
,
int
nSrcStep1
,
const
Npp8u
*
pSrc2
,
int
nSrcStep2
,
NppiSize
oSizeROI
,
Npp64f
*
pRetVal
,
Npp8u
*
pDeviceBuffer
);
typedef
NppStatus
(
*
buf_size_func_t
)(
NppiSize
oSizeROI
,
int
*
hpBufferSize
);
static
const
func_t
funcs
[]
=
{
nppiNormDiff_Inf_8u_C1R
,
nppiNormDiff_L1_8u_C1R
,
nppiNormDiff_L2_8u_C1R
};
static
const
buf_size_func_t
buf_size_funcs
[]
=
{
nppiNormDiffInfGetBufferHostSize_8u_C1R
,
nppiNormDiffL1GetBufferHostSize_8u_C1R
,
nppiNormDiffL2GetBufferHostSize_8u_C1R
};
#endif
NppiSize
sz
;
sz
.
width
=
src1
.
cols
;
...
...
@@ -202,7 +212,16 @@ double cv::gpu::norm(const GpuMat& src1, const GpuMat& src2, int normType)
DeviceBuffer
dbuf
;
nppSafeCall
(
npp_norm_diff_func
[
funcIdx
](
src1
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
src1
.
step
),
src2
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
src2
.
step
),
sz
,
dbuf
)
);
#if CUDA_VERSION < 5050
nppSafeCall
(
funcs
[
funcIdx
](
src1
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
src1
.
step
),
src2
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
src2
.
step
),
sz
,
dbuf
)
);
#else
int
bufSize
;
buf_size_funcs
[
funcIdx
](
sz
,
&
bufSize
);
GpuMat
buf
(
1
,
bufSize
,
CV_8UC1
);
nppSafeCall
(
funcs
[
funcIdx
](
src1
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
src1
.
step
),
src2
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
src2
.
step
),
sz
,
dbuf
,
buf
.
data
)
);
#endif
cudaSafeCall
(
cudaDeviceSynchronize
()
);
...
...
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