Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
ed006a06
O
Opencv
项目概览
Greenplum
/
Opencv
11 个月 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ed006a06
编写于
4月 09, 2013
作者:
V
Vladislav Vinogradov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added private header to gpunvidia module
上级
c2402053
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
179 addition
and
88 deletion
+179
-88
modules/gpu/src/cuda/internal_shared.hpp
modules/gpu/src/cuda/internal_shared.hpp
+2
-19
modules/gpu/src/cuda/safe_call.hpp
modules/gpu/src/cuda/safe_call.hpp
+0
-11
modules/gpu/src/error.cpp
modules/gpu/src/error.cpp
+0
-58
modules/gpunvidia/include/opencv2/gpunvidia/private.hpp
modules/gpunvidia/include/opencv2/gpunvidia/private.hpp
+96
-0
modules/gpunvidia/src/NCV.cpp
modules/gpunvidia/src/NCV.cpp
+80
-0
modules/gpunvidia/src/precomp.hpp
modules/gpunvidia/src/precomp.hpp
+1
-0
未找到文件。
modules/gpu/src/cuda/internal_shared.hpp
浏览文件 @
ed006a06
...
...
@@ -48,28 +48,11 @@
#include "opencv2/core/cuda_devptrs.hpp"
#include "opencv2/core/cuda/common.hpp"
#include "opencv2/gpunvidia.hpp"
#include "opencv2/gpunvidia
/private
.hpp"
#include "safe_call.hpp"
namespace
cv
{
namespace
gpu
{
class
NppStStreamHandler
{
public:
inline
explicit
NppStStreamHandler
(
cudaStream_t
newStream
=
0
)
{
oldStream
=
nppStSetActiveCUDAstream
(
newStream
);
}
#include "safe_call.hpp"
inline
~
NppStStreamHandler
()
{
nppStSetActiveCUDAstream
(
oldStream
);
}
private:
cudaStream_t
oldStream
;
};
}}
#endif
/* __OPENCV_internal_shared_HPP__ */
modules/gpu/src/cuda/safe_call.hpp
浏览文件 @
ed006a06
...
...
@@ -43,30 +43,19 @@
#ifndef __OPENCV_CUDA_SAFE_CALL_HPP__
#define __OPENCV_CUDA_SAFE_CALL_HPP__
#include <cuda_runtime_api.h>
#include <cufft.h>
#include "opencv2/gpunvidia.hpp"
#if defined(__GNUC__)
#define ncvSafeCall(expr) ___ncvSafeCall(expr, __FILE__, __LINE__, __func__)
#define cufftSafeCall(expr) ___cufftSafeCall(expr, __FILE__, __LINE__, __func__)
#else
/* defined(__CUDACC__) || defined(__MSVC__) */
#define ncvSafeCall(expr) ___ncvSafeCall(expr, __FILE__, __LINE__)
#define cufftSafeCall(expr) ___cufftSafeCall(expr, __FILE__, __LINE__)
#endif
namespace
cv
{
namespace
gpu
{
void
ncvError
(
int
err
,
const
char
*
file
,
const
int
line
,
const
char
*
func
=
""
);
void
cufftError
(
int
err
,
const
char
*
file
,
const
int
line
,
const
char
*
func
=
""
);
}}
static
inline
void
___ncvSafeCall
(
int
err
,
const
char
*
file
,
const
int
line
,
const
char
*
func
=
""
)
{
if
(
NCV_SUCCESS
!=
err
)
cv
::
gpu
::
ncvError
(
err
,
file
,
line
,
func
);
}
static
inline
void
___cufftSafeCall
(
cufftResult_t
err
,
const
char
*
file
,
const
int
line
,
const
char
*
func
=
""
)
{
if
(
CUFFT_SUCCESS
!=
err
)
...
...
modules/gpu/src/error.cpp
浏览文件 @
ed006a06
...
...
@@ -73,58 +73,6 @@ namespace
return
str
;
}
//////////////////////////////////////////////////////////////////////////
// NCV errors
const
ErrorEntry
ncv_errors
[]
=
{
error_entry
(
NCV_SUCCESS
),
error_entry
(
NCV_UNKNOWN_ERROR
),
error_entry
(
NCV_CUDA_ERROR
),
error_entry
(
NCV_NPP_ERROR
),
error_entry
(
NCV_FILE_ERROR
),
error_entry
(
NCV_NULL_PTR
),
error_entry
(
NCV_INCONSISTENT_INPUT
),
error_entry
(
NCV_TEXTURE_BIND_ERROR
),
error_entry
(
NCV_DIMENSIONS_INVALID
),
error_entry
(
NCV_INVALID_ROI
),
error_entry
(
NCV_INVALID_STEP
),
error_entry
(
NCV_INVALID_SCALE
),
error_entry
(
NCV_INVALID_SCALE
),
error_entry
(
NCV_ALLOCATOR_NOT_INITIALIZED
),
error_entry
(
NCV_ALLOCATOR_BAD_ALLOC
),
error_entry
(
NCV_ALLOCATOR_BAD_DEALLOC
),
error_entry
(
NCV_ALLOCATOR_INSUFFICIENT_CAPACITY
),
error_entry
(
NCV_ALLOCATOR_DEALLOC_ORDER
),
error_entry
(
NCV_ALLOCATOR_BAD_REUSE
),
error_entry
(
NCV_MEM_COPY_ERROR
),
error_entry
(
NCV_MEM_RESIDENCE_ERROR
),
error_entry
(
NCV_MEM_INSUFFICIENT_CAPACITY
),
error_entry
(
NCV_HAAR_INVALID_PIXEL_STEP
),
error_entry
(
NCV_HAAR_TOO_MANY_FEATURES_IN_CLASSIFIER
),
error_entry
(
NCV_HAAR_TOO_MANY_FEATURES_IN_CASCADE
),
error_entry
(
NCV_HAAR_TOO_LARGE_FEATURES
),
error_entry
(
NCV_HAAR_XML_LOADING_EXCEPTION
),
error_entry
(
NCV_NOIMPL_HAAR_TILTED_FEATURES
),
error_entry
(
NCV_WARNING_HAAR_DETECTIONS_VECTOR_OVERFLOW
),
error_entry
(
NPPST_SUCCESS
),
error_entry
(
NPPST_ERROR
),
error_entry
(
NPPST_CUDA_KERNEL_EXECUTION_ERROR
),
error_entry
(
NPPST_NULL_POINTER_ERROR
),
error_entry
(
NPPST_TEXTURE_BIND_ERROR
),
error_entry
(
NPPST_MEMCPY_ERROR
),
error_entry
(
NPPST_MEM_ALLOC_ERR
),
error_entry
(
NPPST_MEMFREE_ERR
),
error_entry
(
NPPST_INVALID_ROI
),
error_entry
(
NPPST_INVALID_STEP
),
error_entry
(
NPPST_INVALID_SCALE
),
error_entry
(
NPPST_MEM_INSUFFICIENT_BUFFER
),
error_entry
(
NPPST_MEM_RESIDENCE_ERROR
),
error_entry
(
NPPST_MEM_INTERNAL_ERROR
)
};
const
size_t
ncv_error_num
=
sizeof
(
ncv_errors
)
/
sizeof
(
ncv_errors
[
0
]);
//////////////////////////////////////////////////////////////////////////
// CUFFT errors
...
...
@@ -148,12 +96,6 @@ namespace cv
{
namespace
gpu
{
void
ncvError
(
int
code
,
const
char
*
file
,
const
int
line
,
const
char
*
func
)
{
String
msg
=
getErrorString
(
code
,
ncv_errors
,
ncv_error_num
);
cv
::
error
(
cv
::
Error
::
GpuApiCallError
,
msg
,
func
,
file
,
line
);
}
void
cufftError
(
int
code
,
const
char
*
file
,
const
int
line
,
const
char
*
func
)
{
String
msg
=
getErrorString
(
code
,
cufft_errors
,
cufft_error_num
);
...
...
modules/gpunvidia/include/opencv2/gpunvidia/private.hpp
0 → 100644
浏览文件 @
ed006a06
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// 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.
//
//M*/
#ifndef __OPENCV_CORE_GPUNVIDIA_PRIVATE_HPP__
#define __OPENCV_CORE_GPUNVIDIA_PRIVATE_HPP__
#ifndef __OPENCV_BUILD
# error this is a private header which should not be used from outside of the OpenCV library
#endif
#include "opencv2/core/gpu_private.hpp"
#ifndef HAVE_CUDA
# error gpunvidia module requires CUDA
#endif
#include "opencv2/gpunvidia.hpp"
namespace
cv
{
namespace
gpu
{
class
NppStStreamHandler
{
public:
inline
explicit
NppStStreamHandler
(
cudaStream_t
newStream
=
0
)
{
oldStream
=
nppStSetActiveCUDAstream
(
newStream
);
}
inline
~
NppStStreamHandler
()
{
nppStSetActiveCUDAstream
(
oldStream
);
}
private:
cudaStream_t
oldStream
;
};
NCV_EXPORTS
cv
::
String
getNcvErrorMessage
(
int
code
);
static
inline
void
checkNcvError
(
int
err
,
const
char
*
file
,
const
int
line
,
const
char
*
func
)
{
if
(
NCV_SUCCESS
!=
err
)
{
cv
::
String
msg
=
getNcvErrorMessage
(
err
);
cv
::
error
(
cv
::
Error
::
GpuApiCallError
,
msg
,
func
,
file
,
line
);
}
}
}}
#if defined(__GNUC__)
#define ncvSafeCall(expr) cv::gpu::checkNcvError(expr, __FILE__, __LINE__, __func__)
#else
/* defined(__CUDACC__) || defined(__MSVC__) */
#define ncvSafeCall(expr) cv::gpu::checkNcvError(expr, __FILE__, __LINE__, "")
#endif
#endif // __OPENCV_CORE_GPUNVIDIA_PRIVATE_HPP__
modules/gpunvidia/src/NCV.cpp
浏览文件 @
ed006a06
...
...
@@ -48,6 +48,86 @@
//
//==============================================================================
namespace
{
#define error_entry(entry) { entry, #entry }
struct
ErrorEntry
{
int
code
;
const
char
*
str
;
};
struct
ErrorEntryComparer
{
int
code
;
ErrorEntryComparer
(
int
code_
)
:
code
(
code_
)
{}
bool
operator
()(
const
ErrorEntry
&
e
)
const
{
return
e
.
code
==
code
;
}
};
//////////////////////////////////////////////////////////////////////////
// NCV errors
const
ErrorEntry
ncv_errors
[]
=
{
error_entry
(
NCV_SUCCESS
),
error_entry
(
NCV_UNKNOWN_ERROR
),
error_entry
(
NCV_CUDA_ERROR
),
error_entry
(
NCV_NPP_ERROR
),
error_entry
(
NCV_FILE_ERROR
),
error_entry
(
NCV_NULL_PTR
),
error_entry
(
NCV_INCONSISTENT_INPUT
),
error_entry
(
NCV_TEXTURE_BIND_ERROR
),
error_entry
(
NCV_DIMENSIONS_INVALID
),
error_entry
(
NCV_INVALID_ROI
),
error_entry
(
NCV_INVALID_STEP
),
error_entry
(
NCV_INVALID_SCALE
),
error_entry
(
NCV_INVALID_SCALE
),
error_entry
(
NCV_ALLOCATOR_NOT_INITIALIZED
),
error_entry
(
NCV_ALLOCATOR_BAD_ALLOC
),
error_entry
(
NCV_ALLOCATOR_BAD_DEALLOC
),
error_entry
(
NCV_ALLOCATOR_INSUFFICIENT_CAPACITY
),
error_entry
(
NCV_ALLOCATOR_DEALLOC_ORDER
),
error_entry
(
NCV_ALLOCATOR_BAD_REUSE
),
error_entry
(
NCV_MEM_COPY_ERROR
),
error_entry
(
NCV_MEM_RESIDENCE_ERROR
),
error_entry
(
NCV_MEM_INSUFFICIENT_CAPACITY
),
error_entry
(
NCV_HAAR_INVALID_PIXEL_STEP
),
error_entry
(
NCV_HAAR_TOO_MANY_FEATURES_IN_CLASSIFIER
),
error_entry
(
NCV_HAAR_TOO_MANY_FEATURES_IN_CASCADE
),
error_entry
(
NCV_HAAR_TOO_LARGE_FEATURES
),
error_entry
(
NCV_HAAR_XML_LOADING_EXCEPTION
),
error_entry
(
NCV_NOIMPL_HAAR_TILTED_FEATURES
),
error_entry
(
NCV_WARNING_HAAR_DETECTIONS_VECTOR_OVERFLOW
),
error_entry
(
NPPST_SUCCESS
),
error_entry
(
NPPST_ERROR
),
error_entry
(
NPPST_CUDA_KERNEL_EXECUTION_ERROR
),
error_entry
(
NPPST_NULL_POINTER_ERROR
),
error_entry
(
NPPST_TEXTURE_BIND_ERROR
),
error_entry
(
NPPST_MEMCPY_ERROR
),
error_entry
(
NPPST_MEM_ALLOC_ERR
),
error_entry
(
NPPST_MEMFREE_ERR
),
error_entry
(
NPPST_INVALID_ROI
),
error_entry
(
NPPST_INVALID_STEP
),
error_entry
(
NPPST_INVALID_SCALE
),
error_entry
(
NPPST_MEM_INSUFFICIENT_BUFFER
),
error_entry
(
NPPST_MEM_RESIDENCE_ERROR
),
error_entry
(
NPPST_MEM_INTERNAL_ERROR
)
};
const
size_t
ncv_error_num
=
sizeof
(
ncv_errors
)
/
sizeof
(
ncv_errors
[
0
]);
}
cv
::
String
cv
::
gpu
::
getNcvErrorMessage
(
int
code
)
{
size_t
idx
=
std
::
find_if
(
ncv_errors
,
ncv_errors
+
ncv_error_num
,
ErrorEntryComparer
(
code
))
-
ncv_errors
;
const
char
*
msg
=
(
idx
!=
ncv_error_num
)
?
ncv_errors
[
idx
].
str
:
"Unknown error code"
;
String
str
=
cv
::
format
(
"%s [Code = %d]"
,
msg
,
code
);
return
str
;
}
static
void
stdDebugOutput
(
const
cv
::
String
&
msg
)
{
...
...
modules/gpunvidia/src/precomp.hpp
浏览文件 @
ed006a06
...
...
@@ -52,5 +52,6 @@
#include "opencv2/objdetect.hpp"
#include "opencv2/core/gpu_private.hpp"
#include "opencv2/gpunvidia/private.hpp"
#endif
/* __OPENCV_PRECOMP_H__ */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录