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
ed006a06
Commit
ed006a06
authored
Apr 09, 2013
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added private header to gpunvidia module
parent
c2402053
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
179 additions
and
88 deletions
+179
-88
internal_shared.hpp
modules/gpu/src/cuda/internal_shared.hpp
+2
-19
safe_call.hpp
modules/gpu/src/cuda/safe_call.hpp
+0
-11
error.cpp
modules/gpu/src/error.cpp
+0
-58
private.hpp
modules/gpunvidia/include/opencv2/gpunvidia/private.hpp
+96
-0
NCV.cpp
modules/gpunvidia/src/NCV.cpp
+80
-0
precomp.hpp
modules/gpunvidia/src/precomp.hpp
+1
-0
No files found.
modules/gpu/src/cuda/internal_shared.hpp
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
View file @
ed006a06
...
...
@@ -52,5 +52,6 @@
#include "opencv2/objdetect.hpp"
#include "opencv2/core/gpu_private.hpp"
#include "opencv2/gpunvidia/private.hpp"
#endif
/* __OPENCV_PRECOMP_H__ */
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