From patchwork Tue May 21 01:17:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cosmin Stejerean X-Patchwork-Id: 49071 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:3a48:b0:1af:fc2d:ff5a with SMTP id zu8csp4936527pzb; Mon, 20 May 2024 18:25:01 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXb79iVFwVQxkzPFMwt2Zl2uR0SWxq0eqaGqjfkph6ZOvSQaCGFxPhybzuUaPRO057Vd5BdDn45zQC+BZsq4NGzJzPDofOZNFbHqw== X-Google-Smtp-Source: AGHT+IEQPIWmpA1+aFYmDax942n4Hoa1kvylatc8+GJx7aubmHGDsDJpd/KkmVSLEXDj0eMm3Z7/ X-Received: by 2002:a2e:9e14:0:b0:2e1:c97b:6f1f with SMTP id 38308e7fff4ca-2e5203a795emr195587811fa.51.1716254700769; Mon, 20 May 2024 18:25:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716254700; cv=none; d=google.com; s=arc-20160816; b=qcXl2CHgpOB+9aJcx47K1wJKhoCmNKQliY7FE3vCHtD2pg9LujVDcEMPzIk2Kh5UPw 6PVRXLcj2ohYNWoqKRV3YmgfxJkHklbJfbwBr/wpV84ZITH+IJLvSA29Rup6wMW+VsFt p7jfC1z3Fak7WsbzvlrVeUbedHyVWd3f8fGwTyRqoyRSg8gQkUk8dtiimsqwiU4t4L2i BWA4tWR69ycIDfVzjx3OIBb7wIvXWGI7QohL8Dn30XV/YT2fV/dLs7T7e15xdV9s/Lmf dBSS8VmKFtFF+0GgsMozST3k7IIXNrGceK0hFcnFD0O9Y2Mm45zGMLBVmqG68tHht1NJ be0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to:from :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:feedback-id:message-id:thread-topic :thread-index:references:in-reply-to:mime-version:date:to :delivered-to; bh=J1rVrEH2Hehdje38DH0R8vT58nLaPZU7sQueWi905Oc=; fh=CBS/D0cB4KwqFBY8d8UQ4TY1w6HZ9TulitLE+VqI2+k=; b=OKkjC9ZQmM6TZaFqiJYopxm9Y7wUtxW5q/9MJ03gAIptK5Jqf4RV/vzIocOrqMEY9N Aw1jNKfMaITl4CxaCfZ/45b5QQrzCxjPnZPgJ1pBZF/CbVdv0ir5hTJ4g0UcadpLn0Vz S+8m8qw0DAre0gnXN6YsFh9mva9zrjQzz2zTgqduCNuozOZz2n2f6h5tCuuELS6wp/KX 17PwTopowJFnrum5AIVIn+mpgV/5dzNe0+FEFjSHdYoiSj9LW+jWT+RCAEvqktQbuNHk /i+lEzmMWVBHjAcvmzZ0eQ0a564BmCM5RIhetU1hfUPxy75Z6PpLbouMxIbxaKbHfH4Z KPaw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 38308e7fff4ca-2e4d194b2b9si76066221fa.640.2024.05.20.18.25.00; Mon, 20 May 2024 18:25:00 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D3AD568D29E; Tue, 21 May 2024 04:24:56 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from a27-217.smtp-out.us-west-2.amazonses.com (a27-217.smtp-out.us-west-2.amazonses.com [54.240.27.217]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A0EE168BA20 for ; Tue, 21 May 2024 04:24:49 +0300 (EEST) To: =?utf-8?q?ffmpeg-devel=40ffmpeg=2Eorg?= Date: Tue, 21 May 2024 01:17:33 +0000 Mime-Version: 1.0 In-Reply-To: <20240521011728.29347-1-cosmin@cosmin.at> References: <20240521011728.29347-1-cosmin@cosmin.at> <20240521011728.29347-2-cosmin@cosmin.at> X-Mailer: Amazon WorkMail Thread-Index: AQHaqxymBDX4oF7lSnaZQt5sN2k4MAAAAGCb Thread-Topic: [PATCH] avcodec/libsvtav1: send the EOS signal without a one frame delay to allow for the library to operate in a low-delay mode X-Original-Mailer: git-send-email 2.42.1 X-Wm-Sent-Timestamp: 1716254252 Message-ID: <0101018f98b9a2c9-01b87943-0e31-4780-a2a7-d2f58757741e-000000@us-west-2.amazonses.com> Feedback-ID: ::1.us-west-2.An468LAV0jCjQDrDLvlZjeAthld7qrhZr+vow8irkvU=:AmazonSES X-SES-Outgoing: 2024.05.21-54.240.27.217 Subject: [FFmpeg-devel] [PATCH] avcodec/libsvtav1: send the EOS signal without a one frame delay to allow for the library to operate in a low-delay mode 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: , X-Patchwork-Original-From: Cosmin Stejerean via ffmpeg-devel From: Cosmin Stejerean Reply-To: FFmpeg development discussions and patches Cc: =?utf-8?q?Cosmin_Stejerean?= Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 2W5VfhizRVXO From: Cosmin Stejerean Co-authored-by: Amir Naghdinezhad Signed-off-by: Cosmin Stejerean --- libavcodec/libsvtav1.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c index 3b41f5a39e..1eda63200c 100644 --- a/libavcodec/libsvtav1.c +++ b/libavcodec/libsvtav1.c @@ -539,6 +539,14 @@ static int eb_receive_packet(AVCodecContext *avctx, AVPacket *pkt) if (svt_ret == EB_NoErrorEmptyQueue) return AVERROR(EAGAIN); +#if SVT_AV1_CHECK_VERSION(2, 0, 0) + if (headerPtr->flags & EB_BUFFERFLAG_EOS) { + svt_enc->eos_flag = EOS_RECEIVED; + svt_av1_enc_release_out_buffer(&headerPtr); + return AVERROR_EOF; + } +#endif + ref = get_output_ref(avctx, svt_enc, headerPtr->n_filled_len); if (!ref) { av_log(avctx, AV_LOG_ERROR, "Failed to allocate output packet.\n"); @@ -573,8 +581,10 @@ static int eb_receive_packet(AVCodecContext *avctx, AVPacket *pkt) if (headerPtr->pic_type == EB_AV1_NON_REF_PICTURE) pkt->flags |= AV_PKT_FLAG_DISPOSABLE; +#if !(SVT_AV1_CHECK_VERSION(2, 0, 0)) if (headerPtr->flags & EB_BUFFERFLAG_EOS) svt_enc->eos_flag = EOS_RECEIVED; +#endif ff_side_data_set_encoder_stats(pkt, headerPtr->qp * FF_QP2LAMBDA, NULL, 0, pict_type);