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
df9f707f
Commit
df9f707f
authored
Sep 06, 2011
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bug in gpu::remap under win32
parent
ca8c5b63
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
17 deletions
+43
-17
imgproc.cu
modules/gpu/src/cuda/imgproc.cu
+19
-16
border_interpolate.hpp
modules/gpu/src/opencv2/gpu/device/border_interpolate.hpp
+23
-0
tests.cpp
samples/gpu/performance/tests.cpp
+1
-1
No files found.
modules/gpu/src/cuda/imgproc.cu
View file @
df9f707f
...
...
@@ -66,6 +66,24 @@ namespace cv { namespace gpu { namespace imgproc
dst.ptr(y)[x] = saturate_cast<T>(src(ycoo, xcoo));
}
}
template <template <typename> class Filter, template <typename> class B, typename T> struct RemapDispatcherStream
{
static void call(const DevMem2D_<T>& src, const DevMem2Df& mapx, const DevMem2Df& mapy, const DevMem2D_<T>& dst, const float* borderValue, cudaStream_t stream)
{
typedef typename TypeVec<float, VecTraits<T>::cn>::vec_type work_type;
dim3 block(32, 8);
dim3 grid(divUp(dst.cols, block.x), divUp(dst.rows, block.y));
B<work_type> brd(src.rows, src.cols, VecTraits<work_type>::make(borderValue));
BorderReader< PtrStep_<T>, B<work_type> > brdSrc(src, brd);
Filter< BorderReader< PtrStep_<T>, B<work_type> > > filter_src(brdSrc);
remap<<<grid, block, 0, stream>>>(filter_src, mapx, mapy, dst);
cudaSafeCall( cudaGetLastError() );
}
};
template <template <typename> class Filter, template <typename> class B, typename T> struct RemapDispatcherNonStream
{
...
...
@@ -163,22 +181,7 @@ namespace cv { namespace gpu { namespace imgproc
if (stream == 0)
RemapDispatcherNonStream<Filter, B, T>::call(src, mapx, mapy, dst, borderValue);
else
callStream(src, mapx, mapy, dst, borderValue, stream);
}
static void callStream(const DevMem2D_<T>& src, const DevMem2Df& mapx, const DevMem2Df& mapy, const DevMem2D_<T>& dst, const float* borderValue, cudaStream_t stream)
{
typedef typename TypeVec<float, VecTraits<T>::cn>::vec_type work_type;
dim3 block(32, 8);
dim3 grid(divUp(dst.cols, block.x), divUp(dst.rows, block.y));
B<work_type> brd(src.rows, src.cols, VecTraits<work_type>::make(borderValue));
BorderReader< PtrStep_<T>, B<work_type> > brd_src(src, brd);
Filter< BorderReader< PtrStep_<T>, B<work_type> > > filter_src(brd_src);
remap<<<grid, block, 0, stream>>>(filter_src, mapx, mapy, dst);
cudaSafeCall( cudaGetLastError() );
RemapDispatcherStream<Filter, B, T>::call(src, mapx, mapy, dst, borderValue, stream);
}
};
...
...
modules/gpu/src/opencv2/gpu/device/border_interpolate.hpp
View file @
df9f707f
...
...
@@ -758,6 +758,29 @@ namespace cv { namespace gpu { namespace device
const
Ptr2D
ptr
;
const
B
b
;
};
// under win32 there is some bug with templated types that passed as kernel parameters
// with this specialization all works fine
template
<
typename
Ptr2D
,
typename
D
>
struct
BorderReader
<
Ptr2D
,
BrdConstant
<
D
>
>
{
typedef
typename
BrdConstant
<
D
>::
result_type
elem_type
;
typedef
typename
Ptr2D
::
index_type
index_type
;
__host__
__device__
__forceinline__
BorderReader
(
const
Ptr2D
&
src_
,
const
BrdConstant
<
D
>&
b
)
:
src
(
src_
),
height
(
b
.
height
),
width
(
b
.
width
),
val
(
b
.
val
)
{
}
__device__
__forceinline__
D
operator
()(
index_type
y
,
index_type
x
)
const
{
return
(
x
>=
0
&&
x
<
width
&&
y
>=
0
&&
y
<
height
)
?
saturate_cast
<
D
>
(
src
(
y
,
x
))
:
val
;
}
const
Ptr2D
src
;
const
int
height
;
const
int
width
;
const
D
val
;
};
}}}
#endif // __OPENCV_GPU_BORDER_INTERPOLATE_HPP__
samples/gpu/performance/tests.cpp
View file @
df9f707f
...
...
@@ -80,7 +80,7 @@ TEST(remap)
gpu
::
GpuMat
d_src
,
d_dst
,
d_xmap
,
d_ymap
;
int
interpolation
=
INTER_LINEAR
;
int
borderMode
=
BORDER_
CONSTANT
;
int
borderMode
=
BORDER_
REPLICATE
;
for
(
int
size
=
1000
;
size
<=
4000
;
size
*=
2
)
{
...
...
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