Commit 18358521 authored by Roman Donchenko's avatar Roman Donchenko Committed by OpenCV Buildbot

Merge pull request #1162 from jet47:cudev-integration

parents 99624628 6dfd8f18
set(the_description "The Core Functionality")
ocv_add_module(core ${ZLIB_LIBRARIES})
ocv_add_module(core ${ZLIB_LIBRARIES} OPTIONAL opencv_cudev)
ocv_module_include_directories(${ZLIB_INCLUDE_DIR})
if (HAVE_WINRT)
......@@ -7,7 +7,7 @@ if (HAVE_WINRT)
endif()
if(HAVE_CUDA)
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef)
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wenum-compare -Wunused-function)
endif()
file(GLOB lib_cuda_hdrs "include/opencv2/${name}/cuda/*.hpp" "include/opencv2/${name}/cuda/*.h")
......
......@@ -498,6 +498,11 @@ namespace gpu
class CV_EXPORTS Event;
}
namespace cudev
{
template <typename _Tp> class GpuMat_;
}
} // cv
#endif //__OPENCV_CORE_BASE_HPP__
......@@ -96,6 +96,7 @@ public:
_InputArray(const gpu::GpuMat& d_mat);
_InputArray(const ogl::Buffer& buf);
_InputArray(const gpu::CudaMem& cuda_mem);
template<typename _Tp> _InputArray(const cudev::GpuMat_<_Tp>& m);
virtual Mat getMat(int i=-1) const;
virtual void getMatVector(std::vector<Mat>& mv) const;
......@@ -144,6 +145,7 @@ public:
_OutputArray(gpu::GpuMat& d_mat);
_OutputArray(ogl::Buffer& buf);
_OutputArray(gpu::CudaMem& cuda_mem);
template<typename _Tp> _OutputArray(cudev::GpuMat_<_Tp>& m);
template<typename _Tp> _OutputArray(std::vector<_Tp>& vec);
template<typename _Tp> _OutputArray(std::vector<std::vector<_Tp> >& vec);
template<typename _Tp> _OutputArray(std::vector<Mat_<_Tp> >& vec);
......@@ -156,6 +158,7 @@ public:
_OutputArray(const gpu::GpuMat& d_mat);
_OutputArray(const ogl::Buffer& buf);
_OutputArray(const gpu::CudaMem& cuda_mem);
template<typename _Tp> _OutputArray(const cudev::GpuMat_<_Tp>& m);
template<typename _Tp> _OutputArray(const std::vector<_Tp>& vec);
template<typename _Tp> _OutputArray(const std::vector<std::vector<_Tp> >& vec);
template<typename _Tp> _OutputArray(const std::vector<Mat_<_Tp> >& vec);
......
This diff is collapsed.
This diff is collapsed.
/*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*/
#include "opencv2/core/cuda/common.hpp"
namespace cv { namespace gpu { namespace cudev
{
void copyWithMask(PtrStepSzb src, PtrStepSzb dst, size_t elemSize1, int cn, PtrStepSzb mask, bool multiChannelMask, cudaStream_t stream);
template <typename T>
void set(PtrStepSz<T> mat, const T* scalar, int channels, cudaStream_t stream);
template <typename T>
void set(PtrStepSz<T> mat, const T* scalar, PtrStepSzb mask, int channels, cudaStream_t stream);
void convert(PtrStepSzb src, int sdepth, PtrStepSzb dst, int ddepth, double alpha, double beta, cudaStream_t stream);
}}}
This diff is collapsed.
......@@ -335,4 +335,27 @@ __host__ GpuMat_<T>& GpuMat_<T>::assign(const Expr<Body>& expr, Stream& stream)
}}
// Input / Output Arrays
namespace cv {
template<typename _Tp>
__host__ _InputArray::_InputArray(const cudev::GpuMat_<_Tp>& m)
: flags(FIXED_TYPE + GPU_MAT + DataType<_Tp>::type), obj((void*)&m)
{}
template<typename _Tp>
__host__ _OutputArray::_OutputArray(cudev::GpuMat_<_Tp>& m)
: _InputArray(m)
{}
template<typename _Tp>
__host__ _OutputArray::_OutputArray(const cudev::GpuMat_<_Tp>& m)
: _InputArray(m)
{
flags |= FIXED_SIZE;
}
}
#endif
......@@ -91,6 +91,17 @@ __host__ GlobPtrSz<T> globPtr(T* data, size_t step, int rows, int cols)
return p;
}
template <typename T>
__host__ GlobPtrSz<T> globPtr(const GpuMat& mat)
{
GlobPtrSz<T> p;
p.data = (T*) mat.data;
p.step = mat.step;
p.rows = mat.rows;
p.cols = mat.cols;
return p;
}
template <typename T> struct PtrTraits< GlobPtrSz<T> > : PtrTraitsBase<GlobPtrSz<T>, GlobPtr<T> >
{
};
......
......@@ -230,22 +230,22 @@ namespace
switch (srcType)
{
case CV_8UC1:
func_ = cudev::filter2D<uchar, uchar>;
func_ = cv::gpu::cudev::filter2D<uchar, uchar>;
break;
case CV_8UC4:
func_ = cudev::filter2D<uchar4, uchar4>;
func_ = cv::gpu::cudev::filter2D<uchar4, uchar4>;
break;
case CV_16UC1:
func_ = cudev::filter2D<ushort, ushort>;
func_ = cv::gpu::cudev::filter2D<ushort, ushort>;
break;
case CV_16UC4:
func_ = cudev::filter2D<ushort4, ushort4>;
func_ = cv::gpu::cudev::filter2D<ushort4, ushort4>;
break;
case CV_32FC1:
func_ = cudev::filter2D<float, float>;
func_ = cv::gpu::cudev::filter2D<float, float>;
break;
case CV_32FC4:
func_ = cudev::filter2D<float4, float4>;
func_ = cv::gpu::cudev::filter2D<float4, float4>;
break;
}
}
......
......@@ -187,7 +187,7 @@ namespace
_dst.create(src.size(), CV_8UC2);
GpuMat dst = _dst.getGpuMat();
cudev::bgr_to_bgr555(src, dst, StreamAccessor::getStream(stream));
cv::gpu::cudev::bgr_to_bgr555(src, dst, StreamAccessor::getStream(stream));
}
void bgr_to_bgr565(InputArray _src, OutputArray _dst, int, Stream& stream)
......@@ -200,7 +200,7 @@ namespace
_dst.create(src.size(), CV_8UC2);
GpuMat dst = _dst.getGpuMat();
cudev::bgr_to_bgr565(src, dst, StreamAccessor::getStream(stream));
cv::gpu::cudev::bgr_to_bgr565(src, dst, StreamAccessor::getStream(stream));
}
void rgb_to_bgr555(InputArray _src, OutputArray _dst, int, Stream& stream)
......@@ -213,7 +213,7 @@ namespace
_dst.create(src.size(), CV_8UC2);
GpuMat dst = _dst.getGpuMat();
cudev::rgb_to_bgr555(src, dst, StreamAccessor::getStream(stream));
cv::gpu::cudev::rgb_to_bgr555(src, dst, StreamAccessor::getStream(stream));
}
void rgb_to_bgr565(InputArray _src, OutputArray _dst, int, Stream& stream)
......@@ -226,7 +226,7 @@ namespace
_dst.create(src.size(), CV_8UC2);
GpuMat dst = _dst.getGpuMat();
cudev::rgb_to_bgr565(src, dst, StreamAccessor::getStream(stream));
cv::gpu::cudev::rgb_to_bgr565(src, dst, StreamAccessor::getStream(stream));
}
void bgra_to_bgr555(InputArray _src, OutputArray _dst, int, Stream& stream)
......@@ -239,7 +239,7 @@ namespace
_dst.create(src.size(), CV_8UC2);
GpuMat dst = _dst.getGpuMat();
cudev::bgra_to_bgr555(src, dst, StreamAccessor::getStream(stream));
cv::gpu::cudev::bgra_to_bgr555(src, dst, StreamAccessor::getStream(stream));
}
void bgra_to_bgr565(InputArray _src, OutputArray _dst, int, Stream& stream)
......@@ -252,7 +252,7 @@ namespace
_dst.create(src.size(), CV_8UC2);
GpuMat dst = _dst.getGpuMat();
cudev::bgra_to_bgr565(src, dst, StreamAccessor::getStream(stream));
cv::gpu::cudev::bgra_to_bgr565(src, dst, StreamAccessor::getStream(stream));
}
void rgba_to_bgr555(InputArray _src, OutputArray _dst, int, Stream& stream)
......@@ -265,7 +265,7 @@ namespace
_dst.create(src.size(), CV_8UC2);
GpuMat dst = _dst.getGpuMat();
cudev::rgba_to_bgr555(src, dst, StreamAccessor::getStream(stream));
cv::gpu::cudev::rgba_to_bgr555(src, dst, StreamAccessor::getStream(stream));
}
void rgba_to_bgr565(InputArray _src, OutputArray _dst, int, Stream& stream)
......@@ -278,7 +278,7 @@ namespace
_dst.create(src.size(), CV_8UC2);
GpuMat dst = _dst.getGpuMat();
cudev::rgba_to_bgr565(src, dst, StreamAccessor::getStream(stream));
cv::gpu::cudev::rgba_to_bgr565(src, dst, StreamAccessor::getStream(stream));
}
void bgr555_to_rgb(InputArray _src, OutputArray _dst, int, Stream& stream)
......@@ -291,7 +291,7 @@ namespace
_dst.create(src.size(), CV_8UC3);
GpuMat dst = _dst.getGpuMat();
cudev::bgr555_to_rgb(src, dst, StreamAccessor::getStream(stream));
cv::gpu::cudev::bgr555_to_rgb(src, dst, StreamAccessor::getStream(stream));
}
void bgr565_to_rgb(InputArray _src, OutputArray _dst, int, Stream& stream)
......@@ -304,7 +304,7 @@ namespace
_dst.create(src.size(), CV_8UC3);
GpuMat dst = _dst.getGpuMat();
cudev::bgr565_to_rgb(src, dst, StreamAccessor::getStream(stream));
cv::gpu::cudev::bgr565_to_rgb(src, dst, StreamAccessor::getStream(stream));
}
void bgr555_to_bgr(InputArray _src, OutputArray _dst, int, Stream& stream)
......@@ -317,7 +317,7 @@ namespace
_dst.create(src.size(), CV_8UC3);
GpuMat dst = _dst.getGpuMat();
cudev::bgr555_to_bgr(src, dst, StreamAccessor::getStream(stream));
cv::gpu::cudev::bgr555_to_bgr(src, dst, StreamAccessor::getStream(stream));
}
void bgr565_to_bgr(InputArray _src, OutputArray _dst, int, Stream& stream)
......@@ -330,7 +330,7 @@ namespace
_dst.create(src.size(), CV_8UC3);
GpuMat dst = _dst.getGpuMat();
cudev::bgr565_to_bgr(src, dst, StreamAccessor::getStream(stream));
cv::gpu::cudev::bgr565_to_bgr(src, dst, StreamAccessor::getStream(stream));
}
void bgr555_to_rgba(InputArray _src, OutputArray _dst, int, Stream& stream)
......@@ -343,7 +343,7 @@ namespace
_dst.create(src.size(), CV_8UC4);
GpuMat dst = _dst.getGpuMat();
cudev::bgr555_to_rgba(src, dst, StreamAccessor::getStream(stream));
cv::gpu::cudev::bgr555_to_rgba(src, dst, StreamAccessor::getStream(stream));
}
void bgr565_to_rgba(InputArray _src, OutputArray _dst, int, Stream& stream)
......@@ -356,7 +356,7 @@ namespace
_dst.create(src.size(), CV_8UC4);
GpuMat dst = _dst.getGpuMat();
cudev::bgr565_to_rgba(src, dst, StreamAccessor::getStream(stream));
cv::gpu::cudev::bgr565_to_rgba(src, dst, StreamAccessor::getStream(stream));
}
void bgr555_to_bgra(InputArray _src, OutputArray _dst, int, Stream& stream)
......@@ -369,7 +369,7 @@ namespace
_dst.create(src.size(), CV_8UC4);
GpuMat dst = _dst.getGpuMat();
cudev::bgr555_to_bgra(src, dst, StreamAccessor::getStream(stream));
cv::gpu::cudev::bgr555_to_bgra(src, dst, StreamAccessor::getStream(stream));
}
void bgr565_to_bgra(InputArray _src, OutputArray _dst, int, Stream& stream)
......@@ -382,7 +382,7 @@ namespace
_dst.create(src.size(), CV_8UC4);
GpuMat dst = _dst.getGpuMat();
cudev::bgr565_to_bgra(src, dst, StreamAccessor::getStream(stream));
cv::gpu::cudev::bgr565_to_bgra(src, dst, StreamAccessor::getStream(stream));
}
void gray_to_bgr(InputArray _src, OutputArray _dst, int, Stream& stream)
......@@ -427,7 +427,7 @@ namespace
_dst.create(src.size(), CV_8UC2);
GpuMat dst = _dst.getGpuMat();
cudev::gray_to_bgr555(src, dst, StreamAccessor::getStream(stream));
cv::gpu::cudev::gray_to_bgr555(src, dst, StreamAccessor::getStream(stream));
}
void gray_to_bgr565(InputArray _src, OutputArray _dst, int, Stream& stream)
......@@ -440,7 +440,7 @@ namespace
_dst.create(src.size(), CV_8UC2);
GpuMat dst = _dst.getGpuMat();
cudev::gray_to_bgr565(src, dst, StreamAccessor::getStream(stream));
cv::gpu::cudev::gray_to_bgr565(src, dst, StreamAccessor::getStream(stream));
}
void bgr555_to_gray(InputArray _src, OutputArray _dst, int, Stream& stream)
......@@ -453,7 +453,7 @@ namespace
_dst.create(src.size(), CV_8UC1);
GpuMat dst = _dst.getGpuMat();
cudev::bgr555_to_gray(src, dst, StreamAccessor::getStream(stream));
cv::gpu::cudev::bgr555_to_gray(src, dst, StreamAccessor::getStream(stream));
}
void bgr565_to_gray(InputArray _src, OutputArray _dst, int, Stream& stream)
......@@ -466,7 +466,7 @@ namespace
_dst.create(src.size(), CV_8UC1);
GpuMat dst = _dst.getGpuMat();
cudev::bgr565_to_gray(src, dst, StreamAccessor::getStream(stream));
cv::gpu::cudev::bgr565_to_gray(src, dst, StreamAccessor::getStream(stream));
}
void rgb_to_gray(InputArray _src, OutputArray _dst, int, Stream& stream)
......@@ -2145,9 +2145,9 @@ void cv::gpu::demosaicing(InputArray _src, OutputArray _dst, int code, int dcn,
code == COLOR_BayerRG2BGR_MHT || code == COLOR_BayerGR2BGR_MHT ? 0 : 1);
if (dcn == 3)
cudev::MHCdemosaic<3>(srcWhole, make_int2(ofs.x, ofs.y), dst, firstRed, StreamAccessor::getStream(stream));
cv::gpu::cudev::MHCdemosaic<3>(srcWhole, make_int2(ofs.x, ofs.y), dst, firstRed, StreamAccessor::getStream(stream));
else
cudev::MHCdemosaic<4>(srcWhole, make_int2(ofs.x, ofs.y), dst, firstRed, StreamAccessor::getStream(stream));
cv::gpu::cudev::MHCdemosaic<4>(srcWhole, make_int2(ofs.x, ofs.y), dst, firstRed, StreamAccessor::getStream(stream));
break;
}
......@@ -2172,7 +2172,7 @@ void cv::gpu::demosaicing(InputArray _src, OutputArray _dst, int code, int dcn,
const int2 firstRed = make_int2(code == COLOR_BayerRG2BGR_MHT || code == COLOR_BayerGB2BGR_MHT ? 0 : 1,
code == COLOR_BayerRG2BGR_MHT || code == COLOR_BayerGR2BGR_MHT ? 0 : 1);
cudev::MHCdemosaic<1>(srcWhole, make_int2(ofs.x, ofs.y), dst, firstRed, StreamAccessor::getStream(stream));
cv::gpu::cudev::MHCdemosaic<1>(srcWhole, make_int2(ofs.x, ofs.y), dst, firstRed, StreamAccessor::getStream(stream));
break;
}
......
......@@ -181,7 +181,7 @@ namespace
const GpuMat& prevLayer = i == 0 ? layer0_ : pyramid_[i - 1];
cudev::pyramid::downsampleX2(prevLayer, pyramid_[i], img.depth(), img.channels(), StreamAccessor::getStream(stream));
cv::gpu::cudev::pyramid::downsampleX2(prevLayer, pyramid_[i], img.depth(), img.channels(), StreamAccessor::getStream(stream));
szLastLayer = szCurLayer;
}
......@@ -222,7 +222,7 @@ namespace
lastLayer = curLayer;
}
cudev::pyramid::interpolateFrom1(lastLayer, outImg, outImg.depth(), outImg.channels(), StreamAccessor::getStream(stream));
cv::gpu::cudev::pyramid::interpolateFrom1(lastLayer, outImg, outImg.depth(), outImg.channels(), StreamAccessor::getStream(stream));
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment