From patchwork Mon Oct 3 22:44:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38543 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp1575189pzh; Mon, 3 Oct 2022 15:45:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6k94nkfh7rkmKS0ON32GSbXy73QksbPnmJpPXVw5wI21NkoKp+NftbOAKZ5xFN0pKtcdk4 X-Received: by 2002:a17:907:6d8c:b0:781:e30f:3218 with SMTP id sb12-20020a1709076d8c00b00781e30f3218mr16948569ejc.430.1664837118595; Mon, 03 Oct 2022 15:45:18 -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 hz5-20020a1709072ce500b007707e4ce2ebsi8476562ejc.234.2022.10.03.15.45.17; Mon, 03 Oct 2022 15:45:18 -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=tsYAEp95; 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 0268368BBFC; Tue, 4 Oct 2022 01:45:15 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03olkn2035.outbound.protection.outlook.com [40.92.58.35]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 08D3168BA58 for ; Tue, 4 Oct 2022 01:45:08 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DCqleG6JfiTDOPdfnjuI4Dd+pp88ONrfzm6s0gYnN724yuX5M+E9OoNTh0T/+u3IrAsbFZhxu66tR8cJK3TXcqpNpS7wgdD0WdAiVLZmNZkJYQNpZSI72wc1hIdTct/lVx1vz2SH1CdtKQniOPSAymLhTbsDkeQskckdmNxiIJuBetiDCF78EsAW7xSpVioaVXqO/mfXD3ltHFkPJ5sN7l1uAlRxl+3fmhgZXCdehIRuDX1atFtE1UOLXzHlzz90dHIBa3qvKK90WGDU0ajnaw92Ws2iEOeYX447ENQBYy+B+JVAWMI83ZuIz3pxMTl1zD/B9uqUe+BsXtgh5yXvmw== 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=9A9RwuwZ80Ko9woyHet6AHx7T88PvO3F4ve7oN63tBs=; b=nqytXu/0X2Kavlx9kJoHh1PKLzcPjjbRj0HMF1WM7Z2px58FRhkQYcVLdcEaoIQmhTQYmYgEirZH0tDsO1UHPkCwz1mk0LXLa2bfyHtzXeSIHyBJ/iGPUwHXkoqeACFauv8Fqz7zHY/ZAhW+mfjQssgbpcVhfC0nRZ6bFRBFi4hOE7z5dKlL3RP36ebogLrmeosg+xQbSiq7nZYxmZ4lVD/8tnbuBC5uXYwu/1filcLZgB+9g6UoT2C9f5akfVoWgTXuIAKcNBZoXb8pQss7k1pIjQglXD+D2f4UhxEvn9EowXca0FqZdbqGKpPqvbj+s+HLPA5yt47kTQaGNVjmCw== 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=9A9RwuwZ80Ko9woyHet6AHx7T88PvO3F4ve7oN63tBs=; b=tsYAEp95FNhA2hWvd+bk4FfZ0GeVA9opv4pGdX/a1FUYEEj6JFaw0by5Zn0/ZI+6sxy0b4wzQHUaB0hkoTXhkMgWGBgb71g964eKdXCug5g4prVKSHNed5fj/IWP052WsecCzVZcMo3WCebf/QqN41/kr6uEsdu4xnopEHa0+oBKDKJncdvBTZ94T5lX6oLUR/5R4RpaHBh7Bqfix+DkSCp4N+iupZXEP7jFCdK/GqVHA3ujNzDIajnEmcyM2CCCIukjWvKgqFkA6UDMTqFQuC3Srp/IGU3GH1P+GThxRODaqQtZvxhFItPDclL3LsYMW8yIA1Bu0t3G7o765sJR3Q== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by PAXP250MB0470.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:283::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.23; Mon, 3 Oct 2022 22:45:06 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::68bd:2fc7:ac52:38f8]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::68bd:2fc7:ac52:38f8%9]) with mapi id 15.20.5676.023; Mon, 3 Oct 2022 22:45:06 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 4 Oct 2022 00:44:58 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [M5jTOKFPv5ntK6fWk3UXgVnn77WMWdDSy5fj70Bceno=] X-ClientProxiedBy: ZR0P278CA0056.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:21::7) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20221003224505.1846824-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|PAXP250MB0470:EE_ X-MS-Office365-Filtering-Correlation-Id: 979a25eb-d2a5-420d-c858-08daa590eae0 X-MS-Exchange-SLBlob-MailProps: AZnQBsB9Xmpi4YQjBH3ret4WDK5HTi62G71uWh/5pIGGyqd23vwRX7DFK2X7OpieJ9xWYXdzhLbVNj/UCxv6MksEfa1dy+OEPwxJmWHQMAVfi2E0QvD3gDdc5KInKZNvdkRz0fU7mPUP5a+O0wPlSst/xxKCeCYigzXZhpU+yWX3YFghsJcuXYgcKVxyusts893vKup2vV801yR26Nkv+Lm8daNa45TWDQT4MzoaRP1dotL86xRGxRpkwzO3/CpJkoamii3BrYjZZsM0OVz2qVlU2VP76i4YTnp1UmcCVzBKHiI041aJ2fKoZrFMdfDh8XLQBlmsbeFTEIevs2aAAWhtJ+miTAlYF/LvVn4UpJb+h3zmwTiZO18zYB4VDj5lkENlJ74Nrh9aSbELbP2DLhi84kCGMq7VnSYtGKj9FLkVbW36q8ghpJFvnM2cKHRUtgiBkSDec9YLqTF0yUJHiwXPgn0Led9NLNiQrx8+pVjJXyFGaDKANbMYFHcFL9OpKvVA47/c24N9jf4PBz/ZQbGcjJBtpnb/2Q/W9arlszBJT4fA9doWihxLOD6jiJjA0RtQw5F/CKkXpd1hW4qJd7L3u0XAE1mu4078HhzQC3tm/WnX8iiZz4GYTn3qEPyGLCR8ttObDYfc5aYLG93mCqJhTaT1mOPRkh7Ih4qiiSLHZCGgzP/7HukuAdoxaAClbLqCz7dwOMtW9suDi4Y4ANL23eNbqNNpTenV+lYoxU++8DZDf+qdsPy5UMK4Tim89kaDkjLSL+o= X-Microsoft-Antispam: BCL:0; X-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b-d2a5-420d-c858-08daa590eae0 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2022 22:45:06.2850 (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: PAXP250MB0470 Subject: [FFmpeg-devel] [PATCH 2/9] avcodec/opustab: Avoid indirection to access ff_celt_window 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: xkUo5DHbL9YT Currently, it is accessed via a pointer (ff_celt_window) exported from opustab.h which points inside a static array (ff_celt_window_padded) in opustab.h. Instead export ff_celt_window_padded directly and make opustab.h a static const pointer pointing inside ff_celt_window_padded. Also mark all the declarations in opustab.h as hidden, so that the compiler knows that ff_celt_window has a fixed offset from the code even when compiling position-independent code. Signed-off-by: Andreas Rheinhardt --- libavcodec/opusenc.c | 4 ++-- libavcodec/opustab.c | 4 +--- libavcodec/opustab.h | 8 +++++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/libavcodec/opusenc.c b/libavcodec/opusenc.c index 58e3f5fa38..06f71876eb 100644 --- a/libavcodec/opusenc.c +++ b/libavcodec/opusenc.c @@ -203,7 +203,7 @@ static void celt_frame_mdct(OpusEncContext *s, CeltFrame *f) float *src2 = &b->samples[CELT_OVERLAP*t]; s->dsp->vector_fmul(win, src1, ff_celt_window, 128); s->dsp->vector_fmul_reverse(&win[CELT_OVERLAP], src2, - ff_celt_window - 8, 128); + ff_celt_window_padded, 128); src1 = src2; s->tx_fn[0](s->tx[0], b->coeffs + t, win, sizeof(float)*f->blocks); } @@ -224,7 +224,7 @@ static void celt_frame_mdct(OpusEncContext *s, CeltFrame *f) /* Samples, windowed */ s->dsp->vector_fmul_reverse(temp, b->samples + rwin, - ff_celt_window - 8, 128); + ff_celt_window_padded, 128); memcpy(win + lap_dst + blk_len, temp, CELT_OVERLAP*sizeof(float)); s->tx_fn[f->size](s->tx[f->size], b->coeffs, win, sizeof(float)); diff --git a/libavcodec/opustab.c b/libavcodec/opustab.c index b23ca4feac..2a57511177 100644 --- a/libavcodec/opustab.c +++ b/libavcodec/opustab.c @@ -1101,7 +1101,7 @@ const float ff_celt_postfilter_taps[3][3] = { { 0.7998046875f, 0.1000976562f, 0.0 } }; -DECLARE_ALIGNED(32, static const float, ff_celt_window_padded)[136] = { +DECLARE_ALIGNED(32, const float, ff_celt_window_padded)[136] = { 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f, 6.7286966e-05f, 0.00060551348f, 0.0016815970f, 0.0032947962f, 0.0054439943f, @@ -1132,8 +1132,6 @@ DECLARE_ALIGNED(32, static const float, ff_celt_window_padded)[136] = { 1.00000000f, 1.00000000f, 1.00000000f, }; -const float *const ff_celt_window = &ff_celt_window_padded[8]; - /* square of the window, used for the postfilter */ const float ff_celt_window2[120] = { 4.5275357e-09f, 3.66647e-07f, 2.82777e-06f, 1.08557e-05f, 2.96371e-05f, 6.60594e-05f, diff --git a/libavcodec/opustab.h b/libavcodec/opustab.h index 16011db758..9c9f1b9d98 100644 --- a/libavcodec/opustab.h +++ b/libavcodec/opustab.h @@ -25,6 +25,9 @@ #include +#include "libavutil/attributes_internal.h" + +FF_VISIBILITY_PUSH_HIDDEN extern const uint8_t ff_celt_band_end[]; extern const uint8_t ff_opus_default_coupled_streams[]; @@ -154,8 +157,11 @@ extern const uint16_t ff_celt_qn_exp2[]; extern const float ff_celt_postfilter_taps[3][3]; extern const float ff_celt_window2[120]; -extern const float *const ff_celt_window; + +extern const float ff_celt_window_padded[]; +static const float *const ff_celt_window = &ff_celt_window_padded[8]; extern const uint32_t * const ff_celt_pvq_u_row[15]; +FF_VISIBILITY_POP_HIDDEN #endif /* AVCODEC_OPUSTAB_H */