Skip to content

Commit 64bd2e1

Browse files
authored
Merge pull request #3615 from cudawarped:cudacodec_enable_win32_for_updated_dll
`cudacodec`: Enable features available with updated ffmpeg dll
2 parents 504f15c + b893c39 commit 64bd2e1

File tree

3 files changed

+0
-70
lines changed

3 files changed

+0
-70
lines changed

modules/cudacodec/src/ffmpeg_video_source.cpp

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -66,55 +66,9 @@ static std::string fourccToString(int fourcc)
6666
(i32_c.c[3] >= ' ' && i32_c.c[3] < 128) ? i32_c.c[3] : '?');
6767
}
6868

69-
// handle old FFmpeg backend - remove when windows shared library is updated
70-
#ifdef _WIN32
71-
static
72-
Codec FourccToCodecWin32Old(int codec)
73-
{
74-
switch (codec)
75-
{
76-
case CV_FOURCC_MACRO('m', 'p', 'e', 'g'): // fallthru
77-
case CV_FOURCC_MACRO('m', 'p', 'g', '1'): // fallthru
78-
case CV_FOURCC_MACRO('M', 'P', 'G', '1'): return MPEG1;
79-
case CV_FOURCC_MACRO('m', 'p', 'g', '2'): // fallthru
80-
case CV_FOURCC_MACRO('M', 'P', 'G', '2'): return MPEG2;
81-
case CV_FOURCC_MACRO('X', 'V', 'I', 'D'): // fallthru
82-
case CV_FOURCC_MACRO('m', 'p', '4', 'v'): // fallthru
83-
case CV_FOURCC_MACRO('D', 'I', 'V', 'X'): return MPEG4;
84-
case CV_FOURCC_MACRO('W', 'V', 'C', '1'): return VC1;
85-
case CV_FOURCC_MACRO('H', '2', '6', '4'): // fallthru
86-
case CV_FOURCC_MACRO('h', '2', '6', '4'): // fallthru
87-
case CV_FOURCC_MACRO('a', 'v', 'c', '1'): return H264;
88-
case CV_FOURCC_MACRO('H', '2', '6', '5'): // fallthru
89-
case CV_FOURCC_MACRO('h', '2', '6', '5'): // fallthru
90-
case CV_FOURCC_MACRO('h', 'e', 'v', 'c'): return HEVC;
91-
case CV_FOURCC_MACRO('M', 'J', 'P', 'G'): return JPEG;
92-
case CV_FOURCC_MACRO('v', 'p', '8', '0'): // fallthru
93-
case CV_FOURCC_MACRO('V', 'P', '8', '0'): // fallthru
94-
case CV_FOURCC_MACRO('v', 'p', '0', '8'): // fallthru
95-
case CV_FOURCC_MACRO('V', 'P', '0', '8'): return VP8;
96-
case CV_FOURCC_MACRO('v', 'p', '9', '0'): // fallthru
97-
case CV_FOURCC_MACRO('V', 'P', '9', '0'): // fallthru
98-
case CV_FOURCC_MACRO('V', 'P', '0', '9'): // fallthru
99-
case CV_FOURCC_MACRO('v', 'p', '0', '9'): return VP9;
100-
case CV_FOURCC_MACRO('a', 'v', '1', '0'): // fallthru
101-
case CV_FOURCC_MACRO('A', 'V', '1', '0'): // fallthru
102-
case CV_FOURCC_MACRO('a', 'v', '0', '1'): // fallthru
103-
case CV_FOURCC_MACRO('A', 'V', '0', '1'): return AV1;
104-
default:
105-
return NumCodecs;
106-
}
107-
}
108-
#endif
109-
11069
static
11170
Codec FourccToCodec(int codec)
11271
{
113-
#ifdef _WIN32 // handle old FFmpeg backend - remove when windows shared library is updated
114-
Codec win32OldCodec = FourccToCodecWin32Old(codec);
115-
if(win32OldCodec != NumCodecs)
116-
return win32OldCodec;
117-
#endif
11872
switch (codec)
11973
{
12074
case CV_FOURCC_MACRO('m', 'p', 'g', '1'): return MPEG1;

modules/cudacodec/src/video_writer.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,13 +402,10 @@ Ptr<VideoWriter> createVideoWriter(const String& fileName, const Size frameSize,
402402
{
403403
CV_Assert(params.idrPeriod >= params.gopLength);
404404
if (!encoderCallback) {
405-
// required until PR for raw video encapsulation is merged and windows dll is updated
406-
#ifndef WIN32 // remove #define and keep code once merged
407405
try {
408406
encoderCallback = new FFmpegVideoWriter(fileName, codec, fps, frameSize, params.idrPeriod);
409407
}
410408
catch (...)
411-
#endif
412409
{
413410
encoderCallback = new RawVideoWriter(fileName);
414411
}

modules/cudacodec/test/test_video.cpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -611,9 +611,6 @@ CUDA_TEST_P(CheckInitParams, Reader)
611611

612612
CUDA_TEST_P(Seek, Reader)
613613
{
614-
#if defined(WIN32)
615-
throw SkipTestException("Test disabled on Windows until the FFMpeg wrapper is updated to include PR24012.");
616-
#endif
617614
std::string inputFile = std::string(cvtest::TS::ptr()->get_data_path()) + "../highgui/video/big_buck_bunny.mp4";
618615
// seek to a non key frame
619616
const int firstFrameIdx = 18;
@@ -660,13 +657,7 @@ CUDA_TEST_P(TransCode, H264ToH265)
660657
constexpr cv::cudacodec::ColorFormat colorFormat = cv::cudacodec::ColorFormat::NV_NV12;
661658
constexpr double fps = 25;
662659
const cudacodec::Codec codec = cudacodec::Codec::HEVC;
663-
// required until PR for raw video encapsulation is merged and windows dll is updated
664-
#ifdef WIN32
665-
const std::string ext = ".hevc";
666-
#else
667-
// use this after update
668660
const std::string ext = ".mp4";
669-
#endif
670661
const std::string outputFile = cv::tempfile(ext.c_str());
671662
constexpr int nFrames = 5;
672663
Size frameSz;
@@ -743,13 +734,7 @@ CUDA_TEST_P(Write, Writer)
743734
const cudacodec::Codec codec = GET_PARAM(2);
744735
const double fps = GET_PARAM(3);
745736
const cv::cudacodec::ColorFormat colorFormat = GET_PARAM(4);
746-
// required until PR for raw video encapsulation is merged and windows dll is updated
747-
#ifdef WIN32
748-
const std::string ext = codec == cudacodec::Codec::H264 ? ".h264" : ".hevc";
749-
#else
750-
// use this after update
751737
const std::string ext = ".mp4";
752-
#endif
753738
const std::string outputFile = cv::tempfile(ext.c_str());
754739
constexpr int nFrames = 5;
755740
Size frameSz;
@@ -827,13 +812,7 @@ CUDA_TEST_P(EncoderParams, Writer)
827812
const std::string inputFile = std::string(cvtest::TS::ptr()->get_data_path()) + "../highgui/video/big_buck_bunny.mp4";
828813
constexpr double fps = 25.0;
829814
constexpr cudacodec::Codec codec = cudacodec::Codec::H264;
830-
// required until PR for raw video encapsulation is merged and windows dll is updated
831-
#ifdef WIN32
832-
const std::string ext = ".h264";
833-
#else
834-
// use this after update
835815
const std::string ext = ".mp4";
836-
#endif
837816
const std::string outputFile = cv::tempfile(ext.c_str());
838817
Size frameSz;
839818
const int nFrames = max(params.gopLength, params.idrPeriod) + 1;

0 commit comments

Comments
 (0)