Commit 948661d7 authored by Vladislav Vinogradov's avatar Vladislav Vinogradov

switched to Input/Output Array in gpu::gemm

parent 8fcef225
...@@ -350,9 +350,8 @@ static inline void sqrIntegral(InputArray src, OutputArray sqsum, Stream& stream ...@@ -350,9 +350,8 @@ static inline void sqrIntegral(InputArray src, OutputArray sqsum, Stream& stream
sqrIntegral(src, sqsum, buffer, stream); sqrIntegral(src, sqsum, buffer, stream);
} }
//! implements generalized matrix product algorithm GEMM from BLAS CV_EXPORTS void gemm(InputArray src1, InputArray src2, double alpha,
CV_EXPORTS void gemm(const GpuMat& src1, const GpuMat& src2, double alpha, InputArray src3, double beta, OutputArray dst, int flags = 0, Stream& stream = Stream::Null());
const GpuMat& src3, double beta, GpuMat& dst, int flags = 0, Stream& stream = Stream::Null());
//! performs per-element multiplication of two full (not packed) Fourier spectrums //! performs per-element multiplication of two full (not packed) Fourier spectrums
//! supports 32FC2 matrixes only (interleaved format) //! supports 32FC2 matrixes only (interleaved format)
......
...@@ -47,7 +47,7 @@ using namespace cv::gpu; ...@@ -47,7 +47,7 @@ using namespace cv::gpu;
#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) #if !defined (HAVE_CUDA) || defined (CUDA_DISABLER)
void cv::gpu::gemm(const GpuMat&, const GpuMat&, double, const GpuMat&, double, GpuMat&, int, Stream&) { throw_no_cuda(); } void cv::gpu::gemm(InputArray, InputArray, double, InputArray, double, OutputArray, int, Stream&) { throw_no_cuda(); }
void cv::gpu::mulSpectrums(const GpuMat&, const GpuMat&, GpuMat&, int, bool, Stream&) { throw_no_cuda(); } void cv::gpu::mulSpectrums(const GpuMat&, const GpuMat&, GpuMat&, int, bool, Stream&) { throw_no_cuda(); }
void cv::gpu::mulAndScaleSpectrums(const GpuMat&, const GpuMat&, GpuMat&, int, float, bool, Stream&) { throw_no_cuda(); } void cv::gpu::mulAndScaleSpectrums(const GpuMat&, const GpuMat&, GpuMat&, int, float, bool, Stream&) { throw_no_cuda(); }
...@@ -164,23 +164,27 @@ namespace ...@@ -164,23 +164,27 @@ namespace
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// gemm // gemm
void cv::gpu::gemm(const GpuMat& src1, const GpuMat& src2, double alpha, const GpuMat& src3, double beta, GpuMat& dst, int flags, Stream& stream) void cv::gpu::gemm(InputArray _src1, InputArray _src2, double alpha, InputArray _src3, double beta, OutputArray _dst, int flags, Stream& stream)
{ {
#ifndef HAVE_CUBLAS #ifndef HAVE_CUBLAS
(void)src1; (void) _src1;
(void)src2; (void) _src2;
(void)alpha; (void) alpha;
(void)src3; (void) _src3;
(void)beta; (void) beta;
(void)dst; (void) _dst;
(void)flags; (void) flags;
(void)stream; (void) stream;
CV_Error(cv::Error::StsNotImplemented, "The library was build without CUBLAS"); CV_Error(:Error::StsNotImplemented, "The library was build without CUBLAS");
#else #else
// CUBLAS works with column-major matrices // CUBLAS works with column-major matrices
CV_Assert(src1.type() == CV_32FC1 || src1.type() == CV_32FC2 || src1.type() == CV_64FC1 || src1.type() == CV_64FC2); GpuMat src1 = _src1.getGpuMat();
CV_Assert(src2.type() == src1.type() && (src3.empty() || src3.type() == src1.type())); GpuMat src2 = _src2.getGpuMat();
GpuMat src3 = _src3.getGpuMat();
CV_Assert( src1.type() == CV_32FC1 || src1.type() == CV_32FC2 || src1.type() == CV_64FC1 || src1.type() == CV_64FC2 );
CV_Assert( src2.type() == src1.type() && (src3.empty() || src3.type() == src1.type()) );
if (src1.depth() == CV_64F) if (src1.depth() == CV_64F)
{ {
...@@ -203,10 +207,11 @@ void cv::gpu::gemm(const GpuMat& src1, const GpuMat& src2, double alpha, const G ...@@ -203,10 +207,11 @@ void cv::gpu::gemm(const GpuMat& src1, const GpuMat& src2, double alpha, const G
Size src3Size = tr3 ? Size(src3.rows, src3.cols) : src3.size(); Size src3Size = tr3 ? Size(src3.rows, src3.cols) : src3.size();
Size dstSize(src2Size.width, src1Size.height); Size dstSize(src2Size.width, src1Size.height);
CV_Assert(src1Size.width == src2Size.height); CV_Assert( src1Size.width == src2Size.height );
CV_Assert(src3.empty() || src3Size == dstSize); CV_Assert( src3.empty() || src3Size == dstSize );
dst.create(dstSize, src1.type()); _dst.create(dstSize, src1.type());
GpuMat dst = _dst.getGpuMat();
if (beta != 0) if (beta != 0)
{ {
......
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