minor fixes
This commit is contained in:
parent
f7c98c86b3
commit
dc69cf3ab4
@ -304,7 +304,7 @@ namespace cv
|
|||||||
|
|
||||||
CopyToFunc func = tab[depth];
|
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);
|
func(mat_src, mat_dst, mask, channels, stream);
|
||||||
}
|
}
|
||||||
@ -371,7 +371,7 @@ namespace cv
|
|||||||
SetToFunc_without_mask func = tab[depth];
|
SetToFunc_without_mask func = tab[depth];
|
||||||
|
|
||||||
if (func == 0)
|
if (func == 0)
|
||||||
cv::gpu::error("Unsupported convert operation", __FILE__, __LINE__);
|
cv::gpu::error("Unsupported setTo operation", __FILE__, __LINE__);
|
||||||
|
|
||||||
func(mat, channels, stream);
|
func(mat, channels, stream);
|
||||||
}
|
}
|
||||||
@ -396,7 +396,7 @@ namespace cv
|
|||||||
SetToFunc_with_mask func = tab[depth];
|
SetToFunc_with_mask func = tab[depth];
|
||||||
|
|
||||||
if (func == 0)
|
if (func == 0)
|
||||||
cv::gpu::error("Unsupported convert operation", __FILE__, __LINE__);
|
cv::gpu::error("Unsupported setTo operation", __FILE__, __LINE__);
|
||||||
|
|
||||||
func(mat, mask, channels, stream);
|
func(mat, mask, channels, stream);
|
||||||
}
|
}
|
||||||
|
@ -1,54 +1,54 @@
|
|||||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||||
//
|
//
|
||||||
// By downloading, copying, installing or using the software you agree to this license.
|
// 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,
|
// If you do not agree to this license, do not download, install,
|
||||||
// copy or use the software.
|
// copy or use the software.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// License Agreement
|
// License Agreement
|
||||||
// For Open Source Computer Vision Library
|
// For Open Source Computer Vision Library
|
||||||
//
|
//
|
||||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||||
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||||
// Third party copyrights are property of their respective owners.
|
// Third party copyrights are property of their respective owners.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without modification,
|
// Redistribution and use in source and binary forms, with or without modification,
|
||||||
// are permitted provided that the following conditions are met:
|
// are permitted provided that the following conditions are met:
|
||||||
//
|
//
|
||||||
// * Redistribution's of source code must retain the above copyright notice,
|
// * Redistribution's of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
//
|
//
|
||||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
//
|
//
|
||||||
// * The name of the copyright holders may not be used to endorse or promote products
|
// * The name of the copyright holders may not be used to endorse or promote products
|
||||||
// derived from this software without specific prior written permission.
|
// derived from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// This software is provided by the copyright holders and contributors "as is" and
|
// 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
|
// any express or implied warranties, including, but not limited to, the implied
|
||||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
// 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,
|
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||||
// indirect, incidental, special, exemplary, or consequential damages
|
// indirect, incidental, special, exemplary, or consequential damages
|
||||||
// (including, but not limited to, procurement of substitute goods or services;
|
// (including, but not limited to, procurement of substitute goods or services;
|
||||||
// loss of use, data, or profits; or business interruption) however caused
|
// loss of use, data, or profits; or business interruption) however caused
|
||||||
// and on any theory of liability, whether in contract, strict liability,
|
// and on any theory of liability, whether in contract, strict liability,
|
||||||
// or tort (including negligence or otherwise) arising in any way out of
|
// 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.
|
// the use of this software, even if advised of the possibility of such damage.
|
||||||
//
|
//
|
||||||
//M*/
|
//M*/
|
||||||
|
|
||||||
#ifndef __OPENCV_GPU_SATURATE_CAST_HPP__
|
#ifndef __OPENCV_GPU_SATURATE_CAST_HPP__
|
||||||
#define __OPENCV_GPU_SATURATE_CAST_HPP__
|
#define __OPENCV_GPU_SATURATE_CAST_HPP__
|
||||||
|
|
||||||
#include "cuda_shared.hpp"
|
#include "cuda_shared.hpp"
|
||||||
|
|
||||||
namespace cv
|
namespace cv
|
||||||
{
|
{
|
||||||
namespace gpu
|
namespace gpu
|
||||||
{
|
{
|
||||||
template<typename _Tp> __device__ _Tp saturate_cast(uchar v) { return _Tp(v); }
|
template<typename _Tp> __device__ _Tp saturate_cast(uchar v) { return _Tp(v); }
|
||||||
template<typename _Tp> __device__ _Tp saturate_cast(schar v) { return _Tp(v); }
|
template<typename _Tp> __device__ _Tp saturate_cast(schar v) { return _Tp(v); }
|
||||||
template<typename _Tp> __device__ _Tp saturate_cast(ushort v) { return _Tp(v); }
|
template<typename _Tp> __device__ _Tp saturate_cast(ushort v) { return _Tp(v); }
|
||||||
@ -73,7 +73,7 @@ namespace cv
|
|||||||
{ int iv = __float2int_rn(v); return saturate_cast<uchar>(iv); }
|
{ int iv = __float2int_rn(v); return saturate_cast<uchar>(iv); }
|
||||||
template<> __device__ uchar saturate_cast<uchar>(double v)
|
template<> __device__ uchar saturate_cast<uchar>(double v)
|
||||||
{
|
{
|
||||||
#if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 130
|
#if defined (__CUDA_ARCH__) && __CUDA_ARCH__ >= 130
|
||||||
int iv = __double2int_rn(v); return saturate_cast<uchar>(iv);
|
int iv = __double2int_rn(v); return saturate_cast<uchar>(iv);
|
||||||
#else
|
#else
|
||||||
return saturate_cast<uchar>((float)v);
|
return saturate_cast<uchar>((float)v);
|
||||||
@ -98,7 +98,7 @@ namespace cv
|
|||||||
{ int iv = __float2int_rn(v); return saturate_cast<schar>(iv); }
|
{ int iv = __float2int_rn(v); return saturate_cast<schar>(iv); }
|
||||||
template<> __device__ schar saturate_cast<schar>(double v)
|
template<> __device__ schar saturate_cast<schar>(double v)
|
||||||
{
|
{
|
||||||
#if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 130
|
#if defined (__CUDA_ARCH__) && __CUDA_ARCH__ >= 130
|
||||||
int iv = __double2int_rn(v); return saturate_cast<schar>(iv);
|
int iv = __double2int_rn(v); return saturate_cast<schar>(iv);
|
||||||
#else
|
#else
|
||||||
return saturate_cast<schar>((float)v);
|
return saturate_cast<schar>((float)v);
|
||||||
@ -117,7 +117,7 @@ namespace cv
|
|||||||
{ int iv = __float2int_rn(v); return saturate_cast<ushort>(iv); }
|
{ int iv = __float2int_rn(v); return saturate_cast<ushort>(iv); }
|
||||||
template<> __device__ ushort saturate_cast<ushort>(double v)
|
template<> __device__ ushort saturate_cast<ushort>(double v)
|
||||||
{
|
{
|
||||||
#if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 130
|
#if defined (__CUDA_ARCH__) && __CUDA_ARCH__ >= 130
|
||||||
int iv = __double2int_rn(v); return saturate_cast<ushort>(iv);
|
int iv = __double2int_rn(v); return saturate_cast<ushort>(iv);
|
||||||
#else
|
#else
|
||||||
return saturate_cast<ushort>((float)v);
|
return saturate_cast<ushort>((float)v);
|
||||||
@ -137,7 +137,7 @@ namespace cv
|
|||||||
{ int iv = __float2int_rn(v); return saturate_cast<short>(iv); }
|
{ int iv = __float2int_rn(v); return saturate_cast<short>(iv); }
|
||||||
template<> __device__ short saturate_cast<short>(double v)
|
template<> __device__ short saturate_cast<short>(double v)
|
||||||
{
|
{
|
||||||
#if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 130
|
#if defined (__CUDA_ARCH__) && __CUDA_ARCH__ >= 130
|
||||||
int iv = __double2int_rn(v); return saturate_cast<short>(iv);
|
int iv = __double2int_rn(v); return saturate_cast<short>(iv);
|
||||||
#else
|
#else
|
||||||
return saturate_cast<short>((float)v);
|
return saturate_cast<short>((float)v);
|
||||||
@ -147,7 +147,7 @@ namespace cv
|
|||||||
template<> __device__ int saturate_cast<int>(float v) { return __float2int_rn(v); }
|
template<> __device__ int saturate_cast<int>(float v) { return __float2int_rn(v); }
|
||||||
template<> __device__ int saturate_cast<int>(double v)
|
template<> __device__ int saturate_cast<int>(double v)
|
||||||
{
|
{
|
||||||
#if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 130
|
#if defined (__CUDA_ARCH__) && __CUDA_ARCH__ >= 130
|
||||||
return __double2int_rn(v);
|
return __double2int_rn(v);
|
||||||
#else
|
#else
|
||||||
return saturate_cast<int>((float)v);
|
return saturate_cast<int>((float)v);
|
||||||
@ -155,15 +155,15 @@ namespace cv
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<> __device__ uint saturate_cast<uint>(float v){ return __float2uint_rn(v); }
|
template<> __device__ uint saturate_cast<uint>(float v){ return __float2uint_rn(v); }
|
||||||
template<> __device__ uint saturate_cast<uint>(double v)
|
template<> __device__ uint saturate_cast<uint>(double v)
|
||||||
{
|
{
|
||||||
#if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 130
|
#if defined (__CUDA_ARCH__) && __CUDA_ARCH__ >= 130
|
||||||
return __double2uint_rn(v);
|
return __double2uint_rn(v);
|
||||||
#else
|
#else
|
||||||
return saturate_cast<uint>((float)v);
|
return saturate_cast<uint>((float)v);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __OPENCV_GPU_SATURATE_CAST_HPP__ */
|
#endif /* __OPENCV_GPU_SATURATE_CAST_HPP__ */
|
@ -149,7 +149,7 @@ void cv::gpu::GpuMat::convertTo( GpuMat& dst, int rtype, double alpha, double be
|
|||||||
|
|
||||||
GpuMat& GpuMat::operator = (const Scalar& s)
|
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;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user