From patchwork Tue Oct 3 22:53:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vignesh Venkat X-Patchwork-Id: 44135 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4f21:b0:15d:8365:d4b8 with SMTP id gi33csp161607pzb; Tue, 3 Oct 2023 15:53:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHdnTZmkZmCuHfMD/ymW+tN+xHlBH8AixcQt3BM/7Jm3CEudYRjSxKj+2mpJVEDRF1+Ls7w X-Received: by 2002:a17:906:cc15:b0:9ad:ef31:6ef6 with SMTP id ml21-20020a170906cc1500b009adef316ef6mr541583ejb.20.1696373608939; Tue, 03 Oct 2023 15:53:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696373608; cv=none; d=google.com; s=arc-20160816; b=r6HsRsSaDsBIbV9phu9WZQC6NXT8gN7pIGmhUUKNo82E1XefhzGYPlDxJMkMn+DML1 F0keUQ0VXtjn7Weqq7VNGb5BX1+Bht2k7zBeRFygUgTKXXvwWTfPlaVeIAQA9SoovWHf Z4w4Nnz51lCnNQZtJ2VH4tQNLFytoRDJq4FfAGiMFQ4yz1FchpLimrMwUZuO5jbUQ6OS ibgbQ8yBmP+Jux9G6ELZiroBGz1jsN8blCU+ddC/3WM2vM+PLiQIz7dxeFubsBIP2IgW b0NN+ZmSMlBk/VWrJ7tyDwqNWOwiBSNIKpNuhsDqaYbSeQC36qtw2CSQxq4Bc4Uw5hse bI+g== 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:to:message-id:references:mime-version :in-reply-to:date:delivered-to; bh=hbuUMP6zqyBF1XKBMVfUlWuBSPNoGsP1NBUjJ0crTHs=; fh=zLTX2kwa8L5gNw1IDWXMzP8nX5h2CbyibdEHyEbl1/E=; b=UrJVGlgHPmvRTnnenW+c69ar/yo1JGF9jzGeWVgEEIBNKUYJW8Zj+ufV1+0dR2zr5P uS/yrEmlVjykXbbl3VarDpuaHkyZfV4+CrN1oEcyx3NXim+MXkkx4S7pGICCDfsRFlpk cKziWPs5j3SzMsH29Uxx7vZ6r9rgjW+iCNBaeVVUfnZ6Wys0MRniFwx7w4fEz1vNaUn6 OfAjeQhr29oj+w24JS9K3pNovJT+vYvRu+2xvyUTFQ7fLsTcuXK9CFrONsOjC7G6aDvl SAflXyXMnaFzbp1XdH5HmUWjUk4Cob17BipkbTJssV8wJjhIiScKDtygkLCQLeMkYeB+ BxEw== 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 k10-20020a1709065fca00b00993a68a3af5si1090095ejv.529.2023.10.03.15.53.28; Tue, 03 Oct 2023 15:53:28 -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 7984268CB51; Wed, 4 Oct 2023 01:53:26 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 40B3F68C077 for ; Wed, 4 Oct 2023 01:53:19 +0300 (EEST) Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-59f2c7a4f24so22714077b3.0 for ; Tue, 03 Oct 2023 15:53:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696373597; x=1696978397; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HUEMQ3zuaKDGO/RdtKGYqCxMt7mof47xYNAwxySm8UA=; b=p73xXxehYRbAL3ON1Elo74B3xPOWnYCsMBm5bV/ch7QjMmaweVNCBoxAyfZZ2KvkQw evA35rwS+pQyGD30bV4NoVGmRdXxA6ztTmp2PtpTtVYCNdtBQvMsLWX1vS1yZNUtLKTi N972NaRjqdbGBXSk8R2nUoNx8qSOldi88KC8c9M0lj58XawTCeOXanRKEALxLf22oT4X uQLZ950+ELjRXIibHcT666LC8hjGHz92G8YUSPZuRWIRFPq8f/M7bTw2X/zccZ1u0Lzj Ow56XAed2NE6XOOooCTaizNbW3UTkXshUQe2h62JhKuaoXFCoHQ3M+tLue5lL62hPdGj PLKw== X-Gm-Message-State: AOJu0YyZzPz8fcT5JTSw40zmBNTwe4K/c7BT1rRKxoUH5LvBlshBSQLZ kty/B//JQukEWQ672SJe6LkXFx+Z6O8rGuJ4kL9wVXoH2ZLcUvIlkVc9j/tKKarZEzuojg1R+GD annO68Vk7hEBB9W9U2W2AH2fOnQm9417Xq290rJIe0dUIKJn9vGHRmO2ShsC+SAwBQlx1 X-Received: from vigneshv3.mtv.corp.google.com ([2620:0:1000:2511:e58:8b17:6065:ec86]) (user=vigneshv job=sendgmr) by 2002:a81:a849:0:b0:577:619e:d3c9 with SMTP id f70-20020a81a849000000b00577619ed3c9mr20278ywh.10.1696373597373; Tue, 03 Oct 2023 15:53:17 -0700 (PDT) Date: Tue, 3 Oct 2023 15:53:06 -0700 In-Reply-To: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog Message-ID: <20231003225313.407161-1-vigneshv@google.com> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH] avcodec/svt-av1: Set force_key_frames only when gop_size == 1 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: Vignesh Venkatasubramanian via ffmpeg-devel From: Vignesh Venkat Reply-To: FFmpeg development discussions and patches Cc: Vignesh Venkatasubramanian Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Rb4IxVzdjNQv SVT-AV1 does not support requesting keyframes at arbitrary points by setting pic_type to EB_AV1_KEY_PICTURE. So set force_key_frames to 1 only when gop_size == 1. Please see the comments in https://gitlab.com/AOMediaCodec/SVT-AV1/-/issues/2076 for a bit more details. Signed-off-by: Vignesh Venkatasubramanian --- libavcodec/libsvtav1.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c index 5015169244..8d2c7f3be4 100644 --- a/libavcodec/libsvtav1.c +++ b/libavcodec/libsvtav1.c @@ -253,8 +253,13 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param, // In order for SVT-AV1 to force keyframes by setting pic_type to // EB_AV1_KEY_PICTURE on any frame, force_key_frames has to be set. Note // that this does not force all frames to be keyframes (it only forces a - // keyframe with pic_type is set to EB_AV1_KEY_PICTURE). - param->force_key_frames = 1; + // keyframe with pic_type is set to EB_AV1_KEY_PICTURE). As of now, SVT-AV1 + // does not support arbitrary keyframe requests by setting pic_type to + // EB_AV1_KEY_PICTURE, so it is done only when gop_size == 1. + // FIXME: When SVT-AV1 supports arbitrary keyframe requests, this code needs + // to be updated to set force_key_frames accordingly. + if (avctx->gop_size == 1) + param->force_key_frames = 1; if (avctx->framerate.num > 0 && avctx->framerate.den > 0) { param->frame_rate_numerator = avctx->framerate.num;