From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 1505A4CBE6 for ; Fri, 8 Aug 2025 12:30:47 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 4D93568CD28; Fri, 8 Aug 2025 15:30:38 +0300 (EEST) Received: from 0f9ae49ae7c8 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 781EA68CC79 for ; Fri, 8 Aug 2025 15:30:36 +0300 (EEST) MIME-Version: 1.0 From: nowrep To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] =?utf-8?q?=5BPATCH=5D_hw=5Fbase=5Fencode=3A_Suppo?= =?utf-8?q?rt_refs_option_to_limit_number_of_references_=28PR_=2320175=29?= 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Message-Id: <20250808123038.4D93568CD28@ffbox0-bg.ffmpeg.org> Date: Fri, 8 Aug 2025 15:30:38 +0300 (EEST) Archived-At: List-Archive: List-Post: PR #20175 opened by nowrep URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20175 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20175.patch >From 5d7fdc99c2307072b702d9376830a19ed4c6096a Mon Sep 17 00:00:00 2001 From: David Rosca Date: Wed, 25 Jun 2025 08:46:23 +0200 Subject: [PATCH] hw_base_encode: Support refs option to limit number of references --- libavcodec/hw_base_encode.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/hw_base_encode.c b/libavcodec/hw_base_encode.c index 33a30c8d10..927aeb4bad 100644 --- a/libavcodec/hw_base_encode.c +++ b/libavcodec/hw_base_encode.c @@ -666,6 +666,11 @@ int ff_hw_base_init_gop_structure(FFHWBaseEncodeContext *ctx, AVCodecContext *av ctx->ref_l0 = FFMIN(ref_l0, MAX_PICTURE_REFERENCES); ctx->ref_l1 = FFMIN(ref_l1, MAX_PICTURE_REFERENCES); + if (avctx->refs > 0) { + ctx->ref_l0 = FFMIN(ctx->ref_l0, avctx->refs); + ctx->ref_l1 = FFMIN(ctx->ref_l1, avctx->refs); + } + if (flags & FF_HW_FLAG_INTRA_ONLY || avctx->gop_size <= 1) { av_log(avctx, AV_LOG_VERBOSE, "Using intra frames only.\n"); ctx->gop_size = 1; -- 2.49.1 _______________________________________________ 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".