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
193e8573
Commit
193e8573
authored
Apr 04, 2013
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed cu_safe_call.h and cu_safe_call.cpp
parent
204a19b4
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
96 additions
and
226 deletions
+96
-226
common.hpp
modules/core/include/opencv2/core/cuda/common.hpp
+2
-2
gpu_private.hpp
modules/core/include/opencv2/core/gpu_private.hpp
+21
-12
gpumat.cpp
modules/core/src/gpumat.cpp
+73
-5
cu_safe_call.cpp
modules/gpu/src/cu_safe_call.cpp
+0
-137
cu_safe_call.h
modules/gpu/src/cu_safe_call.h
+0
-67
cuvid_video_source.cpp
modules/gpu/src/cuvid_video_source.cpp
+0
-1
video_decoder.h
modules/gpu/src/video_decoder.h
+0
-1
video_parser.cpp
modules/gpu/src/video_parser.cpp
+0
-1
No files found.
modules/core/include/opencv2/core/cuda/common.hpp
View file @
193e8573
...
...
@@ -65,9 +65,9 @@ namespace cv { namespace gpu { namespace cuda {
}}}
#if defined(__GNUC__)
#define cvCudaSafeCall(expr) cv::gpu::cuda::checkError(
(expr)
, __FILE__, __LINE__, __func__)
#define cvCudaSafeCall(expr) cv::gpu::cuda::checkError(
expr
, __FILE__, __LINE__, __func__)
#else
/* defined(__CUDACC__) || defined(__MSVC__) */
#define cvCudaSafeCall(expr) cv::gpu::cuda::checkError(
(expr)
, __FILE__, __LINE__, "")
#define cvCudaSafeCall(expr) cv::gpu::cuda::checkError(
expr
, __FILE__, __LINE__, "")
#endif
namespace
cv
{
namespace
gpu
...
...
modules/core/include/opencv2/core/gpu_private.hpp
View file @
193e8573
...
...
@@ -73,12 +73,7 @@
namespace
cv
{
namespace
gpu
{
CV_EXPORTS
cv
::
String
getNppErrorMessage
(
int
code
);
static
inline
void
checkNppError
(
int
code
,
const
char
*
file
,
const
int
line
,
const
char
*
func
)
{
if
(
code
<
0
)
cv
::
error
(
cv
::
Error
::
GpuApiCallError
,
getNppErrorMessage
(
code
),
func
,
file
,
line
);
}
CV_EXPORTS
cv
::
String
getCudaDriverApiErrorMessage
(
int
code
);
// Converts CPU border extrapolation mode into GPU internal analogue.
// Returns true if the GPU analogue exists, false otherwise.
...
...
@@ -93,14 +88,20 @@ static inline void throw_no_cuda() { CV_Error(cv::Error::GpuNotSupported, "The l
static
inline
void
throw_no_cuda
()
{
CV_Error
(
cv
::
Error
::
StsNotImplemented
,
"The called functionality is disabled for current build or platform"
);
}
#if defined(__GNUC__)
#define nppSafeCall(expr) cv::gpu::checkNppError(expr, __FILE__, __LINE__, __func__)
#else
/* defined(__CUDACC__) || defined(__MSVC__) */
#define nppSafeCall(expr) cv::gpu::checkNppError(expr, __FILE__, __LINE__, "")
#endif
namespace
cv
{
namespace
gpu
{
static
inline
void
checkNppError
(
int
code
,
const
char
*
file
,
const
int
line
,
const
char
*
func
)
{
if
(
code
<
0
)
cv
::
error
(
cv
::
Error
::
GpuApiCallError
,
getNppErrorMessage
(
code
),
func
,
file
,
line
);
}
static
inline
void
checkCudaDriverApiError
(
int
code
,
const
char
*
file
,
const
int
line
,
const
char
*
func
)
{
if
(
code
!=
CUDA_SUCCESS
)
cv
::
error
(
cv
::
Error
::
GpuApiCallError
,
getCudaDriverApiErrorMessage
(
code
),
func
,
file
,
line
);
}
template
<
int
n
>
struct
NPPTypeTraits
;
template
<>
struct
NPPTypeTraits
<
CV_8U
>
{
typedef
Npp8u
npp_type
;
};
template
<>
struct
NPPTypeTraits
<
CV_8S
>
{
typedef
Npp8s
npp_type
;
};
...
...
@@ -129,6 +130,14 @@ namespace cv { namespace gpu
};
}}
#if defined(__GNUC__)
#define nppSafeCall(expr) cv::gpu::checkNppError(expr, __FILE__, __LINE__, __func__)
#define cuSafeCall(expr) cv::gpu::checkCudaDriverApiError(expr, __FILE__, __LINE__, __func__)
#else
/* defined(__CUDACC__) || defined(__MSVC__) */
#define nppSafeCall(expr) cv::gpu::checkNppError(expr, __FILE__, __LINE__, "")
#define cuSafeCall(expr) cv::gpu::checkCudaDriverApiError(expr, __FILE__, __LINE__, "")
#endif
#endif // HAVE_CUDA
#endif // __OPENCV_CORE_GPU_PRIVATE_HPP__
modules/core/src/gpumat.cpp
View file @
193e8573
...
...
@@ -1591,6 +1591,69 @@ namespace
};
const
size_t
npp_error_num
=
sizeof
(
npp_errors
)
/
sizeof
(
npp_errors
[
0
]);
const
ErrorEntry
cu_errors
[]
=
{
error_entry
(
CUDA_SUCCESS
),
error_entry
(
CUDA_ERROR_INVALID_VALUE
),
error_entry
(
CUDA_ERROR_OUT_OF_MEMORY
),
error_entry
(
CUDA_ERROR_NOT_INITIALIZED
),
error_entry
(
CUDA_ERROR_DEINITIALIZED
),
error_entry
(
CUDA_ERROR_PROFILER_DISABLED
),
error_entry
(
CUDA_ERROR_PROFILER_NOT_INITIALIZED
),
error_entry
(
CUDA_ERROR_PROFILER_ALREADY_STARTED
),
error_entry
(
CUDA_ERROR_PROFILER_ALREADY_STOPPED
),
error_entry
(
CUDA_ERROR_NO_DEVICE
),
error_entry
(
CUDA_ERROR_INVALID_DEVICE
),
error_entry
(
CUDA_ERROR_INVALID_IMAGE
),
error_entry
(
CUDA_ERROR_INVALID_CONTEXT
),
error_entry
(
CUDA_ERROR_CONTEXT_ALREADY_CURRENT
),
error_entry
(
CUDA_ERROR_MAP_FAILED
),
error_entry
(
CUDA_ERROR_UNMAP_FAILED
),
error_entry
(
CUDA_ERROR_ARRAY_IS_MAPPED
),
error_entry
(
CUDA_ERROR_ALREADY_MAPPED
),
error_entry
(
CUDA_ERROR_NO_BINARY_FOR_GPU
),
error_entry
(
CUDA_ERROR_ALREADY_ACQUIRED
),
error_entry
(
CUDA_ERROR_NOT_MAPPED
),
error_entry
(
CUDA_ERROR_NOT_MAPPED_AS_ARRAY
),
error_entry
(
CUDA_ERROR_NOT_MAPPED_AS_POINTER
),
error_entry
(
CUDA_ERROR_ECC_UNCORRECTABLE
),
error_entry
(
CUDA_ERROR_UNSUPPORTED_LIMIT
),
error_entry
(
CUDA_ERROR_CONTEXT_ALREADY_IN_USE
),
error_entry
(
CUDA_ERROR_INVALID_SOURCE
),
error_entry
(
CUDA_ERROR_FILE_NOT_FOUND
),
error_entry
(
CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND
),
error_entry
(
CUDA_ERROR_SHARED_OBJECT_INIT_FAILED
),
error_entry
(
CUDA_ERROR_OPERATING_SYSTEM
),
error_entry
(
CUDA_ERROR_INVALID_HANDLE
),
error_entry
(
CUDA_ERROR_NOT_FOUND
),
error_entry
(
CUDA_ERROR_NOT_READY
),
error_entry
(
CUDA_ERROR_LAUNCH_FAILED
),
error_entry
(
CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES
),
error_entry
(
CUDA_ERROR_LAUNCH_TIMEOUT
),
error_entry
(
CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING
),
error_entry
(
CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED
),
error_entry
(
CUDA_ERROR_PEER_ACCESS_NOT_ENABLED
),
error_entry
(
CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE
),
error_entry
(
CUDA_ERROR_CONTEXT_IS_DESTROYED
),
error_entry
(
CUDA_ERROR_ASSERT
),
error_entry
(
CUDA_ERROR_TOO_MANY_PEERS
),
error_entry
(
CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED
),
error_entry
(
CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED
),
error_entry
(
CUDA_ERROR_UNKNOWN
)
};
const
size_t
cu_errors_num
=
sizeof
(
cu_errors
)
/
sizeof
(
cu_errors
[
0
]);
cv
::
String
getErrorString
(
int
code
,
const
ErrorEntry
*
errors
,
size_t
n
)
{
size_t
idx
=
std
::
find_if
(
errors
,
errors
+
n
,
ErrorEntryComparer
(
code
))
-
errors
;
const
char
*
msg
=
(
idx
!=
n
)
?
errors
[
idx
].
str
:
"Unknown error code"
;
cv
::
String
str
=
cv
::
format
(
"%s [Code = %d]"
,
msg
,
code
);
return
str
;
}
}
#endif
...
...
@@ -1601,12 +1664,17 @@ String cv::gpu::getNppErrorMessage(int code)
(
void
)
code
;
return
String
();
#else
size_t
idx
=
std
::
find_if
(
npp_errors
,
npp_errors
+
npp_error_num
,
ErrorEntryComparer
(
code
))
-
npp_errors
;
const
char
*
msg
=
(
idx
!=
npp_error_num
)
?
npp_errors
[
idx
].
str
:
"Unknown error code"
;
String
str
=
cv
::
format
(
"%s [Code = %d]"
,
msg
,
code
);
return
getErrorString
(
code
,
npp_errors
,
npp_error_num
);
#endif
}
return
str
;
String
cv
::
gpu
::
getCudaDriverApiErrorMessage
(
int
code
)
{
#ifndef HAVE_CUDA
(
void
)
code
;
return
String
();
#else
return
getErrorString
(
code
,
cu_errors
,
cu_errors_num
);
#endif
}
...
...
modules/gpu/src/cu_safe_call.cpp
deleted
100644 → 0
View file @
204a19b4
/*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.
// 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*/
#include "cu_safe_call.h"
#ifdef HAVE_CUDA
namespace
{
#define error_entry(entry) { entry, #entry }
struct
ErrorEntry
{
int
code
;
const
char
*
str
;
};
class
ErrorEntryComparer
{
public
:
inline
ErrorEntryComparer
(
int
code
)
:
code_
(
code
)
{}
inline
bool
operator
()(
const
ErrorEntry
&
e
)
const
{
return
e
.
code
==
code_
;
}
private
:
int
code_
;
};
cv
::
String
getErrorString
(
int
code
,
const
ErrorEntry
*
errors
,
size_t
n
)
{
size_t
idx
=
std
::
find_if
(
errors
,
errors
+
n
,
ErrorEntryComparer
(
code
))
-
errors
;
const
char
*
msg
=
(
idx
!=
n
)
?
errors
[
idx
].
str
:
"Unknown error code"
;
cv
::
String
str
=
cv
::
format
(
"%s [Code = %d]"
,
msg
,
code
);
return
str
;
}
const
ErrorEntry
cu_errors
[]
=
{
error_entry
(
CUDA_SUCCESS
),
error_entry
(
CUDA_ERROR_INVALID_VALUE
),
error_entry
(
CUDA_ERROR_OUT_OF_MEMORY
),
error_entry
(
CUDA_ERROR_NOT_INITIALIZED
),
error_entry
(
CUDA_ERROR_DEINITIALIZED
),
error_entry
(
CUDA_ERROR_PROFILER_DISABLED
),
error_entry
(
CUDA_ERROR_PROFILER_NOT_INITIALIZED
),
error_entry
(
CUDA_ERROR_PROFILER_ALREADY_STARTED
),
error_entry
(
CUDA_ERROR_PROFILER_ALREADY_STOPPED
),
error_entry
(
CUDA_ERROR_NO_DEVICE
),
error_entry
(
CUDA_ERROR_INVALID_DEVICE
),
error_entry
(
CUDA_ERROR_INVALID_IMAGE
),
error_entry
(
CUDA_ERROR_INVALID_CONTEXT
),
error_entry
(
CUDA_ERROR_CONTEXT_ALREADY_CURRENT
),
error_entry
(
CUDA_ERROR_MAP_FAILED
),
error_entry
(
CUDA_ERROR_UNMAP_FAILED
),
error_entry
(
CUDA_ERROR_ARRAY_IS_MAPPED
),
error_entry
(
CUDA_ERROR_ALREADY_MAPPED
),
error_entry
(
CUDA_ERROR_NO_BINARY_FOR_GPU
),
error_entry
(
CUDA_ERROR_ALREADY_ACQUIRED
),
error_entry
(
CUDA_ERROR_NOT_MAPPED
),
error_entry
(
CUDA_ERROR_NOT_MAPPED_AS_ARRAY
),
error_entry
(
CUDA_ERROR_NOT_MAPPED_AS_POINTER
),
error_entry
(
CUDA_ERROR_ECC_UNCORRECTABLE
),
error_entry
(
CUDA_ERROR_UNSUPPORTED_LIMIT
),
error_entry
(
CUDA_ERROR_CONTEXT_ALREADY_IN_USE
),
error_entry
(
CUDA_ERROR_INVALID_SOURCE
),
error_entry
(
CUDA_ERROR_FILE_NOT_FOUND
),
error_entry
(
CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND
),
error_entry
(
CUDA_ERROR_SHARED_OBJECT_INIT_FAILED
),
error_entry
(
CUDA_ERROR_OPERATING_SYSTEM
),
error_entry
(
CUDA_ERROR_INVALID_HANDLE
),
error_entry
(
CUDA_ERROR_NOT_FOUND
),
error_entry
(
CUDA_ERROR_NOT_READY
),
error_entry
(
CUDA_ERROR_LAUNCH_FAILED
),
error_entry
(
CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES
),
error_entry
(
CUDA_ERROR_LAUNCH_TIMEOUT
),
error_entry
(
CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING
),
error_entry
(
CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED
),
error_entry
(
CUDA_ERROR_PEER_ACCESS_NOT_ENABLED
),
error_entry
(
CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE
),
error_entry
(
CUDA_ERROR_CONTEXT_IS_DESTROYED
),
error_entry
(
CUDA_ERROR_ASSERT
),
error_entry
(
CUDA_ERROR_TOO_MANY_PEERS
),
error_entry
(
CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED
),
error_entry
(
CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED
),
error_entry
(
CUDA_ERROR_UNKNOWN
)
};
const
size_t
cu_errors_num
=
sizeof
(
cu_errors
)
/
sizeof
(
cu_errors
[
0
]);
}
cv
::
String
cv
::
gpu
::
detail
::
cuGetErrString
(
CUresult
res
)
{
return
getErrorString
(
res
,
cu_errors
,
cu_errors_num
);
}
#endif // HAVE_CUDA
modules/gpu/src/cu_safe_call.h
deleted
100644 → 0
View file @
204a19b4
/*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.
// 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 __CU_SAFE_CALL_H__
#define __CU_SAFE_CALL_H__
#include "precomp.hpp"
#ifdef HAVE_CUDA
namespace
cv
{
namespace
gpu
{
namespace
detail
{
String
cuGetErrString
(
CUresult
res
);
inline
void
cuSafeCall_impl
(
CUresult
res
,
const
char
*
file
,
int
line
)
{
if
(
res
!=
CUDA_SUCCESS
)
cv
::
error
(
cv
::
Exception
(
CV_GpuApiCallError
,
cuGetErrString
(
res
),
"unknown function"
,
file
,
line
)
);
}
}
}}
#define cuSafeCall( op ) cv::gpu::detail::cuSafeCall_impl( (op), __FILE__, __LINE__ )
#endif // HAVE_CUDA
#endif // __CU_SAFE_CALL_H__
modules/gpu/src/cuvid_video_source.cpp
View file @
193e8573
...
...
@@ -41,7 +41,6 @@
//M*/
#include "cuvid_video_source.h"
#include "cu_safe_call.h"
#if defined(HAVE_CUDA) && defined(HAVE_NVCUVID)
...
...
modules/gpu/src/video_decoder.h
View file @
193e8573
...
...
@@ -44,7 +44,6 @@
#define __VIDEO_DECODER_H__
#include "precomp.hpp"
#include "cu_safe_call.h"
#if defined(HAVE_CUDA) && defined(HAVE_NVCUVID)
...
...
modules/gpu/src/video_parser.cpp
View file @
193e8573
...
...
@@ -41,7 +41,6 @@
//M*/
#include "video_parser.h"
#include "cu_safe_call.h"
#if defined(HAVE_CUDA) && defined(HAVE_NVCUVID)
...
...
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