From patchwork Sat May 11 20:51:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48780 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp299897pzb; Sat, 11 May 2024 14:00:22 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXHE+rtwRUmXb6QQCkIoux2pVWW2Sh0Uud5mPgMIptSntiPbKOnQCIsHgPKIfViP2kfV64UnfEFvc6zLEcdZO6QwfSB8qGYD03BFg== X-Google-Smtp-Source: AGHT+IE3mGxjMREepAvSNpG6E1RPbmomgdxjg+aToyFxkmqWjHv91QTAxFV0l6SAH1Euc9I/alZJ X-Received: by 2002:a50:bb0f:0:b0:56f:e7b9:e67d with SMTP id 4fb4d7f45d1cf-5734d5cec3bmr6814944a12.12.1715461222698; Sat, 11 May 2024 14:00:22 -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 4fb4d7f45d1cf-5733beace29si3550459a12.3.2024.05.11.14.00.22; Sat, 11 May 2024 14:00:22 -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=pGksQq7A; 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 67ED168D7E1; Sat, 11 May 2024 23:55:37 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2068.outbound.protection.outlook.com [40.92.90.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3081F68D7AA for ; Sat, 11 May 2024 23:55:34 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=chEYMLAy/51gAEgcPERfuATfIq9cPYUeaNJ5TJbLh+Iy+Wh9iSStHO9L7Ef8h6GrdFZPVwNcm12WuiFG3HPHDzTA0QBKygyY/ZZlO8M+VMEYwxdVm0CA6A0CvRf/0Lis1h0LI4x4b6Om5W2EPRrzUAVOWucJIABnxCESiq/YdJEHHbVJRv1blW+kQG4wAMYpWJdi7nbz1viwsk2RpIiQwIN30l8nPlkBu2PcAi+9qHymKx1Y20wjDvmg3DG3GI7ZSGsoQ4NmiOZVAXnREZTRzYTn257o8zagjWsQsHkDisjAOS+/hCfeXLdPpA5jlumk82oI0e7mkhNJ9OJOSfGViw== 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=MHB07eaZIi+0k1OtXWhkmhhqOj82XjYOu2tIdWMU38U=; b=kK7ljWi7pMA4W6+A+Di3ZDOGJVnBVPmXv68lr9u/6/Pz0mL9f85zykAVcMPQVjQcdjUIYbt+QeePZoNIPbOkJPlWBsznW1KkLbd3g/i8Ur/S21tGk2d1a3e4ePR2RQegM2qRNm3sUzQ9HdWBCHEirvtKHIv5TCmzinLlxuD2e1MZAdcGK/45ANXAR+S306oNiMUT5FMzgpK+f/YIqJjuSlJTPLBaVIobJ5elNAA4KIAkxDhJAoVHH5LEQR1My4/cVWzAf3YmyW4CukC4V0VJKPgwLyFSFSbH9lEHRZ9DLEnPVAAZnYJ3RdJy6KFC9bWynsT3bH3YQkQn5Cd4Mnjb4A== 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=MHB07eaZIi+0k1OtXWhkmhhqOj82XjYOu2tIdWMU38U=; b=pGksQq7AVR7dGDQl40x57MOmVAYSfj54cVEL5PZP1HI7B2GPp5rDXPL6Hc3sn3ZXNHxJHaCYUqwdjkArCWinWOmj5/WvLofMlRjkqU0EWRxV20tQ2VnCkmd6J10gTG6vqd9ZHc6KuOC6wD6KGGVw+dJFtzFl3/LZLaHR87r/7e/0LdFZESxsH2xMLeHInbQnosipVxK9zQpnd+5fIVQ4fkHDUZkDg9R3xQW7xgjV0SLURZBhdnxU/XaSI4FCiavIW9BfCe15Rt2LpxSbOJTNGTUdoYvM+CDiA5yCQKJVM05cPwItOLEGSZdIndxJG4/KKEKieXX0+xNuitKITAvEOA== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AS8P250MB0070.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:37d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:55:33 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:55:33 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:23 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [xlYKxCW4KEbG6vTrdyuxGupDXPn/tCEzp5VcqCp4gtI=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-58-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|AS8P250MB0070:EE_ X-MS-Office365-Filtering-Correlation-Id: ce9ad96a-9ccb-46ff-3b60-08dc71fcb343 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: c5jsnpGGb0Su9vXT996HcxCPkdFYE/HgjE7PM95slrZg4gn4piVrK9bDkpxMyLVcr/mgFnPzxG5Xx1IYcZMRB46NeysmOSqKAoRXOEn2GV3jIY7zm4FfGW4JCaDZhp4cQiLvGf5FC8rWAxK4exznGMdsNK5FbUwaIUH5gmM7sKU98OtLDTcyZnuWcT+PMp52TwoSdMb2wPBIGD0mgdF2rEU4/fSt6ks1dQyN/xKXIj1uLdwZ65I7h7VROpSG6JaHocHFZo+JWi0Svomxsk5p1FqD9kKPK6340vgOPiWvo4TPFD6LpAX9aXdZzv1+PLNIoRhfunEvklp2AGLg8MGAcD4odYtD4G1omj28c+i0yWSM4ZL6hz/gN6t+5qzSilwKmpAicPv+DiUS26z2lEWkXjmFADIKXWTAUFoc7RxmZvRd/ARUuPHWcsbi+UKoHBA28EJ/xBF1PSLw8OO4wvNBENdUy5WRIlYQf3qEsl4bMleOK6LubCx5l9xOXAfJJS090wuv4RM8V6pBMlxyWzM2DZ330o/yoxacuaKachsE77Y45UpNp5Jq3F0WDahsd7rLQn+SpxcTXcymii5NQyE3TuF7rRqQneX2XPd67SofoflKCN/wylW3rs7AeyRIMNDT X-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Fbguut7CehhmeLh5/SzSO8TjlGsUQ/MCrh4s7PN/JuKwi1Q9PzuK7wprrrr5jqKH/PXKsUYRs+3WCooyF11fnebFBSryFx7JZ4V7nQh7DBtuFGL+L0BTkhMZqK4ISswkU1B3SCAxtoZl44e7iXIhGQVNNFKTumPQPRojUfQUww+2u5+1irKumqANdu0rrr1njJBhpYCpwmBQ8+ZCnyv188hAvL/UUq9E+Dd7n/CnvnwPxEvbC79O5HTwP93dW2zkHOYKym6451v6sCcJmSLG8j8C5VpA08J0RrCjC5kg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce9ad96a-9ccb-46ff-3b60-08dc71fcb343 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:55:33.5879 (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: AS8P250MB0070 Subject: [FFmpeg-devel] [PATCH v2 59/71] avcodec/mpegpicture: Use union for b_scratchpad and rd_scratchpad 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: SccWyEMpCftc These pointers point to the same buffers, so one can just use a union for them and avoid synchronising one of them. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegpicture.c | 1 - libavcodec/mpegpicture.h | 6 ++++-- libavcodec/mpegvideo.c | 1 - 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c index 9308fce97c..43d35934c8 100644 --- a/libavcodec/mpegpicture.c +++ b/libavcodec/mpegpicture.c @@ -175,7 +175,6 @@ int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me, sc->linesize = linesizeabs; me->temp = me->scratchpad; - sc->rd_scratchpad = me->scratchpad; sc->b_scratchpad = me->scratchpad; sc->obmc_scratchpad = me->scratchpad + 16; diff --git a/libavcodec/mpegpicture.h b/libavcodec/mpegpicture.h index f9633e11db..ddb3ac5a2b 100644 --- a/libavcodec/mpegpicture.h +++ b/libavcodec/mpegpicture.h @@ -33,9 +33,11 @@ typedef struct ScratchpadContext { uint8_t *edge_emu_buffer; ///< temporary buffer for if MVs point to out-of-frame data - uint8_t *rd_scratchpad; ///< scratchpad for rate distortion mb decision uint8_t *obmc_scratchpad; - uint8_t *b_scratchpad; ///< scratchpad used for writing into write only buffers + union { + uint8_t *b_scratchpad; ///< scratchpad used for writing into write only buffers + uint8_t *rd_scratchpad; ///< scratchpad for rate distortion mb decision + }; int linesize; ///< linesize that the buffers in this context have been allocated for } ScratchpadContext; diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 42b4d7f395..36947c6e31 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -440,7 +440,6 @@ static void free_duplicate_context(MpegEncContext *s) av_freep(&s->sc.edge_emu_buffer); av_freep(&s->me.scratchpad); s->me.temp = - s->sc.rd_scratchpad = s->sc.b_scratchpad = s->sc.obmc_scratchpad = NULL; s->sc.linesize = 0;