From patchwork Wed Feb 14 17:24:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46266 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:b819:b0:19e:cdac:8cce with SMTP id fi25csp78569pzb; Wed, 14 Feb 2024 09:22:43 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV6g1C4vYk3PXYvjQmyA10eI/nSAXZw+UdIbfxM8/UY7XFs95VUu8MyGX9qrfr++c1QcXuBrGXRTBdJwE9V7eh5WekbjloheMrVNA== X-Google-Smtp-Source: AGHT+IHu2VbPMHVoX88ilTHr4EzlIAE5uBgTkDNT1uioOjDvRz1JzbymsjcOVJ5gjCI3djYlWkwz X-Received: by 2002:a19:c517:0:b0:511:6fa1:9259 with SMTP id w23-20020a19c517000000b005116fa19259mr2285119lfe.55.1707931363461; Wed, 14 Feb 2024 09:22:43 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVsXQGfkl5Zkyfk43Q7CBS0Zqk9e0K0ZLENl0OBDacUm7yk70WVvfcz/1GI7N+HaHCDWkUw5bPqOVA9E3IJeamkigV9zT2EPUOJwUG0kIZpy3ETELTFEfY+wQqzazMkE70833cnJq/1w0zRdDOOJS44GQOGHBK4UFZSFpibpVhYUfpkTiqrpJJW2XXsY+tm8K410o+t1dTR7ddqaevEyCdPNG7JKlEXyXD7jt288h4pRIoDje6BJsmYTVG9FzOa4oXTBwLW6xQI1sHUvTnSTAWUvEpEOvQ2jsFwJ0zNsxhK/Vh6d0yETp6h34ph0kjoDthsslqD3ie6wbDC+f/RkXlffYip3i38d2rYVI5Fwby89Smzh5bCGUCitb5BUZHSkT6tdC1iJm8Q5A1SERbnwJrD50kUAfAYSv29jhzGyHk/HF1xtgw/WhVtJPzFnmFwl8fudnUyM8AoUGqu+YwDnzJMBoYr00P02iV7m9HaxeHSPry1bNcnRiOabGFStJEYcPujv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ayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id m14-20020a056402510e00b00561ccc91032si2958868edd.432.2024.02.14.09.22.31; Wed, 14 Feb 2024 09:22:43 -0800 (PST) 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=mZW8uE5t; 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 8ADFD68D1FB; Wed, 14 Feb 2024 19:22:28 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2037.outbound.protection.outlook.com [40.92.89.37]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 10DE268D1CC for ; Wed, 14 Feb 2024 19:22:21 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TP29ZoFHlmzlXII6YeVPFtQl/wZWsERq1zeQX3Bf/lDfuZG+NZpF+/oStlikhOosA3SvrY6AD5VXG0OJdlq0ff3OiN8N9vMWGKBg3S4K1wrixtHlRMtWM7Bjx38YKhtOGnKUt7ibNcL8fcN9gon37uT6fV0rknQTSr+/kx+xkX0NySyA6K1egM3bp0j2CvTKG4N0BIlxv+3sL79rCJ6PRWXL8StcEsZ69C2T+kic/X+TpZAYaIgIh/loLw9aJ//E8hIAwuDys7K69oOqsuu9vJ4SWHQILOJE6IDTN9jaLEnlELqRO/55Q84PgjQ8549xIJHq/XsPNwuUWfy9Bu+qOg== 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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MB4lMFYfZCmDqoU88TjmDfuhL44667jA6uEKLvOM5IQ=; b=NKf6AITlVz0UFTjf6wcV+vbn+pWj61SZFEJYLH/KXHRtDVLnwv8V0xqyRiMJ/HoV0WdaWPkS24bP8AMyMPfL6Nn8BgmeKbIpE547YOmoEg9T7LhE770E0zwV6xyx3d0i/rn/1QiZRz2P888bq1ONLdRkUyW1qn59pi2BGRD8b3U3vknGKEE8IguasnPlsS6LwB54J6M3oonf18HlXTF5VXaRou3C3PTVsze+GIInypsm0AzOw6Q8J/KwnOXESzd/SXunYvLedpS+IkjQrZaOWIrb94qiW0vCGi8h2/wemsJH3dJ3LbgCq74/2jz3PZJSIwPaX5+jwcfj8b7+MDedpQ== 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=MB4lMFYfZCmDqoU88TjmDfuhL44667jA6uEKLvOM5IQ=; b=mZW8uE5tw8jm9e8J1TXvKtlQ0KvxwdAArwVTll03bWQ036JR8HdjRY5wM9iVbSKDhsXI72PEju3PpzSDYIZfjGV15omInDAqwcnfX03n5xx9yOpNtDWS8CurLtzEoM6Dczn9xT7+L8zhefSYK5ibrTMdsEWZb/ixAp9qvU8LNmzqxW+tHmZ89gADV5lpJMVaqQKBF2KGXPWnjyReOEpMWoN2rQBB8E8z2lqKLVftolS094KuRU7Fmux37XPVswJOQ/qsMVPw+QI+/kUfOxC6Gz2w0D8V1MpYC820L25WzJPtwh/H35hgmrN3IcEpHTICeqCQbbuEk4DuoiZNVCg2/g== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by DU2P250MB0320.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:27d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.39; Wed, 14 Feb 2024 17:22:18 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d%5]) with mapi id 15.20.7270.036; Wed, 14 Feb 2024 17:22:18 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 14 Feb 2024 18:24:01 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 X-TMN: [0Ck2Gxierfq4ChEKfSAYqUI5fudQKSGaFc8DILVlUxE=] X-ClientProxiedBy: ZR2P278CA0052.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:53::16) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240214172408.1099356-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|DU2P250MB0320:EE_ X-MS-Office365-Filtering-Correlation-Id: 230c9584-8f0b-4848-bc4b-08dc2d817f1e X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: R1B3IIP5NT4T+rutAV3+dojsnF6iIEXpEZS6o73Ehtv2kK8TwI/aVRpCU/+6jTjGV/uN2ny6pt2R9u8OkdsDz/kLE1L6qHOIhahe7aSZVWWscoRDneRVyq7Lu82de5Q4K4IpSv6xqlns1jqORZN8ej8/gHLCjQyWzXnRvD2zYDOwRU3c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g8KYVU4z2U2bQIj9f8tn2srKWv58Mj3OV5trKALeCtYeQW+S40b0B/xl8uB8DxIxHuKsPXXQuQw1VkHAJQA0WMyEeRWKNTZKF/41ph+ubXU+6cyGGNFOXsS3S07xiPEh/44RLEn0p7SrCpgBLrglsLYQLCEbcUj9AZlRgcbMjGzj4ETX5J/ytor4VdQSfftGCUQ6Sd6K4wFRSzdShoyRVytzfrQTMF/0hgqsmFNzONg5mNpe/z8wnrUoaYPE3ktHTdUmZPNd7pa11VGA0Qb86+1eiCk1ZJEoXsijMJsvLEbMnNP+7b42mZAuZNJ3y+k103uHBSe0Y9DNaUyMTfoYY8bS4xOFIp2exYHkEzZU/5xp2PxNYEqedFB1Ou0bLFHBPQPeP5CzwSvpuZs2ekZQ68V2PyNiYC7J//S45aQ9CaPE/ZHLVtH0b+LiZXjKwKzJF0wH0aogztwrK3Nyqpn2OSqr+19LmtmTvDmSHHdOW6p4BuU01HlSFEPDKkjEfd63ZBdQwliBQuuFjKGbz8T+YMjtZ4s2CSDdJKRBQsM7zIdJsE23cRpdFB1fDUn313287Lj44bVeGT3Mqs8qehjsLX8DRhoCY9rtkK2E0jjT01THqV/SyJIrFws7OWNy2B2UGKaRcXC1d5LKOq/PoLzrEfTUN46md/F04SfqZYPnU5/yNVPyWbN/LIc6KTIbcjbxaWL+gZRUh6w/+RtAokZJEHaJq9XUGyOilB6g== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 230c9584-8f0b-4848-bc4b-08dc2d817f1e X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2024 17:22:18.9266 (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: DU2P250MB0320 Subject: [FFmpeg-devel] [PATCH 1/8] avfilter/avfilter: Avoid allocation for AVFilterInternal 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: nexqRij4jynm To do this, allocate AVFilterInternal jointly with AVFilterContext and rename it to FFFilterContext in the process (similarly to AVStream/FFStream). The AVFilterInternal* will be removed from AVFilterContext on the next major bump. Signed-off-by: Andreas Rheinhardt --- Several of these patches are from the bump patchset; I have just removed the removal of the internal-pointers, so that this could be applied at any time. libavfilter/avfilter.c | 22 ++++++++++------------ libavfilter/graphparser.c | 2 +- libavfilter/internal.h | 16 +++++++++++++--- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 9fe249f3f9..2d935cf576 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -159,7 +159,7 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad, src->outputs[srcpad] || dst->inputs[dstpad]) return AVERROR(EINVAL); - if (!src->internal->initialized || !dst->internal->initialized) { + if (!fffilterctx(src)->initialized || !fffilterctx(dst)->initialized) { av_log(src, AV_LOG_ERROR, "Filters must be initialized before linking.\n"); return AVERROR(EINVAL); } @@ -668,15 +668,17 @@ static int default_execute(AVFilterContext *ctx, avfilter_action_func *func, voi AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name) { + FFFilterContext *ctx; AVFilterContext *ret; int preinited = 0; if (!filter) return NULL; - ret = av_mallocz(sizeof(AVFilterContext)); - if (!ret) + ctx = av_mallocz(sizeof(*ctx)); + if (!ctx) return NULL; + ret = &ctx->p; ret->av_class = &avfilter_class; ret->filter = filter; @@ -698,10 +700,7 @@ AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name) av_opt_set_defaults(ret->priv); } - ret->internal = av_mallocz(sizeof(*ret->internal)); - if (!ret->internal) - goto err; - ret->internal->execute = default_execute; + ctx->execute = default_execute; ret->nb_inputs = filter->nb_inputs; if (ret->nb_inputs ) { @@ -735,7 +734,6 @@ err: av_freep(&ret->output_pads); ret->nb_outputs = 0; av_freep(&ret->priv); - av_freep(&ret->internal); av_free(ret); return NULL; } @@ -807,7 +805,6 @@ void avfilter_free(AVFilterContext *filter) av_expr_free(filter->enable); filter->enable = NULL; av_freep(&filter->var_values); - av_freep(&filter->internal); av_free(filter); } @@ -891,9 +888,10 @@ int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options) { + FFFilterContext *ctxi = fffilterctx(ctx); int ret = 0; - if (ctx->internal->initialized) { + if (ctxi->initialized) { av_log(ctx, AV_LOG_ERROR, "Filter already initialized\n"); return AVERROR(EINVAL); } @@ -908,7 +906,7 @@ int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options) ctx->thread_type & ctx->graph->thread_type & AVFILTER_THREAD_SLICE && ctx->graph->internal->thread_execute) { ctx->thread_type = AVFILTER_THREAD_SLICE; - ctx->internal->execute = ctx->graph->internal->thread_execute; + ctxi->execute = ctx->graph->internal->thread_execute; } else { ctx->thread_type = 0; } @@ -924,7 +922,7 @@ int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options) return ret; } - ctx->internal->initialized = 1; + ctxi->initialized = 1; return 0; } diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c index 96ef6b15bf..229e647c0a 100644 --- a/libavfilter/graphparser.c +++ b/libavfilter/graphparser.c @@ -626,7 +626,7 @@ int avfilter_graph_segment_init(AVFilterGraphSegment *seg, int flags) if (p->filter_name) return fail_creation_pending(seg, p->filter_name, __func__); - if (!p->filter || p->filter->internal->initialized) + if (!p->filter || fffilterctx(p->filter)->initialized) continue; ret = avfilter_init_dict(p->filter, NULL); diff --git a/libavfilter/internal.h b/libavfilter/internal.h index a6cdf9994c..3d46923cad 100644 --- a/libavfilter/internal.h +++ b/libavfilter/internal.h @@ -133,18 +133,28 @@ struct AVFilterGraphInternal { FFFrameQueueGlobal frame_queues; }; -struct AVFilterInternal { +typedef struct FFFilterContext { + /** + * The public AVFilterContext. See avfilter.h for it. + */ + AVFilterContext p; + avfilter_execute_func *execute; // 1 when avfilter_init_*() was successfully called on this filter // 0 otherwise int initialized; -}; +} FFFilterContext; + +static inline FFFilterContext *fffilterctx(AVFilterContext *ctx) +{ + return (FFFilterContext*)ctx; +} static av_always_inline int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs) { - return ctx->internal->execute(ctx, func, arg, ret, nb_jobs); + return fffilterctx(ctx)->execute(ctx, func, arg, ret, nb_jobs); } enum FilterFormatsState { From patchwork Wed Feb 14 17:25:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46268 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:b819:b0:19e:cdac:8cce with SMTP id fi25csp79248pzb; Wed, 14 Feb 2024 09:24:00 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXwUvfKAs8YqGdMIimx1ilEtxcejb8141HhOHYkWdr5MejNdaqREiOQPf5zS+Eur4JboJY6UCAvRG3c0raE3AVRinlmRjX5NzgMFQ== X-Google-Smtp-Source: AGHT+IGn2/FsVHKZI+tKuopYWWT2e0qSaKnFmNXXA5s6bsudd4CLBvfg7IqYkvV5oH7XyNbk66mb X-Received: by 2002:a17:906:d142:b0:a3d:6704:1011 with SMTP id br2-20020a170906d14200b00a3d67041011mr1033799ejb.28.1707931440299; Wed, 14 Feb 2024 09:24:00 -0800 (PST) X-Forw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1/abOlpr0q4Ux8H2a6R5s6muTmID+ES7sjm1E2yYp4cHLUckGLYeD/yccyilxGiNpXv7vnQO0BuRdXjgYphxrGfji8BrsLnJhVWdMTB6BXdNtL8ca6tO48I3mwHs7Mjr05qdnS1E/cLfODeKuEUxFpjHyLI/CarnwF31Y4cjn+alNyqXoe3E9Bt4CG4uQV6pMedRG+LddxdOmHkUH6oY/J1NUmxsU56gLfQFmGn2N1WbeP45aUaUZsYq6nTfxefCJLswZGxarnayt/V0Ru1gV5p3s5YjFQRBBtbRq0D629SQH4fZeced/6bKfPKMbeySMlH7/MfeSTgi08xg3nipaxS9ir9qId94qZ1Ui+ctiEQOt5JmLUPJf1dOwDkHv782OQP0SFsVFCpDnDEJFUGH2LSCXObPOoqUurWbBVITXwJYXXEhcxm/PXgmXCQR435PSImOTlJpy9RFUXe4W6/N3yiZnKChtxVUlokbOUYEt1tLUbju6LW4HIlOsDRhMHUqCXcs5eXKPqVHk+Ao2bXYW2JEUPPNT3dek3kbFzc= Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id d15-20020a1709067f0f00b00a3cf8f53a42si2008372ejr.353.2024.02.14.09.23.59; Wed, 14 Feb 2024 09:24:00 -0800 (PST) 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=ck3XgD+r; 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 CBF0E68D1FF; Wed, 14 Feb 2024 19:23:57 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04olkn2100.outbound.protection.outlook.com [40.92.73.100]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 953F768D1D7 for ; Wed, 14 Feb 2024 19:23:50 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GJem+QY9gJG22kcmCks1x7nd0sIin9nhRtPf9fqubo4bEwK18a8REoWipsAErJEPHJxYOFV/eUZ6cB+RxkzbUqLGzEPjATtCGRtNCIPbPh7NjNnaAcIYvHGUDncAbcdmJxteo6EGjvhRK+3VZALsNGuuG/7vNOW/OfX6Qwi76g5O4sd2vYYIZ9e6dFj0PIsupJvb/r0AkwcrwzasxueIeHYnWObc6LWRhQsHlVm5v6sdbMk8RJr7z6z5v/05AvmUNXqdpue9nxx8veDMOdZryHN4I2c6T3hecLmyPUwpg/fipIbbu28GMvWz0iaMflfIp6Eg8HCmU2y9iVtQE9wpZA== 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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OCWKOJrW2QIwKokukxhC6e7N0FTbyMHFJ2ycGjDJxuw=; b=h0YZyIZYGWsCQmkopTeTCHrnLGqz69nm7I+s2TA5WzMKn7SumTjSRLllfk5acCiq6lF1d1SDKS3wEUbHPfqX4DHb33GH8FWGgHZ10CN+Tl17LOVcFtsTXy4kmy79ZeQjx95ibZ+qoLjiPXREpz4Mhmv2cV/lK1kZ7luza+0nXasXbpSkPeB+nS+6UsPYkxoiKCwF2g+Pt/UEjsaal79cTc48Prc91+Urnjb7/TQiW0wspSs5D10/8rxAgSSn/TmpLk/c6vnf5h1Xg4FyHQtFSKNVxWysRAEEiCLhxbV5/qgmScfH0SSgcyttO8wPsFZDMeuv0/YV99vzpW+OYVbn/g== 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=OCWKOJrW2QIwKokukxhC6e7N0FTbyMHFJ2ycGjDJxuw=; b=ck3XgD+r8ae5jZ+qtScmoPHuufOglItEQuylVl9E4mCiJcAN7krmYvMcPavNmoKFamyXkSp0VGO+kxBs99lrrP2VxDIfJUQ6fzcAXqiWqYNwwQHJNbE115McRsgkR33Rz3W8J620tk4i1IC2ybSP7bWUjhqasae+z4iaHAOkcJOCtEfsKD7dDOpsf9EON+da+Zv2wAWAXlupWYORMfYN5Pbkbtu49RH7R5o3dASeoLSq4lKWue2GxrLYiqr2gZOEG4y/zJBXYXN93rl8f31Ht9ZfGE/uJkQf7jhyP9/tWUyj9Ik4KUigoxyD0oQds3mRvma5yG1pOvy3YzDaYEAgkQ== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by AM8P250MB0374.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:329::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.39; Wed, 14 Feb 2024 17:23:48 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d%5]) with mapi id 15.20.7270.036; Wed, 14 Feb 2024 17:23:48 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 14 Feb 2024 18:25:31 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [HwDVskcnaaEVc69ISZxWc26NV8+5GwopUWJsN/EiSi8=] X-ClientProxiedBy: ZR0P278CA0001.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:16::11) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240214172537.1099404-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|AM8P250MB0374:EE_ X-MS-Office365-Filtering-Correlation-Id: 59151c10-fca8-4744-8e8d-08dc2d81b474 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lPMkPa6Y3AnTulrDDdFoCusph22r97Cm0ipvOMCbS72PwGVJsvpbs9ZILkypQvf2ArnaspRmY/w5P5hNxeqk88RIm98wonft5C4ITz6AB2dqrF04BGsyau7293l1gGz2YPHT9EnLfr8/wLMS7aJ3mKizKNiel85VoGJc4cyPdT7J2sSlNYYHgfIndMMBjUF56tUVFY4BveNKJAxIzPWZasUjnscwcOsmyH9Zcvv0DxJc8TE0wwqjyDMIogs8Wa/7MuFyHrLEiLCxl32Hd1loY1Ma5AkE5+kHg1lsl6sa3qi1poyjrp1eCqyYe3IXomi1hSxT+aMDV+JWBV6bp8Strm1WbGKHk7fZqEvtm6K7p5luqoWK24s930m1xq81f7bfMJW6oB+EE/pd7lfVu6rCzEQ6GZ68jtBZP1CFaX5VrOeaVqjs4Yat1S73vT86SAw9XIdnsdxGMvMoXK5SC+h8urBpDvCBVFQFOQ/rjyZBXgMxxepHMDpRk1EHAj84JC0keFQ4bdhkLmMODNzkAgeXCqd2ZjlWx0HjBzFhPykgYFVyYpx8Bka5L9EwLBDknNm+BJxTjeGlgsp2keKdLqhzAfl8fQg309Pz7TQ9qAXJ/EfBr4JIJoCh0qoZjJRvfxrT X-MS-Exchange-AntiSpam-MessageData-ChunkCount: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n3L+aBX94fdw64HUmWU5d7/8ljOcwpyxu+pmug3+XGaeLpNR/98C9IPoXzVu5DY50TId0OTTCXcn4iy4aWGvPonOPeWsYGMHR4A6Kj5YUcXMnsUUTxw3YgcbBpifYFZQtbK+0ICqUG9DwJOZkhRnC5yz/XyxlWwtl/0NR/vfPpTWUbAbVNCY5a/7lA5BvDMuVcuL8ID+tShdECUFeZoGA6heo6ahOSss4cdY7qg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 59151c10-fca8-4744-8e8d-08dc2d81b474 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2024 17:23:48.3214 (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: AM8P250MB0374 Subject: [FFmpeg-devel] [PATCH 2/8] avfilter: Add a header for internal generic-layer APIs 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: DDC4lyS7My6H This commit moves the generic-layer stuff (that is not used by filters) to a new header of its own, similarly to 5e7b5b0090bdf68e0897fe55ee657fdccc0cbca2 for libavcodec. Signed-off-by: Andreas Rheinhardt --- libavfilter/avfilter.c | 1 + libavfilter/avfilter_internal.h | 84 +++++++++++++++++++++++++++++++++ libavfilter/avfiltergraph.c | 2 +- libavfilter/graphparser.c | 1 + libavfilter/internal.h | 50 -------------------- libavfilter/pthread.c | 3 +- libavfilter/thread.h | 28 ----------- 7 files changed, 88 insertions(+), 81 deletions(-) create mode 100644 libavfilter/avfilter_internal.h delete mode 100644 libavfilter/thread.h diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 2d935cf576..5dcb548e90 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -36,6 +36,7 @@ #include "audio.h" #include "avfilter.h" +#include "avfilter_internal.h" #include "filters.h" #include "formats.h" #include "framequeue.h" diff --git a/libavfilter/avfilter_internal.h b/libavfilter/avfilter_internal.h new file mode 100644 index 0000000000..3dd51fb993 --- /dev/null +++ b/libavfilter/avfilter_internal.h @@ -0,0 +1,84 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * APIs internal to the generic filter(graph) layer. + * + * MUST NOT be included by individual filters. + */ + +#ifndef AVFILTER_AVFILTER_INTERNAL_H +#define AVFILTER_AVFILTER_INTERNAL_H + +#include "avfilter.h" +#include "framequeue.h" + +typedef struct AVFilterCommand { + double time; ///< time expressed in seconds + char *command; ///< command + char *arg; ///< optional argument for the command + int flags; + struct AVFilterCommand *next; +} AVFilterCommand; + +struct AVFilterGraphInternal { + void *thread; + avfilter_execute_func *thread_execute; + FFFrameQueueGlobal frame_queues; +}; + +/** + * Update the position of a link in the age heap. + */ +void ff_avfilter_graph_update_heap(AVFilterGraph *graph, AVFilterLink *link); + +/** + * Allocate a new filter context and return it. + * + * @param filter what filter to create an instance of + * @param inst_name name to give to the new filter context + * + * @return newly created filter context or NULL on failure + */ +AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name); + +/** + * Remove a filter from a graph; + */ +void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter); + +int ff_filter_activate(AVFilterContext *filter); + +/** + * Parse filter options into a dictionary. + * + * @param logctx context for logging + * @param priv_class a filter's private class for shorthand options or NULL + * @param options dictionary to store parsed options in + * @param args options string to parse + * + * @return a non-negative number on success, a negative error code on failure + */ +int ff_filter_opt_parse(void *logctx, const AVClass *priv_class, + AVDictionary **options, const char *args); + +int ff_graph_thread_init(AVFilterGraph *graph); + +void ff_graph_thread_free(AVFilterGraph *graph); + +#endif /* AVFILTER_AVFILTER_INTERNAL_H */ diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index ea0d7713e3..df22de03a0 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -34,12 +34,12 @@ #include "avfilter.h" +#include "avfilter_internal.h" #include "buffersink.h" #include "formats.h" #include "framequeue.h" #include "internal.h" #include "link_internal.h" -#include "thread.h" #define OFFSET(x) offsetof(AVFilterGraph, x) #define F AV_OPT_FLAG_FILTERING_PARAM diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c index 229e647c0a..5d6dcdb9d3 100644 --- a/libavfilter/graphparser.c +++ b/libavfilter/graphparser.c @@ -29,6 +29,7 @@ #include "libavutil/opt.h" #include "avfilter.h" +#include "avfilter_internal.h" #include "internal.h" #define WHITESPACES " \n\t\r" diff --git a/libavfilter/internal.h b/libavfilter/internal.h index 3d46923cad..0e3f68d1f4 100644 --- a/libavfilter/internal.h +++ b/libavfilter/internal.h @@ -26,20 +26,6 @@ #include "libavutil/internal.h" #include "avfilter.h" -#include "framequeue.h" - -typedef struct AVFilterCommand { - double time; ///< time expressed in seconds - char *command; ///< command - char *arg; ///< optional argument for the command - int flags; - struct AVFilterCommand *next; -} AVFilterCommand; - -/** - * Update the position of a link in the age heap. - */ -void ff_avfilter_graph_update_heap(AVFilterGraph *graph, AVFilterLink *link); /** * A filter pad used for either input or output. @@ -127,12 +113,6 @@ struct AVFilterPad { int (*config_props)(AVFilterLink *link); }; -struct AVFilterGraphInternal { - void *thread; - avfilter_execute_func *thread_execute; - FFFrameQueueGlobal frame_queues; -}; - typedef struct FFFilterContext { /** * The public AVFilterContext. See avfilter.h for it. @@ -356,23 +336,6 @@ int ff_request_frame(AVFilterLink *link); */ int ff_filter_frame(AVFilterLink *link, AVFrame *frame); -/** - * Allocate a new filter context and return it. - * - * @param filter what filter to create an instance of - * @param inst_name name to give to the new filter context - * - * @return newly created filter context or NULL on failure - */ -AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name); - -int ff_filter_activate(AVFilterContext *filter); - -/** - * Remove a filter from a graph; - */ -void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter); - /** * The filter is aware of hardware frames, and any hardware frame context * should not be automatically propagated through it. @@ -415,17 +378,4 @@ int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, int ff_filter_init_hw_frames(AVFilterContext *avctx, AVFilterLink *link, int default_pool_size); -/** - * Parse filter options into a dictionary. - * - * @param logctx context for logging - * @param priv_class a filter's private class for shorthand options or NULL - * @param options dictionary to store parsed options in - * @param args options string to parse - * - * @return a non-negative number on success, a negative error code on failure - */ -int ff_filter_opt_parse(void *logctx, const AVClass *priv_class, - AVDictionary **options, const char *args); - #endif /* AVFILTER_INTERNAL_H */ diff --git a/libavfilter/pthread.c b/libavfilter/pthread.c index 1a063d3cc0..a0336a8e04 100644 --- a/libavfilter/pthread.c +++ b/libavfilter/pthread.c @@ -29,8 +29,7 @@ #include "libavutil/slicethread.h" #include "avfilter.h" -#include "internal.h" -#include "thread.h" +#include "avfilter_internal.h" typedef struct ThreadContext { AVFilterGraph *graph; diff --git a/libavfilter/thread.h b/libavfilter/thread.h deleted file mode 100644 index c709f17a33..0000000000 --- a/libavfilter/thread.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFILTER_THREAD_H -#define AVFILTER_THREAD_H - -#include "avfilter.h" - -int ff_graph_thread_init(AVFilterGraph *graph); - -void ff_graph_thread_free(AVFilterGraph *graph); - -#endif /* AVFILTER_THREAD_H */ From patchwork Wed Feb 14 17:25:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46269 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:b819:b0:19e:cdac:8cce with SMTP id fi25csp79341pzb; Wed, 14 Feb 2024 09:24:09 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWlwqBLSy+iQersbJUiqtvDdAD3hj1jho954q3uDRzlUBs/X8eSOKZOxlZAuOg92c1UOB3Amfjz65AfLQkamV4KPeN0Zw2IImJVQg== X-Google-Smtp-Source: AGHT+IFvjNo4TwIX72EBN2qWcqRI94FrpKHrH9v4U6B4OxCqeK/ZpJhIafcpvdWhGP4/X3qRvFdN X-Received: by 2002:a17:906:acf:b0:a36:c353:952e with SMTP id z15-20020a1709060acf00b00a36c353952emr2260935ejf.41.1707931448846; Wed, 14 Feb 2024 09:24:08 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXInPX0E+NJTkb9fux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6Rlpl8LMb0jQ3aLLMOcLqzLyWhxthDzwU1jV3u7NqC6EnOubAYUiIaaaUvisOz9ZAkyRFPrNH6Ult1u79P+PZkiuzCDEGkB7ZVGnNy9tPV6BRdLFhKerkJ1rjuJfUY8HI0ZtOpm6znuU6h+30Q+BGWVuRGbYmWX5YXZ+wxmKJPLwIbHyLiup8wSLw+QVn1Z1SMnXcRXpdIAZyeINYea9S6V6t9POSDfLyAPEbT94y2Sy1+CJ82NgycAFWbco7z4+//lMhU23LRMj2C8s9cvsWtDhKp8Prr76FazrCQvEPA0wjIxbJnNfRmY4PqwCAM9/3cknlj3YczqsYJxGsOR3yUWAYSgZpmWvmwhlgC+cA/ULP/1BQzkpev/yt2pl2HJdQSQUo74IRya1u7b0Z18o9ItpYlDLq6cXxkavFROp/TdNHxzg8Xe6VmayNDrj92dngrnRIyevYuOBCW0vbU6CQ/dJLcFPr7pDW2pVmjMZwFcfG7tQdF+A= Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id lr8-20020a170906fb8800b00a3d2e89cebdsi1114497ejb.457.2024.02.14.09.24.08; Wed, 14 Feb 2024 09:24:08 -0800 (PST) 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="X3kiyO/w"; 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 EEE4768D206; Wed, 14 Feb 2024 19:24:02 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04olkn2100.outbound.protection.outlook.com [40.92.73.100]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D6A5A68D1EC for ; Wed, 14 Feb 2024 19:23:55 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NAuutHBbTvokiqeZJ84134sYaJMUJwwP5QM0CigFwgiD1MI4vH18o4CAGHdNRavjt16ptlty9FZUppLQgs4EDQR2uplOCZ8tyuhoGFGU02OJSEiAe7JxBjfHMX1tz80gIAzJg+A/B9OQ8CLN/5Q1/93jFubacy7BiIBbJGMYLdFQTL+TEWGZwbMxbB/c9qjpzMg+RzhGsFBjxoiC9XyT+TSa5K6JpmdYYJJHuLu87LpHK0krG5fLC3Ad8veXLA46UuggQ06/OxXtzU+QLOVWC4ySvUeAcwPASh81rA/6vspw9zEdxqlHzTxCs1HDBlIrnXFQaN7qYGXWf9k+ynKPPg== 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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vL56I69pnhK36P6VQdsjpjQepeEaQUBj+lRzfeJRMH8=; b=P1pOy/vr7F4M21fHXU6RLvJs8CJQPbMn2hu/voxxtymX3vuNhw+IjckELVe6qV/8oeXUUVdJccOwMwNIov4CtvvjzyTPfzqO9Qe6ZJJ6L3V9q/5QWivG8chM7bHq/ZQPbDo/sNSNl/X4g4YTheNX4MeJBaL6XsfQTVEPvLHWorG4v6CQDi/D7oLEJzLfqhk09PHtVLJSIVpy6xQMgDnXDxgVKtFcRbHM0oC2sv4vtWObvP3OUWh6EYpGMQXFvd922Qh/DBLhTu8P9oDUVgUZ5kIxJI7wjANpHxyjOg0VZAIf6TZe54pQAUAD/uIL4vPEZsZYIT7/C16d7F1t8g8gXQ== 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=vL56I69pnhK36P6VQdsjpjQepeEaQUBj+lRzfeJRMH8=; b=X3kiyO/wUcl1Fb+DPw2JFGOCzPVkC6WeK4AhJTtF8fTPOFZmIloYMLPGBr4q1n8NQBMZMSRibNpdDFvyx05zvA16Z1kZrFvyXxOeQ0UJPgoj0Ob/YqD53Q23Gye3Eh1pVyXSYaXeib9SOd/iGssJsHP26GQ7hbz31BeiFwDK0W1RtlC1GHh5t+dRPUuo0LOpXQgLoh7HAyzPanuLsjDS59NntSqQa7TY3PKsgp/Pi7lLjnxcq7gxS7qE9dXhKQNmDftG1kWmI/ru4vmTEPvEjuYC6R2Hv18P6Cp6dD8KMsXRx6cCDdyjmVDgY5DeXXblzKFR4tFrcQ3jWwU0t5c3qQ== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by AM8P250MB0374.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:329::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.39; Wed, 14 Feb 2024 17:23:50 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d%5]) with mapi id 15.20.7270.036; Wed, 14 Feb 2024 17:23:50 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 14 Feb 2024 18:25:32 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [1Qs+PVJAT1d8wOFPbpzipDB/s79hY9zbzV8CN3m2qkA=] X-ClientProxiedBy: ZR0P278CA0001.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:16::11) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240214172537.1099404-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|AM8P250MB0374:EE_ X-MS-Office365-Filtering-Correlation-Id: d6639892-8aac-40b3-f898-08dc2d81b5af X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UdXDJBO/xmUMNHjvu5SOpR3Va8I6p/Q+kV7BCLFUzvC89d9hfWTxnkFKV1svT93NX63bhAlkjUUVD6gcstPcPptz5g68ISwzMkr4kvlbcdxl+J8en+FZRvYEWivWaMrTBUFkcIDGw8wonOC2uFJdX+GdoMH0E6E6szuTCHXQrPs7ZrRKjo9CX36EjNtsEEk0svvSQYBja6AhC/O5iLSqhcOlEi5RxBqEO7uU/B4eZeOaRYXBXPgZtN1Jc3DOJPzq8sDrVdiTAqHC3pHEQD/M3JMmK1UX/d5pJE6eExlq1YiVacp54DTyLlsNWMAEVHE0/KVYobvRP+2TweIq3/9OmRUCYiGEhAv9YaQfNHPMX7vlX89UrJqiACsr/CKuoIGZwQFw9/f20X90o1CjmnHwXJ9BLsRCt2YeuJwuy40VvxxnCpRpPUJc+3XeZVk2RhuMrQMG6g2TciHYWXastsSq6IRQW8LkjfvxNAFNSGX8EoOPlptWzQL2owRu2sfbHX3ZWyd6Tc1tcwN57QoknO1uJW70JUrPJ++4aK7ixo5Qs2DGsCqUoP776UoPZH1yEgEj7ZUjBFPJQhme82AiBAg/r+6xVaYDikV8roSRfINUfLY= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QVDUEk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lKmPvXTf8vNxCHuYJ9m85nyoSMeRFQo4GWxTANwJoJ1CIX0KG67rmEqgfaKto2r7EgLEe0dqEpCT/jsvk4h3H4qMROtLfUIinCOytjJag2UcRmKcLljPYyPrq1g6aDSE4WGCF0kl3M/VmKFR11Hg6sZMxP8gYzafwUFaCLg1+RKqvMs7DBKVEO19Dk/a/vqFXhBL3yoJbR3SxYPnw20jmrLd82829qxA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d6639892-8aac-40b3-f898-08dc2d81b5af X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2024 17:23:50.4258 (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: AM8P250MB0374 Subject: [FFmpeg-devel] [PATCH 3/8] avfilter/avfiltergraph: Avoid indirection when freeing filtergraph 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: B6ZhiKuf4Ya6 Signed-off-by: Andreas Rheinhardt --- libavfilter/avfiltergraph.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index df22de03a0..a9befb954f 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -117,23 +117,25 @@ void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter } } -void avfilter_graph_free(AVFilterGraph **graph) +void avfilter_graph_free(AVFilterGraph **graphp) { - if (!*graph) + AVFilterGraph *graph = *graphp; + + if (!graph) return; - while ((*graph)->nb_filters) - avfilter_free((*graph)->filters[0]); + while (graph->nb_filters) + avfilter_free(graph->filters[0]); - ff_graph_thread_free(*graph); + ff_graph_thread_free(graph); - av_freep(&(*graph)->sink_links); + av_freep(&graph->sink_links); - av_opt_free(*graph); + av_opt_free(graph); - av_freep(&(*graph)->filters); - av_freep(&(*graph)->internal); - av_freep(graph); + av_freep(&graph->filters); + av_freep(&graph->internal); + av_freep(graphp); } int avfilter_graph_create_filter(AVFilterContext **filt_ctx, const AVFilter *filt, From patchwork Wed Feb 14 17:25:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46270 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:b819:b0:19e:cdac:8cce with SMTP id fi25csp79467pzb; Wed, 14 Feb 2024 09:24:18 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXXjiF10P/zp+ZJvO5QHBWMNs5pMIYwru/L+X06CQOfb+sf7QlZoNpNOy/wpzeEaEgqQWZz/vJxqWORVuILGNddA6pKeeBTn/0fAg== X-Google-Smtp-Source: AGHT+IFUvUX7CL0o5iz+HaDQ36T2KIcbFH7qHL5wQZQbFElqyZHl0OVG2QECopo9YQSNDXahUGTL X-Received: by 2002:a50:fb90:0:b0:561:4238:e6d3 with SMTP id e16-20020a50fb90000000b005614238e6d3mr2473159edq.2.1707931458615; Wed, 14 Feb 2024 09:24:18 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU9udt6Jhw4kiRoPXIHvS5rhcNfQq6DBxKhabXlXNJROyYVvt1948l4BNW2IR+TXobK0aU351DclXXTu0gIVVPkQPY7ASGtEYomZDA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ixam1aCZVv5rjzJ2EZprYH2x+Jxpkw5KXMWPsapJkeADmdFFTPceaqjIfqf8cYf5YwxMxhdz3XTm2foBp/eq5rq7vi+hDZCMTH6TIW1fQHwf75g8x4Fy8WyBihTes8JoXEHvByYMvJqc55HGLRUSGuEYUxw2n19gJxnRe5ai1pre0ov9Rm7nzXl3Ff9BgjkgbGJnHeIgL+gVQ1gW6Ezs808iPNxE/9QHSmBqijL3wl7NNJW1Fkm5umnfC8ftgKVpd7Gtkqy37SEamPdcsKh+Ko7jdEpGmU3mQ5rL+EHnZFOg1fXC+fWQJkwHpdqqibnPDahr8oEsHuUudqvzPSV9KyEikYhMtOQEg03qUvwxakaPNFMEYco8vRHoM7nTMPDn8g3k40WvOOzDq9lYIgkUyMd59//B3t7P3WgicLg8aCe Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id df13-20020a05640230ad00b00563919b3b9csi255345edb.220.2024.02.14.09.24.18; Wed, 14 Feb 2024 09:24:18 -0800 (PST) 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=kgvhhZGw; 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 03A8468D211; Wed, 14 Feb 2024 19:24:09 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04olkn2100.outbound.protection.outlook.com [40.92.73.100]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0E4ED68D1EC for ; Wed, 14 Feb 2024 19:24:01 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gwsPH6O/cigkv0lKu8ouc5gewSh8ATiFsQIG+c5b5i7RT60mUy5N48omKz8yaR16OKpRM4ucP1WRPksEIVeMECUopMwAj/gGZncL8u0QlQjQ4Fz/q9fTKvLxA//h+eJKbluFVZUTqrVnDLXxTp/aivDP5Z4dYc7oXQUrqrL8nm4NByM5cyIg5FV7qamrWQGhY5FTwreqxZYxKJE1nds8Hkzaqkch1nTBzRqPFNnumLAWzFfmxC8aTlXjenWvTBoXT42fjCCv5WcQl3H/HqaDk6qbFydW/nU619Fd5TKQ5zD+dTTjdi2I9wvOfOXM5Acs6QyyF7rtAQqOCn3sDBDcbg== 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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=d3ZqD2vnH7mZg7K9VlheY1W/WumJuZssmvK03oiW6r4=; b=fhZdstk0mpjUv95SOTiobJNrxD8V+B0pehZoMfcfxlTWe8F4BSuNYZrGsgvEIiJNXvxQ4zNSx+hzHFEV/+8Wn+bSLliI6psxkqXbjZihwqfiBiLWRqPVgQbUBQWWzou6uN61lgeq06Qun0nH7LAw4zJ0oF2A1GbqPRXldrAh36wXtHKhns4lKgjrC714s4fSqoH6Jhpruj4tfVArKaBoUDQ+MdtDm48NSPiHJ4FuhgVZQvqTBIo8y0PdBcLgcGqWDViA0AFtAdP7BaEoIivaP9+oYMQSAhTYXDzoNKzfJk7mRzmR0e+LRtg9OLTCvKyPIJT9opZjoMk3x6JbI6+YlQ== 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=d3ZqD2vnH7mZg7K9VlheY1W/WumJuZssmvK03oiW6r4=; b=kgvhhZGwPNZ5ReuspYvIVsOfvcWErbV6whXqjvum6HkNSsZ5CvplIGUhvCBAG3KcvjTipxvpGBTYwqfKkU4yyqfu5MpweSrIjwoqDe/sUxBRPXJX9ZSTeLTMsgBTAaNzycvXKAfIEfzAgWKTKjiFiTMAAbog6jUcLVN1VamctYMTsuRUZk41pWkfZGC32Q4MHbjWIrFhT1z8IPwj9aunRENRTj2I2tcCamu9rdVUo3PVPhl2F3N5SharIHW4Pf0+78kJinWrMB5/yKAjFsMiaYow4Pe4+B+puEWylEOiMmsXPkxeiOsxmpKiLEkfQiskeUuRVmTPGYln2pGpM+5HAg== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by AM8P250MB0374.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:329::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.39; Wed, 14 Feb 2024 17:23:52 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d%5]) with mapi id 15.20.7270.036; Wed, 14 Feb 2024 17:23:52 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 14 Feb 2024 18:25:33 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [WJB+gf0DGsCHRorSpG9FwXs8qVqdnHFOAyJ9DYzoOzU=] X-ClientProxiedBy: ZR0P278CA0001.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:16::11) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240214172537.1099404-3-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|AM8P250MB0374:EE_ X-MS-Office365-Filtering-Correlation-Id: a95817f7-fa8e-4614-3734-08dc2d81b703 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: c4X6HZrjOBzSjG1jY5I2kKaAhLV/44uDi6h56/qyAsaJA1NjbkqJ/VDg+iOKTDIwdFWoLqdxPcH8iatP03vI/9Wt3ngzF8+KRyC1BJwkOnagTrIEKQydnwOsVDsCtSI9Ni5QMhIAjjEyhdEK6Cny9G2EwjY6fAAJoCYMv5Dt0Jc+PvrizTGoybKCn6RI4oiO2xwOV7EJBIhH1IqeE9+5U1RqP0vaQVUOxAeopcVcmenE6MGz81cYLVCXbsUKca1Z9qdX4z3evlTYoO9Ir3dsv+pVTaQbDJvh+pFBTV0rhANWd77/yyqEABcDrap/lY2bN/v7bpfz7s8dlBCQnpEjgs9VljkIisWzGBEHNEYw4ihjqvznVgJOMoP/9XnkryEKhGdxy/wvA2uZzMlzV5VpdGL9O/IRhVV+C3iVQvLaE/lwobbipvlrWSapBE9p3+0GsnM8VYur8CfsF1BBrqz2UDI87JJGtNSs91SLIJjccKmeQ7HwVWqihugn5OrZh2B7ZC0b8MMmRqdtGaojiByK7KqRaugUEdQQoQ5H2MNazpWvmJR9My7yhfAA+2GCNgKbdP2fYstnBolztfjthxrRFxu0A/Q4ucDLEtv+F/yWqw4/Nf2ALBs/ezx+MvS9bkGj X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: stnNlgV4Dpd8XlnQnIwEwhf1hGR0iLFCMatejC2K9VhNyMoTsQHupVCqsv+M1rUm7ao/vPd+PTUODY0dd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7YseKhKFLv9poXthVCGGH1JDCiOeEylP3NLteHp5Wpo9qlZxGX1CTrGpP0L0sQY02r2pAMVyrYPBI5ExQGissrY6ISxCqsxr9w+6WySyVq59ZiIInzvJ9HmCL3SR60FMFUTZYl8brCqgfPuWMg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a95817f7-fa8e-4614-3734-08dc2d81b703 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2024 17:23:52.6213 (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: AM8P250MB0374 Subject: [FFmpeg-devel] [PATCH 4/8] avfilter/avfiltergraph: Avoid allocation for AVFilterGraphInternal 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: takeXKD28xT6 To do this, allocate AVFilterGraphInternal jointly with AVFilterGraph and rename it to FFFilterGraph in the process (similarly to AVStream/FFStream). The AVFilterGraphInternal* will be removed on the next major version bump. Signed-off-by: Andreas Rheinhardt --- libavfilter/avfilter.c | 6 +++--- libavfilter/avfilter_internal.h | 17 +++++++++++++---- libavfilter/avfiltergraph.c | 32 +++++++++++++++----------------- libavfilter/pthread.c | 23 ++++++++++++----------- 4 files changed, 43 insertions(+), 35 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 5dcb548e90..796ec29afd 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -188,7 +188,7 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad, av_assert0(AV_PIX_FMT_NONE == -1 && AV_SAMPLE_FMT_NONE == -1); link->format = -1; link->colorspace = AVCOL_SPC_UNSPECIFIED; - ff_framequeue_init(&li->fifo, &src->graph->internal->frame_queues); + ff_framequeue_init(&li->fifo, &fffiltergraph(src->graph)->frame_queues); return 0; } @@ -905,9 +905,9 @@ int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options) if (ctx->filter->flags & AVFILTER_FLAG_SLICE_THREADS && ctx->thread_type & ctx->graph->thread_type & AVFILTER_THREAD_SLICE && - ctx->graph->internal->thread_execute) { + fffiltergraph(ctx->graph)->thread_execute) { ctx->thread_type = AVFILTER_THREAD_SLICE; - ctxi->execute = ctx->graph->internal->thread_execute; + ctxi->execute = fffiltergraph(ctx->graph)->thread_execute; } else { ctx->thread_type = 0; } diff --git a/libavfilter/avfilter_internal.h b/libavfilter/avfilter_internal.h index 3dd51fb993..9ddb82bf26 100644 --- a/libavfilter/avfilter_internal.h +++ b/libavfilter/avfilter_internal.h @@ -36,11 +36,20 @@ typedef struct AVFilterCommand { struct AVFilterCommand *next; } AVFilterCommand; -struct AVFilterGraphInternal { +typedef struct FFFilterGraph { + /** + * The public AVFilterGraph. See avfilter.h for it. + */ + AVFilterGraph p; void *thread; avfilter_execute_func *thread_execute; FFFrameQueueGlobal frame_queues; -}; +} FFFilterGraph; + +static inline FFFilterGraph *fffiltergraph(AVFilterGraph *graph) +{ + return (FFFilterGraph*)graph; +} /** * Update the position of a link in the age heap. @@ -77,8 +86,8 @@ int ff_filter_activate(AVFilterContext *filter); int ff_filter_opt_parse(void *logctx, const AVClass *priv_class, AVDictionary **options, const char *args); -int ff_graph_thread_init(AVFilterGraph *graph); +int ff_graph_thread_init(FFFilterGraph *graph); -void ff_graph_thread_free(AVFilterGraph *graph); +void ff_graph_thread_free(FFFilterGraph *graph); #endif /* AVFILTER_AVFILTER_INTERNAL_H */ diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index a9befb954f..1e7874adc6 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -68,33 +68,30 @@ static const AVClass filtergraph_class = { }; #if !HAVE_THREADS -void ff_graph_thread_free(AVFilterGraph *graph) +void ff_graph_thread_free(FFFilterGraph *graph) { } -int ff_graph_thread_init(AVFilterGraph *graph) +int ff_graph_thread_init(FFFilterGraph *graph) { - graph->thread_type = 0; - graph->nb_threads = 1; + graph->p.thread_type = 0; + graph->p.nb_threads = 1; return 0; } #endif AVFilterGraph *avfilter_graph_alloc(void) { - AVFilterGraph *ret = av_mallocz(sizeof(*ret)); - if (!ret) - return NULL; + FFFilterGraph *graph = av_mallocz(sizeof(*graph)); + AVFilterGraph *ret; - ret->internal = av_mallocz(sizeof(*ret->internal)); - if (!ret->internal) { - av_freep(&ret); + if (!graph) return NULL; - } + ret = &graph->p; ret->av_class = &filtergraph_class; av_opt_set_defaults(ret); - ff_framequeue_global_init(&ret->internal->frame_queues); + ff_framequeue_global_init(&graph->frame_queues); return ret; } @@ -120,6 +117,7 @@ void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter void avfilter_graph_free(AVFilterGraph **graphp) { AVFilterGraph *graph = *graphp; + FFFilterGraph *graphi = fffiltergraph(graph); if (!graph) return; @@ -127,14 +125,13 @@ void avfilter_graph_free(AVFilterGraph **graphp) while (graph->nb_filters) avfilter_free(graph->filters[0]); - ff_graph_thread_free(graph); + ff_graph_thread_free(graphi); av_freep(&graph->sink_links); av_opt_free(graph); av_freep(&graph->filters); - av_freep(&graph->internal); av_freep(graphp); } @@ -170,12 +167,13 @@ AVFilterContext *avfilter_graph_alloc_filter(AVFilterGraph *graph, const char *name) { AVFilterContext **filters, *s; + FFFilterGraph *graphi = fffiltergraph(graph); - if (graph->thread_type && !graph->internal->thread_execute) { + if (graph->thread_type && !graphi->thread_execute) { if (graph->execute) { - graph->internal->thread_execute = graph->execute; + graphi->thread_execute = graph->execute; } else { - int ret = ff_graph_thread_init(graph); + int ret = ff_graph_thread_init(graphi); if (ret < 0) { av_log(graph, AV_LOG_ERROR, "Error initializing threading: %s.\n", av_err2str(ret)); return NULL; diff --git a/libavfilter/pthread.c b/libavfilter/pthread.c index a0336a8e04..06590fe65a 100644 --- a/libavfilter/pthread.c +++ b/libavfilter/pthread.c @@ -58,7 +58,7 @@ static void slice_thread_uninit(ThreadContext *c) static int thread_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs) { - ThreadContext *c = ctx->graph->internal->thread; + ThreadContext *c = fffiltergraph(ctx->graph)->thread; if (nb_jobs <= 0) return 0; @@ -79,8 +79,9 @@ static int thread_init_internal(ThreadContext *c, int nb_threads) return FFMAX(nb_threads, 1); } -int ff_graph_thread_init(AVFilterGraph *graph) +int ff_graph_thread_init(FFFilterGraph *graphi) { + AVFilterGraph *graph = &graphi->p; int ret; if (graph->nb_threads == 1) { @@ -88,27 +89,27 @@ int ff_graph_thread_init(AVFilterGraph *graph) return 0; } - graph->internal->thread = av_mallocz(sizeof(ThreadContext)); - if (!graph->internal->thread) + graphi->thread = av_mallocz(sizeof(ThreadContext)); + if (!graphi->thread) return AVERROR(ENOMEM); - ret = thread_init_internal(graph->internal->thread, graph->nb_threads); + ret = thread_init_internal(graphi->thread, graph->nb_threads); if (ret <= 1) { - av_freep(&graph->internal->thread); + av_freep(&graphi->thread); graph->thread_type = 0; graph->nb_threads = 1; return (ret < 0) ? ret : 0; } graph->nb_threads = ret; - graph->internal->thread_execute = thread_execute; + graphi->thread_execute = thread_execute; return 0; } -void ff_graph_thread_free(AVFilterGraph *graph) +void ff_graph_thread_free(FFFilterGraph *graph) { - if (graph->internal->thread) - slice_thread_uninit(graph->internal->thread); - av_freep(&graph->internal->thread); + if (graph->thread) + slice_thread_uninit(graph->thread); + av_freep(&graph->thread); } From patchwork Wed Feb 14 17:25:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46271 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:b819:b0:19e:cdac:8cce with SMTP id fi25csp79559pzb; Wed, 14 Feb 2024 09:24:28 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUdj+iAqjYpKF2RkcSuRjd7w+gt7ShpWjSVOoI7LGIG+EDo3uBc0eZVjMT8rbrevCzoXeGOu2fJyXgm2RXcXen5vpIDE8yDlH7Hqw== X-Google-Smtp-Source: AGHT+IH3qfJSJ43QcXIvn4QKi4pehj8toUHiFH+cB6xVazrnDET2sniUHiGDPPDbN/Q4ZChmm1g3 X-Received: by 2002:a17:906:a451:b0:a3c:a4ba:6b02 with SMTP id cb17-20020a170906a45100b00a3ca4ba6b02mr2253876ejb.1.1707931468209; Wed, 14 Feb 2024 09:24:28 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXYj2/VhrIlrHN8BARwIUW6FjLfg6DSv7YqM90bJzhs/4UTpZqt6lh2oheTZljzqThZUJEs9uu1XD+kY8sJBusJkovHsjgkn0qLNGEJg/j3eSsmSEH6dKkv83LhyVJMftOgP94FZH7x0jP0TnzDOmy0JXMfr/70ltHjHGtQWBV5MC9bHqieAfMkiYT1OKyUcN9KvMXvwnT6gBXzvTZV9Q+iQDPOBchgQqiUDewRrSlopJFzsgeqS0Z0dhBf8l3aUivCRDtOGBmKbkwyFSbkSjEMBYvVY5ADt/RnCHUoVcmxTnRmXUcvtZXVeXSFi/kdozTGbqiSLezHkRqLHYI5At2joyODnr8ncVqqY3OOvMTL2OU0DLKqr9MyeC6mUakEf+1qJk5PCMAItvX9PWfJ36uadKdvRs9ObWY2IuQN6X6Xn2qqb2rkXjek8UcEql1ntSnWzTFWVi5eaKaOdWsCmB1p2sU+gsrKSlAPEMuZTZvV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Zk8WP117blOYsUuHYtE8 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id qa34-20020a17090786a200b00a3cef3f7613si2291908ejc.526.2024.02.14.09.24.27; Wed, 14 Feb 2024 09:24:28 -0800 (PST) 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=X9Eg2P5f; 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 953B568D219; Wed, 14 Feb 2024 19:24:14 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04olkn2100.outbound.protection.outlook.com [40.92.73.100]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A68B468D1D7 for ; Wed, 14 Feb 2024 19:24:07 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ida9aWP7xzeCXbvY+1o/yBzAhBCP21FGRG3VC164QjOcd14Nq6fwiab/UgHZS7SgvADDz0Xfz6IQ7JScNJ9J6E+++bnSPtZotqeNzdoj1xBFEDnxkwSIK3+UYRXfKEHqd+0YNOtJCzsgltDuKDhzLX6ARneX66M6sr83BcRvhj8tLDLBSk/g23hHemgTKulyDKB3lYO4ayuitIAMOh5VqUsWPXvMXjaiDEMBaVMbDtOBct+5guhw+GdfryDZKEs6tYKLWoD8E+Z5iqSGQOqYKxLCxHRHaZyq3hFth8eYgA8qqFdFi/9EsohlxKQ4lK4W/uSXMJWMPEEMDbg6kMqPTg== 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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=X0fuaFCdw1JSRNcjfUOwcYgyZTE7TerbKrT9ruT4hhA=; b=IVK800V1Y15l6IKkrhprUqObuZGjxuCM1DeiO7RcC6Vv8JCbcO7Z3TTrUAwE9Y5mivdRmnWbJAxMub+eM4sTvmBjKScGdyC8Y3D8HpwKZmIgSL+fXMimtBAgpNHGL8J79r1TRqQDIvk1iQMPqKNWJQV7Tvr4HX5URbyxTHKLHV074WQcONAHn093/A3cK/v0GHRFf9f+f4aUQez8zTAnOVJ1ON5Rhoi9x4lYY4aNZ+/FlYIUoA4r1UtTvwnaEAgedKRkmpNe/7qYaYogSA91WmvtKtzHocxAtQjEmFBvXlTcrHpJvm1rbK/z5EqhJ1oLVwOHPqGI0kufG4K8d2/7ig== 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=X0fuaFCdw1JSRNcjfUOwcYgyZTE7TerbKrT9ruT4hhA=; b=X9Eg2P5frd38IkTEXt1ZIJ2RAWS2mgu+9XJwYf7DMj9eamWCwe5fpcyURJ7GFZeyEDZbMkugI4cNsntIjxmY/+jt7SDpaGRSzvLSDYslt2AUKsxaV5x3OzSxsQ9JfCo2+MeP20js0rgwf9I5UtV8u0hj84/5faLKCy1IUZ2FUebSLw0fJnkR4jReiBytyRlgs+9xXPcAUUJEg4a16XcCwfWt5N0pJOzdOlv1pFl/DafHFlJr/5Oo8pM9vSjZKgr4Z+em6pwJIOdbB2pzID4pORmuV9OmljyD0QjcJls4iePLzKKwWNMQiwkfZjIpL3dG1k6kmt6lUVTh4+z/FK0S2A== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by AM8P250MB0374.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:329::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.39; Wed, 14 Feb 2024 17:23:53 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d%5]) with mapi id 15.20.7270.036; Wed, 14 Feb 2024 17:23:53 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 14 Feb 2024 18:25:34 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [h4ROnnkFsOyShYFo2ePPN0AbwS/THBHhUy0ZfubdOS0=] X-ClientProxiedBy: ZR0P278CA0001.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:16::11) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240214172537.1099404-4-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|AM8P250MB0374:EE_ X-MS-Office365-Filtering-Correlation-Id: 06e34f71-02a5-4b70-c00e-08dc2d81b7b2 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VQyXdkz4Jr8dfbRiGYmnDIhrGbJxvNI0l6A5AE5ITq+an6O0f6SHag3maI/Zq3kUFa7koXEWMv90HrlZ7io1clq1w1c6Tw7walFuF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M+xypF7PYPm2n4KKm++s0wMGr3PUYe2kyPz9r59MkYVmaFa0RBVk0YTOKGX8IuouRBaHOpqYynbZNhJVRdUp7pDVsA6hIEPCs0DXxUM7h0xo9LKy1zIjsOFgTukufsd6fUWLdVTHigJW1iIPb6PVI1wxGQ/UMgM7fEFx4JX/qfi4ieQ0C3MrP4q7STHdQDn9sEQaq05bQCkGhvUrL2a+TezoAsPA9G48ztqzffdtkTsvybX2f0Aw81RJkyVheszOIO/9b3cQeytM5FZT9wyof2C1ogTNqPWGOQ4qD4tkjV96lNCoID44Tr9VsQwSfYGGYCigYVyUiSnt6oUJoJNBG3G92ARHgMcOHN4fwrLZwB710pBVNuP19aPx9dAHPZwP3bd7UOyRR8uYiq3H5uziaZIcY9Zvv+ly/ulgBe1q3fHaGITvtPK3pOePaf5nwsQ1+WQRX86gEv+S788ZA8gt18zFkrSzqzXUtm/O4LfxmB9hmH6G9jpUDpLaAGlrvbwKxupQtNUQ6Xm7fHNKpESkDr139uYAomHkPVtUXguBAgsd6+tziizZMV6hxLyz7LxtvGHVD4UIntNz/Q8Ots6grboIL1jewqSWRv9t3oIcRuVoi5ThXFIZVyLjEdkUFNhUrNMMHrXWWmneWDjweA03lQ9DF0oE3z1emX/JNvzVkKxEVsq2qhwwLMEQc043J3UJmch1kLtC1XdRXHQGHD9WQ4qyWBh4lF0GzCQ0Tr/T+AHipGfqZyLmgroRcVRUfsWwA7MmHVfQYCvyWZJROYepp/QVuQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 06e34f71-02a5-4b70-c00e-08dc2d81b7b2 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2024 17:23:53.7838 (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: AM8P250MB0374 Subject: [FFmpeg-devel] [PATCH 5/8] avfilter/avfilter: Move AVFilterGraph private fields to FFFilterGraph 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: 2XQtXAH54L1U (These fields were in AVFilterGraph although AVFilterGraphInternal existed for years.) Signed-off-by: Andreas Rheinhardt --- libavfilter/avfilter.h | 12 ------------ libavfilter/avfilter_internal.h | 6 ++++++ libavfilter/avfiltergraph.c | 32 +++++++++++++++++--------------- 3 files changed, 23 insertions(+), 27 deletions(-) diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index b5346f40ab..1d2909e28d 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -899,18 +899,6 @@ typedef struct AVFilterGraph { avfilter_execute_func *execute; char *aresample_swr_opts; ///< swr options to use for the auto-inserted aresample filters, Access ONLY through AVOptions - - /** - * Private fields - * - * The following fields are for internal use only. - * Their type, offset, number and semantic can change without notice. - */ - - AVFilterLink **sink_links; - int sink_links_count; - - unsigned disable_auto_convert; } AVFilterGraph; /** diff --git a/libavfilter/avfilter_internal.h b/libavfilter/avfilter_internal.h index 9ddb82bf26..72712608e7 100644 --- a/libavfilter/avfilter_internal.h +++ b/libavfilter/avfilter_internal.h @@ -41,6 +41,12 @@ typedef struct FFFilterGraph { * The public AVFilterGraph. See avfilter.h for it. */ AVFilterGraph p; + + AVFilterLink **sink_links; + int sink_links_count; + + unsigned disable_auto_convert; + void *thread; avfilter_execute_func *thread_execute; FFFrameQueueGlobal frame_queues; diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index 1e7874adc6..5278cf2010 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -127,7 +127,7 @@ void avfilter_graph_free(AVFilterGraph **graphp) ff_graph_thread_free(graphi); - av_freep(&graph->sink_links); + av_freep(&graphi->sink_links); av_opt_free(graph); @@ -159,7 +159,7 @@ fail: void avfilter_graph_set_auto_convert(AVFilterGraph *graph, unsigned flags) { - graph->disable_auto_convert = flags; + fffiltergraph(graph)->disable_auto_convert = flags; } AVFilterContext *avfilter_graph_alloc_filter(AVFilterGraph *graph, @@ -471,7 +471,7 @@ static int query_formats(AVFilterGraph *graph, void *log_ctx) char inst_name[30]; const char *opts; - if (graph->disable_auto_convert) { + if (fffiltergraph(graph)->disable_auto_convert) { av_log(log_ctx, AV_LOG_ERROR, "The filters '%s' and '%s' do not have a common format " "and automatic conversion is disabled.\n", @@ -1317,8 +1317,8 @@ static int graph_config_pointers(AVFilterGraph *graph, void *log_ctx) } } av_assert0(n == sink_links_count); - graph->sink_links = sinks; - graph->sink_links_count = sink_links_count; + fffiltergraph(graph)->sink_links = sinks; + fffiltergraph(graph)->sink_links_count = sink_links_count; return 0; } @@ -1401,7 +1401,7 @@ int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const return 0; } -static void heap_bubble_up(AVFilterGraph *graph, +static void heap_bubble_up(FFFilterGraph *graph, AVFilterLink *link, int index) { AVFilterLink **links = graph->sink_links; @@ -1420,7 +1420,7 @@ static void heap_bubble_up(AVFilterGraph *graph, link->age_index = index; } -static void heap_bubble_down(AVFilterGraph *graph, +static void heap_bubble_down(FFFilterGraph *graph, AVFilterLink *link, int index) { AVFilterLink **links = graph->sink_links; @@ -1446,18 +1446,20 @@ static void heap_bubble_down(AVFilterGraph *graph, void ff_avfilter_graph_update_heap(AVFilterGraph *graph, AVFilterLink *link) { - heap_bubble_up (graph, link, link->age_index); - heap_bubble_down(graph, link, link->age_index); + FFFilterGraph *graphi = fffiltergraph(graph); + heap_bubble_up (graphi, link, link->age_index); + heap_bubble_down(graphi, link, link->age_index); } int avfilter_graph_request_oldest(AVFilterGraph *graph) { - AVFilterLink *oldest = graph->sink_links[0]; + FFFilterGraph *graphi = fffiltergraph(graph); + AVFilterLink *oldest = graphi->sink_links[0]; int64_t frame_count; int r; - while (graph->sink_links_count) { - oldest = graph->sink_links[0]; + while (graphi->sink_links_count) { + oldest = graphi->sink_links[0]; if (oldest->dst->filter->activate) { r = av_buffersink_get_frame_flags(oldest->dst, NULL, AV_BUFFERSINK_FLAG_PEEK); @@ -1472,12 +1474,12 @@ int avfilter_graph_request_oldest(AVFilterGraph *graph) oldest->dst->name, oldest->dstpad->name); /* EOF: remove the link from the heap */ - if (oldest->age_index < --graph->sink_links_count) - heap_bubble_down(graph, graph->sink_links[graph->sink_links_count], + if (oldest->age_index < --graphi->sink_links_count) + heap_bubble_down(graphi, graphi->sink_links[graphi->sink_links_count], oldest->age_index); oldest->age_index = -1; } - if (!graph->sink_links_count) + if (!graphi->sink_links_count) return AVERROR_EOF; av_assert1(!oldest->dst->filter->activate); av_assert1(oldest->age_index >= 0); From patchwork Wed Feb 14 17:25:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46272 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:b819:b0:19e:cdac:8cce with SMTP id fi25csp79658pzb; Wed, 14 Feb 2024 09:24:37 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX1WMGfNJQI6/zW17NrUo1qxso5GXoKllLfnpNVJIXUcT/mmmlw1JXdhMH+w2Zn3wbm2sC9/z1eXlNh+XomIeUdfIC/KhQYVsQHEw== X-Google-Smtp-Source: AGHT+IEm3dn1neaaVxJr337ssfO7xGnsAADU24z4VtXtunbx+y+VbSCqaiF8QScUZj+ut4FvNKmN X-Received: by 2002:a17:906:e50:b0:a38:24dd:f44f with SMTP id q16-20020a1709060e5000b00a3824ddf44fmr2305154eji.65.1707931477169; Wed, 14 Feb 2024 09:24:37 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVzGBK4v/5TYtnvgwr/6e1qqAru1eTaar1Nb9jqicmK6JRcRrCQiLF6confoJLjqajIdksGIAW//zswfyIamgnaGnlu3amFR3Ya+aj7iCpWnsxp5KICkqQL3FmMvlcoyl352e3z1uYqfnlveEzXxy9g9D0CJDJDIlG6VByDmuujkXj8ZVE3VqDsEOI1iOYj2R5nowZUC3LMzi7188XT06iyssfbf4kEiHX3YYJGcYEqTQotFwNia92Q6TyrKVw8dDi1QXzeamyHXeu2JiaS3aZX7Yqqvsx+WGDQcjQfxk2Bp7BUOkXf+VFZq+67jvsugYh4WvFXdwpRrpomWNclDWKBgpD3ojv8e6iGY7ANF5gGR8cqvdHIui//3/oB8SIpDPeD8PRs8DrlbseJpHBPXilbe0VbUn/4vsi2yWZB1yhPeGMBe72FBXBwDvxKgCwI/V9/nAiEwgsDXz8/58Y632DVIbHR9dGDUuqk0IqMQ3RPvYPiUVR/+jmRS/S+0RMlVLW7tFQnXWGbddVBuDyPIChtmOBdd5a0bAzG8eMpvMlLvyxRqepgzsAHRExlf8MFZLvFeLdijsStsSuq3AkhZNQ0KHdTICDhPV8YViskAdkvkvouUKk99yOroCMM9O5tZl9FY0dAAXJqruLQPP6fThVA11+jmo4LJIWH5STdAuy2teCZbJp+kT66ko2Rabr1vEz4EZe/YGeUC/zpdjc+MmfUbPptAeJqQc0ETKR21Du8mWwfkhpltLpdsv7ed11IWmwJvxO1MdKLZWCaznMNyoXgFmGu0wn2PVmje9P6tiiJlJNM8vk0L0Qs3/a1R/N/p033URyn2T4W0dDieLed9JqmhbhDuDLc+gIr1utgToGmZ5vpI5abwx9RmS7ITnzZXQ3tJidnBy4dL8c4rUKctMo1WJOriZzEW9exmqmxZKEPsB5teGdhEnR6rj08eLOQt/VSJL Zr4s107b5ffTC1qTq9Wm7UJCS+gcprhgjCHDM/pv+gu4+KmSzZDOchSzDDNXzjhXkNlZeyPhxr6hnpJl8Bm5p1r4Jpe1P0vNroO41VhQhzQLnd4XOvB8lMLCaoJ1/02+n5D+/gW1+rKFioh6g13vKtcPXt+kZIqiFIrSsjXxIdTf8+cFppyNNpX7l/rB3bhT3tEHuDbatDeTlW9FV/0NzpAWAtZeCO4oB1OE9KYoF8iOLAWqOxnSpijij7bu7n2OwpAo0xgHX1PQ1KT3E6C349+U5tXynYQHzaKnaaY3jAz/0EpZZEk9tRP4nge3G+BDNxDslhVHAB4N4wK22/q8+1+0+tibp1WOGulwYTxwb3YiqdtAQ4Be3TuCehSYGnxib8ST2wfIwOBULaG4bVg8ybcsFAisuteIVRmek5PHzPdZqOtk3tkDgvMU+WINQ8JP7z9VyhPhXRvhnx+RrtVrZR8+RKI6VghUH5kuLYBVhQeJgnyDqTlOlxLhf1w1pUVH51SVqNqn5nPWBkcunW+FMPhbK74XuJ4qItowgshoZY4f91KBeOoPT1OQ1saPzEULb/DhTK25KPWs5YEiitmlwyRHoqRngyQWjLRVcCJckAVJ8Comb94u56cCaLq9w= Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id i8-20020a170906264800b00a38815c23edsi2462264ejc.778.2024.02.14.09.24.36; Wed, 14 Feb 2024 09:24:37 -0800 (PST) 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=cZTHGNLj; 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 1E9F668D212; Wed, 14 Feb 2024 19:24:16 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04olkn2100.outbound.protection.outlook.com [40.92.73.100]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1946668D213 for ; Wed, 14 Feb 2024 19:24:13 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CqQcR0OZirx1eCxBB+0kP9buZVNB52iE6K//Ri6F8FiSiWnISxnxXp+5/eW0w9TZg6NHvW35ioHxFzkLAsPFrGwsnWwl5tsGq5MW5OEJ29p5+bo/1AmjU+h0Cq3e5nbnWDUouWSG65sx0Llr5zn+Igpu5xtU0KgsdfEV93ex6ubv62wj4hQYcIM7hUw8O2B5JDy8Y7LfRVN3jJyasbzfe3TWwS4uj09so5l90ghYGo2ShsBQBUYKNOpJMRTcnIr4Mg0tSF3mmNh7HDJzjnweUboGop9+LZpIavjOcfqptc4Pe9sTmdaRLAmuSfPyRA46mH7SUSPW5HkAG445APSVSg== 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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bEyo/dTcvpNvdojrV8nUxac5tr/nW4RK7FEJGt/Gw9M=; b=aaoED0/FIuac/4EMa7lh8M4R96QbFy/4HmL7+NsLzm1Mjgsh+sPDGHeKfzrFtq1dS9eaqQZxwAkDJLgeBbBvm+mbYMk5pBQBRJi2dbfLtoSh6ahfD4UeZTN3XGgPw5adbIz2IxNim0v1qyZyT4nnCccfwcxkeCxIDERtaiWueWbpaBgwTHWAzlwVx1hQYnbrFX2uJ6EHASU6rwB60YoaDDeVKfKLjd8QYw10vFJnZIrjIvlOxAs3pLnD1Sa5qJQFYsd6SR0uVlNhwfuGKDs4UYJyhXPYr0z2oIN2nObn1vWntiuI2RXYoA4GuasO0Re49/6LcdUG3L4BqCg61DsO+g== 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=bEyo/dTcvpNvdojrV8nUxac5tr/nW4RK7FEJGt/Gw9M=; b=cZTHGNLjcx54IzhGcjphjNSa+VJQPTpmTcHZic6UQydtOhhQwmwwb+VqPIk74WUj9bKhDYOiKpGtWRgePdcwwoNdfn4uN3fBFpgyUqR798CW/OaiDYsx0S7nJbOZ7pkC3OLkiztyo9TZXqljlGR+XWFsNNb/jgB+cqYHVn53V0HZKqYUFFbI83hmdSbTsMaIb71oN4y7LmjE14od7FzVajTQNf1p+2EWk6unhSJydPfl4bIauwMleK6D6audnNzNAUuwIET+ArdQQ8+y6S4h9pcwLnWn9YX3TnRhfTvU67rZhQps1D1B9i5tE3QpKHmHosQf6RAZWFG3sixHPwu/PA== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by AM8P250MB0374.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:329::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.39; Wed, 14 Feb 2024 17:23:54 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d%5]) with mapi id 15.20.7270.036; Wed, 14 Feb 2024 17:23:54 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 14 Feb 2024 18:25:35 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [2LBBwrkciPjM4uzK6piPyeFyZO9BNvm6kBnriWwypJU=] X-ClientProxiedBy: ZR0P278CA0001.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:16::11) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240214172537.1099404-5-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|AM8P250MB0374:EE_ X-MS-Office365-Filtering-Correlation-Id: 79f282b6-466d-4e73-0c4c-08dc2d81b837 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Lx3LaY8Bb1CnsdT+mKWx5heG6BbhRcu4DvucZ81EsIrQ54oeyVwMwTJzOdI6Bz0P4qRXTrHizRlX5yww+aGJVq8eDEUavvGg75Nhf4PR4m4m3AH5gfCfobQ3kI1+pOyMlTPuqhlCt4l7VvHvqj47q5WRBgW7SkT1lZM05XB9EWagwQeD0XrVlMFH0IwvWwrZ6TogJszVZGsgluMhL4oX/9HE12s95wG/C88JSTHKEJU98EfLlAVlmsNfCag8Icu4rWo/mANqarEz8BCEKWJycC0Mhsxxc2EI4ZmeOCE5pJtoAW6FkAPj5fysmVU9E6oLenXQf/UnCcxRTxXWUVsJrKWg2wBl5maVObByu3cDjGWXAUAEJI2L1Ro1eCCeri/YMikpp11Glds11mlnQ982WZkdJcxe7enAsrcEJfB/tZCK9zC2wShMgeaTFQiwwnzt/AggHFLqu0S9hN1EMwItfxq0t7M8wKL1UKLXZyCTA4xIw+schXqd4F1MzuXr5cr10GQtFaJ76MIWdx3BlB8behAxJV5SyWAxmFlmGFfWX0e67rVRSYBOCSoP9oFvWkUyoi/5zYkWQ1nlwpsenXrZ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l4LBd0ZAT0m3IMgVmcZm3wCB1/1b8ycql/4YRr/oTkP15rHmwC8+yw6f4V1BNyH/ZWgU5ysMFj3BBIEKlEh8e1R+JyPkEax1BiOz7ngNeubsXcQawVi4nB8xh1NyHgRUmkE26N98A2TRsWfLeMUtZ0IUzKz8BRuOzxeXEVCKKf2DURZSKpytouHXnPMp6UzViJRuW5Mg2YFKZCX7OymGzNu7hPuqeGMRqok7ehWb6bJchagEeGYhCeqoTC6cFxWi0DLEFK1kCy4gkzMgloME2Fc7r3H6wAseVMHyqEwEuP6i/mkjQG06IF8As+N41Q== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 79f282b6-466d-4e73-0c4c-08dc2d81b837 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2024 17:23:54.6339 (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: AM8P250MB0374 Subject: [FFmpeg-devel] [PATCH 6/8] avfilter/avfilter: Move init_state to FilterLinkInternal 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: 23m2NIOQC4n1 Signed-off-by: Andreas Rheinhardt --- libavfilter/avfilter.c | 7 ++++--- libavfilter/avfilter.h | 7 ------- libavfilter/link_internal.h | 7 +++++++ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 796ec29afd..a3f8c403c3 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -323,6 +323,7 @@ int avfilter_config_links(AVFilterContext *filter) for (i = 0; i < filter->nb_inputs; i ++) { AVFilterLink *link = filter->inputs[i]; AVFilterLink *inlink; + FilterLinkInternal *li = ff_link_internal(link); if (!link) continue; if (!link->src || !link->dst) { @@ -335,14 +336,14 @@ int avfilter_config_links(AVFilterContext *filter) link->current_pts = link->current_pts_us = AV_NOPTS_VALUE; - switch (link->init_state) { + switch (li->init_state) { case AVLINK_INIT: continue; case AVLINK_STARTINIT: av_log(filter, AV_LOG_INFO, "circular filter chain detected\n"); return 0; case AVLINK_UNINIT: - link->init_state = AVLINK_STARTINIT; + li->init_state = AVLINK_STARTINIT; if ((ret = avfilter_config_links(link->src)) < 0) return ret; @@ -413,7 +414,7 @@ int avfilter_config_links(AVFilterContext *filter) return ret; } - link->init_state = AVLINK_INIT; + li->init_state = AVLINK_INIT; } } diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 1d2909e28d..5c6e34e8fc 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -611,13 +611,6 @@ struct AVFilterLink { */ AVFilterFormatsConfig outcfg; - /** stage of the initialization of the link properties (dimensions, etc) */ - enum { - AVLINK_UNINIT = 0, ///< not started - AVLINK_STARTINIT, ///< started, but incomplete - AVLINK_INIT ///< complete - } init_state; - /** * Graph the filter belongs to. */ diff --git a/libavfilter/link_internal.h b/libavfilter/link_internal.h index b5a8ac89ec..030eb24765 100644 --- a/libavfilter/link_internal.h +++ b/libavfilter/link_internal.h @@ -59,6 +59,13 @@ typedef struct FilterLinkInternal { * corresponding code. */ int status_out; + + /** stage of the initialization of the link properties (dimensions, etc) */ + enum { + AVLINK_UNINIT = 0, ///< not started + AVLINK_STARTINIT, ///< started, but incomplete + AVLINK_INIT ///< complete + } init_state; } FilterLinkInternal; static inline FilterLinkInternal *ff_link_internal(AVFilterLink *link) From patchwork Wed Feb 14 17:25:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46267 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:b819:b0:19e:cdac:8cce with SMTP id fi25csp79765pzb; Wed, 14 Feb 2024 09:24:46 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCURJDCLbbdVW0KD7pUTfJLaVJA+MFoCOuAnAvB5LvmLKlys8G0RdX2UnoeJOGPVH24O2S6aGks828/uQqOMAQe3TN+qx2IEigwa8A== X-Google-Smtp-Source: AGHT+IF90c4+7S84945c0H8Bc32ZcZVwmPN8yF+yB2Zp4ll1Acq90/Y0uBDDjjnue+nVwUkV4gR4 X-Received: by 2002:a17:906:bf47:b0:a3c:fd0a:7d7 with SMTP id ps7-20020a170906bf4700b00a3cfd0a07d7mr2883045ejb.3.1707931486697; Wed, 14 Feb 2024 09:24:46 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXGM5PEbJ3fqbRltrjGYUYu5HoYMzC6rDkUmGSzI6J28CE2aoFpxqOTw57YwIrQr/eErbbAsPuC/M65uWNtLWRivcXCkJLiw36e7A62EgP/CexNjA5rmcLo4IygLIhfEsjGj4JjSbq/yHZxrElZqulYi5Fz8Ojo0yxIIw3l6VeOaJbvh79b524t0YCv7X2y8/Wvu71WTXdGBVcLXzPLHIzSMgj8oHuLdksZUrl7wsTChdwJjUk/KI1CDr3leD3O0CXCVGevdzwyQLjI6uhYxmCyocVlr8cdM0nPTvnwAT+SX6mmWjdgBf+gMzppNNCXqA38n6mdksQnzuFtC3SHcnksSp+i8zy0r7eCc8qNFrpp4woCpu/BfUEe57/dD0Y4QU2UKDB2tEhMNRcCLfHcmPSpv+9gQlHc5VY25HpM0RV+gQDfSw2twWoC9fHUXFjBsSXKt/pKoX59OPyNTclId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5u9C8pbUaUNL84V13mylU8Yu Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id um12-20020a170906cf8c00b00a3d42dafba0si774537ejb.1052.2024.02.14.09.24.46; Wed, 14 Feb 2024 09:24:46 -0800 (PST) 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=HRlhheQW; 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 6975068D222; Wed, 14 Feb 2024 19:24:17 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04olkn2100.outbound.protection.outlook.com [40.92.73.100]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6218668D213 for ; Wed, 14 Feb 2024 19:24:13 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CXPwFibjRx/h5h8pQBa4EMXb7mfqOngQi+ltjHNq6DQE/SzuSBjrn7yYIhN+PZgKB7jbpn7pir7fqOkFvt+LrbcC0PYNV9T/HX8WLg0iSOyj1Jx624PZ57MWIOeInwlkO3d6xD6giZK3BPDxhyIeAbSfABYeArmXn+SskfBIQXf3Bpq+LIudPQNMZgMrH4ULjbv5mtqOKNIJNod/r4LorVZPCFkpxKTIn8RwNjECTAEYoXTlYZ3deObnqNIT7AuDtmgRUHbXjGndsVu0VefFs+WjkQE+JhNjDc3XAYfoY2rDqd3NAmA4D/Rq7O64WZzascJsSHUDV/sqfwzhN53NWQ== 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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TYF0tjqhtCnKKKFGUTJMP2YCy0dchBAFOtVhr/XfhqY=; b=P8CLBpw6dAn1/JFZgdzKl4OyYrbmB9Rp9oSND/9q/j6XWN1l2X7tkFkWPeWrwuGsDHSbdEkTHqaVORcNlloH7YJAvmKwkj85psyg3t4RUdQnD1ztZdXzeiUUwpL9AAXeH4ehWummsNGCdW0ukY2RucrzelJs+XKfq2qAYfACa9uNIsMhmUkYAb5YMWqTqWSRq26A3VSZ4EAppQ4UteEvboeJmqw3TQItFkH5Nswx489/ESJfOH4Joa4Jm1BUb5JQiDxmAPZS6iQHgQ1p9KRzEkJ74VJicWw+WEwTytGtMkdARM9mnGbjosc7DEIrrwx9YmEOEc/+JDF+tiyG1EeKcA== 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=TYF0tjqhtCnKKKFGUTJMP2YCy0dchBAFOtVhr/XfhqY=; b=HRlhheQW9QzQIDJiDc55jgzJw/tmTtwZS6cwr7jtKUWNMXO4n0TiLrd9hXA0dAK5MZOL+mmjzksl6DiROjZsC84xeNbPgQRA7CwJkxjRUI1USPBXQPFoNVL9jQ443PvR1BW5TBTHaU5c+ol89B5hwj0aREDs10/iOpAq5ODWtBp2WCOFyP2efstBH4u03IxCcLcyMsRU7tbxKCHsO0tI+gGDJ8HHS0mGYNttFB/bWfxrPm9EEY9KMEDW5oncY34xxK2mBIdXzJMZFrVAnxf+bpCIbKdMk5zEYY7SkFL0ovPQD96PCNF0fnHj8hNw/NPSHpKAVbdQoFdV2b5wuT8WlA== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by AM8P250MB0374.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:329::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.39; Wed, 14 Feb 2024 17:23:55 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d%5]) with mapi id 15.20.7270.036; Wed, 14 Feb 2024 17:23:55 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 14 Feb 2024 18:25:36 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [lIgEqByu/W3emSarB0K828VtJa1vl4SwaxdTJFXXzz8=] X-ClientProxiedBy: ZR0P278CA0001.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:16::11) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240214172537.1099404-6-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|AM8P250MB0374:EE_ X-MS-Office365-Filtering-Correlation-Id: ef02c1c7-408b-441c-d820-08dc2d81b8cf X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UnfdMeywEno7bGZXH4RSvxKRegILbjaNq/oJvWdXYYlRRbCkNMkmZB4f7cYdKI//BqYDiHMut8LCJaXZsOay5NJzrK5/bOXAjUIf81D1zQwSzrXVDgF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iXp5JBuv51XfSnI8fnvb4t+zWAa1YzFoqU7E/p4IJxHzZC4VJteW3CwowmBbnslQ2x2c4GwJNs2cLfe5IvCeP0opGTD2xEQm9s0Ui0fMddBuW/a5h/0maOvjc2yef878DaQ3lWk+01BW/uguEdboJVRUhFllO12PbPfQSgWUJ141/t1r7FO3M1UNYBD3BqyRGtf6i6GK11SucaqFlOEKwz6nqLM6IcRXKJnSQojtwTb1gv5o9QIDD0Fsg/ysOGBlyOe4hqEOIYsGLfJT219Tfgbo75iT7ZOtUUw0p1AyN9e2PEZ/6GaIs6ziWgCAnVGMXZYrTiVlwFEjafnb/alr95OpmkftouLuI/ynQsE/fsQY7vgiE0ECwofCZ0h5M/FkAagWg2X11SGDONnRfMabvK2ZtP0nhz3myRZpYrp/q41W/s9DWbK54PIPVxPa9+o6PntHGYgJz7tIFJAPW2pWtcPXLUVRcPp/T569q4ChT93jjaOMhi4i7D7L3pyeABQjwew5AvTRdgnWfeJLyHNYshg5TyZcupDTPEAyS9U55bpPBf7a735/qFpzhC4lK14cOxuJ+buHTXsGO9632x9cO00o7CJOwbyZbkQaqPgbmvpGlnrreA3P/PmbpYICz8IUI8jQpNx5YVRzoxeXS0H6iU7rtceibjKQ1IL0yQhY6WbFf1ciU++B99oXRW2dUE2v0Q+20ZO4j8mP1WF706AAY6WAGQC1DkCy1ivOkqP/wM3XkhmZpydtTSENOByOR+JgnsGYv2lkOajJjPT4w== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ef02c1c7-408b-441c-d820-08dc2d81b8cf X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2024 17:23:55.6278 (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: AM8P250MB0374 Subject: [FFmpeg-devel] [PATCH 7/8] avfilter/avfilter: Move age_index to FilterLinkInternal 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: AQs1ZOMqwPEU Also make FFFilterGraph.sink_links a FilterLinkInternal** because sink_links is used to access FilterLinkInternal fields. Signed-off-by: Andreas Rheinhardt --- libavfilter/avfilter.c | 21 +++++++----- libavfilter/avfilter.h | 5 --- libavfilter/avfilter_internal.h | 5 +-- libavfilter/avfiltergraph.c | 61 +++++++++++++++++---------------- libavfilter/link_internal.h | 5 +++ 5 files changed, 52 insertions(+), 45 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index a3f8c403c3..52ef5ca9a4 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -208,15 +208,17 @@ void avfilter_link_free(AVFilterLink **link) av_freep(link); } -static void update_link_current_pts(AVFilterLink *link, int64_t pts) +static void update_link_current_pts(FilterLinkInternal *li, int64_t pts) { + AVFilterLink *const link = &li->l; + if (pts == AV_NOPTS_VALUE) return; link->current_pts = pts; link->current_pts_us = av_rescale_q(pts, link->time_base, AV_TIME_BASE_Q); /* TODO use duration */ - if (link->graph && link->age_index >= 0) - ff_avfilter_graph_update_heap(link->graph, link); + if (link->graph && li->age_index >= 0) + ff_avfilter_graph_update_heap(link->graph, li); } void ff_filter_set_ready(AVFilterContext *filter, unsigned priority) @@ -266,7 +268,7 @@ static void link_set_out_status(AVFilterLink *link, int status, int64_t pts) av_assert0(!li->status_out); li->status_out = status; if (pts != AV_NOPTS_VALUE) - update_link_current_pts(link, pts); + update_link_current_pts(li, pts); filter_unblock(link->dst); ff_filter_set_ready(link->src, 200); } @@ -1393,7 +1395,7 @@ int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts if (!li->status_in) return *rstatus = 0; *rstatus = li->status_out = li->status_in; - update_link_current_pts(link, li->status_in_pts); + update_link_current_pts(li, li->status_in_pts); *rpts = link->current_pts; return 1; } @@ -1424,9 +1426,10 @@ int ff_inlink_check_available_samples(AVFilterLink *link, unsigned min) return samples >= min || (li->status_in && samples); } -static void consume_update(AVFilterLink *link, const AVFrame *frame) +static void consume_update(FilterLinkInternal *li, const AVFrame *frame) { - update_link_current_pts(link, frame->pts); + AVFilterLink *const link = &li->l; + update_link_current_pts(li, frame->pts); ff_inlink_process_commands(link, frame); link->dst->is_disabled = !ff_inlink_evaluate_timeline_at_frame(link, frame); link->frame_count_out++; @@ -1448,7 +1451,7 @@ int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe) } frame = ff_framequeue_take(&li->fifo); - consume_update(link, frame); + consume_update(li, frame); *rframe = frame; return 1; } @@ -1469,7 +1472,7 @@ int ff_inlink_consume_samples(AVFilterLink *link, unsigned min, unsigned max, ret = take_samples(li, min, max, &frame); if (ret < 0) return ret; - consume_update(link, frame); + consume_update(li, frame); *rframe = frame; return 1; } diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 5c6e34e8fc..9252713ae2 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -628,11 +628,6 @@ struct AVFilterLink { */ int64_t current_pts_us; - /** - * Index in the age array. - */ - int age_index; - /** * Frame rate of the stream on the link, or 1/0 if unknown or variable; * if left to 0/0, will be automatically copied from the first input diff --git a/libavfilter/avfilter_internal.h b/libavfilter/avfilter_internal.h index 72712608e7..5ad44ca866 100644 --- a/libavfilter/avfilter_internal.h +++ b/libavfilter/avfilter_internal.h @@ -42,7 +42,7 @@ typedef struct FFFilterGraph { */ AVFilterGraph p; - AVFilterLink **sink_links; + struct FilterLinkInternal **sink_links; int sink_links_count; unsigned disable_auto_convert; @@ -60,7 +60,8 @@ static inline FFFilterGraph *fffiltergraph(AVFilterGraph *graph) /** * Update the position of a link in the age heap. */ -void ff_avfilter_graph_update_heap(AVFilterGraph *graph, AVFilterLink *link); +void ff_avfilter_graph_update_heap(AVFilterGraph *graph, + struct FilterLinkInternal *li); /** * Allocate a new filter context and return it. diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index 5278cf2010..9c91953cc9 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -1286,17 +1286,17 @@ static int graph_config_pointers(AVFilterGraph *graph, void *log_ctx) unsigned i, j; int sink_links_count = 0, n = 0; AVFilterContext *f; - AVFilterLink **sinks; + FilterLinkInternal **sinks; for (i = 0; i < graph->nb_filters; i++) { f = graph->filters[i]; for (j = 0; j < f->nb_inputs; j++) { f->inputs[j]->graph = graph; - f->inputs[j]->age_index = -1; + ff_link_internal(f->inputs[j])->age_index = -1; } for (j = 0; j < f->nb_outputs; j++) { f->outputs[j]->graph = graph; - f->outputs[j]->age_index= -1; + ff_link_internal(f->outputs[j])->age_index = -1; } if (!f->nb_outputs) { if (f->nb_inputs > INT_MAX - sink_links_count) @@ -1311,8 +1311,9 @@ static int graph_config_pointers(AVFilterGraph *graph, void *log_ctx) f = graph->filters[i]; if (!f->nb_outputs) { for (j = 0; j < f->nb_inputs; j++) { - sinks[n] = f->inputs[j]; - f->inputs[j]->age_index = n++; + sinks[n] = ff_link_internal(f->inputs[j]); + sinks[n]->age_index = n; + n++; } } } @@ -1402,28 +1403,28 @@ int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const } static void heap_bubble_up(FFFilterGraph *graph, - AVFilterLink *link, int index) + FilterLinkInternal *li, int index) { - AVFilterLink **links = graph->sink_links; + FilterLinkInternal **links = graph->sink_links; av_assert0(index >= 0); while (index) { int parent = (index - 1) >> 1; - if (links[parent]->current_pts_us >= link->current_pts_us) + if (links[parent]->l.current_pts_us >= li->l.current_pts_us) break; links[index] = links[parent]; links[index]->age_index = index; index = parent; } - links[index] = link; - link->age_index = index; + links[index] = li; + li->age_index = index; } static void heap_bubble_down(FFFilterGraph *graph, - AVFilterLink *link, int index) + FilterLinkInternal *li, int index) { - AVFilterLink **links = graph->sink_links; + FilterLinkInternal **links = graph->sink_links; av_assert0(index >= 0); @@ -1432,34 +1433,37 @@ static void heap_bubble_down(FFFilterGraph *graph, if (child >= graph->sink_links_count) break; if (child + 1 < graph->sink_links_count && - links[child + 1]->current_pts_us < links[child]->current_pts_us) + links[child + 1]->l.current_pts_us < links[child]->l.current_pts_us) child++; - if (link->current_pts_us < links[child]->current_pts_us) + if (li->l.current_pts_us < links[child]->l.current_pts_us) break; links[index] = links[child]; links[index]->age_index = index; index = child; } - links[index] = link; - link->age_index = index; + links[index] = li; + li->age_index = index; } -void ff_avfilter_graph_update_heap(AVFilterGraph *graph, AVFilterLink *link) +void ff_avfilter_graph_update_heap(AVFilterGraph *graph, FilterLinkInternal *li) { - FFFilterGraph *graphi = fffiltergraph(graph); - heap_bubble_up (graphi, link, link->age_index); - heap_bubble_down(graphi, link, link->age_index); + FFFilterGraph *graphi = fffiltergraph(graph); + + heap_bubble_up (graphi, li, li->age_index); + heap_bubble_down(graphi, li, li->age_index); } int avfilter_graph_request_oldest(AVFilterGraph *graph) { FFFilterGraph *graphi = fffiltergraph(graph); - AVFilterLink *oldest = graphi->sink_links[0]; + FilterLinkInternal *oldesti = graphi->sink_links[0]; + AVFilterLink *oldest = &oldesti->l; int64_t frame_count; int r; while (graphi->sink_links_count) { - oldest = graphi->sink_links[0]; + oldesti = graphi->sink_links[0]; + oldest = &oldesti->l; if (oldest->dst->filter->activate) { r = av_buffersink_get_frame_flags(oldest->dst, NULL, AV_BUFFERSINK_FLAG_PEEK); @@ -1474,22 +1478,21 @@ int avfilter_graph_request_oldest(AVFilterGraph *graph) oldest->dst->name, oldest->dstpad->name); /* EOF: remove the link from the heap */ - if (oldest->age_index < --graphi->sink_links_count) + if (oldesti->age_index < --graphi->sink_links_count) heap_bubble_down(graphi, graphi->sink_links[graphi->sink_links_count], - oldest->age_index); - oldest->age_index = -1; + oldesti->age_index); + oldesti->age_index = -1; } if (!graphi->sink_links_count) return AVERROR_EOF; av_assert1(!oldest->dst->filter->activate); - av_assert1(oldest->age_index >= 0); + av_assert1(oldesti->age_index >= 0); frame_count = oldest->frame_count_out; while (frame_count == oldest->frame_count_out) { - FilterLinkInternal * const li = ff_link_internal(oldest); r = ff_filter_graph_run_once(graph); if (r == AVERROR(EAGAIN) && - !oldest->frame_wanted_out && !li->frame_blocked_in && - !li->status_in) + !oldest->frame_wanted_out && !oldesti->frame_blocked_in && + !oldesti->status_in) ff_request_frame(oldest); else if (r < 0) return r; diff --git a/libavfilter/link_internal.h b/libavfilter/link_internal.h index 030eb24765..57efd44a45 100644 --- a/libavfilter/link_internal.h +++ b/libavfilter/link_internal.h @@ -60,6 +60,11 @@ typedef struct FilterLinkInternal { */ int status_out; + /** + * Index in the age array. + */ + int age_index; + /** stage of the initialization of the link properties (dimensions, etc) */ enum { AVLINK_UNINIT = 0, ///< not started From patchwork Wed Feb 14 17:25:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46273 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:b819:b0:19e:cdac:8cce with SMTP id fi25csp79837pzb; Wed, 14 Feb 2024 09:24:55 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVvvr1GtntX9UCWp3VJ48cE8WsZWhiaCfmhUMPoZQK9raWYzp60YJ5wndUXQIzWf+GK9uJOquXM67ZeTxwwWvDJGVF7IClvi0TKPQ== X-Google-Smtp-Source: AGHT+IGSNQhy11lUuiU1EmvDnKAfdpaCJp2m4eohrHIe5SiL4mTNrnWNmY4DRQmGaTRpSwQ3KuWE X-Received: by 2002:a17:906:4a4d:b0:a37:aad2:1cff with SMTP id a13-20020a1709064a4d00b00a37aad21cffmr2808819ejv.63.1707931495733; Wed, 14 Feb 2024 09:24:55 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWmFudXCVXwkJ0oGgaBuSKRK3chF8NDFqOYlUBF1Ji5AX1AC2JnFen9P9yEqRugZIwOYn8Um7asumpre4RvehssULR22ItHhlHZ0L60eR0wOOFo/3xFmfbEHIBvVriv4F+6z9i8j1flbkHW5v5jX0HY6hL1P299uhv+Z7qXFQY0LJDCEMGqjYJfaLWbEoot2nwOQei5GqHuXmHmatZekeif8lQHB2Yyrmhb5goHA4pCV0ybomTwoirdTRSNcM6vhcWwBhNrL44vk0798a5glA71rm7UUsZv2l8YdCWQUfJEBrxq0qbxflst26jPTcBzBMyX97kPacdgc4wmIhAAOqR9p8iY61dY58+38Iz1ovryKoNVuli/auhfs3A9HN5Gdq4VX4HgMVPlnnT3WKob0POIUxT1Y5vEEhMxaN2Ta1FdoMnKH53kpgC+T/ig53Q4bdrtvR+EEXLwiaziQOPVVvI8nsZ7Rs0qyZ4qDmzmWXcEMf4ukONmBf9mLp6NljykPFJgRl8OIUrARyJIvTqhG6yeHsXYCoo7CN00qRTqQeDL+erjG4guo5HxU2MhR3PhH7G1McP0fN9mVkrZ9jCKKK26u8S1gQv2z45CT8+LTT/DcWcl1O02M3zMxH8o8tYh16zYVLehUE01rOoclHCfLUqGkGCNy9yIWtXPMCgEVqanKTaKmfd+d2EHinRlG2FxjJuzjNeAkZcnjnM01cK+Svl+aRRVhCdqS0xCHGy6Eo9CZYHFPb4YqwRYDAZ8UsmJ4IlYP/DheAU0Trk+vvN5W0PEvpVpicWR+6N/Hk4xHqRsp5pWqrRX65I6/xWIct49pvtdxTEwEHxwgiUqf+PVwls+IRCxwndoEwDRRccXdig35JZ+C+6y0U53VEVXVfPOTuPaqBMZI+BbW1AOCuVnzGeZYs5mq0HbUnr0ka+BXj1I+0SzX69ltPV4GXqEVHr8Evi352 S9caDvMND+iS0116kbqNqe+DHeMq4QPLHKcZ5HVnLVCBRaMQWe6/ZhIjxSt6pd9GQMBdJgmXP/VWuTUUMEAkEIFuW3SQgILzau8nLDxUIemXt+N84EklAlIcJpmSwcDDna7EEpB7OBrZkNUj7bjyoKCrD+jRRD0YOzPQc++XRaocZXvZsn7PInz6GgMI6C2jy91ECNIZdHSAa8/oxB9FHQYJHlmEmVFuxODsA3PyVLF2u7Ug9aC+R4AvjkXFX5R7o5hxRqZgSmd07kaV/qdefr+8XDFg4HVY0UaK4kK6hTefQuXSyqZnIZMw7cqs7Afwkj9ULjUs6mUxsaFp/U9zsqPhW4WVheaGnjtrFt73JOR3xBT/SOxP4VAd/zHQ5VXlaHXWh/UZyGkgZTkg1JZLapz7f1NOBmC11qVnDyVnbW4rx81LF7FEsHqJJ3P89UWVklOWe9kh36I4rBxuWm/SMDMdgfsltrf5fzxKIO3QWmdpWGt1jMcRkO2JVnaJ217A6UhEX3uY0gxosrDbXBpj3C3STqPJ1lXkc2wjFltqavlniB3x96xzfcnvyp/sK985ePg+ViRBHQjH6+WO4wnFND8ihUUumoUdDGJC0deoguGSacwvdYM4knqnTiknl/cbUBgHB4 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id xo15-20020a170907bb8f00b00a3cf2f68a4asi1794757ejc.1055.2024.02.14.09.24.55; Wed, 14 Feb 2024 09:24:55 -0800 (PST) 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=CIkj8ekA; 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 3459468D20F; Wed, 14 Feb 2024 19:24:19 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04olkn2100.outbound.protection.outlook.com [40.92.73.100]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AFB7F68D213 for ; Wed, 14 Feb 2024 19:24:13 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YrgsPlCMVHbD7tQ79Cj6gyr7AlNiPthNi89GkifmWO5uS6nRMMzYuVGXNHkKFfrJCbSDBabhZeJhB9NVgrzgutFjBj02c4VhR/l3ve7mM5+qI++Y4h76jDS/vxbZm0bjjoGs4ppqWbf/HIvMcyS0IWLSl0+02IUjH//OdiBnUUo0XmumIjq36hGnFusY8/UHvP5Oh/dcwtY6sCIY1noRcuRkumIdZ4YeRC5wQjZShXvXN6NGYUbYdYRsUVh9bdTPOrj8Rdp2qZIsg+aU+V/Kyh31B4caXuEI52aQ1Bb++txxHn2GQPE4+rBiB/PjZ2I0e3RMQuqr6kVW0b7I4pfReg== 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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZUjqTB9B/R+4lz2wB8qiFVE0dtThgbbmev0noFpYJFc=; b=FNQSLucOgznZNItYd5v0mb6IsQ0EEZYFGwxLkjEK+bS+MRR9ssTsEYafVCnq025nTRbKsikyGdCkL+BvDHVRI1bzZOwspBGya4/CJmZwOoFPA6vLEVFGJdtRoMH1vpD3hhlZwG7K2X7GZec5EfhFVT3KPYmozkBH2pmTu3uzEDLQYtok4gXmJQc6Iu/Io8uf2VQBh7gZuIrXhsOK665aoR/54ywIm2nKnV3isjW+pkqQXyIjyV5ggvkjhItSBJo0AuVoNHvnEqtWowS0IXfELkn0EegMU7hONatTA0M5nthXDiUuB71F5ss78jPOL2oMz3zaL2lUMZZuiy00VjVh+A== 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=ZUjqTB9B/R+4lz2wB8qiFVE0dtThgbbmev0noFpYJFc=; b=CIkj8ekA6BmgxaX0sbXMS2Q1EjvEbeDhmCVrdffDuwogpA6HDWWjmyOBTxagXuhyCq5GHPnnfdsB15noexNNKTuDxxeCeJ/JuNJ4JHuJhFGUoCbEofkOxWosB+PKuMz4W9Bnyz64cRJE+h8Gyo0rFUZUdRkLLVsZeg7PCA/mdyCYAC/VUVgy7zC/UmAosQ6cu4OQSYg00H606Po5geOE4LlJeO+1N9Ig8bZBFRYQ1xtUSuLpF9Egt2nQiHkDUAkuwWBncw1ee3WP12AES+YFd0oTDLeoZEBgXmOLR25gPTvwGmXDRycP2emPeM0cPtCl2ELXljz57E62NQqk7m1AUA== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by AM8P250MB0374.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:329::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.39; Wed, 14 Feb 2024 17:23:57 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d%5]) with mapi id 15.20.7270.036; Wed, 14 Feb 2024 17:23:56 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 14 Feb 2024 18:25:37 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [SwcdsXtRiCaC+1U/T7glutnIEuMu93L9KQHRQERqvNA=] X-ClientProxiedBy: ZR0P278CA0001.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:16::11) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240214172537.1099404-7-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|AM8P250MB0374:EE_ X-MS-Office365-Filtering-Correlation-Id: 7dc787bc-400f-4223-1694-08dc2d81b973 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: htbyp9nKVC7cx45VPKYJF4JUVpj1sP4cF2GJ7R8B5Et1FF/st3Jx5xjkPBuWsJXd47yz8tkL2iH+mWdpSKAk3615oAiIDSnv03rDK66HK5ySvAigvEVW1g2AZnS1B99BujwWYZnlZ9EricYcVNcLdk53Z/L2EnU0p5j1jXW7Ly39oxJ27skur9GfA9I0vNn38oHgZWRdsexCm2GXhBOhinyLS4TmCj55eR5PBPhTxrMN+t3Ig8E3rzwyNF54JnVguSJzQzYunJ7vVOCl/+TYUSnMGLgJzjq74CKlM5C0vvHR3Alc7sGRIUpEc0wxDgccO7uwD7G7IsBQp45gqBnzWZvzGsLyDPk+w1/CIyBiWqAAd1w2KxHYi0u/jRsFxRQ1Nk3o/iCI0bFvLwX047+G4O73wmiBCPOYEBqnG7mMGJfH/czYu27TNcrjiqK6matK3ytpyczzMG8ig6CebgR8bTcDCfYnjFY0ssFEZqiyyQM1ved0On5Bu0K03OnR5xYWeSsVxkhM+8U1tG9mFRlbjgXljrHPy0+ekDE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c3zIRc+NVKZhw2w6hLTvcJOeu+SZIn0XJs/p7Kyt65si/zYVwE+NzghDr+S0YWLbGDE4KOpPP9Gb0CxSICo62mZDEKyMtEssTURNqOVUY/Zd0Ax2XL9e/VL+KFq9jZWrv7Kd78kgqerBHeegiAHJ5E4n9sR8yMoJyvyXK6wkHLXeeh6BinMEG0hXv/c0Ieby2jJwJmEgLFAlkwO4VF1xLBWk6v7RrubVqbyCJaFWAhyVo0YIfhY3FmfrzcOBdK7NyTynDiIEuukb932AqL7uKAYkajNnZAgea3ZkHBO432a6h0QMHpvnFCA7IwJA2iXq2E0AbWQCJIxb7kgHy67+ZwykhdqhBbC261s9eHND1WA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7dc787bc-400f-4223-1694-08dc2d81b973 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2024 17:23:56.6990 (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: AM8P250MB0374 Subject: [FFmpeg-devel] [PATCH 8/8] avfilter/avfilter: Move frame_pool to FilterLinkInternal 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: e65tOMwuooms Avoids ugly casts when uninitializing. (One could actually avoid allocating this separately if one were willing to expose FFFramePool to those files including link_internal.h.) Signed-off-by: Andreas Rheinhardt --- libavfilter/audio.c | 22 ++++++++++++---------- libavfilter/avfilter.c | 2 +- libavfilter/avfilter.h | 5 ----- libavfilter/link_internal.h | 2 ++ libavfilter/video.c | 22 ++++++++++++---------- 5 files changed, 27 insertions(+), 26 deletions(-) diff --git a/libavfilter/audio.c b/libavfilter/audio.c index 35270c14d2..abcbaf7304 100644 --- a/libavfilter/audio.c +++ b/libavfilter/audio.c @@ -28,6 +28,7 @@ #include "avfilter.h" #include "framepool.h" #include "internal.h" +#include "link_internal.h" const AVFilterPad ff_audio_default_filterpad[1] = { { @@ -44,6 +45,7 @@ AVFrame *ff_null_get_audio_buffer(AVFilterLink *link, int nb_samples) AVFrame *ff_default_get_audio_buffer(AVFilterLink *link, int nb_samples) { AVFrame *frame = NULL; + FilterLinkInternal *const li = ff_link_internal(link); int channels = link->ch_layout.nb_channels; int align = av_cpu_max_align(); #if FF_API_OLD_CHANNEL_LAYOUT @@ -54,10 +56,10 @@ FF_DISABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS #endif - if (!link->frame_pool) { - link->frame_pool = ff_frame_pool_audio_init(av_buffer_allocz, channels, - nb_samples, link->format, align); - if (!link->frame_pool) + if (!li->frame_pool) { + li->frame_pool = ff_frame_pool_audio_init(av_buffer_allocz, channels, + nb_samples, link->format, align); + if (!li->frame_pool) return NULL; } else { int pool_channels = 0; @@ -65,7 +67,7 @@ FF_ENABLE_DEPRECATION_WARNINGS int pool_align = 0; enum AVSampleFormat pool_format = AV_SAMPLE_FMT_NONE; - if (ff_frame_pool_get_audio_config(link->frame_pool, + if (ff_frame_pool_get_audio_config(li->frame_pool, &pool_channels, &pool_nb_samples, &pool_format, &pool_align) < 0) { return NULL; @@ -74,15 +76,15 @@ FF_ENABLE_DEPRECATION_WARNINGS if (pool_channels != channels || pool_nb_samples < nb_samples || pool_format != link->format || pool_align != align) { - ff_frame_pool_uninit((FFFramePool **)&link->frame_pool); - link->frame_pool = ff_frame_pool_audio_init(av_buffer_allocz, channels, - nb_samples, link->format, align); - if (!link->frame_pool) + ff_frame_pool_uninit(&li->frame_pool); + li->frame_pool = ff_frame_pool_audio_init(av_buffer_allocz, channels, + nb_samples, link->format, align); + if (!li->frame_pool) return NULL; } } - frame = ff_frame_pool_get(link->frame_pool); + frame = ff_frame_pool_get(li->frame_pool); if (!frame) return NULL; diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 52ef5ca9a4..44185ff3e6 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -202,7 +202,7 @@ void avfilter_link_free(AVFilterLink **link) li = ff_link_internal(*link); ff_framequeue_free(&li->fifo); - ff_frame_pool_uninit((FFFramePool**)&(*link)->frame_pool); + ff_frame_pool_uninit(&li->frame_pool); av_channel_layout_uninit(&(*link)->ch_layout); av_freep(link); diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 9252713ae2..5eff35b836 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -666,11 +666,6 @@ struct AVFilterLink { */ int64_t sample_count_in, sample_count_out; - /** - * A pointer to a FFFramePool struct. - */ - void *frame_pool; - /** * True if a frame is currently wanted on the output of this filter. * Set when ff_request_frame() is called by the output, diff --git a/libavfilter/link_internal.h b/libavfilter/link_internal.h index 57efd44a45..c01c15109e 100644 --- a/libavfilter/link_internal.h +++ b/libavfilter/link_internal.h @@ -29,6 +29,8 @@ typedef struct FilterLinkInternal { AVFilterLink l; + struct FFFramePool *frame_pool; + /** * Queue of frames waiting to be filtered. */ diff --git a/libavfilter/video.c b/libavfilter/video.c index 243762c8fd..22412244ad 100644 --- a/libavfilter/video.c +++ b/libavfilter/video.c @@ -31,6 +31,7 @@ #include "avfilter.h" #include "framepool.h" #include "internal.h" +#include "link_internal.h" #include "video.h" const AVFilterPad ff_video_default_filterpad[1] = { @@ -47,6 +48,7 @@ AVFrame *ff_null_get_video_buffer(AVFilterLink *link, int w, int h) AVFrame *ff_default_get_video_buffer2(AVFilterLink *link, int w, int h, int align) { + FilterLinkInternal *const li = ff_link_internal(link); AVFrame *frame = NULL; int pool_width = 0; int pool_height = 0; @@ -68,13 +70,13 @@ AVFrame *ff_default_get_video_buffer2(AVFilterLink *link, int w, int h, int alig return frame; } - if (!link->frame_pool) { - link->frame_pool = ff_frame_pool_video_init(av_buffer_allocz, w, h, - link->format, align); - if (!link->frame_pool) + if (!li->frame_pool) { + li->frame_pool = ff_frame_pool_video_init(av_buffer_allocz, w, h, + link->format, align); + if (!li->frame_pool) return NULL; } else { - if (ff_frame_pool_get_video_config(link->frame_pool, + if (ff_frame_pool_get_video_config(li->frame_pool, &pool_width, &pool_height, &pool_format, &pool_align) < 0) { return NULL; @@ -83,15 +85,15 @@ AVFrame *ff_default_get_video_buffer2(AVFilterLink *link, int w, int h, int alig if (pool_width != w || pool_height != h || pool_format != link->format || pool_align != align) { - ff_frame_pool_uninit((FFFramePool **)&link->frame_pool); - link->frame_pool = ff_frame_pool_video_init(av_buffer_allocz, w, h, - link->format, align); - if (!link->frame_pool) + ff_frame_pool_uninit(&li->frame_pool); + li->frame_pool = ff_frame_pool_video_init(av_buffer_allocz, w, h, + link->format, align); + if (!li->frame_pool) return NULL; } } - frame = ff_frame_pool_get(link->frame_pool); + frame = ff_frame_pool_get(li->frame_pool); if (!frame) return NULL;