From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 09F8E46C44 for ; Thu, 6 Jul 2023 10:23:23 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CB4F068C6C2; Thu, 6 Jul 2023 13:23:20 +0300 (EEST) Received: from btbn.de (btbn.de [136.243.74.85]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B87D568C600 for ; Thu, 6 Jul 2023 13:23:13 +0300 (EEST) Received: from [authenticated] by btbn.de (Postfix) with ESMTPSA id DC6D7180AAF for ; Thu, 6 Jul 2023 12:23:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rothenpieler.org; s=mail; t=1688638992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Yoxwh1rZoa5VBxjI5aZYFr5gFg/QSQHl/8rf15QR3Tw=; b=Oi4TfscSNQPsNno8016rZcVAGTjcN3s6nsxd/O6KthMNCoQNllXoJyYzDBI8EuEGY6FRgM 24awewoCQF2vo/TIdnU1Y+rCn5bRVdrxPttJo38OJksdA9gBACemC3htPFlbKIjFrgvNmo MzOSQ2K42vc4ygioJK2nxbPzYZICRIYfNbCbRhCRsF6LAShLGcvJZRSqmsbgXXoHVu1JWy rez3ibLkLgqRIzN2/VdsbxDHjNZTthHjZtkcyg/RAMe9BFjtGlLgmwxpG9PrgRb3TDiEbl HEH+VcpLydkypZSw2WN2PL6bmtx3AlJqPbRL1u98eIoCSFCGy7/Eth20Q0W5yw== Message-ID: Date: Thu, 6 Jul 2023 12:23:13 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 To: ffmpeg-devel@ffmpeg.org References: Content-Language: en-US, de-DE From: Timo Rothenpieler In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH] avcodec/nvenc: fix intraRefreshPeriod setting X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 06/07/2023 14:00, Zhao Zhili wrote: > From: Zhao Zhili > > Regression since 99dfdb45. intraRefreshPeriod access cc->gopLength, > which has been overwritten to NVENC_INFINITE_GOPLENGTH before. > > Fixes #10445. > --- > libavcodec/nvenc.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c > index 06579a502b..13fafcd246 100644 > --- a/libavcodec/nvenc.c > +++ b/libavcodec/nvenc.c > @@ -1173,6 +1173,7 @@ static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx) > h264->enableIntraRefresh = 1; > h264->intraRefreshPeriod = cc->gopLength; > h264->intraRefreshCnt = cc->gopLength - 1; > + cc->gopLength = NVENC_INFINITE_GOPLENGTH; > #ifdef NVENC_HAVE_SINGLE_SLICE_INTRA_REFRESH > h264->singleSliceIntraRefresh = ctx->single_slice_intra_refresh; > #endif > @@ -1297,6 +1298,7 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx) > hevc->enableIntraRefresh = 1; > hevc->intraRefreshPeriod = cc->gopLength; > hevc->intraRefreshCnt = cc->gopLength - 1; > + cc->gopLength = NVENC_INFINITE_GOPLENGTH; > #ifdef NVENC_HAVE_SINGLE_SLICE_INTRA_REFRESH > hevc->singleSliceIntraRefresh = ctx->single_slice_intra_refresh; > #endif > @@ -1415,6 +1417,7 @@ static av_cold int nvenc_setup_av1_config(AVCodecContext *avctx) > av1->enableIntraRefresh = 1; > av1->intraRefreshPeriod = cc->gopLength; > av1->intraRefreshCnt = cc->gopLength - 1; > + cc->gopLength = NVENC_INFINITE_GOPLENGTH; > > av1->idrPeriod = NVENC_INFINITE_GOPLENGTH; > } else if (cc->gopLength > 0) { > @@ -1619,9 +1622,6 @@ FF_ENABLE_DEPRECATION_WARNINGS > if(ctx->single_slice_intra_refresh) > ctx->intra_refresh = 1; > > - if (ctx->intra_refresh) > - ctx->encode_config.gopLength = NVENC_INFINITE_GOPLENGTH; > - > nvenc_recalc_surfaces(avctx); > > nvenc_setup_rate_control(avctx); Shouldn't it be enough to move this block down a bit, below nvenc_setup_codec_config? That way the codec specific configs can still access the value, and the logic of setting it to infinite for intra refresh mode doesn't have to be duplicated everywhere. Though I'm not sure which way I prefer. Having it in the intra_refresh specific block in each codec definitely also has its advantage of keeping that logic in one place. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".