From 68c708d833db30b9c455da7aede189be8523b5b6 Mon Sep 17 00:00:00 2001 From: Vadim Levin Date: Wed, 19 Jul 2023 21:56:27 +0300 Subject: [PATCH] fix: remove using namespace cuda from public header --- modules/cudacodec/include/opencv2/cudacodec.hpp | 16 +++++++--------- modules/cudacodec/src/video_decoder.hpp | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/modules/cudacodec/include/opencv2/cudacodec.hpp b/modules/cudacodec/include/opencv2/cudacodec.hpp index bb664386e80..42325c64613 100644 --- a/modules/cudacodec/include/opencv2/cudacodec.hpp +++ b/modules/cudacodec/include/opencv2/cudacodec.hpp @@ -59,8 +59,6 @@ namespace cv { namespace cudacodec { -using namespace cuda; // Stream - //! @addtogroup cudacodec //! @{ @@ -264,7 +262,7 @@ class CV_EXPORTS_W VideoWriter @param stream Stream for frame pre-processing. */ CV_EXPORTS_W Ptr createVideoWriter(const String& fileName, const Size frameSize, const Codec codec = Codec::H264, const double fps = 25.0, - const ColorFormat colorFormat = ColorFormat::BGR, Ptr encoderCallback = 0, const Stream& stream = Stream::Null()); + const ColorFormat colorFormat = ColorFormat::BGR, Ptr encoderCallback = 0, const cuda::Stream& stream = cuda::Stream::Null()); /** @brief Creates video writer. @@ -278,7 +276,7 @@ CV_EXPORTS_W Ptr createVideoWriter(const String& fileNam @param stream Stream for frame pre-processing. */ CV_EXPORTS_W Ptr createVideoWriter(const String& fileName, const Size frameSize, const Codec codec, const double fps, const ColorFormat colorFormat, - const EncoderParams& params, Ptr encoderCallback = 0, const Stream& stream = Stream::Null()); + const EncoderParams& params, Ptr encoderCallback = 0, const cuda::Stream& stream = cuda::Stream::Null()); ////////////////////////////////// Video Decoding ////////////////////////////////////////// @@ -313,7 +311,7 @@ enum DeinterlaceMode - This function demonstrates how to map the luma histogram back so that it is equivalent to the result obtained from cuda::calcHist() if the returned frame was colorFormat::GRAY. */ -CV_EXPORTS_W void MapHist(const GpuMat& hist, CV_OUT Mat& histFull); +CV_EXPORTS_W void MapHist(const cuda::GpuMat& hist, CV_OUT Mat& histFull); /** @brief Struct providing information about video file format. : */ @@ -387,7 +385,7 @@ class CV_EXPORTS_W VideoReader If no frames have been grabbed (there are no more frames in video file), the methods return false. The method throws an Exception if error occurs. */ - CV_WRAP virtual bool nextFrame(CV_OUT GpuMat& frame, Stream &stream = Stream::Null()) = 0; + CV_WRAP virtual bool nextFrame(CV_OUT cuda::GpuMat& frame, cuda::Stream &stream = cuda::Stream::Null()) = 0; /** @brief Grabs, decodes and returns the next video frame and frame luma histogram. @@ -401,7 +399,7 @@ class CV_EXPORTS_W VideoReader @note Histogram data is collected by NVDEC during the decoding process resulting in zero performance penalty. NVDEC computes the histogram data for only the luma component of decoded output, not on post-processed frame(i.e. when scaling, cropping, etc. applied). If the source is encoded using a limited range of luma values (FormatInfo::videoFullRangeFlag == false) then the histogram bin values will correspond to to this limited range of values and will need to be mapped to contain the same output as cuda::calcHist(). The MapHist() utility function can be used to perform this mapping on the host if required. */ - CV_WRAP_AS(nextFrameWithHist) virtual bool nextFrame(CV_OUT GpuMat& frame, CV_OUT GpuMat& histogram, Stream& stream = Stream::Null()) = 0; + CV_WRAP_AS(nextFrameWithHist) virtual bool nextFrame(CV_OUT cuda::GpuMat& frame, CV_OUT cuda::GpuMat& histogram, cuda::Stream& stream = cuda::Stream::Null()) = 0; /** @brief Returns information about video file format. */ @@ -418,7 +416,7 @@ class CV_EXPORTS_W VideoReader The primary use of the function is for reading both the encoded and decoded video data when rawMode is enabled. With rawMode enabled retrieve() can be called following grab() to retrieve all the data associated with the current video source since the last call to grab() or the creation of the VideoReader. */ - CV_WRAP virtual bool grab(Stream& stream = Stream::Null()) = 0; + CV_WRAP virtual bool grab(cuda::Stream& stream = cuda::Stream::Null()) = 0; /** @brief Returns previously grabbed video data. @@ -457,7 +455,7 @@ class CV_EXPORTS_W VideoReader The method returns data associated with the current video source since the last call to grab(). If no data is present the method returns false and the function returns an empty image. */ - CV_WRAP inline bool retrieve(CV_OUT GpuMat& frame) const { + CV_WRAP inline bool retrieve(CV_OUT cuda::GpuMat& frame) const { return retrieve(OutputArray(frame)); } diff --git a/modules/cudacodec/src/video_decoder.hpp b/modules/cudacodec/src/video_decoder.hpp index a32bf1bb0a4..bea15369011 100644 --- a/modules/cudacodec/src/video_decoder.hpp +++ b/modules/cudacodec/src/video_decoder.hpp @@ -96,7 +96,7 @@ class VideoDecoder return cuvidDecodePicture(decoder_, picParams) == CUDA_SUCCESS; } - GpuMat mapFrame(int picIdx, CUVIDPROCPARAMS& videoProcParams) + cuda::GpuMat mapFrame(int picIdx, CUVIDPROCPARAMS& videoProcParams) { CUdeviceptr ptr; unsigned int pitch;