From patchwork Thu Mar 28 23:10: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: 47615 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp1667302pzb; Thu, 28 Mar 2024 16:11:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXgytBQXzwsZH41Ld7N4Jn7wm3aNKCcCHfn59/rw0C1hl65NKOf7YHDgSwLM4879pYJW5LhGfLbPzhv/1wafJarl7oVhB3OlWkayA== X-Google-Smtp-Source: AGHT+IHpqTf6Cl3aUAdlyi8jr6iobhAg0vpjY1Ch1lLKVTJjPioYOWmwqVTxkiKLNuMbIzJ0+91l X-Received: by 2002:a17:906:2adb:b0:a47:5104:c39 with SMTP id m27-20020a1709062adb00b00a4751040c39mr368414eje.0.1711667486357; Thu, 28 Mar 2024 16:11:26 -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 a13-20020a170906670d00b00a4e18901d3csi1151694ejp.754.2024.03.28.16.11.19; Thu, 28 Mar 2024 16:11:26 -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="Cg3J/seX"; 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 0878C68D748; Fri, 29 Mar 2024 01:11:17 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2063.outbound.protection.outlook.com [40.92.90.63]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CBE0968D744 for ; Fri, 29 Mar 2024 01:11:09 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hOpERbVlh3Y2Cel0dMOogX/ydhnmha6dI2sFDe3YvPMkchUdE77KoC4TvKFEZr0KcPAMYQEVrjQmufl1/yfOig3CdU0KMmKYfxy/4gAd+3VEA80APb9CmvZz9yv4kXlhTUe1dcItEyNlQHe/zVPGJtr5472c4Tx1deiofW3++a35/F1JTG3v0m54DxtyosT8ta12+ZEVcySo30e/4FgEWtw0GBhIzbRacblTRhdPUSLtsu/z4oX643pX9Tu0APH+8XKE6NaL/uY3kTPugwAszo/CUu0qyfSWvhwDwPX4PRNuBvoxWVBunCcKR1f6K32cAGghucTjadwdxnp3QcFHhg== 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=PFDhxU6qq1c8SUa+ypUqI1HZpBDaQRYEruQriIzlhjo=; b=GZvVqTtLgoxnv5ewAFfoxbW+9A0zWXgCa32GCuEeVspJLKghBhB0bEkkJxB9enZzS/AkFLbieuacxfDxBtqv9vY1DaF8Y5zWhzGgH3WNx+QNWTTGR5kA7A0rrxgkPY2PsZcOp4mX/1E+WToeYSlhs2fGI+npi6+TSJBJGGRR5TCqdSbk1YzuP+NGucNlGHnlQe29YWb/3JVAV/uNUhne/FlxbPIKPSWukjqRBYyEpKUZRtHWMzB2nanbVfxf7dC1Z8/vY+HzKYD4u6mkwSi8mtu4FEDai12VT+pRBN/nH7TSgIzahDjtp5VhNba8Bm1qe07ag7uqkPUsEyM2HomVhA== 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=PFDhxU6qq1c8SUa+ypUqI1HZpBDaQRYEruQriIzlhjo=; b=Cg3J/seXOz99q4mtvd1lHtfvj4ij/z/ZH3OeO0/D1MX1L9wBJbUkeq9tDT3jrtMFnAq/aLETHgwJO3ytIShM57tdNR3xuVdZ5i01mVfOO904EnarFwU5Nvup9xD/USAV9prtIiiEUQN3tkDeDUKzYM9G9DXGdFs/Sc9ZGYJUpv6sI6IIfCXr+xw2hEE0K23cis62qxgLmja924vn4r31KC6CyRN0JFxi3Qc99oeENSjdAG34srK6yDnVu+LsAjCsUjcrPjyjyc6HWBtiI5E0duoIrZNgInlI4DwBTZ0IOd76Q1D+UfvpB7C5vjxrX7KXdoDX5JqlMF+kPbeSH+Ny6w== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by AS1P250MB0553.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:4af::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Thu, 28 Mar 2024 23:11:08 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::1f29:8206:b8c3:45bb]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::1f29:8206:b8c3:45bb%3]) with mapi id 15.20.7409.039; Thu, 28 Mar 2024 23:11:08 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 29 Mar 2024 00:10:32 +0100 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [TfFKSLz7NQBQnNaMYqFc4j2Kz3mL9RMmSTlYI1gg+hg=] X-ClientProxiedBy: ZR0P278CA0093.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:23::8) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240328231047.2202386-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|AS1P250MB0553:EE_ X-MS-Office365-Filtering-Correlation-Id: 6adbe1be-131a-4ae7-5f35-08dc4f7c59d3 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Bzut+wRgjjwZr1EvZH84bkOMKCZ+/icOA1lqh0tnK61hISZ+xCTmsbj90SdGRlJgM4p2BYarZeXEnjZk48cqJEQTqDHQ7zQb8U8hqwwJumnrpqgmR/7KpdMton95tPM66TE1knMNoJ2WaUZ5QWuqdfiGiYO+38XUo0f5s8C56qBUuDhnVPmw/nIl2bf/hDonUfCF2wPVn4er8pnMqUrfyc/Rx5OJc/YGJF9y+ShD61hvC6ezdyDS1DstilNdZjif31FMXwO8osjszzZ53ct3kH5FuQMjFvCXN9/4BPL4SwzKCefC6JQr65oqVQQHdCk5VqYs44hGD+tplDAe6kYZj5QOGzwvNLQ657TXrnsDw5nZ2Xg3yGREQbieev25c/fjL00rkBEFWOjlSEKskPPU+YnIrzzq8M2XvRlmeSy/NOa0m1b9ICom41HVXckcpT9y15Z/+eHxZN+1uVg2guNA0iLEMDIbsbjpp8q5SrX57JvNS2NNf6h7TmBTWFcrbxoTSM4ETiZ8T4Dstd9hUffon9ux0B1SMMzMdCLWfPqWUuCWMUZS/4HQA+jsf4VcxhRTrjRCkbry8QmoRLa9rMoONooclITg2QcJywMhw9mGIpP67JRxxCx3fPXS1ved1/qB X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 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IxjCg/VVDb++2tB7rAcZYfmG+mXQIUWTkwSz/EK9tWf4WIIR0jalZsvYQNCNQtHv/paOiWZV3AotR4E+9LiPOSIOTebNsPmgNUnKl3H/SFr4C5W4R12s+9q1i+yAVyVDLVniqUtKMxlCWd4/gel/cBqqPyNDDFZ6ccttudWJ58HwIH7ET/o0ezuvJzPEdSNlcHoMW72gc2OUdelJpkPW8+5b4oti8CT+SL7p/h0vV0XC9iww72XAbw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6adbe1be-131a-4ae7-5f35-08dc4f7c59d3 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2024 23:11:08.3072 (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: AS1P250MB0553 Subject: [FFmpeg-devel] [PATCH 03/18] swscale/ppc/swscale_altivec: Fix build with -O0 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: 2sxgrccd3iuf In this case GCC does not treat a const variable initialized to the compile-time constant "3" as a compile-time constant and errors out because the argument is not a literal value. Signed-off-by: Andreas Rheinhardt --- A similar issue exists in libswscale/ppc/swscale_vsx.c, but fixing this would be more involved (making templates out of always-inline functions...). libswscale/ppc/swscale_altivec.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libswscale/ppc/swscale_altivec.c b/libswscale/ppc/swscale_altivec.c index 1630355f51..8e35e0372f 100644 --- a/libswscale/ppc/swscale_altivec.c +++ b/libswscale/ppc/swscale_altivec.c @@ -107,6 +107,8 @@ #endif /* HAVE_BIGENDIAN */ +#define SHIFT 3 + #define output_pixel(pos, val, bias, signedness) \ if (big_endian) { \ AV_WB16(pos, bias + av_clip_ ## signedness ## 16(val >> shift)); \ @@ -149,12 +151,11 @@ yuv2plane1_float_bswap_u(const int32_t *src, uint32_t *dest, int dstW, int start static void yuv2plane1_float_altivec(const int32_t *src, float *dest, int dstW) { const int dst_u = -(uintptr_t)dest & 3; - const int shift = 3; - const int add = (1 << (shift - 1)); + const int add = (1 << (SHIFT - 1)); const int clip = (1 << 16) - 1; const float fmult = 1.0f / 65535.0f; const vec_u32 vadd = (vec_u32) {add, add, add, add}; - const vec_u32 vshift = (vec_u32) vec_splat_u32(shift); + const vec_u32 vshift = (vec_u32) vec_splat_u32(SHIFT); const vec_u32 vlargest = (vec_u32) {clip, clip, clip, clip}; const vec_f vmul = (vec_f) {fmult, fmult, fmult, fmult}; const vec_f vzero = (vec_f) {0, 0, 0, 0}; @@ -182,12 +183,11 @@ static void yuv2plane1_float_altivec(const int32_t *src, float *dest, int dstW) static void yuv2plane1_float_bswap_altivec(const int32_t *src, uint32_t *dest, int dstW) { const int dst_u = -(uintptr_t)dest & 3; - const int shift = 3; - const int add = (1 << (shift - 1)); + const int add = (1 << (SHIFT - 1)); const int clip = (1 << 16) - 1; const float fmult = 1.0f / 65535.0f; const vec_u32 vadd = (vec_u32) {add, add, add, add}; - const vec_u32 vshift = (vec_u32) vec_splat_u32(shift); + const vec_u32 vshift = (vec_u32) vec_splat_u32(SHIFT); const vec_u32 vlargest = (vec_u32) {clip, clip, clip, clip}; const vec_f vmul = (vec_f) {fmult, fmult, fmult, fmult}; const vec_f vzero = (vec_f) {0, 0, 0, 0};