From dc69cf3ab4bcb8eae0dc8704880a13cb76715350 Mon Sep 17 00:00:00 2001 From: Anatoly Baksheev Date: Wed, 28 Jul 2010 13:38:37 +0000 Subject: [PATCH] minor fixes --- modules/gpu/src/cuda/matrix_operations.cu | 6 +- modules/gpu/src/cuda/saturate_cast.hpp | 126 +++++++++++++++--------------- modules/gpu/src/matrix_operations.cpp | 2 +- 3 files changed, 67 insertions(+), 67 deletions(-) diff --git a/modules/gpu/src/cuda/matrix_operations.cu b/modules/gpu/src/cuda/matrix_operations.cu index 0c56fcc..fe730cc 100644 --- a/modules/gpu/src/cuda/matrix_operations.cu +++ b/modules/gpu/src/cuda/matrix_operations.cu @@ -304,7 +304,7 @@ namespace cv CopyToFunc func = tab[depth]; - if (func == 0) cv::gpu::error("Unsupported convert operation", __FILE__, __LINE__); + if (func == 0) cv::gpu::error("Unsupported copyTo operation", __FILE__, __LINE__); func(mat_src, mat_dst, mask, channels, stream); } @@ -371,7 +371,7 @@ namespace cv SetToFunc_without_mask func = tab[depth]; if (func == 0) - cv::gpu::error("Unsupported convert operation", __FILE__, __LINE__); + cv::gpu::error("Unsupported setTo operation", __FILE__, __LINE__); func(mat, channels, stream); } @@ -396,7 +396,7 @@ namespace cv SetToFunc_with_mask func = tab[depth]; if (func == 0) - cv::gpu::error("Unsupported convert operation", __FILE__, __LINE__); + cv::gpu::error("Unsupported setTo operation", __FILE__, __LINE__); func(mat, mask, channels, stream); } diff --git a/modules/gpu/src/cuda/saturate_cast.hpp b/modules/gpu/src/cuda/saturate_cast.hpp index c8fbc7e..c46b276 100644 --- a/modules/gpu/src/cuda/saturate_cast.hpp +++ b/modules/gpu/src/cuda/saturate_cast.hpp @@ -1,54 +1,54 @@ -/*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 __OPENCV_GPU_SATURATE_CAST_HPP__ -#define __OPENCV_GPU_SATURATE_CAST_HPP__ - -#include "cuda_shared.hpp" - -namespace cv -{ - namespace gpu - { +/*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 __OPENCV_GPU_SATURATE_CAST_HPP__ +#define __OPENCV_GPU_SATURATE_CAST_HPP__ + +#include "cuda_shared.hpp" + +namespace cv +{ + namespace gpu + { template __device__ _Tp saturate_cast(uchar v) { return _Tp(v); } template __device__ _Tp saturate_cast(schar v) { return _Tp(v); } template __device__ _Tp saturate_cast(ushort v) { return _Tp(v); } @@ -73,7 +73,7 @@ namespace cv { int iv = __float2int_rn(v); return saturate_cast(iv); } template<> __device__ uchar saturate_cast(double v) { - #if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 130 + #if defined (__CUDA_ARCH__) && __CUDA_ARCH__ >= 130 int iv = __double2int_rn(v); return saturate_cast(iv); #else return saturate_cast((float)v); @@ -98,7 +98,7 @@ namespace cv { int iv = __float2int_rn(v); return saturate_cast(iv); } template<> __device__ schar saturate_cast(double v) { - #if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 130 + #if defined (__CUDA_ARCH__) && __CUDA_ARCH__ >= 130 int iv = __double2int_rn(v); return saturate_cast(iv); #else return saturate_cast((float)v); @@ -117,7 +117,7 @@ namespace cv { int iv = __float2int_rn(v); return saturate_cast(iv); } template<> __device__ ushort saturate_cast(double v) { - #if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 130 + #if defined (__CUDA_ARCH__) && __CUDA_ARCH__ >= 130 int iv = __double2int_rn(v); return saturate_cast(iv); #else return saturate_cast((float)v); @@ -137,7 +137,7 @@ namespace cv { int iv = __float2int_rn(v); return saturate_cast(iv); } template<> __device__ short saturate_cast(double v) { - #if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 130 + #if defined (__CUDA_ARCH__) && __CUDA_ARCH__ >= 130 int iv = __double2int_rn(v); return saturate_cast(iv); #else return saturate_cast((float)v); @@ -147,7 +147,7 @@ namespace cv template<> __device__ int saturate_cast(float v) { return __float2int_rn(v); } template<> __device__ int saturate_cast(double v) { - #if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 130 + #if defined (__CUDA_ARCH__) && __CUDA_ARCH__ >= 130 return __double2int_rn(v); #else return saturate_cast((float)v); @@ -155,15 +155,15 @@ namespace cv } template<> __device__ uint saturate_cast(float v){ return __float2uint_rn(v); } - template<> __device__ uint saturate_cast(double v) + template<> __device__ uint saturate_cast(double v) { - #if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 130 + #if defined (__CUDA_ARCH__) && __CUDA_ARCH__ >= 130 return __double2uint_rn(v); #else return saturate_cast((float)v); - #endif - } - } -} - + #endif + } + } +} + #endif /* __OPENCV_GPU_SATURATE_CAST_HPP__ */ \ No newline at end of file diff --git a/modules/gpu/src/matrix_operations.cpp b/modules/gpu/src/matrix_operations.cpp index d62435f..f0e0e7e 100644 --- a/modules/gpu/src/matrix_operations.cpp +++ b/modules/gpu/src/matrix_operations.cpp @@ -149,7 +149,7 @@ void cv::gpu::GpuMat::convertTo( GpuMat& dst, int rtype, double alpha, double be GpuMat& GpuMat::operator = (const Scalar& s) { - cv::gpu::impl::set_to_without_mask( *this, depth(), s.val, channels()); + impl::set_to_without_mask( *this, depth(), s.val, channels()); return *this; } -- 2.7.4