From patchwork Sat Sep 25 22:52:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 30575 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6506:0:0:0:0:0 with SMTP id z6csp2808812iob; Sat, 25 Sep 2021 15:52:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7ilDA4IOy1fD1ffDWOUipt4Q9Bc6CVqWpwQ7kSR/f8AL+3EpLXMpRdGY29XuVkVek5+9U X-Received: by 2002:a17:906:36d6:: with SMTP id b22mr18933593ejc.387.1632610365543; Sat, 25 Sep 2021 15:52:45 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id j4si12470584ejo.567.2021.09.25.15.52.44; Sat, 25 Sep 2021 15:52:45 -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=@outlook.com header.s=selector1 header.b=ZhlE3AyU; arc=fail (body hash mismatch); 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 958D968A906; Sun, 26 Sep 2021 01:52:41 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-oln040092075038.outbound.protection.outlook.com [40.92.75.38]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EDAB068A852 for ; Sun, 26 Sep 2021 01:52:33 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T03rqqJ1VEMRaE4dgmhFRZwYs4/rXqbD+ggPSxfTx4ihGExESntoLhITjgohyIIjkiymMBVmeJFuTYOiqMcWB2U1a3ko++W7gP7IUCTdh7xXYDCxuefXUXGw0m7xAfbhSRRB8JiSti4+1+6LvFgXSIzrnQphXUg1mPnUNXScuQ8i+69V34vNHLoxpM5wGjPLwoKkbLTkI62viJCi2NFhPymxay3hFLth9BWvuLWv6A3RFie+yb5xpWTopy41KhE49aIkjq+MZyEleTLYQ/qCdMYagEXLMfpdIudz9Uj2ydQjER5x3lORef8FE6ymmOVLOs8m4qz9hghIlPa0xyO50g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=KVArdefVD1XXPNNBhZVFdC3pWnt5s5fhNHFwU/Qcelc=; b=bCgG+qn0DkZJySzM/kOMdrpZfU4k2fnJ3M6h7+VnyXk8WNfFD3frdFW8ZKC9LlPN9eyguPFXw0m74s9VxfTDsviRyBycd4Qmao7OdsIZcldtWKo10DXrOMyaGr5IjwoeaIiAP3MlBuZw7XnL563sLML6GCv+Lo7mmEwHbVsdrls9cQusuzhiSgZIC8Akr/bydqdTdTUoEdqymKfrMWjK/N3UK/ttakz0wPop8MRxt/p0FzwA+v5nW0JbTBeixT/yE7Ul9heqXXOhmnJp34UxLgcZX6xd/Y3SHmCHDph2Gkg59TNcIgziQH9fm0YS0AdI+0Hg4Nssv4P0oVP8hmMNqA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KVArdefVD1XXPNNBhZVFdC3pWnt5s5fhNHFwU/Qcelc=; b=ZhlE3AyU8YuvVpa8ekdCGkP7ZdlA7EKldeG8wU7vPbveo4AQ8a5jVIV2GdoKqoT3OegXBt/ERANQdPVmskR991p3dSMpEEbHJjt8KZP3BD8243xiJD/BrOHjJA0dCB1jfMkbwh83XsmxOuxczDr45a3gs5Hl4ipcnWRIdfny+GJZVihRPZdN+PGO3USAaV9tfwcosFKFbNqGIWYLEfI1iD+m/FvzObmKpcX30s2yCmxCtMDR5YRmN/gAAKg55YB58xfZaBmUa52NrYT2vMRR+fS1aFfOSx7xgDuYSLBocGxkvTNwzUCVKfjrB6hgxTfqztPtUbs7zcLvP1y2UXky8g== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB5926.eurprd03.prod.outlook.com (2603:10a6:20b:e7::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.18; Sat, 25 Sep 2021 22:52:32 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00%3]) with mapi id 15.20.4544.021; Sat, 25 Sep 2021 22:52:32 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sun, 26 Sep 2021 00:52:17 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 X-TMN: [HBzQpxd81Y5YQFzZidlItIsINhU7pPky] X-ClientProxiedBy: PR3P192CA0030.EURP192.PROD.OUTLOOK.COM (2603:10a6:102:56::35) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210925225220.175182-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by PR3P192CA0030.EURP192.PROD.OUTLOOK.COM (2603:10a6:102:56::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Sat, 25 Sep 2021 22:52:29 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c55d88c7-8b78-44a7-d4b4-08d980772759 X-MS-Exchange-SLBlob-MailProps: EpEO96k6Wom4HOLjhpPwl6SghFHdFexrvCVMeyMxK6FjhWIXHNbIIu6mn5fnaz6OlCM7bDl0TsAOvAwHnLJDVrRqepBlCu1VEDKV2FAgHNhpSnA8wQKnpLat/4zzY8FmUUqAE4y3rvOLdncfK2GzL785JLCVP31m6O8mQDEcnppqft+tVBNCwrT3TcIoWEJtbVGMf//2K0/fK7QHjWuSh4dShxee+WKGc2MCm1ttH+r6QQdzNDvuG4Pe+wNqSdS205553bO9osh9UgKcMjZF6yW+zi2PidhESN0E4lSqasNzj68TBWpIIZ+eN3ncBh9OZLYyZ2PdhAUfyfazxmenJLprOa4TUDG9UYhjVzWR/GS8ELL6hsinJdwVkU0iELGb1xcrTG8AWxLTn43OnDM7cbzqm0Xs1NGozWYMwVoWWX1z3By7lABP+x7cAvIm4iqVjgMAO/F+tVgvs5SOgz3PE/5vkGsUR24TeMAMnGeY0BfzlslpKDWh+05R3MZ2Rsf4I0fxdZRtspkEZqh7qxOviePoUx35I1uuNph6z+9xnQFvkWrQk/w6Z4yrkEEnu8Dg9sYubGUO+rYK88vprxOveHvfb0acre3wVmIImtLpwlvPgq8rQ3I65Zl6OphESqzrOF5ZZCp2+f/rx7J1NTiuJcMeLmaVP4Eue9kWZ2E6nACoex8OmwKrEiTBCXAFc7OM4YLSOIc3/eGRl3NWODp7jw1W8TXIHIGJ3X38sVrzo7kR199nq1qxEQSwqXb8wdO23JDkHndQpNE= X-MS-TrafficTypeDiagnostic: AM6PR03MB5926: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cbmo+245Jf2J1Gg0isUiEayY5zZymlkkv+dnKfzZbORg/L+Rx/Oq6tstsSqTHcfbcMQ9e8xp7D7Qw3q2knnsqGlrpLvpOC8JY38KSgzJpdX/jtOklO3DY1tNElrqqW0vaGU4A2AChXFm3K46IuRW3fHU9GrxnDgdsULwy25mM7a/ga6z7nLKsL4lgKHRNzYrVr2MFrYgE4zcks+busRL4pkJrpMxYf4HKl3h8r4pjaCPqFx//ZIl1A0ISPIJogmkdV9gBHrQQfgO+fULIpNs+SUtJI/Xr5Ziw/kYpS/iJwVyXNILZmT8YtCCT65x9qQRSuxO7n7raf8k9F2vIawD0f6pgOQzvI/sn0ZglngBXAeJiGVNyZp83xAddyf/F95Y1b153W4JM2zy0iXC/o0iBJoiLFvNVuUfvhoid9KV8JyphX6EpM+ln4ytKZkB6wGc X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gaTQAp4K/r/ucqopFOQ02W3HqMGLiv6g4uew99qoPy837x31QHYWD4eSSjw20i4WjuU51SHRZgnBm1SVXkGG8IUUsMM8vvTecm0Up9AZLBnuVFvGcp+HHwwHMNX6wpQAqr65KwUDNZ+Q+hcDMA4izg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c55d88c7-8b78-44a7-d4b4-08d980772759 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2021 22:52:32.5891 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR03MB5926 Subject: [FFmpeg-devel] [PATCH 1/3] avfilter/vf_swaprect: Use ff_formats_pixdesc_filter() 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 6Xt5wNKcBaXJ Signed-off-by: Andreas Rheinhardt --- libavfilter/vf_swaprect.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/libavfilter/vf_swaprect.c b/libavfilter/vf_swaprect.c index 4a5f4a12a6..fff9b53dc4 100644 --- a/libavfilter/vf_swaprect.c +++ b/libavfilter/vf_swaprect.c @@ -22,7 +22,6 @@ #include "libavutil/eval.h" #include "libavutil/imgutils.h" #include "libavutil/opt.h" -#include "libavutil/pixdesc.h" #include "avfilter.h" #include "formats.h" @@ -59,16 +58,13 @@ AVFILTER_DEFINE_CLASS(swaprect); static int query_formats(AVFilterContext *ctx) { AVFilterFormats *pix_fmts = NULL; - int fmt, ret; - - for (fmt = 0; av_pix_fmt_desc_get(fmt); fmt++) { - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt); - if (!(desc->flags & AV_PIX_FMT_FLAG_PAL || - desc->flags & AV_PIX_FMT_FLAG_HWACCEL || - desc->flags & AV_PIX_FMT_FLAG_BITSTREAM) && - (ret = ff_add_format(&pix_fmts, fmt)) < 0) - return ret; - } + int ret; + + ret = ff_formats_pixdesc_filter(&pix_fmts, 0, AV_PIX_FMT_FLAG_PAL | + AV_PIX_FMT_FLAG_HWACCEL | + AV_PIX_FMT_FLAG_BITSTREAM); + if (ret < 0) + return ret; return ff_set_common_formats(ctx, pix_fmts); } From patchwork Sat Sep 25 22:53:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 30577 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6506:0:0:0:0:0 with SMTP id z6csp2809154iob; Sat, 25 Sep 2021 15:53:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzXVcnypAfeM8+jWwflEEvRi7rtHxlZZH+hfyliK3QA1dIuD8Ch49NcD0N/pPrU1tBu4pW X-Received: by 2002:a05:6402:1841:: with SMTP id v1mr14214103edy.170.1632610421765; Sat, 25 Sep 2021 15:53:41 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id s3si14233223edd.303.2021.09.25.15.53.41; Sat, 25 Sep 2021 15:53:41 -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=@outlook.com header.s=selector1 header.b=Xd342zf7; arc=fail (body hash mismatch); 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 115C868A936; Sun, 26 Sep 2021 01:53:39 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-oln040092075079.outbound.protection.outlook.com [40.92.75.79]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9143A68A3DF for ; Sun, 26 Sep 2021 01:53:32 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YnjFZPhE+pTeFG/KFFFjZ4miB71BogieHmZauLHHgxadHTFAWc8pDMNa9pMgG5m0Hg8aJZDoiEbNIqQq2k5+3nvzLsIr3JFmBBXIk6wDzf6g3zwoTehO+R7/uUCB7W/zIhLYn386eX08I6RuN6g+cVpTj5+eysh95DcNuUzhdZnOg1nKlKs9VkEhXwAR8EFvmqXgrdIfc04J/ierRHOwseFChH80GtXYDibxtRC6c3dsafENf78/hRJ02IJE7IXLR2k9AtLXvaug3zOSl+fBMUV2nrBt4Sz826jyg/pBtSu+ge30K7kREVuxMTinmdC3gEcS0VRF86/zBhU4vsXM6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=tSMJhuK7xkO3ehrmQMN6Z8MSP4hzKTxHJ5pMu67lOrs=; b=HsBrUeu7JNyTyafgVPaPuWQvenaMkxEuWWXEQEGsHGKJ4HaMfRQohcTZpkj1Tihnerw/j0ATLYXaujcXPfCa062Y5Mir9L6kgvu/VipsU64nlmhLbF8XEJTiHbyjlkCI+FECRKDRTQTDK4v+3+/wZgholPhB2J4kEtp3ydU6zDU40qIxWZMiAQjsWz4FBpEdEPcgbJedaB6Tn81xljOlkFbqs7j1E0X+tVs+XwKimn5A7K7X1at9u1Sr4hqD5BE0nWpIT3NVotaHpHpWCN47Yv8XbqN8s4xvV099LgNZxOHu5id/VJSUeR2q7VnO8xooTyqaWQGZUPrwK0pkOQf66A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tSMJhuK7xkO3ehrmQMN6Z8MSP4hzKTxHJ5pMu67lOrs=; b=Xd342zf7IP8mUJyGbtbZjti2GylEfgT12haC1FGYxS57/f795useDo31mE3H9lBMmweCB2QLb5SO1Yd8FNSBGbvsImnKeEP9kCfYbEDDS4L9JBrY08FvqvrLW+3dkwSOLtS4CxdqeRyV9da9hWC6Djqv7ydA7NWlGTuCeJAPSh1D6c3ixzUrmCCpLryKgoOqauaQ+jtVd+E+LaWKTNvm4YUOIwnMYLmap7ie22P+lxruAxckZRufXOJl6gUVFY/Kx49lwDvSCC5TalvDUtW0ZqHnLU96oAZv3aaYmFYQqBqO/EXsd4x4dtjlsUAz5xnCFEAGRwsj/zEqNYqs/qe8gw== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB5926.eurprd03.prod.outlook.com (2603:10a6:20b:e7::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.18; Sat, 25 Sep 2021 22:53:31 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00%3]) with mapi id 15.20.4544.021; Sat, 25 Sep 2021 22:53:31 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sun, 26 Sep 2021 00:53:22 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [+lLsGuzpzRlRn+zuRnFNG75DtssLugbk] X-ClientProxiedBy: FR0P281CA0072.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::9) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210925225323.175304-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by FR0P281CA0072.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.10 via Frontend Transport; Sat, 25 Sep 2021 22:53:30 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 866c4984-cf4e-4aa7-6126-08d980774bd6 X-MS-Exchange-SLBlob-MailProps: f36zkjAOy3W8n08WDYL1L+7sKKGXzP4P/rgoskUsn0jV3siFCFTaAVn32Tn2i+3ELYKW4439Xwh+98cTnC++K7AaKSKCVyOoS+l+gWDfYlfOYAN9WfvoS6anyuPurf6mCYvOSKwcS6ZpgxNr/3gp8bRGQlO6PQjxuXgk26tGcwIl/kuFLMaLfqFwQ9bv5Wwb3TJQqr1xHVY4GTWio97PnJVxlmFY76x40Wq0UweKBVM+n6zQvLKE4XuRgStMHcG8oFpwSN8diZXoJywtDJeRCz8cxmFJjlJjN3xRrJ3awjy1lG6NgTsC1oNneYba8soEbh3lCj7PSOM/Y2i8+VMmzJQUp1mSTRjlzreSPj7p+cY6+pYFKOM+I6Q9bbQKJqHSwhI6DCaItgzGVp99qm0xAzxVwB7vfntJanpf4LenH7bW2YIdlXbOnNs3SF2GWhX+frSHL/LKttQNVcLsua1GnPtjzVCxgCsc9spg449Id1DgcUPAoVjc7LwKdDc7g0HTDWlYgS5p81b6LmHDO/gndtXsYt3AOOGmr4h34NnQ1ocB4LOCWhCajyo+ThpExpvjwi1u1Wj6KpXdGBxlKA1gF4c2ojvORbp6cioX6i8g/svi+JDqQZBz/jYFdDH5qEl6q9NC3WGBexIKvrzH6MB64VQJuckohB4/YHNpD0DAAgdsPDDd2YPs4RvqecKpaZa3mfuZnIL1dqHBL6BPEZiewrNXb+laECBsk70JHm0ReKI= X-MS-TrafficTypeDiagnostic: AM6PR03MB5926: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vJRYVMAm4WoqW67fnCxExihPVW0yrHPmCyTG16aZVMPi5QVHoYsOXd7F4lguzuj4ycZGez8qXsPJX4fJaRcbEDulZm/4+5XQgmd6Dgs4c+nHvvjJiTRPiDtEwI+TDEoaEVHzeroyR4F5tIhErrZQbko/Wmv/Gbw9Vifc3Xc7p/Lwv+3ilViDR5j29N28rf8td/7NfeYsuP1MFF/xNo0KSu2a/M1JUwVhhYHEHlCQRqKUMXGIHAIaUji6zupDvlRVEnEUbuNyNRVWR04u1BHsNsQrrdTyS48fOxu6TddayaqFzdNJpi79qXCkmgFqlbdJw8MUYs9be3TLFujW18gRqmFIy2X5CpPBqb4piQgsjR485L1Qsb32qt7Em8sLBpwGklYUkkZrUxVs3QZ5D18uKOJHgsdHsyeoNtWG1/BqubwPNUxv2SDyKvv3zzafuX85 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iub6TDgZULwvzkiYCn+efr7sKpziQDf4D2n5FeaG7K634XEWOqZ2xJNHyrG5UD1AO3Xk8ovOFFnwm1j/TlqViTWuYhvL2zMLTiXxYQOfLOZIA9e5SHIyOfh+xT00U97aEzdDt+1LRnGEac2XStfBxQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 866c4984-cf4e-4aa7-6126-08d980774bd6 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2021 22:53:31.4198 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR03MB5926 Subject: [FFmpeg-devel] [PATCH 2/3] avfilter/formats: Make ff_formats_pixdesc_filter return AVFilterFormats* 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: fbEIZBulBkew Up until now, it has returned the AVFilterFormats list via an AVFilterFormats** parameter; the actual return value was an int that was always AVERROR(ENOMEM) on error. The AVFilterFormats** argument was a pure output parameter which was only documented by naming the parameter rfmts. Yet nevertheless all callers initialized the underlying AVFilterFormats* to NULL. This commit changes this to return a pointer to AVFilterFormats directly. This is more in line with the API in general, as it allows to avoid checks for intermediate values. Signed-off-by: Andreas Rheinhardt --- libavfilter/formats.c | 9 ++++----- libavfilter/formats.h | 2 +- libavfilter/vf_copy.c | 9 +-------- libavfilter/vf_crop.c | 8 ++------ libavfilter/vf_detelecine.c | 13 ++++--------- libavfilter/vf_fieldhint.c | 13 ++++--------- libavfilter/vf_hwdownload.c | 9 ++++----- libavfilter/vf_il.c | 10 ++-------- libavfilter/vf_mix.c | 13 ++++--------- libavfilter/vf_stack.c | 13 ++++--------- libavfilter/vf_swaprect.c | 13 ++++--------- libavfilter/vf_telecine.c | 15 +++++---------- libavfilter/vf_untile.c | 15 +++++---------- libavfilter/vf_weave.c | 10 ++-------- 14 files changed, 46 insertions(+), 106 deletions(-) diff --git a/libavfilter/formats.c b/libavfilter/formats.c index 1bf7d36195..59ea966424 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -452,7 +452,7 @@ AVFilterFormats *ff_all_formats(enum AVMediaType type) return ret; } -int ff_formats_pixdesc_filter(AVFilterFormats **rfmts, unsigned want, unsigned rej) +AVFilterFormats *ff_formats_pixdesc_filter(unsigned want, unsigned rej) { unsigned nb_formats, fmt, flags; AVFilterFormats *formats = NULL; @@ -476,18 +476,17 @@ int ff_formats_pixdesc_filter(AVFilterFormats **rfmts, unsigned want, unsigned r } if (formats) { av_assert0(formats->nb_formats == nb_formats); - *rfmts = formats; - return 0; + return formats; } formats = av_mallocz(sizeof(*formats)); if (!formats) - return AVERROR(ENOMEM); + return NULL; formats->nb_formats = nb_formats; if (nb_formats) { formats->formats = av_malloc_array(nb_formats, sizeof(*formats->formats)); if (!formats->formats) { av_freep(&formats); - return AVERROR(ENOMEM); + return NULL; } } } diff --git a/libavfilter/formats.h b/libavfilter/formats.h index 471cb42bc4..42fe068765 100644 --- a/libavfilter/formats.h +++ b/libavfilter/formats.h @@ -230,7 +230,7 @@ AVFilterFormats *ff_all_formats(enum AVMediaType type); * properties */ av_warn_unused_result -int ff_formats_pixdesc_filter(AVFilterFormats **rfmts, unsigned want, unsigned rej); +AVFilterFormats *ff_formats_pixdesc_filter(unsigned want, unsigned rej); //* format is software, non-planar with sub-sampling #define FF_PIX_FMT_FLAG_SW_FLAT_SUB (1 << 24) diff --git a/libavfilter/vf_copy.c b/libavfilter/vf_copy.c index 16fbe438a1..0ed61324e7 100644 --- a/libavfilter/vf_copy.c +++ b/libavfilter/vf_copy.c @@ -29,14 +29,7 @@ static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - int ret; - - ret = ff_formats_pixdesc_filter(&formats, 0, - AV_PIX_FMT_FLAG_HWACCEL); - if (ret < 0) - return ret; - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats(ctx, ff_formats_pixdesc_filter(0, AV_PIX_FMT_FLAG_HWACCEL)); } static int filter_frame(AVFilterLink *inlink, AVFrame *in) diff --git a/libavfilter/vf_crop.c b/libavfilter/vf_crop.c index 76d375cdfc..27ae1b8118 100644 --- a/libavfilter/vf_crop.c +++ b/libavfilter/vf_crop.c @@ -93,13 +93,9 @@ typedef struct CropContext { static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - int ret; + int reject_flags = AV_PIX_FMT_FLAG_BITSTREAM | FF_PIX_FMT_FLAG_SW_FLAT_SUB; - ret = ff_formats_pixdesc_filter(&formats, 0, AV_PIX_FMT_FLAG_BITSTREAM | FF_PIX_FMT_FLAG_SW_FLAT_SUB); - if (ret < 0) - return ret; - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats(ctx, ff_formats_pixdesc_filter(0, reject_flags)); } static av_cold void uninit(AVFilterContext *ctx) diff --git a/libavfilter/vf_detelecine.c b/libavfilter/vf_detelecine.c index 7f34a88217..e36e1a6245 100644 --- a/libavfilter/vf_detelecine.c +++ b/libavfilter/vf_detelecine.c @@ -124,16 +124,11 @@ static av_cold int init(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - int ret; + int reject_flags = AV_PIX_FMT_FLAG_BITSTREAM | + AV_PIX_FMT_FLAG_PAL | + AV_PIX_FMT_FLAG_HWACCEL; - ret = ff_formats_pixdesc_filter(&formats, 0, - AV_PIX_FMT_FLAG_BITSTREAM | - AV_PIX_FMT_FLAG_PAL | - AV_PIX_FMT_FLAG_HWACCEL); - if (ret < 0) - return ret; - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats(ctx, ff_formats_pixdesc_filter(0, reject_flags)); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_fieldhint.c b/libavfilter/vf_fieldhint.c index c6c2a8eebe..c41f2ef751 100644 --- a/libavfilter/vf_fieldhint.c +++ b/libavfilter/vf_fieldhint.c @@ -77,16 +77,11 @@ static av_cold int init(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - int ret; + int reject_flags = AV_PIX_FMT_FLAG_BITSTREAM | + AV_PIX_FMT_FLAG_HWACCEL | + AV_PIX_FMT_FLAG_PAL; - ret = ff_formats_pixdesc_filter(&formats, 0, - AV_PIX_FMT_FLAG_HWACCEL | - AV_PIX_FMT_FLAG_BITSTREAM | - AV_PIX_FMT_FLAG_PAL); - if (ret < 0) - return ret; - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats(ctx, ff_formats_pixdesc_filter(0, reject_flags)); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_hwdownload.c b/libavfilter/vf_hwdownload.c index f00f105f84..5bd63a8a8f 100644 --- a/libavfilter/vf_hwdownload.c +++ b/libavfilter/vf_hwdownload.c @@ -37,13 +37,12 @@ typedef struct HWDownloadContext { static int hwdownload_query_formats(AVFilterContext *avctx) { - AVFilterFormats *fmts; int err; - if ((err = ff_formats_pixdesc_filter(&fmts, AV_PIX_FMT_FLAG_HWACCEL, 0)) || - (err = ff_formats_ref(fmts, &avctx->inputs[0]->outcfg.formats)) || - (err = ff_formats_pixdesc_filter(&fmts, 0, AV_PIX_FMT_FLAG_HWACCEL)) || - (err = ff_formats_ref(fmts, &avctx->outputs[0]->incfg.formats))) + if ((err = ff_formats_ref(ff_formats_pixdesc_filter(AV_PIX_FMT_FLAG_HWACCEL, 0), + &avctx->inputs[0]->outcfg.formats)) || + (err = ff_formats_ref(ff_formats_pixdesc_filter(0, AV_PIX_FMT_FLAG_HWACCEL), + &avctx->outputs[0]->incfg.formats))) return err; return 0; diff --git a/libavfilter/vf_il.c b/libavfilter/vf_il.c index 8e829b2f69..38ef1ac47a 100644 --- a/libavfilter/vf_il.c +++ b/libavfilter/vf_il.c @@ -83,15 +83,9 @@ AVFILTER_DEFINE_CLASS(il); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - int ret; + int reject_flags = AV_PIX_FMT_FLAG_PAL | AV_PIX_FMT_FLAG_HWACCEL; - ret = ff_formats_pixdesc_filter(&formats, 0, - AV_PIX_FMT_FLAG_PAL | - AV_PIX_FMT_FLAG_HWACCEL); - if (ret < 0) - return ret; - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats(ctx, ff_formats_pixdesc_filter(0, reject_flags)); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_mix.c b/libavfilter/vf_mix.c index ce66202557..13032e466a 100644 --- a/libavfilter/vf_mix.c +++ b/libavfilter/vf_mix.c @@ -55,16 +55,11 @@ typedef struct MixContext { static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - int ret; + int reject_flags = AV_PIX_FMT_FLAG_BITSTREAM | + AV_PIX_FMT_FLAG_HWACCEL | + AV_PIX_FMT_FLAG_PAL; - ret = ff_formats_pixdesc_filter(&formats, 0, - AV_PIX_FMT_FLAG_BITSTREAM | - AV_PIX_FMT_FLAG_PAL | - AV_PIX_FMT_FLAG_HWACCEL); - if (ret < 0) - return ret; - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats(ctx, ff_formats_pixdesc_filter(0, reject_flags)); } static int parse_weights(AVFilterContext *ctx) diff --git a/libavfilter/vf_stack.c b/libavfilter/vf_stack.c index 3afcdfda87..338154e715 100644 --- a/libavfilter/vf_stack.c +++ b/libavfilter/vf_stack.c @@ -60,21 +60,16 @@ typedef struct StackContext { static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; StackContext *s = ctx->priv; - int ret; + int reject_flags = AV_PIX_FMT_FLAG_BITSTREAM | + AV_PIX_FMT_FLAG_HWACCEL | + AV_PIX_FMT_FLAG_PAL; if (s->fillcolor_enable) { return ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0)); } - ret = ff_formats_pixdesc_filter(&formats, 0, - AV_PIX_FMT_FLAG_HWACCEL | - AV_PIX_FMT_FLAG_BITSTREAM | - AV_PIX_FMT_FLAG_PAL); - if (ret < 0) - return ret; - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats(ctx, ff_formats_pixdesc_filter(0, reject_flags)); } static av_cold int init(AVFilterContext *ctx) diff --git a/libavfilter/vf_swaprect.c b/libavfilter/vf_swaprect.c index fff9b53dc4..e03603fe5a 100644 --- a/libavfilter/vf_swaprect.c +++ b/libavfilter/vf_swaprect.c @@ -57,16 +57,11 @@ AVFILTER_DEFINE_CLASS(swaprect); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *pix_fmts = NULL; - int ret; + int reject_flags = AV_PIX_FMT_FLAG_PAL | + AV_PIX_FMT_FLAG_HWACCEL | + AV_PIX_FMT_FLAG_BITSTREAM; - ret = ff_formats_pixdesc_filter(&pix_fmts, 0, AV_PIX_FMT_FLAG_PAL | - AV_PIX_FMT_FLAG_HWACCEL | - AV_PIX_FMT_FLAG_BITSTREAM); - if (ret < 0) - return ret; - - return ff_set_common_formats(ctx, pix_fmts); + return ff_set_common_formats(ctx, ff_formats_pixdesc_filter(0, reject_flags)); } static const char *const var_names[] = { "w", "h", "a", "n", "t", "pos", "sar", "dar", NULL }; diff --git a/libavfilter/vf_telecine.c b/libavfilter/vf_telecine.c index 99c6d22b7d..eaaddf734d 100644 --- a/libavfilter/vf_telecine.c +++ b/libavfilter/vf_telecine.c @@ -101,16 +101,11 @@ static av_cold int init(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - int ret; - - ret = ff_formats_pixdesc_filter(&formats, 0, - AV_PIX_FMT_FLAG_BITSTREAM | - AV_PIX_FMT_FLAG_PAL | - AV_PIX_FMT_FLAG_HWACCEL); - if (ret < 0) - return ret; - return ff_set_common_formats(ctx, formats); + int reject_flags = AV_PIX_FMT_FLAG_BITSTREAM | + AV_PIX_FMT_FLAG_HWACCEL | + AV_PIX_FMT_FLAG_PAL; + + return ff_set_common_formats(ctx, ff_formats_pixdesc_filter(0, reject_flags)); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_untile.c b/libavfilter/vf_untile.c index 2bf5146591..85e1d56d2b 100644 --- a/libavfilter/vf_untile.c +++ b/libavfilter/vf_untile.c @@ -62,16 +62,11 @@ static av_cold int init(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - int ret; - - ret = ff_formats_pixdesc_filter(&formats, 0, - AV_PIX_FMT_FLAG_HWACCEL | - AV_PIX_FMT_FLAG_BITSTREAM | - FF_PIX_FMT_FLAG_SW_FLAT_SUB); - if (ret < 0) - return ret; - return ff_set_common_formats(ctx, formats); + int reject_flags = AV_PIX_FMT_FLAG_HWACCEL | + AV_PIX_FMT_FLAG_BITSTREAM | + FF_PIX_FMT_FLAG_SW_FLAT_SUB; + + return ff_set_common_formats(ctx, ff_formats_pixdesc_filter(0, reject_flags)); } static int config_output(AVFilterLink *outlink) diff --git a/libavfilter/vf_weave.c b/libavfilter/vf_weave.c index 60e37a1037..52fb4c684d 100644 --- a/libavfilter/vf_weave.c +++ b/libavfilter/vf_weave.c @@ -51,15 +51,9 @@ AVFILTER_DEFINE_CLASS_EXT(weave, "(double)weave", weave_options); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - int ret; + int reject_flags = AV_PIX_FMT_FLAG_PAL | AV_PIX_FMT_FLAG_HWACCEL; - ret = ff_formats_pixdesc_filter(&formats, 0, - AV_PIX_FMT_FLAG_PAL | - AV_PIX_FMT_FLAG_HWACCEL); - if (ret < 0) - return ret; - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats(ctx, ff_formats_pixdesc_filter(0, reject_flags)); } static int config_props_output(AVFilterLink *outlink) From patchwork Sat Sep 25 22:53:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 30576 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6506:0:0:0:0:0 with SMTP id z6csp2809215iob; Sat, 25 Sep 2021 15:53:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygsow924UQC3bQsEhqZVV9NGXns16lXK/400pZXVUD3AOW+m6mElWMQ6xYxRP8EH9EIE64 X-Received: by 2002:a50:9d82:: with SMTP id w2mr10157684ede.379.1632610429939; Sat, 25 Sep 2021 15:53:49 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id l7si6481028edk.342.2021.09.25.15.53.49; Sat, 25 Sep 2021 15:53:49 -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=@outlook.com header.s=selector1 header.b=Lato4Al2; arc=fail (body hash mismatch); 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 103BC68A94A; Sun, 26 Sep 2021 01:53:44 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-oln040092075079.outbound.protection.outlook.com [40.92.75.79]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AD2BB68A8FA for ; Sun, 26 Sep 2021 01:53:37 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hkQ3vxH8jRI8pSE3FhuZVoLPeczg98Z4wNNFPJWSIzkLFdQWGfy7sXFrGWUjKhtYrmwUSrS7/zdP5/KSNAEk0piCWhdqQWmbGa6S8LCG5d7PNdr1dsKgCgmKe3YsOusTLTfvyryD0ZIF+MW9ujBdRMpLqNImJgnIf88XnOHKS5kpry7XrMjSfq1AMj5lyf9A8fhDd62XFHNkiArO7Pp0+b7q4GmOeDPiohOwqRr4Ro3DjFegkuG0z3pkpmfTmyr7hIyEgkgzOU3Vrk33KFdZfgn19S3UzsX7jh+FZ/tCFzfiaP1FoJ1TZn3kxzUM7LRnymzhLxmlED7vpyKa4gIY3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=sqS+wEvGWjoXWLhpuTTkPj9WoYOW3EatJ9ZFSbp7CIs=; b=hsXreWYESyKK/3viQtKPGNYoABu8KtmYuHO9zr9EyHIPHKazE6sXc3W2Xhk44lCqabArUjvWNHQILQV5zEM/f7jAKU4CJT87LXSrIL/cBIy29f3gN2/n330shH4olywp42fNKUtV6RMS5ObY+qn3aKLEJ2Y6wyKt6FmJQ0Kr9OS0ffDa92VH31Mq8rLgHbJFSdB68wML87ZA99DZua0cgzoqRUSwV6Ut32M117ISkz2BMk0vc/kuk0nPepYqxIU4gjgdrYYzDNyIJHvzaztF8P2ZYJZ+FHo7d//LN+hKUoVGwsjk1QTFumgLNJexllkSHUKPGVAX6NDphAe6PpA9BA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sqS+wEvGWjoXWLhpuTTkPj9WoYOW3EatJ9ZFSbp7CIs=; b=Lato4Al2itXLIXwBZ1oc4IeFqBoKYlYafZ2zpd4dZBIG7bR7K0bbj9Tervr5AmuEd66ikXXnv0Vi69/CctOUfeTSKCPZwrWs9/smigqdmvc/d7S50sf1KE7q99+qJNICqpJF42nPunpOJGskSYS25T5gGXz+GljcgeDxg3YfNEsWHdyaLNEbRnbemLwUtLjgQla+HlIG3HJVKh6oc22vfv60eyu045Zm0cilPPVy/M+CIeCxnt9NSSX8DMlsNzpfX1XoO+XiigzgO/hquwE4UHQk/GL2tCMdPYJTm3Yq02cyWyIddkS4y2rF6Mti8DsDTKxRpdn+KpQIsdXjm+5DDA== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB5926.eurprd03.prod.outlook.com (2603:10a6:20b:e7::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.18; Sat, 25 Sep 2021 22:53:35 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00%3]) with mapi id 15.20.4544.021; Sat, 25 Sep 2021 22:53:35 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sun, 26 Sep 2021 00:53:23 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [cx23IJVhPLY1DvDCPGIcht3JGu4I8cCH] X-ClientProxiedBy: FR0P281CA0072.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::9) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210925225323.175304-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by FR0P281CA0072.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.10 via Frontend Transport; Sat, 25 Sep 2021 22:53:34 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 392f6733-74cf-43f3-a451-08d980774e33 X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNUDzg/JPsaGZvm+FE5KEKAj8xWADqiW9JiAXbSvOsKPU8kI203tzGc16gEBQ/+S9l58Fq8wEWn90tiYZUWcZkdeuF1EcBltYlY/OHtGjvjeiVbRsUjGIaiQLvmwJtFN2B/FAPCMGkdJWZENp7vJiDaqYenHgNcODfNY2vEVuV3XkX2dB+PKT4i2J5Ywoi4/mC7AHsXtBNsmqilL6HxieMlX4Tk6UsJ3f9nwnUSh+cBDeRdlfLAxOeHPqLqN+z5fpJDr2DFZcEA04GiqpOQyZBhDem+GWchsuQEfpAIUxik6mnjuK1eK7mlfSGTQFIV3sKOLQ0QGaoYMMgytG38TLrFvPx2D7VN/8rrvaloJRjZaDVGEFWEUt3gZyupnD3vPiQXn99XhYtLNeq9zJURGeyxeR0TTFm8e48C5QZfB6i5jq1bnc4BizFpb9SbIrAGy4lmK5r9sNoccHlnOf7iUqsRAvbqlzSuzcMUXGB7jXA81V2O06skCmJUVIuwauIrYbAnvdgk3YCOxLfR8+ukvI+tZJUe9qYGXbeEjuNqes7Ux/Ftz0h6eVLdd27xAspvcT2p/SPvU4IEBjcKYBDaJ89VtsOYhvK4Krii19VwQGm2/fBYAJ01eoIL8xHyqCk+63gitBRLpaiNDzJPgPC6LMQbguKvu8OevDCFrEwFFp80U310+x7oMKd9BSA/YVhRXTyuRKRdrtwsah62DYJIljusWeQB4XqoqppI= X-MS-TrafficTypeDiagnostic: AM6PR03MB5926: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JtJcLGEJvFi59KbanLgGcQ45a+prcRtoGrwXZ4V76gTAhzJz4zRHYGf4prf0TqF33N2nmGwEzmbeCGvBvIPWF6ikXckjydm2zEqQIz6k699Ejdi/sLkO2/l5IO8UfmK+vwy/v5cejMK7wMl+Hv5t3mREfYdriY1dtJiflIuWkmXnjnYsoCEH/7ttaa9PEfeKNizh2VYR1zLKwX+bIvJG+jLgGVRPHPAAzQnAsOSKYDqWvETIhWGwpDBuztVuKNhNqihQqT9fz7XFL9Szf6fJ45LabZkPiIMOEEazV0Zf1HR1T+l2FsGBalhBYloyo3/g9FXyW1f5PLygjEEi7fkXIpe/6I3T0qXiVaAcnSbZXExUibJSR9MExgGpU9lKf6mqHvl+10vnIbr0lv8+tfzZYwusYwwzMfG19PbV2XHhJSk3bM1C8FxezvSSgIVn5tJ1 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Oez8vJlG4kB+QGYLleLAYpHJTdp0ewItXqcsl5oc01mwuBsGgoHnfj1toeHzBOR8FCHkzSzsSJuVI8JVrKYM+KKrpVSmufUcUm7fOvQHtrWAivwrWG0hKjEgglzXYhvoptdncNVM1Uv4pA0+2Ho8aw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 392f6733-74cf-43f3-a451-08d980774e33 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2021 22:53:35.3774 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR03MB5926 Subject: [FFmpeg-devel] [PATCH 3/3] avfilter/formats: Avoid reallocations for video in ff_all_formats() 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Bdd80LP5aGwx Up until now, the list of pixfmts is reallocated every time an entry is added to it; there are currently 196 pixel formats, so this matters: It causes 5541704 calls to av_realloc_array() in a typical FATE run, which is the majority for said function (8095768 calls) and even a large chunk of the calls to av_realloc() itself (12589508 calls). Fix this by using ff_formats_pixdesc_filter() instead. Signed-off-by: Andreas Rheinhardt --- libavfilter/formats.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libavfilter/formats.c b/libavfilter/formats.c index 59ea966424..1d2a51c0af 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -435,11 +435,7 @@ AVFilterFormats *ff_all_formats(enum AVMediaType type) AVFilterFormats *ret = NULL; if (type == AVMEDIA_TYPE_VIDEO) { - const AVPixFmtDescriptor *desc = NULL; - while ((desc = av_pix_fmt_desc_next(desc))) { - if (ff_add_format(&ret, av_pix_fmt_desc_get_id(desc)) < 0) - return NULL; - } + return ff_formats_pixdesc_filter(0, 0); } else if (type == AVMEDIA_TYPE_AUDIO) { enum AVSampleFormat fmt = 0; while (av_get_sample_fmt_name(fmt)) {