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
74f1162a
Commit
74f1162a
authored
Jun 16, 2011
by
Anatoly Baksheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tabs
parent
35d5a671
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
62 deletions
+62
-62
datamov_utils.hpp
modules/gpu/src/opencv2/gpu/device/datamov_utils.hpp
+62
-62
No files found.
modules/gpu/src/opencv2/gpu/device/datamov_utils.hpp
View file @
74f1162a
...
@@ -38,68 +38,68 @@
...
@@ -38,68 +38,68 @@
// or tort (including negligence or otherwise) arising in any way out of
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
// the use of this software, even if advised of the possibility of such damage.
//
//
//M*/
//M*/
#ifndef __OPENCV_GPU_DATAMOV_UTILS_HPP__
#ifndef __OPENCV_GPU_DATAMOV_UTILS_HPP__
#define __OPENCV_GPU_DATAMOV_UTILS_HPP__
#define __OPENCV_GPU_DATAMOV_UTILS_HPP__
#include "internal_shared.hpp"
#include "internal_shared.hpp"
namespace
cv
{
namespace
gpu
{
namespace
device
namespace
cv
{
namespace
gpu
{
namespace
device
{
{
#if __CUDA_ARCH__ >= 200
#if __CUDA_ARCH__ >= 200
// for Fermi memory space is detected automatically
// for Fermi memory space is detected automatically
template
<
typename
T
>
struct
ForceGlob
template
<
typename
T
>
struct
ForceGlob
{
{
__device__
__forceinline__
static
void
Load
(
const
T
*
ptr
,
int
offset
,
T
&
val
)
{
val
=
ptr
[
offset
];
}
__device__
__forceinline__
static
void
Load
(
const
T
*
ptr
,
int
offset
,
T
&
val
)
{
val
=
ptr
[
offset
];
}
};
};
#else // __CUDA_ARCH__ >= 200
#else // __CUDA_ARCH__ >= 200
#if defined(_WIN64) || defined(__LP64__)
#if defined(_WIN64) || defined(__LP64__)
// 64-bit register modifier for inlined asm
// 64-bit register modifier for inlined asm
#define _OPENCV_ASM_PTR_ "l"
#define _OPENCV_ASM_PTR_ "l"
#else
#else
// 32-bit register modifier for inlined asm
// 32-bit register modifier for inlined asm
#define _OPENCV_ASM_PTR_ "r"
#define _OPENCV_ASM_PTR_ "r"
#endif
#endif
template
<
class
T
>
struct
ForceGlob
;
template
<
class
T
>
struct
ForceGlob
;
#define DEFINE_FORCE_GLOB(base_type, ptx_type, reg_mod) \
#define DEFINE_FORCE_GLOB(base_type, ptx_type, reg_mod) \
template <> struct ForceGlob<base_type> \
template
<>
struct
ForceGlob
<
base_type
>
\
{ \
{
\
__device__ __forceinline__ static void Load(const base_type* ptr, int offset, base_type& val) \
__device__
__forceinline__
static
void
Load
(
const
base_type
*
ptr
,
int
offset
,
base_type
&
val
)
\
{ \
{
\
asm("ld.global."#ptx_type" %0, [%1];" : "="#reg_mod(val) : _OPENCV_ASM_PTR_(ptr + offset)); \
asm
(
"ld.global."
#
ptx_type
" %0, [%1];"
:
"="
#
reg_mod
(
val
)
:
_OPENCV_ASM_PTR_
(
ptr
+
offset
));
\
} \
}
\
};
};
#define DEFINE_FORCE_GLOB_B(base_type, ptx_type) \
#define DEFINE_FORCE_GLOB_B(base_type, ptx_type) \
template <> struct ForceGlob<base_type> \
template
<>
struct
ForceGlob
<
base_type
>
\
{ \
{
\
__device__ __forceinline__ static void Load(const base_type* ptr, int offset, base_type& val) \
__device__
__forceinline__
static
void
Load
(
const
base_type
*
ptr
,
int
offset
,
base_type
&
val
)
\
{ \
{
\
asm("ld.global."#ptx_type" %0, [%1];" : "=r"(*reinterpret_cast<uint*>(&val)) : _OPENCV_ASM_PTR_(ptr + offset)); \
asm
(
"ld.global."
#
ptx_type
" %0, [%1];"
:
"=r"
(
*
reinterpret_cast
<
uint
*>
(
&
val
))
:
_OPENCV_ASM_PTR_
(
ptr
+
offset
));
\
} \
}
\
};
};
DEFINE_FORCE_GLOB_B
(
uchar
,
u8
)
DEFINE_FORCE_GLOB_B
(
uchar
,
u8
)
DEFINE_FORCE_GLOB_B
(
schar
,
s8
)
DEFINE_FORCE_GLOB_B
(
schar
,
s8
)
DEFINE_FORCE_GLOB_B
(
char
,
b8
)
DEFINE_FORCE_GLOB_B
(
char
,
b8
)
DEFINE_FORCE_GLOB
(
ushort
,
u16
,
h
)
DEFINE_FORCE_GLOB
(
ushort
,
u16
,
h
)
DEFINE_FORCE_GLOB
(
short
,
s16
,
h
)
DEFINE_FORCE_GLOB
(
short
,
s16
,
h
)
DEFINE_FORCE_GLOB
(
uint
,
u32
,
r
)
DEFINE_FORCE_GLOB
(
uint
,
u32
,
r
)
DEFINE_FORCE_GLOB
(
int
,
s32
,
r
)
DEFINE_FORCE_GLOB
(
int
,
s32
,
r
)
DEFINE_FORCE_GLOB
(
float
,
f32
,
f
)
DEFINE_FORCE_GLOB
(
float
,
f32
,
f
)
DEFINE_FORCE_GLOB
(
double
,
f64
,
d
)
DEFINE_FORCE_GLOB
(
double
,
f64
,
d
)
#undef DEFINE_FORCE_GLOB
#undef DEFINE_FORCE_GLOB
#undef DEFINE_FORCE_GLOB_B
#undef DEFINE_FORCE_GLOB_B
#undef _OPENCV_ASM_PTR_
#undef _OPENCV_ASM_PTR_
#endif // __CUDA_ARCH__ >= 200
#endif // __CUDA_ARCH__ >= 200
}}}
}}}
#endif // __OPENCV_GPU_DATAMOV_UTILS_HPP__
#endif // __OPENCV_GPU_DATAMOV_UTILS_HPP__
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