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+TXobK0aU351DclXXTu0gIVVPkQPY7ASGtEYomZDAf7YrFsdUKViOtPIIskf9gEAkUy7AV1QYAPs8O8JDciA0d00sjLrNs51F9Ise9lXXQycfYlgob7kF/mSZZPtE1MdMgevFNaGOIYSG5HaWjs8ndzrrE4VHVhsk90C/Kjwwu7vXXIxAsTSKC49LFen2jysh5n9S274e5ozWigZaLK/ZB75LLMagXBdWfFJLcFBGCv8hhpI/cRdQDIc3Af3xvaE8syYVLJ6FayrRxmo4eXMSt0Kv/i0LvlMz4n525g06h8+zZH/IONhH8EGdmEhkz8ju2UyrQiUR84aHYiPVh521gbJxGG5Z9GN7u+NMhM1Z+g5aA+hojURYO1eSeIq6IKH4LUPMbUQilbicAalb1se8l6DMOe3zhizCBka5bNiBo5aZXmQFFFNfRAk26WdSwbz+N+Rr8Awm1cP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//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+KRyC1BJwkOnagTrIEKQydn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U/3sSzjVhatEWCjpHsJBC9STXXAh337vqvQX9dNVLHphJ0h5vAtppLsA2QkkS+YF8BIyE+P0Fr+lkQ8Fk9xAIkOAx+MyZh4ofD+HM73ddnaniawPM2A0zFAUrSjDrcwTwhCOgjitMEJYq/pa+t0MXVHDCUDUHIO/wFQO9R8fGdAj+ploUawSIV05M5xg1ptmNY9dHjs6oWABd1S73DXlJ8UcFzqM0UBl7FuHLFuSbgsR21vI9iFaf9BWYB5dFdUf6YA++Ok88NOa5GknAItnc8OZkCWCD9/fzSwIkUv6We0dNVb4sZ68MuCI3/mcAwkuAOem2dIuLcCzc3m5hivPw7IqrOkSrjHOECKP1xibKbmmo0zVkDl6AgsI3FQk3MvOjEeKhiic9h86nMYy59WrujV8KjrxWih0IF/A+litklPGC6Pc9pShScwG1dVI9z/SFPwVZG/jIAFGBi1rxk+yl2SRoSy6YAgj3CyRfTRwxLH1gU3DJXwyWmQN2MuVUGTIFBzqO8KSqIpIwhyPuLyox5r6cjXBC+/c6d6npNh94dkzv/CvcdNVPlZNzscyJBcwfTLhBTE3nfUcMzUbIc5jSWF4REWAApDES4QEYi30PJW2y15hl8rn2hI4Fp8fKgLUYEmLew6x6byq1v0ABuFEmJHFVl1sRSi7YseKhKFLv9poXthVCGGH1JDCiOeEylP3NLteHp5Wpo9qlZxGX1CTrGpP0L0sQY02r2pAMVyrYPBI5ExQGissrY6ISxCqsxr9w+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); }