From patchwork Thu Sep 30 13:40: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: 30737 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6506:0:0:0:0:0 with SMTP id z6csp697125iob; Thu, 30 Sep 2021 06:58:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjWpzV31M36pJCwYnB18AjD1Qn30Gbi33JIgFEAUhxRjFGao0S2o4NnTZRzo/9PBY7FDrZ X-Received: by 2002:a17:906:5e4d:: with SMTP id b13mr4537513eju.428.1633010315979; Thu, 30 Sep 2021 06:58:35 -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 g13si3323550edr.467.2021.09.30.06.58.35; Thu, 30 Sep 2021 06:58:35 -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=S5oBssCk; 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 27F7E68A83B; Thu, 30 Sep 2021 16:48:13 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2055.outbound.protection.outlook.com [40.92.90.55]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CC3D068AEEF for ; Thu, 30 Sep 2021 16:48:10 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mOcpJDG2POc4r3Hk0bUEjOEnVZi8BbUDLJQPLuPoXtilwf7V6yxgIsa7NCAn2N74+OGLMiwDoUWep5v38dyiNOPc/wv1FQO8mD7X+/1QXBHn4uzDFOYloE70KYYZgnxzyiON3FEBmfHzKvFB+yJ1arq0OFU2HgsA6QYCpm82j/eFLQNIs+SJ3NWBp39ugvTneFQBBCe7A1IW+4wvtjRfibT4EjoUjWrhg08hOU0j73ShDZblnniGIFHxMd7SCOdbnB0F9IEXhmXj5JfI6IO3I7+7xNQMekW4ZyjrrScLIH9Zx3stAcutXHeLQIbKcCvP22k9ZUvLP2YCxklwUBwkuw== 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=rXSX3rfTKAQoutjgoKU6qrRHz1WBAnj3kQuykBemXEE=; b=mEi58ZpLiJ8ah6glOJEZ2rwaegz3g9sbhXOQ5krFWyHJcds8y96SLCtQqhcTwG5offOngYB0VY2OKkCPILB/Tx2eG4amRIcQdyNPacB/Fl3smNg+cEIXam7eTr5HAKVtrg3QqNxjXBZAa43iHbmZEJyS0UvR9uZ6ENUwPjjDFs4oxSt7KV6K4XJg0Y7/tX4lHjx7fOy2AZNydSVltbtWINrZzzhk1Ogkqpqj1HT16XoNQ4rNI87Qzm3cBe55Ctfb49dCgiOOi/f1eGIBoqAxvlTvWBjuAqGq5xCEhUQC9EXKo77+MhbUpux833VXpiQAiYp9xibCn2bAVfXlB4oDJQ== 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=rXSX3rfTKAQoutjgoKU6qrRHz1WBAnj3kQuykBemXEE=; b=S5oBssCkbRWbiZ/XkT1PpSJU9wp73F1K3BRZz6vHMXFMxi09+q83auAlrqufpHTk5udQMeZcKowtqjKSM2RQdP955PBvuA+C+Mt7njEficCINXIxu4J00bPUYLXLLCEEe796UruqLXA3UQRI6abdvSnDJuk1M8U42WZPCVyw8STMZyKyTPTPVQbJ4BBdKrZ0GjEkh8AwgQ8EakhZlvZ+7toaq3pvw7crgvt6E6FHNxwUs79gPk4B6deNfjryPBm8gDquZZHzOviqQ1SxV41+HD+NreYqQ+ugTh1/GDcz+qJGVmhsfpfO9grGPvc97uIwen2jdzFItYeuIUOgwxVDRQ== Received: from PR3PR03MB6665.eurprd03.prod.outlook.com (2603:10a6:102:7d::6) by PR2PR03MB5161.eurprd03.prod.outlook.com (2603:10a6:101:1b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.13; Thu, 30 Sep 2021 13:48:09 +0000 Received: from PR3PR03MB6665.eurprd03.prod.outlook.com ([fe80::15d4:ff2d:e607:cf68]) by PR3PR03MB6665.eurprd03.prod.outlook.com ([fe80::15d4:ff2d:e607:cf68%3]) with mapi id 15.20.4566.015; Thu, 30 Sep 2021 13:48:09 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 30 Sep 2021 15:40:17 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [EUy3xcwN84c8zw647rXQr8DHKx3PEoOb] X-ClientProxiedBy: AS9PR06CA0306.eurprd06.prod.outlook.com (2603:10a6:20b:45b::15) To PR3PR03MB6665.eurprd03.prod.outlook.com (2603:10a6:102:7d::6) X-Microsoft-Original-Message-ID: <20210930134239.2672698-75-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by AS9PR06CA0306.eurprd06.prod.outlook.com (2603:10a6:20b:45b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.15 via Frontend Transport; Thu, 30 Sep 2021 13:48:08 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3925c09f-a74c-4dd4-d86d-08d98418f033 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiQEFGYb/YN4yvKEtCzw5Q2lK7Q8FL92qbN6ihUoa1XKEHXuNP8S0qOvFASoZIvxekJdLsJDTfZF84lCGOKRxVsICm6GBFqcGaG0EW0mA6GXXDwo4CIuX6VftvuOn4QJv1gReKXw9UIE5x9MBzmHKiiY+OPs4BquhCkgyyOaNN/unhB/5YVk24Yw1B4iA+WJB6xme1PLk0rlDvLaVGs4I9WDORzTpky6T8rugJ2ioOUFuhqkQKwisP0wDN2bCnJS5oMe74stS6N0YbxEjzy0mfji+YeYmnCJ9j8nNVPAyx5wFhA9NLlmO2961J4kEPn86GPzhScdKUTxJDzkJ++04RFdQaEz7r6Q/J9HiWTPaCkOtq31MRh52toV9TS256EbamxhJi3MadTBhUNX2uTcTQOLre/7/VHpSfq2SAnXVnil8HevQ5+xfCECE5osNMeJYzccEan3REDhDIMiy2VdQ52Z1vT9fIfQMncNd1AGWxU6OL484+tLeQQp1NYn/PAt6oUv7mk4HpprteEX3e11ndf6cXfwp7nbCyUbNg4ZB/TTG1Q4h6A+iWVKfmW0GiCC/BaXK4oRNLlYOCWcnV72HuGvrDvWQ/0WGSk/0J36EzpUd3ke7vOps1AD2tXhQfCXnsuaMlpbBqGuLObiKm8a6o1dLhSEsQ/dnl+9CuwiaG/S5Y0tvlB3ao2OZwbeT2zCiBHY436NsnOokBHNhV/mrGvT/5swlSXEXlqAX18y+HkSunGCbfl0wbSjExqBuy/Bk1U= X-MS-TrafficTypeDiagnostic: PR2PR03MB5161: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: W/vrCmTVajZPXBEsLXO8W2mSMNOa9mxABAe5JlerMLIvxZwBc1OvnirO7KHp/1edQwAlra8ZDHq1YsbydWQHyv9NBwqkt55Oa+9RiagF2RUbWcaWE2KaUiju3S1a8OCx+LL7azEyqRDQHWbCssASdSt/YS63SRABghIy59xQ5q4bRp8KUEr/4ZD/avP8euoMshO/MTKyt67rtCF/fpuuhz18ebh67xl8lBYa76r+3J0j1EJyaRnQjaGuPCQKl9OyNImhPwDMf7RnagwCCdBg9DncOfbc+/r/BKzDalVIaUsWQ4a615If9zYnfKaK+9t752yvOQIIqe04oe0tTUkJfc2GEfPt/sf0c+rfX9XtrndkXmceDdTyT6yHXBTOQ6tMHxnuU6XmE0E4uqc5y19HsXBlk1pQDFsrX2tsRCbisacWvVWHxXW9yptxx+w0HnSn X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0Ir4e/AvuqHJ1QNYRv4TzOIPZFAATD9Y10SYjCMjeS2pGi3+fzcsJUkzAY4DXcP8AzmpdjkpzZR4vwyVfkUI2qQvvTxAdyzX5lGdoNnCL+k+45PPhj5+6zj8rpfM0ySz0UzZUmoxCy/LeX1PlmFEzg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3925c09f-a74c-4dd4-d86d-08d98418f033 X-MS-Exchange-CrossTenant-AuthSource: PR3PR03MB6665.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Sep 2021 13:48:09.5747 (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: PR2PR03MB5161 Subject: [FFmpeg-devel] [PATCH 076/218] avfilter/vf_chromakey: Use formats list instead of query function 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: nDol4+Px0PKQ In this case it also allows to avoid a runtime check to which filter an AVFilterContext belongs to. Signed-off-by: Andreas Rheinhardt --- libavfilter/vf_chromakey.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/libavfilter/vf_chromakey.c b/libavfilter/vf_chromakey.c index 532d81ecf6..d08e127445 100644 --- a/libavfilter/vf_chromakey.c +++ b/libavfilter/vf_chromakey.c @@ -301,9 +301,7 @@ static av_cold int config_output(AVFilterLink *outlink) return 0; } -static av_cold int query_formats(AVFilterContext *avctx) -{ - static const enum AVPixelFormat pixel_fmts[] = { +static const enum AVPixelFormat chromakey_fmts[] = { AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA444P, @@ -332,12 +330,6 @@ static av_cold int query_formats(AVFilterContext *avctx) AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16, AV_PIX_FMT_NONE }; - const enum AVPixelFormat *pix_fmts; - - pix_fmts = !strcmp(avctx->filter->name, "chromahold") ? hold_pixel_fmts : pixel_fmts; - - return ff_set_common_formats_from_list(avctx, pix_fmts); -} static av_cold int config_input(AVFilterLink *inlink) { @@ -401,7 +393,7 @@ const AVFilter ff_vf_chromakey = { .priv_class = &chromakey_class, FILTER_INPUTS(chromakey_inputs), FILTER_OUTPUTS(chromakey_outputs), - FILTER_QUERY_FUNC(query_formats), + FILTER_PIXFMTS_ARRAY(chromakey_fmts), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, }; @@ -441,7 +433,7 @@ const AVFilter ff_vf_chromahold = { .priv_class = &chromahold_class, FILTER_INPUTS(chromahold_inputs), FILTER_OUTPUTS(chromahold_outputs), - FILTER_QUERY_FUNC(query_formats), + FILTER_PIXFMTS_ARRAY(hold_pixel_fmts), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, };