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
99c49648
Commit
99c49648
authored
Mar 20, 2013
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed gpu::LUT on multi device system
parent
321070cc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
33 deletions
+22
-33
arithm.cpp
modules/gpu/src/arithm.cpp
+22
-33
No files found.
modules/gpu/src/arithm.cpp
View file @
99c49648
...
@@ -319,61 +319,50 @@ void cv::gpu::flip(const GpuMat& src, GpuMat& dst, int flipCode, Stream& stream)
...
@@ -319,61 +319,50 @@ void cv::gpu::flip(const GpuMat& src, GpuMat& dst, int flipCode, Stream& stream)
void
cv
::
gpu
::
LUT
(
const
GpuMat
&
src
,
const
Mat
&
lut
,
GpuMat
&
dst
,
Stream
&
s
)
void
cv
::
gpu
::
LUT
(
const
GpuMat
&
src
,
const
Mat
&
lut
,
GpuMat
&
dst
,
Stream
&
s
)
{
{
class
LevelsInit
const
int
cn
=
src
.
channels
();
{
public
:
Npp32s
pLevels
[
256
];
const
Npp32s
*
pLevels3
[
3
];
int
nValues3
[
3
];
#if (CUDA_VERSION > 4020)
CV_Assert
(
src
.
type
()
==
CV_8UC1
||
src
.
type
()
==
CV_8UC3
);
GpuMat
d_pLevels
;
CV_Assert
(
lut
.
depth
()
==
CV_8U
);
#endif
CV_Assert
(
lut
.
channels
()
==
1
||
lut
.
channels
()
==
cn
);
CV_Assert
(
lut
.
rows
*
lut
.
cols
==
256
&&
lut
.
isContinuous
()
);
LevelsInit
()
dst
.
create
(
src
.
size
(),
CV_MAKE_TYPE
(
lut
.
depth
(),
cn
));
{
nValues3
[
0
]
=
nValues3
[
1
]
=
nValues3
[
2
]
=
256
;
NppiSize
sz
;
sz
.
height
=
src
.
rows
;
sz
.
width
=
src
.
cols
;
Mat
nppLut
;
lut
.
convertTo
(
nppLut
,
CV_32S
);
int
nValues3
[]
=
{
256
,
256
,
256
};
Npp32s
pLevels
[
256
];
for
(
int
i
=
0
;
i
<
256
;
++
i
)
for
(
int
i
=
0
;
i
<
256
;
++
i
)
pLevels
[
i
]
=
i
;
pLevels
[
i
]
=
i
;
const
Npp32s
*
pLevels3
[
3
];
#if (CUDA_VERSION <= 4020)
#if (CUDA_VERSION <= 4020)
pLevels3
[
0
]
=
pLevels3
[
1
]
=
pLevels3
[
2
]
=
pLevels
;
pLevels3
[
0
]
=
pLevels3
[
1
]
=
pLevels3
[
2
]
=
pLevels
;
#else
#else
GpuMat
d_pLevels
;
d_pLevels
.
upload
(
Mat
(
1
,
256
,
CV_32S
,
pLevels
));
d_pLevels
.
upload
(
Mat
(
1
,
256
,
CV_32S
,
pLevels
));
pLevels3
[
0
]
=
pLevels3
[
1
]
=
pLevels3
[
2
]
=
d_pLevels
.
ptr
<
Npp32s
>
();
pLevels3
[
0
]
=
pLevels3
[
1
]
=
pLevels3
[
2
]
=
d_pLevels
.
ptr
<
Npp32s
>
();
#endif
#endif
}
};
static
LevelsInit
lvls
;
int
cn
=
src
.
channels
();
CV_Assert
(
src
.
type
()
==
CV_8UC1
||
src
.
type
()
==
CV_8UC3
);
CV_Assert
(
lut
.
depth
()
==
CV_8U
&&
(
lut
.
channels
()
==
1
||
lut
.
channels
()
==
cn
)
&&
lut
.
rows
*
lut
.
cols
==
256
&&
lut
.
isContinuous
());
dst
.
create
(
src
.
size
(),
CV_MAKETYPE
(
lut
.
depth
(),
cn
));
NppiSize
sz
;
sz
.
height
=
src
.
rows
;
sz
.
width
=
src
.
cols
;
Mat
nppLut
;
lut
.
convertTo
(
nppLut
,
CV_32S
);
cudaStream_t
stream
=
StreamAccessor
::
getStream
(
s
);
cudaStream_t
stream
=
StreamAccessor
::
getStream
(
s
);
NppStreamHandler
h
(
stream
);
NppStreamHandler
h
(
stream
);
if
(
src
.
type
()
==
CV_8UC1
)
if
(
src
.
type
()
==
CV_8UC1
)
{
{
#if (CUDA_VERSION <= 4020)
#if (CUDA_VERSION <= 4020)
nppSafeCall
(
nppiLUT_Linear_8u_C1R
(
src
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
src
.
step
),
nppSafeCall
(
nppiLUT_Linear_8u_C1R
(
src
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
src
.
step
),
dst
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
dst
.
step
),
sz
,
nppLut
.
ptr
<
Npp32s
>
(),
lvls
.
pLevels
,
256
)
);
dst
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
dst
.
step
),
sz
,
nppLut
.
ptr
<
Npp32s
>
(),
pLevels
,
256
)
);
#else
#else
GpuMat
d_nppLut
(
Mat
(
1
,
256
,
CV_32S
,
nppLut
.
data
));
GpuMat
d_nppLut
(
Mat
(
1
,
256
,
CV_32S
,
nppLut
.
data
));
nppSafeCall
(
nppiLUT_Linear_8u_C1R
(
src
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
src
.
step
),
nppSafeCall
(
nppiLUT_Linear_8u_C1R
(
src
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
src
.
step
),
dst
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
dst
.
step
),
sz
,
d_nppLut
.
ptr
<
Npp32s
>
(),
lvls
.
d_pLevels
.
ptr
<
Npp32s
>
(),
256
)
);
dst
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
dst
.
step
),
sz
,
d_nppLut
.
ptr
<
Npp32s
>
(),
d_pLevels
.
ptr
<
Npp32s
>
(),
256
)
);
#endif
#endif
}
}
else
else
...
@@ -410,7 +399,7 @@ void cv::gpu::LUT(const GpuMat& src, const Mat& lut, GpuMat& dst, Stream& s)
...
@@ -410,7 +399,7 @@ void cv::gpu::LUT(const GpuMat& src, const Mat& lut, GpuMat& dst, Stream& s)
}
}
nppSafeCall
(
nppiLUT_Linear_8u_C3R
(
src
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
src
.
step
),
nppSafeCall
(
nppiLUT_Linear_8u_C3R
(
src
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
src
.
step
),
dst
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
dst
.
step
),
sz
,
pValues3
,
lvls
.
pLevels3
,
lvls
.
nValues3
)
);
dst
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
dst
.
step
),
sz
,
pValues3
,
pLevels3
,
nValues3
)
);
}
}
if
(
stream
==
0
)
if
(
stream
==
0
)
...
...
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