fixed to use NVCUVID in 'cudacodec' module.

This commit is contained in:
atinfinity 2016-01-31 01:28:15 +09:00
parent a4692a0da5
commit ed8368fed7
4 changed files with 14 additions and 5 deletions

View File

@ -33,7 +33,12 @@ if(CUDA_FOUND)
if(WIN32) if(WIN32)
find_cuda_helper_libs(nvcuvenc) find_cuda_helper_libs(nvcuvenc)
endif() endif()
set(HAVE_NVCUVID 1) if(CUDA_nvcuvid_LIBRARY)
set(HAVE_NVCUVID 1)
endif()
if(CUDA_nvcuvenc_LIBRARY)
set(HAVE_NVCUVENC 1)
endif()
endif() endif()
message(STATUS "CUDA detected: " ${CUDA_VERSION}) message(STATUS "CUDA detected: " ${CUDA_VERSION})

View File

@ -15,7 +15,9 @@ set(extra_libs "")
if(HAVE_NVCUVID) if(HAVE_NVCUVID)
list(APPEND extra_libs ${CUDA_CUDA_LIBRARY} ${CUDA_nvcuvid_LIBRARY}) list(APPEND extra_libs ${CUDA_CUDA_LIBRARY} ${CUDA_nvcuvid_LIBRARY})
endif()
if(HAVE_NVCUVENC)
if(WIN32) if(WIN32)
list(APPEND extra_libs ${CUDA_nvcuvenc_LIBRARY}) list(APPEND extra_libs ${CUDA_nvcuvenc_LIBRARY})
endif() endif()

View File

@ -61,7 +61,9 @@
#ifdef WIN32 #ifdef WIN32
#define NOMINMAX #define NOMINMAX
#include <windows.h> #include <windows.h>
#include <NVEncoderAPI.h> #ifdef HAVE_NVCUVENC
#include <NVEncoderAPI.h>
#endif
#else #else
#include <pthread.h> #include <pthread.h>
#include <unistd.h> #include <unistd.h>

View File

@ -47,7 +47,7 @@ using namespace cv;
using namespace cv::cuda; using namespace cv::cuda;
using namespace cv::cudacodec; using namespace cv::cudacodec;
#if !defined(HAVE_NVCUVID) || !defined(WIN32) #if !defined(HAVE_NVCUVENC) || !defined(WIN32)
cv::cudacodec::EncoderParams::EncoderParams() { throw_no_cuda(); } cv::cudacodec::EncoderParams::EncoderParams() { throw_no_cuda(); }
cv::cudacodec::EncoderParams::EncoderParams(const String&) { throw_no_cuda(); } cv::cudacodec::EncoderParams::EncoderParams(const String&) { throw_no_cuda(); }
@ -60,7 +60,7 @@ Ptr<VideoWriter> cv::cudacodec::createVideoWriter(const String&, Size, double, c
Ptr<VideoWriter> cv::cudacodec::createVideoWriter(const Ptr<EncoderCallBack>&, Size, double, SurfaceFormat) { throw_no_cuda(); return Ptr<VideoWriter>(); } Ptr<VideoWriter> cv::cudacodec::createVideoWriter(const Ptr<EncoderCallBack>&, Size, double, SurfaceFormat) { throw_no_cuda(); return Ptr<VideoWriter>(); }
Ptr<VideoWriter> cv::cudacodec::createVideoWriter(const Ptr<EncoderCallBack>&, Size, double, const EncoderParams&, SurfaceFormat) { throw_no_cuda(); return Ptr<VideoWriter>(); } Ptr<VideoWriter> cv::cudacodec::createVideoWriter(const Ptr<EncoderCallBack>&, Size, double, const EncoderParams&, SurfaceFormat) { throw_no_cuda(); return Ptr<VideoWriter>(); }
#else // !defined HAVE_CUDA || !defined WIN32 #else // !defined HAVE_NVCUVENC || !defined WIN32
void RGB_to_YV12(const GpuMat& src, GpuMat& dst); void RGB_to_YV12(const GpuMat& src, GpuMat& dst);
@ -913,4 +913,4 @@ Ptr<VideoWriter> cv::cudacodec::createVideoWriter(const Ptr<EncoderCallBack>& en
return makePtr<VideoWriterImpl>(encoderCallback, frameSize, fps, params, format); return makePtr<VideoWriterImpl>(encoderCallback, frameSize, fps, params, format);
} }
#endif // !defined HAVE_CUDA || !defined WIN32 #endif // !defined HAVE_NVCUVENC || !defined WIN32