From patchwork Wed Jul 24 15:17:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 50722 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:a742:0:b0:482:c625:d099 with SMTP id f2csp3326279vqm; Wed, 24 Jul 2024 08:37:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVxb+jUJRsf8JHDmL0lEQ76YW5JaggwCby4IYNLKKsvXExRk0OqfPN6MppEp1yxoY3udnFRl6TZGmlubjIDU8GJ+KZ3z4+Yv4MQMw== X-Google-Smtp-Source: AGHT+IErBazmbdmJTXWVwTIZjlzuM6uACvJPfIWe2H8np2zw6L4UbPddUpBbs7DWdItJjdRe/lsZ X-Received: by 2002:a17:907:3f98:b0:a7a:afe8:1013 with SMTP id a640c23a62f3a-a7ab2bf90afmr216956066b.1.1721835432136; Wed, 24 Jul 2024 08:37:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721835432; cv=none; d=google.com; s=arc-20160816; b=zrr7+QqHOl85kgDlalSA8uvPhYsHIbTahN/Unts5NMRd8KMKSdFT7km4OWzu78rZpN y37QaFe8qmCaDHyDEkdZdi/Ey4UeVvZY9pA6V9z9nktF4HfQallWoWequyX3cmBg213O WtgUTemFHuTxwhXV514yQlmZkf56TaBFofIRWzbFk1wOar1RFaJUJurG7guvZe8J+TRX 80T6a4CqMkvZ6z+WNB1mbWwAdVBAUVPmBOXWzpXuHMIsysT+nCmXTFRWmrpiTiJjjbRw VZyO8aQFU5sdsA+mRbm2qT1loIQ9LrWyS7b2rOYLHU0xY26s2w8X9rwznzU8+NL12ieo SMDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=RMLnWCcx8b7MHHgu6YlursOEKmcUjWSiCl1sC/FIPvg=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=aYPZi9aDf5fl44XXo8BoGLXsiwSf6VDxE1lTFNQZdCjGL4DycHryhTV8rIl6cf1vWG B0EI+QOxkq1NUgilduJ50HC+pybmSrQCTDq3lYmzBzFPzMGaC6k7Sx9OM3QvpI9Mp+9t eaiBaZIt7PglP+R6LVNZXNFP5hvhYgkVSyU2PKQL/31BVY2dbOpfa/8GXMKzBoBipxiy jqE9VPMCeTdUjDQjhMGDdo7T7gHof8ZUjOndnEduaMeHe0xjrgICL+yP5LQfvFOSPtya MC28JBQYnHVoYgPDgpAsNzTZUJ/joAm5MdPO2akGYPmR/8Sj8w00Rg6OJkyCU7PmYrLg zThQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b=VdMSWaOM; 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 a640c23a62f3a-a7a3c925208si716430466b.566.2024.07.24.08.36.48; Wed, 24 Jul 2024 08:37:12 -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; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b=VdMSWaOM; 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 B5EA768D3C9; Wed, 24 Jul 2024 18:17:39 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C90C168CC56 for ; Wed, 24 Jul 2024 18:17:32 +0300 (EEST) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=VdMSWaOM; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 59AE54DE1 for ; Wed, 24 Jul 2024 17:17:30 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id wCHqGkWVA20z for ; Wed, 24 Jul 2024 17:17:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1721834249; bh=40HLX5YDAQwsYoV4Za0sFOntCXCXJomkj98vFuvGAS4=; h=From:To:Subject:Date:From; b=VdMSWaOMNsy3B3LDklwoUbxw51zRdqZc+PPOg6mkb1/8zSR4SBFhp+BQW7GXTJzXi uNH2YBaf12ueck2Pzg8bpWC1A1kciGfc+R3dsNHqWyqdX/jtO4aThpzVhs+7Y8E8kR BWwJurJ9Nv1KPVXQuN845LugYzEX/lPIxp3oP9GqrxiFHG/77RSH+A3ctrtTkTs8ct Z/PRdKYXyby1FfZje/TvqsUKoMGQ41MKf2j60PFFx5xkIKgEsW1OQgRCwQQFeWT1Xr CxkzEDr5y7rUQJVCEnHIga+5RCCfk1Po9kalfJS7ikQl6ZXIkPRA9pxoCT2TYTrEGm ohwFoovTasWbQ== Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail1.khirnov.net (Postfix) with ESMTPS id 4EFAA91A for ; Wed, 24 Jul 2024 17:17:29 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id B30353A02CA for ; Wed, 24 Jul 2024 17:17:23 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Jul 2024 17:17:06 +0200 Message-ID: <20240724151706.12491-1-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavfi/framesync: avoid forcing frame writability unnecessarily 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: HhogsAX365ok Callers of ff_framesync_get_frame() generally do not expect the result to be writable, those that do (e.g. ff_framesync_dualinput_get_writable()) ensure writability themselves. Significantly reduces memory consumption in complex graphs with framesync-based filters (e.g. scale, ssim). Reported-By: Mark Shwartzman --- libavfilter/framesync.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/libavfilter/framesync.c b/libavfilter/framesync.c index 535fbe9c7c..8e06e0e700 100644 --- a/libavfilter/framesync.c +++ b/libavfilter/framesync.c @@ -273,7 +273,6 @@ int ff_framesync_get_frame(FFFrameSync *fs, unsigned in, AVFrame **rframe, AVFrame *frame; unsigned need_copy = 0, i; int64_t pts_next; - int ret; if (!fs->in[in].frame) { *rframe = NULL; @@ -291,10 +290,6 @@ int ff_framesync_get_frame(FFFrameSync *fs, unsigned in, AVFrame **rframe, if (need_copy) { if (!(frame = av_frame_clone(frame))) return AVERROR(ENOMEM); - if ((ret = ff_inlink_make_frame_writable(fs->parent->inputs[in], &frame)) < 0) { - av_frame_free(&frame); - return ret; - } } else { fs->in[in].frame = NULL; }