From patchwork Mon Mar 25 01:53: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: 47414 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c889:b0:1a3:b6bb:3029 with SMTP id hb9csp930663pzb; Sun, 24 Mar 2024 18:54:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVX7H0HnJgfyZxB+bCLN/nuiglZqfG4TjiUX8YAsQsqyRtdJap+A/Ds3roFg64RYGQF3/H2Iysnqktlod3rTLFOCcI43V9Ne2Z4ag== X-Google-Smtp-Source: AGHT+IH9dyPIuMQEhRBGFRZ8wa3sbzU16GLfRgXqb6vbRo/GJHYZQokeA+hR4c52rezADO74T5k7 X-Received: by 2002:a50:9b0b:0:b0:56b:b03b:2a85 with SMTP id o11-20020a509b0b000000b0056bb03b2a85mr3384265edi.0.1711331667254; Sun, 24 Mar 2024 18:54:27 -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 z22-20020a50cd16000000b005656776bf67si1975384edi.655.2024.03.24.18.54.26; Sun, 24 Mar 2024 18:54:27 -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=myKFW5ph; 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 0DC8E68D26F; Mon, 25 Mar 2024 03:53:58 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04olkn2109.outbound.protection.outlook.com [40.92.75.109]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 85F6C68D428 for ; Mon, 25 Mar 2024 03:53:54 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MP81jCAt6uie2eyjtbIBnD1pTI8L6bU7tPG+1MZCqkq3VErkldHoHCTGdctbUH+JW2yUaBgwlypraolGuBVqH2WlOzmLtG+OutU6TjucoD4W2KJ6lGQdSvr+qfAxM2bpyaw4JrC4jt+VcPwuV4d13cR4rZ7akLjTtbBN+Drfst4E6o/KsWt+QcULNj1qApkgId1+v4c9NxnPvIizWg0P2Ne1ORvsw3cVxCByJ1etHD0VCfWtXzym/2geMcMheaF9dYvq/mGO9pfMB7OhUJpnK7CsLWmNX9DGJu/9/JBmYqrQ+Cwppo/5Zrl8tRQGBL44tkrqUp48fa/7zG9ogxH+vQ== 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=35M9ERVh5XW5euR6ETnAW+yeEPCoBdKn5hAe5OudypQ=; b=JmKFS9ZXYr8ypiIfEOdzIsSYkg6OtgXT5t3EJ8xgRvgo020qIxRnF5wuNTRx9aWsgFoayPdp5WJ/tgGpVIEmLQBvcBzs0BgX3aCqn4n0hXh5bhKMKWY+XuDpM79QfFQYPBW94BIUs4d7/q/HHVILRM32mFiphr+Jfx3lUreB2uEDtn0peF3o3WoHKK4VKjXzNlUbOhhWdPLMiT+n6JHX8NNRiSlmhws1GJ3sjuvH2lVYWDMvYdhrgpH8L/0oiFtGo6EFr2r20/ANbTGKWuJJfozNqw9CS2+Bw/nNISUdm0EakXeondp6jTpza3OvTBuRKRADeKrkew2O9yAUJu6dgQ== 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=35M9ERVh5XW5euR6ETnAW+yeEPCoBdKn5hAe5OudypQ=; b=myKFW5phEQnUSN4IH8v52Vnoh5neNN46u/UOeN0B7tXPvrdOgLJdxGljxExR0hrKb/XeX7dtRQRt8apjAvtrWbSS+XKCnUz3B4l6iV+Wg+JbTgVbziCMi/ly8Fnz2DSv3GSz3mOwIF6cwzFXbRMVEa2ldu1kcg8GzEJibw8JeuDnoXz67SKVkD7gxslSyhqqapqTXfEqfgUlluMf6Vdo3/ITK8IcJn4Byria1zoN+osDGA6zwghjpbQh2FlzjhyH1qQTpdh3l+AS3h9iJo5Q9T7CaDxWQZYmELGKVrY/Gdi7sormJ3OY9l04A3ZPMv3ZPjK0F/R/TEQfwUICplb0Lw== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AS8P250MB0118.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:371::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Mon, 25 Mar 2024 01:53:43 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::4a3b:cf76:cddc:c68d]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::4a3b:cf76:cddc:c68d%4]) with mapi id 15.20.7409.028; Mon, 25 Mar 2024 01:53:43 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 25 Mar 2024 02:53:23 +0100 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [a08yfySYNZe7gopJ8R0ELjeAz01IA6OAoTSOIbspYtQ=] X-ClientProxiedBy: FR3P281CA0202.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a5::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240325015324.2348789-8-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|AS8P250MB0118:EE_ X-MS-Office365-Filtering-Correlation-Id: d92af4a7-a1c0-4826-18e3-08dc4c6e66a2 X-MS-Exchange-SLBlob-MailProps: 9IecXKUgicBMjzDtAlr46x5HKEJiZ0RbegPkSnuf+Ow2eQUO/HKt3as2IvcDY0Um46VTWAVF15rIs9nmI3y1VmJd2NNXerwURQkTQFbmqzEqQKgRBZdBBt4NnBEzgiGFxvh5CVe0vB+X3IquP3nvngTKqmMOg8OwqP8r39nDok/faq1FSqJsY16te1pUdcnK5yzpo+D7+5ZkTF0Ys9YComaM6epi+UxQUqzcKGgLLlNlYy+17bXn2mzBQyBq17dtU+CYE1kx8GPyA1YbD22t4nSHEevXdR7p2z+UigFDZmozPk2JeeZ6VA+GeeWHGo89CRagK9TMiEdeXhwLLPatTnaeOkyRwvyaItoYrnqw6jsc7ha16Jqv/OcfEkatblsAf/01eenTZM6jgK7Zpw2h1LtP6TNZa7afqy/oH0y7n87hHnrGCh92sq0W5sdhpwBb3esxK0vHjawy4BRB1OW+8JOSCJAbCJfw4G/jUthFhS7C+nz93BeucxK32bgBF9RRqAyHf2aUbkHVeIBIOOsXeTcetTrS5NgQ+B8PAp9NP4asZpGXNKjaibE2l9T4DS5fFyXbZyqQxh2fr/ozTy0vKC7QtrcWi/Ush0raBtF9ev62GWbtIWcS585cltbGYXm98fSS8z8j7ajqqLlwxVLXM7jqk33l+6LAsAxwygB+ryYIS2Nna10rrNi+KvoRpB0g3MV5MAjDN1ZSNldDjyrqibEvSRVRKegCjnAGp13Vc//BFjNwQPJU/w== X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 68rH36ERb8+DqNOU5JUAiV/ZvarcKNWYzCEM28Qy17w1djGbRSTCTJ0k0XNk7+IjjMfozldfw8EiO06qXlXleBODwbm9JCX4tilK2tkrQO27YwmK7xhkWofo7rnzP3kYkArjP4puwEaa1j8UARSQPbmrNy2ZrUn5eGEvfZme/BYppl39NRM5kxCKNSqDp+2Bohiylr3/u/jx5/487UEE93o5S6Gt5IYMnYURnqxbozImvTAEmKw5Tn2dpbsEfAO/k25GRR4SR173WKeVxcopGYic/jSzm4DaPVxId9jPyWkjkkAQ2KrkvaK855k+o16ylE9AqXE/yStGfnDr9jTmfmrJ7xqqRcbGvL5FF6EZgqqr2DrXCu4vVy25LrYyLCh2eNQPAHQLGb4Y5F/ao4fdiFHzrn7eqgqECUkfjIvOtMZi+xUNPNsZoUKy1dgIzYVZ3M86kT6lThKyLimccPzinUGiPpTyxmUPWqBNOS+72T6T0ZbxsG50e9mW/sGdtdxPMEC/mVD+ocunzsSr/docko/AHQMZVCwus9vUAdJMYzswoBQuZG4rPO5fbfZcOQ6+K618BcuLaNoB0YnypEFEsosfm9az4r53578JKw1ErZlsRBtIY1b6N22/GkIxHWqv X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ceTKR7IKqsg9iOEgbB2zcY7ghOIRe5gd5cgk9PmPHk9gmc1vGDRM2A+Yxk7SZutAMyaLANzKqWt4lVOQHyjJ2NOFrprDA6pKoPyLKx1oje8GsAehCwIN4p9jsqRqMGYEFW61maZAfmkSWtIlniV2d/K07Q8Ch6AIN65Y3vVd9/DUKwTY4xHBJAAGmd/kSpCKbB8OMQfSe29g2QNSdh+wCWap3aSVbvRTnOwKgZV3UyprMzfkOcSef/dNgxJ8mKnT52hbM5XG2t3YF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enant-Network-Message-Id: d92af4a7-a1c0-4826-18e3-08dc4c6e66a2 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2024 01:53:43.3068 (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: AS8P250MB0118 Subject: [FFmpeg-devel] [PATCH 09/10] avcodec/magicyuvenc: Don't call functions twice due to macro 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: gErQyzIYWm+x Signed-off-by: Andreas Rheinhardt --- libavcodec/magicyuvenc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libavcodec/magicyuvenc.c b/libavcodec/magicyuvenc.c index 3ae1ee2c71..93eabb9f9a 100644 --- a/libavcodec/magicyuvenc.c +++ b/libavcodec/magicyuvenc.c @@ -211,10 +211,13 @@ static av_cold int magy_encode_init(AVCodecContext *avctx) return AVERROR(ENOMEM); if (s->correlate) { - s->decorrelate_buf[0] = av_calloc(2U * (s->nb_slices * s->slice_height), FFALIGN(avctx->width, av_cpu_max_align())); + size_t max_align = av_cpu_max_align(); + size_t aligned_width = FFALIGN(avctx->width, max_align); + s->decorrelate_buf[0] = av_calloc(2U * (s->nb_slices * s->slice_height), + aligned_width); if (!s->decorrelate_buf[0]) return AVERROR(ENOMEM); - s->decorrelate_buf[1] = s->decorrelate_buf[0] + (s->nb_slices * s->slice_height) * FFALIGN(avctx->width, av_cpu_max_align()); + s->decorrelate_buf[1] = s->decorrelate_buf[0] + (s->nb_slices * s->slice_height) * aligned_width; } s->bitslice_size = avctx->width * s->slice_height + 2; @@ -493,7 +496,8 @@ static int encode_slice(AVCodecContext *avctx, void *tdata, static int predict_slice(AVCodecContext *avctx, void *tdata, int n, int threadnr) { - const int aligned_width = FFALIGN(avctx->width, av_cpu_max_align()); + size_t max_align = av_cpu_max_align(); + const int aligned_width = FFALIGN(avctx->width, max_align); MagicYUVContext *s = avctx->priv_data; const int slice_height = s->slice_height; const int last_height = FFMIN(slice_height, avctx->height - n * slice_height);