Move Ptr-related code from lut.cu to lut.cpp

This commit is contained in:
Namgoo Lee 2019-03-13 18:52:11 +09:00
parent bd1342c164
commit a54affeb8d
4 changed files with 58 additions and 23 deletions

View File

@ -57,8 +57,6 @@ void cv::cuda::transpose(InputArray, OutputArray, Stream&) { throw_no_cuda(); }
void cv::cuda::flip(InputArray, OutputArray, int, Stream&) { throw_no_cuda(); }
Ptr<LookUpTable> cv::cuda::createLookUpTable(InputArray) { throw_no_cuda(); return Ptr<LookUpTable>(); }
void cv::cuda::copyMakeBorder(InputArray, OutputArray, int, int, int, int, int, Scalar, Stream&) { throw_no_cuda(); }
#else /* !defined (HAVE_CUDA) */

View File

@ -48,6 +48,8 @@
#else
#include "../lut.hpp"
#include "opencv2/cudaarithm.hpp"
#include "opencv2/cudev.hpp"
#include "opencv2/core/private.cuda.hpp"
@ -56,24 +58,10 @@ using namespace cv;
using namespace cv::cuda;
using namespace cv::cudev;
namespace
{
namespace cv { namespace cuda {
texture<uchar, cudaTextureType1D, cudaReadModeElementType> texLutTable;
class LookUpTableImpl : public LookUpTable
{
public:
LookUpTableImpl(InputArray lut);
~LookUpTableImpl();
void transform(InputArray src, OutputArray dst, Stream& stream = Stream::Null()) CV_OVERRIDE;
private:
GpuMat d_lut;
cudaTextureObject_t texLutTableObj;
bool cc30;
};
LookUpTableImpl::LookUpTableImpl(InputArray _lut)
{
if (_lut.kind() == _InputArray::CUDA_GPU_MAT)
@ -200,11 +188,7 @@ namespace
syncOutput(dst, _dst, stream);
}
}
Ptr<LookUpTable> cv::cuda::createLookUpTable(InputArray lut)
{
return makePtr<LookUpTableImpl>(lut);
}
} }
#endif

View File

@ -0,0 +1,23 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#include "precomp.hpp"
#include "lut.hpp"
using namespace cv;
using namespace cv::cuda;
#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER)
Ptr<LookUpTable> cv::cuda::createLookUpTable(InputArray) { throw_no_cuda(); return Ptr<LookUpTable>(); }
#else /* !defined (HAVE_CUDA) || defined (CUDA_DISABLER) */
Ptr<LookUpTable> cv::cuda::createLookUpTable(InputArray lut)
{
return makePtr<LookUpTableImpl>(lut);
}
#endif

View File

@ -0,0 +1,30 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#ifndef __CUDAARITHM_LUT_HPP__
#define __CUDAARITHM_LUT_HPP__
#include "opencv2/cudaarithm.hpp"
#include <cuda_runtime.h>
namespace cv { namespace cuda {
class LookUpTableImpl : public LookUpTable
{
public:
LookUpTableImpl(InputArray lut);
~LookUpTableImpl();
void transform(InputArray src, OutputArray dst, Stream& stream = Stream::Null()) CV_OVERRIDE;
private:
GpuMat d_lut;
cudaTextureObject_t texLutTableObj;
bool cc30;
};
} }
#endif // __CUDAARITHM_LUT_HPP__