From bf7c1c6c25790b07ece8e1b23996b99add1eee98 Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Fri, 7 Jun 2013 14:38:27 +0400 Subject: [PATCH] fixed NPP error constants usage --- .../core/include/opencv2/core/gpu_private.hpp | 2 + modules/core/src/gpumat.cpp | 78 ++++++++++++++----- 2 files changed, 62 insertions(+), 18 deletions(-) diff --git a/modules/core/include/opencv2/core/gpu_private.hpp b/modules/core/include/opencv2/core/gpu_private.hpp index 7692bc20e6..7a45a50f07 100644 --- a/modules/core/include/opencv2/core/gpu_private.hpp +++ b/modules/core/include/opencv2/core/gpu_private.hpp @@ -60,6 +60,8 @@ # include "opencv2/core/stream_accessor.hpp" # include "opencv2/core/cuda/common.hpp" +# define NPP_VERSION (NPP_VERSION_MAJOR * 1000 + NPP_VERSION_MINOR * 100 + NPP_VERSION_BUILD) + # define CUDART_MINIMUM_REQUIRED_VERSION 4020 # if (CUDART_VERSION < CUDART_MINIMUM_REQUIRED_VERSION) diff --git a/modules/core/src/gpumat.cpp b/modules/core/src/gpumat.cpp index 11bb41948a..9637f86489 100644 --- a/modules/core/src/gpumat.cpp +++ b/modules/core/src/gpumat.cpp @@ -1547,48 +1547,90 @@ namespace const ErrorEntry npp_errors [] = { - error_entry( NPP_NOT_SUPPORTED_MODE_ERROR ), - error_entry( NPP_ROUND_MODE_NOT_SUPPORTED_ERROR ), - error_entry( NPP_RESIZE_NO_OPERATION_ERROR ), - -#if defined (_MSC_VER) + #if defined (_MSC_VER) error_entry( NPP_NOT_SUFFICIENT_COMPUTE_CAPABILITY ), -#endif + #endif + #if NPP_VERSION < 5500 error_entry( NPP_BAD_ARG_ERROR ), - error_entry( NPP_LUT_NUMBER_OF_LEVELS_ERROR ), - error_entry( NPP_TEXTURE_BIND_ERROR ), error_entry( NPP_COEFF_ERROR ), error_entry( NPP_RECT_ERROR ), error_entry( NPP_QUAD_ERROR ), - error_entry( NPP_WRONG_INTERSECTION_ROI_ERROR ), - error_entry( NPP_NOT_EVEN_STEP_ERROR ), - error_entry( NPP_INTERPOLATION_ERROR ), - error_entry( NPP_RESIZE_FACTOR_ERROR ), - error_entry( NPP_HAAR_CLASSIFIER_PIXEL_MATCH_ERROR ), error_entry( NPP_MEMFREE_ERR ), error_entry( NPP_MEMSET_ERR ), - error_entry( NPP_MEMCPY_ERROR ), error_entry( NPP_MEM_ALLOC_ERR ), error_entry( NPP_HISTO_NUMBER_OF_LEVELS_ERROR ), error_entry( NPP_MIRROR_FLIP_ERR ), error_entry( NPP_INVALID_INPUT ), + error_entry( NPP_POINTER_ERROR ), + error_entry( NPP_WARNING ), + error_entry( NPP_ODD_ROI_WARNING ), + #else + error_entry( NPP_INVALID_HOST_POINTER_ERROR ), + error_entry( NPP_INVALID_DEVICE_POINTER_ERROR ), + error_entry( NPP_LUT_PALETTE_BITSIZE_ERROR ), + error_entry( NPP_ZC_MODE_NOT_SUPPORTED_ERROR ), + error_entry( NPP_MEMFREE_ERROR ), + error_entry( NPP_MEMSET_ERROR ), + error_entry( NPP_QUALITY_INDEX_ERROR ), + error_entry( NPP_HISTOGRAM_NUMBER_OF_LEVELS_ERROR ), + error_entry( NPP_CHANNEL_ORDER_ERROR ), + error_entry( NPP_ZERO_MASK_VALUE_ERROR ), + error_entry( NPP_QUADRANGLE_ERROR ), + error_entry( NPP_RECTANGLE_ERROR ), + error_entry( NPP_COEFFICIENT_ERROR ), + error_entry( NPP_NUMBER_OF_CHANNELS_ERROR ), + error_entry( NPP_COI_ERROR ), + error_entry( NPP_DIVISOR_ERROR ), + error_entry( NPP_CHANNEL_ERROR ), + error_entry( NPP_STRIDE_ERROR ), + error_entry( NPP_ANCHOR_ERROR ), + error_entry( NPP_MASK_SIZE_ERROR ), + error_entry( NPP_MIRROR_FLIP_ERROR ), + error_entry( NPP_MOMENT_00_ZERO_ERROR ), + error_entry( NPP_THRESHOLD_NEGATIVE_LEVEL_ERROR ), + error_entry( NPP_THRESHOLD_ERROR ), + error_entry( NPP_CONTEXT_MATCH_ERROR ), + error_entry( NPP_FFT_FLAG_ERROR ), + error_entry( NPP_FFT_ORDER_ERROR ), + error_entry( NPP_SCALE_RANGE_ERROR ), + error_entry( NPP_DATA_TYPE_ERROR ), + error_entry( NPP_OUT_OFF_RANGE_ERROR ), + error_entry( NPP_DIVIDE_BY_ZERO_ERROR ), + error_entry( NPP_MEMORY_ALLOCATION_ERR ), + error_entry( NPP_RANGE_ERROR ), + error_entry( NPP_BAD_ARGUMENT_ERROR ), + error_entry( NPP_NO_MEMORY_ERROR ), + error_entry( NPP_ERROR_RESERVED ), + error_entry( NPP_NO_OPERATION_WARNING ), + error_entry( NPP_DIVIDE_BY_ZERO_WARNING ), + error_entry( NPP_WRONG_INTERSECTION_ROI_WARNING ), + #endif + + error_entry( NPP_NOT_SUPPORTED_MODE_ERROR ), + error_entry( NPP_ROUND_MODE_NOT_SUPPORTED_ERROR ), + error_entry( NPP_RESIZE_NO_OPERATION_ERROR ), + error_entry( NPP_LUT_NUMBER_OF_LEVELS_ERROR ), + error_entry( NPP_TEXTURE_BIND_ERROR ), + error_entry( NPP_WRONG_INTERSECTION_ROI_ERROR ), + error_entry( NPP_NOT_EVEN_STEP_ERROR ), + error_entry( NPP_INTERPOLATION_ERROR ), + error_entry( NPP_RESIZE_FACTOR_ERROR ), + error_entry( NPP_HAAR_CLASSIFIER_PIXEL_MATCH_ERROR ), + error_entry( NPP_MEMCPY_ERROR ), error_entry( NPP_ALIGNMENT_ERROR ), error_entry( NPP_STEP_ERROR ), error_entry( NPP_SIZE_ERROR ), - error_entry( NPP_POINTER_ERROR ), error_entry( NPP_NULL_POINTER_ERROR ), error_entry( NPP_CUDA_KERNEL_EXECUTION_ERROR ), error_entry( NPP_NOT_IMPLEMENTED_ERROR ), error_entry( NPP_ERROR ), error_entry( NPP_NO_ERROR ), error_entry( NPP_SUCCESS ), - error_entry( NPP_WARNING ), error_entry( NPP_WRONG_INTERSECTION_QUAD_WARNING ), error_entry( NPP_MISALIGNED_DST_ROI_WARNING ), error_entry( NPP_AFFINE_QUAD_INCORRECT_WARNING ), - error_entry( NPP_DOUBLE_SIZE_WARNING ), - error_entry( NPP_ODD_ROI_WARNING ) + error_entry( NPP_DOUBLE_SIZE_WARNING ) }; const size_t npp_error_num = sizeof(npp_errors) / sizeof(npp_errors[0]);