From patchwork Sat Sep 11 23:40:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 30166 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp2757203iov; Sat, 11 Sep 2021 16:42:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybggjH/zzOBgf/sXhBqE/MmL8qgrYkVrYu53PMgjOyn0kCUN/kgRCZtm8u67ei5adNNaKr X-Received: by 2002:a05:6402:1c1e:: with SMTP id ck30mr5217734edb.103.1631403766151; Sat, 11 Sep 2021 16:42:46 -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 h15si3098376ede.550.2021.09.11.16.42.45; Sat, 11 Sep 2021 16:42:46 -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=DhJozzxf; 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 3953768A930; Sun, 12 Sep 2021 02:41:49 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05olkn2068.outbound.protection.outlook.com [40.92.91.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 300D268A8A5 for ; Sun, 12 Sep 2021 02:41:42 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aTgsEBDsUkmiLcWa8zZJaoMxUQvtqiobPgNfei+UvtoABhP3hfsBuCAaKt/demIe5W8fodlHXl4oxgi+2L4PRycbeOFEDfh2eeXg55HsU3dFOtqgZzaxyxKQFe/wES3utPCZfYcptlHszQIet1KCHOnLCp0O17WbPA99ehsN0m7tWkfrvhNAVRJ70mdTdE6byeHoyWJdrWA5d/j14G/UMnG5ROalGy0iHAY6UYv1US/r4K8Wi3e4VZ6zHWYZ0RZh6GvLxl6Q9u1CGBBx4r+TTV122qHNzezX8GM92nH8475IAf+0okRXZCw+60dJhcXrhoEbXKio+CRaEj3/6lG3/g== 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=tkeypuDS4og6g3H+U37pSMMskkN2DrF4qRPH3nVUCrU=; b=XDWK1699HpvX3VdJpOQVu/AS6/T51daIsPG7oOzBtRhE2uoIaS8FbR/XzCE/VBOzALlwXKlRzaP2IhlNes+ICAfSmR9BZD6sLoRY42RTJ2i62sRrY5sKwx8yY4qYIe2wB2A1fvQgF9VMM4lvyreS3TtIE/SpQW/pxvo+S31Vhv7EeSfWn1TY5BvD/dyKc1gheMbI0oe3i9wtGF2zxdETe77vvPNNOYgXN2P6PSG/ZWymRlfyEIneB+tnxauyxzvWYRpR1Sfik4qxU2bOkVBeH91zDRU2reYm9zGr1nY7EKBL2mPcMtzetE6GPWb0RcWzc1p7w19UEWs9qp/Nrwy11A== 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=tkeypuDS4og6g3H+U37pSMMskkN2DrF4qRPH3nVUCrU=; b=DhJozzxfFu/eYuTE5ZbxMGTOJzZL8zWAxW6actZLNWmhRWVnupxB1urpW8km7lf909tSU6qoTzdwQYJF5oCptCPe9ubMSgDGP9c2FxbUXDr/gFkysv/1K8N8uutuzlKOh4KZpMObtVqonBIl5r6UDsuEVSvwjJHpVg8mUBbwLrAZ1cBUQV3Wyx9nSPwD0SOfK/z9layeUZNk49smrFRiDBIKymlFJxDHtRvM3RG98tcIaihuShlzIvrdGoJ6Pg1Jw3BoT9pd9nizRyLI7EEJnJKWF3H5ZbKd1yFx9tMn3SGDzDR5/h/nsJQQKWlwX/2goDc0N06Gl/ohcszEtQrSnA== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB5047.eurprd03.prod.outlook.com (2603:10a6:20b:89::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.16; Sat, 11 Sep 2021 23:41: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%4]) with mapi id 15.20.4500.018; Sat, 11 Sep 2021 23:41:32 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sun, 12 Sep 2021 01:40:37 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [pXC3+t4n8uGbMr24VSuok86oivM/BfyV] X-ClientProxiedBy: AM0PR05CA0088.eurprd05.prod.outlook.com (2603:10a6:208:136::28) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210911234109.2246196-6-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by AM0PR05CA0088.eurprd05.prod.outlook.com (2603:10a6:208:136::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14 via Frontend Transport; Sat, 11 Sep 2021 23:41:31 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ad75f376-ec39-45a8-2dec-08d9757daf0f X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNVv/2++Uk5pM+AmDHCluBYM/8C4AD1FRg9BimNal7QQPlDY13PODPiFMX4Q5DIBdNK7jqJD0tZTNZ7kzYWMahh/BXX/OOZh0JmTq83mk3eUKPmnxqw1J6juvJAmllyKyL26o/4A6gKPfKnGp9RHB+4505DhiEaYivhmEBTFBZQyIlIjzAdQFee82xxSwRcXlJUbEmQC5SBBZuUIyX1rO1ISkpkqm9PU35GnULpe/Vf2TonwH9yhV13oGZ2CtSxhlfEUQsj7jP10DKpeETz2WdGxGrRzsQ3HmaT6kaxi/rArZdRiDD5O4pMSFQHxFFaZan7gVQZN2was7DVXeYyv9o8IgK1C0sot7Sz3mi6W3Lt5NMo8g+zQSngxeOscN6tlnGUpFTRCotH9n6+rmxVLKzNKKzjWILAjQaMdOSDSxQu2PUfdM/n5MDQrOv6uDuoDFiex+kCWuUyn4hwArFypJueco9yv0p7GQ/S4q/rwlitoHOzLIlgEsddYvOjCjzy9FFGy2420VIL+KsEoc+p8KpEw1x9/+W17nJxYrhD/DoTXFP1g39dYrNqEOcly09sMdQ7Y6mRU08LdLiw98czyzMuicsn0j5PFcW+4fxkCP/05BSDkGvY1aFaJVBhlL2GJ+aO87QnGenNM8afGL+imSV7wokjC+WgdpTlaU7+2F0L0XByGBq172PyVbHM4Fa1n9kbXMIZS7U4CcwAYjO4he7mHX5mnLQGOcnQ= X-MS-TrafficTypeDiagnostic: AM6PR03MB5047: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IwXXWq6UJSxN7zR+wVQwQzYdP/Z7PWrfoh+k1HbBLXWymUYq/ENzkG6lNTFIq4DsJ+OByB//pO3rH14f2Ug9Nw1C+WSmhixyB7bLj6XYtiH18kaD3Ht0N4mXJ6EMLM49JWnMJ77cI1eo9LVLp99sUpAzZuzwtg7yhh55OJIrAGo6oxV2ieNjT4DXhqCZuDeiRNBTgfUtX2BK4aKo5M6CPW1qRVX/SsRcAdpkOZrTv4aNE+ji/iNppItjcIKYZefch1eYL771kjoxqsP/YpNCVbH/0r0k6HL+/X0uFFd16JZ+o2SR5GDqCkfXHWuAs3o1uxkts8XyS6dP4TV2UjCcWblsFiYMg0tASYdFqLQ/j+Sro8yr7WwUC2xTDii5mFhfOuu4PYq1YvPnyGaHJ0zimKgVKo/XecG24Lv81qJaS+muiYIJsjIm2NazunVhZuH4 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jGh7Okbq9Ko886rdgUHqZ8+itL1nJliGS9MP9c1pWXTZ3xdbm/Z/l9uiWHsbh1efUrNIvkj68nw+5hpx8eDJqxmCJzcFf1ZHPXOpckoUGZ9ksfM34fThXqygJzihN+J3FQNGtwvPyeYvbil6geSJ1g== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ad75f376-ec39-45a8-2dec-08d9757daf0f X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2021 23:41:32.0076 (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: AM6PR03MB5047 Subject: [FFmpeg-devel] [PATCH 07/39] avfilter/af_biquads: Deduplicate AVClasses 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: x4FD74sEA/PO Signed-off-by: Andreas Rheinhardt --- libavfilter/af_biquads.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/libavfilter/af_biquads.c b/libavfilter/af_biquads.c index c110734458..828af05b20 100644 --- a/libavfilter/af_biquads.c +++ b/libavfilter/af_biquads.c @@ -853,8 +853,7 @@ static const AVFilterPad outputs[] = { #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM #define AF AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM -#define DEFINE_BIQUAD_FILTER(name_, description_) \ -AVFILTER_DEFINE_CLASS(name_); \ +#define DEFINE_BIQUAD_FILTER_2(name_, description_, priv_class_) \ static av_cold int name_##_init(AVFilterContext *ctx) \ { \ BiquadsContext *s = ctx->priv; \ @@ -865,17 +864,21 @@ static av_cold int name_##_init(AVFilterContext *ctx) \ const AVFilter ff_af_##name_ = { \ .name = #name_, \ .description = NULL_IF_CONFIG_SMALL(description_), \ + .priv_class = &priv_class_##_class, \ .priv_size = sizeof(BiquadsContext), \ .init = name_##_init, \ .uninit = uninit, \ .query_formats = query_formats, \ FILTER_INPUTS(inputs), \ FILTER_OUTPUTS(outputs), \ - .priv_class = &name_##_class, \ .process_command = process_command, \ .flags = AVFILTER_FLAG_SLICE_THREADS | AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, \ } +#define DEFINE_BIQUAD_FILTER(name, description) \ + AVFILTER_DEFINE_CLASS(name); \ + DEFINE_BIQUAD_FILTER_2(name, description, name) + #if CONFIG_EQUALIZER_FILTER static const AVOption equalizer_options[] = { {"frequency", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, 999999, FLAGS}, @@ -954,14 +957,13 @@ static const AVOption bass_lowshelf_options[] = { {NULL} }; +AVFILTER_DEFINE_CLASS_EXT(bass_lowshelf, "bass/lowshelf", bass_lowshelf_options); #if CONFIG_BASS_FILTER -#define bass_options bass_lowshelf_options -DEFINE_BIQUAD_FILTER(bass, "Boost or cut lower frequencies."); +DEFINE_BIQUAD_FILTER_2(bass, "Boost or cut lower frequencies.", bass_lowshelf); #endif /* CONFIG_BASS_FILTER */ #if CONFIG_LOWSHELF_FILTER -#define lowshelf_options bass_lowshelf_options -DEFINE_BIQUAD_FILTER(lowshelf, "Apply a low shelf filter."); +DEFINE_BIQUAD_FILTER_2(lowshelf, "Apply a low shelf filter.", bass_lowshelf); #endif /* CONFIG_LOWSHELF_FILTER */ #endif /* CONFIG_BASS_FILTER || CONFIG LOWSHELF_FILTER */ #if CONFIG_TREBLE_FILTER || CONFIG_HIGHSHELF_FILTER @@ -1003,14 +1005,15 @@ static const AVOption treble_highshelf_options[] = { {NULL} }; +AVFILTER_DEFINE_CLASS_EXT(treble_highshelf, "treble/highshelf", + treble_highshelf_options); + #if CONFIG_TREBLE_FILTER -#define treble_options treble_highshelf_options -DEFINE_BIQUAD_FILTER(treble, "Boost or cut upper frequencies."); +DEFINE_BIQUAD_FILTER_2(treble, "Boost or cut upper frequencies.", treble_highshelf); #endif /* CONFIG_TREBLE_FILTER */ #if CONFIG_HIGHSHELF_FILTER -#define highshelf_options treble_highshelf_options -DEFINE_BIQUAD_FILTER(highshelf, "Apply a high shelf filter."); +DEFINE_BIQUAD_FILTER_2(highshelf, "Apply a high shelf filter.", treble_highshelf); #endif /* CONFIG_HIGHSHELF_FILTER */ #endif /* CONFIG_TREBLE_FILTER || CONFIG_HIGHSHELF_FILTER */ #if CONFIG_BANDPASS_FILTER