@ -1011,10 +1011,6 @@ struct H264ToH265 : SetDevice
{
} ;
# if defined(WIN32) // remove when FFmpeg wrapper includes PR25874
# define WIN32_WAIT_FOR_FFMPEG_WRAPPER_UPDATE
# endif
CUDA_TEST_P ( H264ToH265 , Transcode )
{
const std : : string inputFile = std : : string ( cvtest : : TS : : ptr ( ) - > get_data_path ( ) ) + " ../highgui/video/big_buck_bunny.h264 " ;
@ -1054,10 +1050,8 @@ CUDA_TEST_P(H264ToH265, Transcode)
for ( int i = 0 ; i < nFrames ; + + i ) {
cap > > frame ;
ASSERT_FALSE ( frame . empty ( ) ) ;
# if !defined(WIN32_WAIT_FOR_FFMPEG_WRAPPER_UPDATE)
const int pts = static_cast < int > ( cap . get ( CAP_PROP_PTS ) ) ;
ASSERT_EQ ( i , pts > 0 ? pts : 0 ) ; // FFmpeg back end returns dts if pts is zero.
# endif
}
}
ASSERT_EQ ( 0 , remove ( outputFile . c_str ( ) ) ) ;
@ -1066,7 +1060,7 @@ CUDA_TEST_P(H264ToH265, Transcode)
INSTANTIATE_TEST_CASE_P ( CUDA_Codec , H264ToH265 , ALL_DEVICES ) ;
CV_ENUM ( YuvColorFormats , cudacodec : : ColorFormat : : NV_YUV444 , cudacodec : : ColorFormat : : NV_YUV420_10BIT , cudacodec : : ColorFormat : : NV_YUV444_10BIT )
PARAM_TEST_CASE ( YUVFormats , cv : : cuda : : DeviceInfo , YuvColorFormats )
PARAM_TEST_CASE ( YUVFormats , cv : : cuda : : DeviceInfo , YuvColorFormats , bool )
{
} ;
@ -1075,6 +1069,7 @@ CUDA_TEST_P(YUVFormats, Transcode)
cv : : cuda : : setDevice ( GET_PARAM ( 0 ) . deviceID ( ) ) ;
const std : : string inputFile = std : : string ( cvtest : : TS : : ptr ( ) - > get_data_path ( ) ) + " ../highgui/video/big_buck_bunny.h265 " ;
const cv : : cudacodec : : ColorFormat writerColorFormat = static_cast < cudacodec : : ColorFormat > ( static_cast < int > ( GET_PARAM ( 1 ) ) ) ;
const bool fullRange = GET_PARAM ( 2 ) ;
constexpr double fps = 25 ;
const cudacodec : : Codec codec = cudacodec : : Codec : : HEVC ;
const std : : string ext = " .mp4 " ;
@ -1088,6 +1083,7 @@ CUDA_TEST_P(YUVFormats, Transcode)
cv : : cudacodec : : EncoderParams params ;
params . tuningInfo = cv : : cudacodec : : EncodeTuningInfo : : ENC_TUNING_INFO_LOSSLESS ;
params . rateControlMode = cv : : cudacodec : : EncodeParamsRcMode : : ENC_PARAMS_RC_CONSTQP ;
params . videoFullRangeFlag = fullRange ;
for ( int i = 0 ; i < nFrames ; + + i ) {
ASSERT_TRUE ( cap . read ( frame ) ) ;
ASSERT_FALSE ( frame . empty ( ) ) ;
@ -1101,7 +1097,7 @@ CUDA_TEST_P(YUVFormats, Transcode)
yuvFormat = cudacodec : : SurfaceFormat : : SF_P016 ;
bitDepth = cudacodec : : BitDepth : : SIXTEEN ;
}
generateTestImages ( frame , yuv , bgr , yuvFormat , cudacodec : : ColorFormat : : BGR , bitDepth , false ) ;
generateTestImages ( frame , yuv , bgr , yuvFormat , cudacodec : : ColorFormat : : BGR , bitDepth , false , fullRange ) ;
bgrGs . push_back ( bgr . clone ( ) ) ;
if ( writer . empty ( ) )
writer = cv : : cudacodec : : createVideoWriter ( outputFile , frame . size ( ) , codec , fps , writerColorFormat , params ) ;
@ -1125,7 +1121,7 @@ CUDA_TEST_P(YUVFormats, Transcode)
ASSERT_EQ ( 0 , remove ( outputFile . c_str ( ) ) ) ;
}
INSTANTIATE_TEST_CASE_P ( CUDA_Codec , YUVFormats , testing : : Combine ( ALL_DEVICES , YuvColorFormats : : all ( ) ) ) ;
INSTANTIATE_TEST_CASE_P ( CUDA_Codec , YUVFormats , testing : : Combine ( ALL_DEVICES , YuvColorFormats : : all ( ) , testing : : Bool ( ) ) ) ;
# endif
# if defined(HAVE_NVCUVENC)
@ -1201,10 +1197,8 @@ CUDA_TEST_P(Write, Writer)
for ( int i = 0 ; i < nFrames ; + + i ) {
cap > > frame ;
ASSERT_FALSE ( frame . empty ( ) ) ;
# if !defined(WIN32_WAIT_FOR_FFMPEG_WRAPPER_UPDATE)
const int pts = static_cast < int > ( cap . get ( CAP_PROP_PTS ) ) ;
ASSERT_EQ ( i , pts > 0 ? pts : 0 ) ; // FFmpeg back end returns dts if pts is zero.
# endif
}
}
ASSERT_EQ ( 0 , remove ( outputFile . c_str ( ) ) ) ;
@ -1299,10 +1293,8 @@ CUDA_TEST_P(EncoderParams, Writer)
const bool keyFrameActual = capRaw . get ( CAP_PROP_LRF_HAS_KEY_FRAME ) = = 1.0 ;
const bool keyFrameReference = i % idrPeriod = = 0 ;
ASSERT_EQ ( keyFrameActual , keyFrameReference ) ;
# if !defined(WIN32_WAIT_FOR_FFMPEG_WRAPPER_UPDATE)
const int pts = static_cast < int > ( cap . get ( CAP_PROP_PTS ) ) ;
ASSERT_EQ ( i , pts > 0 ? pts : 0 ) ; // FFmpeg back end returns dts if pts is zero.
# endif
}
}
}