From patchwork Thu Sep 2 15:41:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 29962 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp401626iov; Thu, 2 Sep 2021 08:44:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6N75vSlsnKgQq2vpjGCVU1FdeTUS35HpB+E0OrA1ByfG/3dHS1Vjs3aPJzmMz+noSzbRs X-Received: by 2002:a17:906:56cc:: with SMTP id an12mr4487557ejc.456.1630597449109; Thu, 02 Sep 2021 08:44:09 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id j25si2242324eje.334.2021.09.02.08.44.08; Thu, 02 Sep 2021 08:44:09 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=Z176nHpF; 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 9F18468A701; Thu, 2 Sep 2021 18:42:09 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-oln040092064091.outbound.protection.outlook.com [40.92.64.91]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 90DEC68A630 for ; Thu, 2 Sep 2021 18:42:02 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C9r7WYPnBQLGtsCb+dsnD8u+F0cFO22PVkiYf/Sv8bDV1lwv4xvoPx4CI2HBHOfmxwjqhlAQYOh2/tp1b8f3FY+5bPEyQUXhVlVGs2RFpSzofhM5oijEcgYf9wpmcBtwJYWM3/LrNRY5+6eT8GSLjjdGQdYj2xEy23OvzgRj7OsjRWDQyXsD5Uzk1GUCWxW4Hk++n2WwkeGCIvhZaDvINRxA8RyazWt4EBdWEQ1we622dtCLd13yvb0Fba2qkg2WN9g7EEO6zlKkPEzo2SprFyjUyt8fp1pmlkB2pyy7/5nlC7txQRGVKzv9ciOdrRjbejIU/Ubo/ypgZ6B73JR2lg== 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-SenderADCheck; bh=7PuqTqEvR3BJLxeQE8sUF6obFltARgUo1BX6zWTuvd0=; b=CZX/QCOtyYa8eSficTn4AwRNLTRLOvadjeWjfiipq3bnL9KV/79/EAkry4PpGh3JgVf/78JvDn7PN+simr9yT7n6f9CoudbfvlcRRlR7GN8uVwyNqAl3jiHluNgPiKBJ3C0Y7l/vgu8eAloX7T6te2GDwPyF2zBXkkuSxpInNiq6matW1Aq6TzoaJdqh1L0qUBwh8ImX3TkbAQALUfyuRreYiH8h8UOfSBbA8MBTzfECD66xrEvXhT8ecmZPwqzUY4soKLuczPpxgYJQkAENRy2Acikf8v0Ju81C531lt1pe6fwSkNMRQWA6w2C6eo5v+o6Rq/lo8kgVHDVZduQMaA== 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=7PuqTqEvR3BJLxeQE8sUF6obFltARgUo1BX6zWTuvd0=; b=Z176nHpF5NV1oLsiolyYF2AESvQx15Xik+3heVGODrA5VRNpmESezxuiGZ/vIa+oVyymeCy1qBH2MQX/UE5tO+NyLL68ZYE/WkrE0jtpokW5B6lry0Hq/N/1u9d0H8LgUsWzTXN61qkOf92/TPcC/Xcebe8q3nIz0OYZAFSc3Ktr2YyhyIywoMhJxhXHFi8nNLbXmR9q8GH0tAYBfvQllGpmcjbeO5rpNW+XYpf6C4kfFCwk6ZcLe1+DEzllIZixJtQ8oa+l/ya6cU4hfUScVJgDy0Lwws58ju2mgfz8OT7Bir/W9p/+eDHsAw9//NJzZVZsmpfPtu3MIen0URr4xg== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM7PR03MB6532.eurprd03.prod.outlook.com (2603:10a6:20b:1c3::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.17; Thu, 2 Sep 2021 15:41:47 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f8b5:1ef2:89b2:f8c5]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f8b5:1ef2:89b2:f8c5%7]) with mapi id 15.20.4457.024; Thu, 2 Sep 2021 15:41:47 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 2 Sep 2021 17:41:20 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [nVU5g9ugy4l3XxhmWafCyH7Au8pGmg+G] X-ClientProxiedBy: PR1P264CA0031.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:19f::18) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210902154127.2571616-5-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by PR1P264CA0031.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:19f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.20 via Frontend Transport; Thu, 2 Sep 2021 15:41:46 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 705d6088-401f-4dbb-c6a3-08d96e282c62 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiRAro5Pl0DReHj5zSq9SRg2j1C5mT4H/h9cz1g+O7S9MWvsxZOgyizfIFHBE0bYbWeaQcbosyuWImDECB4yjmwcAJoys78HJJBOP0Ju3vvqz47BJFG4PcRhhTK1DBXxesfcr0RMLEPXPczQ+PTJ1XmL40AWBKUDO4FCx7zYGprGCUsB6wXFQn54esk54yHgB8Wxw9zckmjNyYIH8GiCmKkjRAXV5EmxCslilw9MNSRKSaGjOu4D8MfNE5D6hj0It8p4Jm2Vsz985Zm2whJHdXC8eXetuix2ObfHzX5sLmzkHXhwmA4ecbuMEv7GXAUCRao+COG8cbKWiyvYj3s6oomBWoXFYOmwmWFE4drHjxONFCtUwFc4rgYXDsDtzS77nqNNk1jf5E25qqNkPzgq9BHm1SJLwZt2c6mi0TB5tNWzU2tblnShFArexQknI+Mv25Ikwlo3E6r0KqNSMP6hsoObAQYnRD36vHIPQCC8l4xQoGq3wjeAm1SA86MSjmR5v59EFfbltsFSomWYGW4zAVspAvB1CfXHZSiqFHgzRDazmQWRkP0J+e7FteD5JzIB6hbj7AtsoucBFmQGc1+uI3lKoqJSqwSBtXeHqWi3wyuUhx5NhfXVPYz47WM9xG4MxflNftaD0CxDDYv6zP5MrslHUGp5UpXPfoFH/ylnz3nDsjQGpaM72pyhRog7+CfWcswetT7j7VnSYZXzAhMiAEFQ3rNk0vXQoy+vdllMdZGEZPejDw+Cspuz3dWEQUZcZjw= X-MS-TrafficTypeDiagnostic: AM7PR03MB6532: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /+FUMUJj9WPfkUU/tBXB0y/ZGYzXWCCvuJw/kg9w2swHGAPse5hVFW9kUDh45NJPtMirEkwfK43WNiLgwfPv7HiJwPRZ0ezrKnZDU6QPAz8cF+TjYjbw+a21pTkcOy73F0OKdvsRiBGRItfMB4LYwDRJS4H5yO0As87S0Z7xNjw51EtrivP8/7YouVREUZICe//xDAGDCow2gDBZSAmCEdkPYWbhtYAmrx0Pim4S9Z/fP1fukPTy5btdozMZq2qlS/mQzfHJ9KsdlHv2FHe2lobjKROicu/kCZPJ6ql69Is7sRiQqo0AWryJE9AZU9rW4VfGJehM8peh7mxLD5u/usM4+mS7I+zYhf5haIA1NRiGV+LjGOCGi/yIqICcWDoAbolX6Sot8OOsCs4FGN2QxPqeLTiUNULbxWFEpsOt9xHECyiWePCwDEiWVqzjfhqe X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +VfoGNfDwLlthQJGbwB8i9In3aUceX/dltpHSHtatG/PNdW9vO8dI+Shon6MFMwWyJKm2X+JigHkjjvFdctKEnGXtRMdRhpVF7QVNdKQsKSzloTqEGxQQJFWWBl/LBYTbLeWBUdhQ1cRA4yTNcUncw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 705d6088-401f-4dbb-c6a3-08d96e282c62 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Sep 2021 15:41:47.3985 (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: AM7PR03MB6532 Subject: [FFmpeg-devel] [PATCH 06/13] avcodec/vp9: Remove vp9_free_entries() 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: HWm9fg0dsd7p Now that the mutexes and conditions are only initialized and destroyed once, said function only had one purpose: free the entries array. Given that vp9_alloc_entries() already does this if the array is already allocated it is unnecessary to call vp9_free_entries() anywhere except when closing. And then one can just inline the one free into vp9_decode_free(). Signed-off-by: Andreas Rheinhardt --- libavcodec/vp9.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c index 8bdcb86625..c1b58d4752 100644 --- a/libavcodec/vp9.c +++ b/libavcodec/vp9.c @@ -45,14 +45,6 @@ DEFINE_OFFSET_ARRAY(VP9Context, vp9_context, pthread_init_cnt, (offsetof(VP9Context, progress_mutex)), (offsetof(VP9Context, progress_cond))); -static void vp9_free_entries(AVCodecContext *avctx) { - VP9Context *s = avctx->priv_data; - - if (avctx->active_thread_type & FF_THREAD_SLICE) { - av_freep(&s->entries); - } -} - static int vp9_alloc_entries(AVCodecContext *avctx, int n) { VP9Context *s = avctx->priv_data; int i; @@ -88,7 +80,6 @@ static void vp9_await_tile_progress(VP9Context *s, int field, int n) { pthread_mutex_unlock(&s->progress_mutex); } #else -static void vp9_free_entries(AVCodecContext *avctx) {} static int vp9_alloc_entries(AVCodecContext *avctx, int n) { return 0; } #endif @@ -794,7 +785,6 @@ static int decode_frame_header(AVCodecContext *avctx, } s->s.h.tiling.tile_cols = 1 << s->s.h.tiling.log2_tile_cols; - vp9_free_entries(avctx); s->active_tile_cols = avctx->active_thread_type == FF_THREAD_SLICE ? s->s.h.tiling.tile_cols : 1; vp9_alloc_entries(avctx, s->sb_rows); @@ -1249,8 +1239,8 @@ static av_cold int vp9_decode_free(AVCodecContext *avctx) } free_buffers(s); - vp9_free_entries(avctx); #if HAVE_THREADS + av_freep(&s->entries); ff_pthread_free(s, vp9_context_offsets); #endif av_freep(&s->td);