@ -1171,8 +1171,8 @@ static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx)
if ( ctx - > intra_refresh ) {
h264 - > enableIntraRefresh = 1 ;
h264 - > intraRefreshPeriod = avctx - > gop_size ;
h264 - > intraRefreshCnt = avctx - > gop_size - 1 ;
h264 - > intraRefreshPeriod = cc - > gopLength ;
h264 - > intraRefreshCnt = cc - > gopLength - 1 ;
# ifdef NVENC_HAVE_SINGLE_SLICE_INTRA_REFRESH
h264 - > singleSliceIntraRefresh = ctx - > single_slice_intra_refresh ;
# endif
@ -1192,8 +1192,8 @@ static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx)
if ( ctx - > intra_refresh ) {
h264 - > idrPeriod = NVENC_INFINITE_GOPLENGTH ;
} else if ( avctx - > gop_size > = 0 ) {
h264 - > idrPeriod = avctx - > gop_size ;
} else if ( cc - > gopLength > 0 ) {
h264 - > idrPeriod = cc - > gopLength ;
}
if ( IS_CBR ( cc - > rcParams . rateControlMode ) ) {
@ -1295,8 +1295,8 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx)
if ( ctx - > intra_refresh ) {
hevc - > enableIntraRefresh = 1 ;
hevc - > intraRefreshPeriod = avctx - > gop_size ;
hevc - > intraRefreshCnt = avctx - > gop_size - 1 ;
hevc - > intraRefreshPeriod = cc - > gopLength ;
hevc - > intraRefreshCnt = cc - > gopLength - 1 ;
# ifdef NVENC_HAVE_SINGLE_SLICE_INTRA_REFRESH
hevc - > singleSliceIntraRefresh = ctx - > single_slice_intra_refresh ;
# endif
@ -1318,8 +1318,8 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx)
if ( ctx - > intra_refresh ) {
hevc - > idrPeriod = NVENC_INFINITE_GOPLENGTH ;
} else if ( avctx - > gop_size > = 0 ) {
hevc - > idrPeriod = avctx - > gop_size ;
} else if ( cc - > gopLength > 0 ) {
hevc - > idrPeriod = cc - > gopLength ;
}
if ( IS_CBR ( cc - > rcParams . rateControlMode ) ) {
@ -1413,12 +1413,12 @@ static av_cold int nvenc_setup_av1_config(AVCodecContext *avctx)
if ( ctx - > intra_refresh ) {
av1 - > enableIntraRefresh = 1 ;
av1 - > intraRefreshPeriod = avctx - > gop_size ;
av1 - > intraRefreshCnt = avctx - > gop_size - 1 ;
av1 - > intraRefreshPeriod = cc - > gopLength ;
av1 - > intraRefreshCnt = cc - > gopLength - 1 ;
av1 - > idrPeriod = NVENC_INFINITE_GOPLENGTH ;
} else if ( avctx - > gop_size > = 0 ) {
av1 - > idrPeriod = avctx - > gop_size ;
} else if ( cc - > gopLength > 0 ) {
av1 - > idrPeriod = cc - > gopLength ;
}
if ( IS_CBR ( cc - > rcParams . rateControlMode ) ) {
@ -1603,17 +1603,18 @@ FF_ENABLE_DEPRECATION_WARNINGS
}
if ( avctx - > gop_size > 0 ) {
if ( avctx - > max_b_frames > = 0 ) {
/* 0 is intra-only, 1 is I/P only, 2 is one B-Frame, 3 two B-frames, and so on. */
ctx - > encode_config . frameIntervalP = avctx - > max_b_frames + 1 ;
}
// only overwrite preset if a GOP size was selected as input
ctx - > encode_config . gopLength = avctx - > gop_size ;
} else if ( avctx - > gop_size = = 0 ) {
ctx - > encode_config . frameIntervalP = 0 ;
ctx - > encode_config . gopLength = 1 ;
}
if ( avctx - > max_b_frames > = 0 & & ctx - > encode_config . gopLength > 1 ) {
/* 0 is intra-only, 1 is I/P only, 2 is one B-Frame, 3 two B-frames, and so on. */
ctx - > encode_config . frameIntervalP = avctx - > max_b_frames + 1 ;
}
/* force to enable intra refresh */
if ( ctx - > single_slice_intra_refresh )
ctx - > intra_refresh = 1 ;