From patchwork Mon Jun 14 22:41:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28282 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp3247729iol; Mon, 14 Jun 2021 15:44:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyCOyFR6uf+rdLxntf/zs9VZLYc9CzjuJw0rVxMUcYHnIztNg5j+zdyhmitjum6rz8yOcU X-Received: by 2002:a05:6402:3594:: with SMTP id y20mr2159024edc.299.1623710641463; Mon, 14 Jun 2021 15:44:01 -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 k4si12509060edv.523.2021.06.14.15.44.00; Mon, 14 Jun 2021 15:44:01 -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=cAAa9DOl; 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 4B853689C7E; Tue, 15 Jun 2021 01:42:15 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR06-VI1-obe.outbound.protection.outlook.com (mail-vi1eur06olkn2062.outbound.protection.outlook.com [40.92.17.62]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D079B689B19 for ; Tue, 15 Jun 2021 01:42:10 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AW3W/0zXRxd5xEyDRn3ud1YVzA5K7+Ay9pv7unqyXgbaVDSgW9svf6S+O9JnlXPbWms2Fnj2SKLe2YkN1NAzH4V13OAARsOxPhyoZP6UXWopDEkxm6/g1jkX8onQ04fZGnIa8IeX8ltoa1Ak9S24K/n3TmfnZqxjLUe0alrldVJP5/xJIU8sNtgkSboXxkgVLAh/EUeiT9FHNDA4bjKBslqyd5sVdh148BcaIPKsj6ZF0EUYjzummu2EMWZx11SWdv0PRSZ5GxjGoWk7VrlRgl1tqqmc6rteMCe+KRrskoCPO5w5LrpmYvDk0rk2C2XerF8K3ttJ/SpunP2eclWvqg== 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=nS0GKSZKS1s/9Eppmmxc8m5CZyrED6js10HJo1TfTWE=; b=E/bi8/W6JM1nRNJ4NZcx/ILlQeSpqJeXTw4NmM9FjngvU7lFVnceioqn8BBybDuwMsmDVzgEjFez7g16eZH0wLxjcl7KRFFDjKLAD4uHDtoU707NOOwBQbq3zLhiw3U0NV1TmPvP1WOFuDMq03OZmGfydlpgslBU28pcEbJYyYBTvBRvaPdjNtLR+W7pWPJTnrSO4JUc/KVZJsaBffPrwq+Ph+fiJ86Jq7PAL/8w2BXs172Am1L8ydV4YuJEZdq2VXJQtOL2pi3Oz6wYYWuD4Yn5o5RcpCPYco7F9Oo6F18oDoxjq6g+EAU47wISRKQxKmC2eMnRML61yfNeuh+JGA== 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=nS0GKSZKS1s/9Eppmmxc8m5CZyrED6js10HJo1TfTWE=; b=cAAa9DOlyDzmz4P6uyv5BKUgu3IH64ibUW2htkBBHalc3+JvvccPYtgOQXqqNgh/JTk/8T6yWm5p8JIw6vdR5xwnt+ogq+HRNjl0FLcpaUrYlG5IAwdKL7ipAo4R238f0Pip3VEviP7yetZOFZocNAcQKfMdyaoUJjF67L/Lws3klc+239e0qxNsHmVeu0s8Y7P5yMVgLFFPSb+2vn3Gjv4iG7RN6Awk8y5m7ixGUtf9giWtaxsXJep1W5OgnkLfLrVmUaZw9APJXTFx+QHWzZpJKbEpHYuIHEyxx3gkr1MMQdAPN/dvJUIcTyPXCPIDS/ffPD9I74ceyGySbm2Pbg== Received: from DB8EUR06FT015.eop-eur06.prod.protection.outlook.com (2a01:111:e400:fc35::40) by DB8EUR06HT107.eop-eur06.prod.protection.outlook.com (2a01:111:e400:fc35::405) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21; Mon, 14 Jun 2021 22:42:09 +0000 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com (2a01:111:e400:fc35::46) by DB8EUR06FT015.mail.protection.outlook.com (2a01:111:e400:fc35::156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21 via Frontend Transport; Mon, 14 Jun 2021 22:42:09 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:2A3D50B16F535098736E4536F7A2D6BD0DFB6873C6C832CC27F95EBFD6F66CED; UpperCasedChecksum:E0A9FC258288965ADB3253BFC2580DE08BEB3AB967732394FEE18A18344DBC60; SizeAsReceived:7590; Count:48 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::f4cc:63fc:9cef:37fb]) by HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::f4cc:63fc:9cef:37fb%6]) with mapi id 15.20.4219.025; Mon, 14 Jun 2021 22:42:09 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 15 Jun 2021 00:41:30 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [dP82GDn/DruvgAo1w/FcY/Kj0Bvc68mQ] X-ClientProxiedBy: AM0PR10CA0039.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:150::19) To HE1PR0301MB2154.eurprd03.prod.outlook.com (2603:10a6:3:2a::22) X-Microsoft-Original-Message-ID: <20210614224134.1029350-13-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.97.82) by AM0PR10CA0039.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:150::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.20 via Frontend Transport; Mon, 14 Jun 2021 22:42:09 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: b617f9f8-1c04-4d69-e2c8-08d92f85a4d4 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiS8u28ets82B/Gq5G20dnAw0nLmfMpfb94gUEHTimxlKdU8Bdx9+PEZBeflXrh5szKzbm/2jlWI0VOV/YiYBQ1G/JLLnfp+vkk/HngHMlRZ8nI0HZ/PysPhv5oEzOaEQLKRNBuyPOSeETx+tOlDeX6XCGtY1kWGLzj38pdUS7Vhn4Z6C3WG6dy2AFFZh78nEE/SVT/Ta+XGbN0LayRy8To+SlFXrhYlxZ03YFUAu/b+8htGMKNmbezhwCTZ82rpnK4n9PIM1sR7WzcIwvQzRR05zCGDwqfTTzdMX6saMPaBSRL1RmXXpv1NhKgYqs5hCeB1SowgLAn1dEIgeiL3GFnhkRwRpCz2IaJwgRT2Zvw9rggEEw2tZqy9BVB4ULqECw1HpUIk/DwyTYkByjL8WQdKvuTeeWFnyyaY3h61bddy7sUFBDq/RRYWf6AxFB1aeAE8dY2JZf3HoDmV2QxKZ/sQDfdIrwUBolDl9eGAdhCg9mDaRFir3f3sN1JISBBM4NNAZtM3PFMv3DuMEI120c1wD2wSx9SGZFyA/G8evFweDIKFlBfXB8NXq/wXP/PrUmpm8ws2nzU6k90NHWHfaYX1jJjzVJV1aFISSbBsBWmmL4Ajpvl9GYX5t2PMXuPcOxmqTH6sLq3elvbr0grB2H2k5OZB3Cpa9KBDxxRF+fLbrpyunukNJ6XN2/S5/5266QlVPgZmiRDdem0nF6mmmF019KjH0NSamtaRZk/vravCvBB+nPK0+AnRMLxFck7N0fI= X-MS-TrafficTypeDiagnostic: DB8EUR06HT107: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MywENC8x0r80/Be4H3vtrI83Ur57nxctDRPYHl1Rt4RZ4pGAv2SmNSXHaNMIuNmXZGPoA43g2znmwCySol38L1qrLL02Mf0GygVDPc7nr2mPuh2lsUjeadY8MMIGxJwyc1UAjynI+m7vXJ2ssZ3OeFUXpVPwF893/NRG+YJd8YdRlfQuWLrraGaKqEKbDERRf4w6aynFWOTrCnuOtM7ShCD6ePQwS1z8lU/RtAYY0qt+ktGB7VvXhRQ/3dY0739wRkLso6v1EBQiF/ToaUtfz33z+25QrEJ89hHWaXsDpB2bOhvuePwZoXSJ+nyRVI7Coo4ErMR+ae8/TLH2G++Thm/70cUualMyrXb/DNMkflGqvHdq2/652ckTsJZ4uMVCM8cvCClXZSFVJsLEM4w1Vg== X-MS-Exchange-AntiSpam-MessageData: 7ZQK7gb5Lnf9xV7sJrYDRVWFchfhAhUYfMCu0zRiiU2aU8e4dodDIOlgyRZ5QE1sbcVNvEICNM4al7CKH+lziGUZ+Dqb5lzNmyJtIXpSt5FlTk1rHfBTF1NHYk/rmFVNRLSxleDSIrHnF3E91sughA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b617f9f8-1c04-4d69-e2c8-08d92f85a4d4 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2021 22:42:09.4425 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: DB8EUR06FT015.eop-eur06.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8EUR06HT107 Subject: [FFmpeg-devel] [PATCH 14/17] avcodec/dsd_tablegen: Merge header into dsd.c 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: EuqT62s8Wein Since b492fbcc6e87094804fdf71308dc500976c6b165, the DSD tables are always initialized at runtime, so merge the dsd_tablegen.h header into dsd.c. Signed-off-by: Andreas Rheinhardt --- libavcodec/dsd.c | 44 ++++++++++++++++++++++- libavcodec/dsd_tablegen.h | 75 --------------------------------------- 2 files changed, 43 insertions(+), 76 deletions(-) delete mode 100644 libavcodec/dsd_tablegen.h diff --git a/libavcodec/dsd.c b/libavcodec/dsd.c index 95aab61ea4..c18e20436a 100644 --- a/libavcodec/dsd.c +++ b/libavcodec/dsd.c @@ -25,9 +25,51 @@ #include "libavcodec/internal.h" #include "libavcodec/mathops.h" #include "avcodec.h" -#include "dsd_tablegen.h" #include "dsd.h" +#define CTABLES ((HTAPS + 7) / 8) /** number of "8 MACs" lookup tables */ + +/* + * Properties of this 96-tap lowpass filter when applied on a signal + * with sampling rate of 44100*64 Hz: + * + * () has a delay of 17 microseconds. + * + * () flat response up to 48 kHz + * + * () if you downsample afterwards by a factor of 8, the + * spectrum below 70 kHz is practically alias-free. + * + * () stopband rejection is about 160 dB + * + * The coefficient tables ("ctables") take only 6 Kibi Bytes and + * should fit into a modern processor's fast cache. + */ + +/** + * The 2nd half (48 coeffs) of a 96-tap symmetric lowpass filter + */ +static const double htaps[HTAPS] = { + 0.09950731974056658, 0.09562845727714668, 0.08819647126516944, + 0.07782552527068175, 0.06534876523171299, 0.05172629311427257, + 0.0379429484910187, 0.02490921351762261, 0.0133774746265897, + 0.003883043418804416, -0.003284703416210726, -0.008080250212687497, + -0.01067241812471033, -0.01139427235000863, -0.0106813877974587, + -0.009007905078766049, -0.006828859761015335, -0.004535184322001496, + -0.002425035959059578, -0.0006922187080790708, 0.0005700762133516592, + 0.001353838005269448, 0.001713709169690937, 0.001742046839472948, + 0.001545601648013235, 0.001226696225277855, 0.0008704322683580222, + 0.0005381636200535649, 0.000266446345425276, 7.002968738383528e-05, + -5.279407053811266e-05, -0.0001140625650874684, -0.0001304796361231895, + -0.0001189970287491285, -9.396247155265073e-05, -6.577634378272832e-05, + -4.07492895872535e-05, -2.17407957554587e-05, -9.163058931391722e-06, + -2.017460145032201e-06, 1.249721855219005e-06, 2.166655190537392e-06, + 1.930520892991082e-06, 1.319400334374195e-06, 7.410039764949091e-07, + 3.423230509967409e-07, 1.244182214744588e-07, 3.130441005359396e-08 +}; + +static float ctables[CTABLES][256]; + static av_cold void dsd_ctables_tableinit(void) { int t, e, m, sign; diff --git a/libavcodec/dsd_tablegen.h b/libavcodec/dsd_tablegen.h deleted file mode 100644 index e5da86a1dc..0000000000 --- a/libavcodec/dsd_tablegen.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Header file for hardcoded DSD tables - * based on BSD licensed dsd2pcm by Sebastian Gesemann - * Copyright (c) 2009, 2011 Sebastian Gesemann. All rights reserved. - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_DSD_TABLEGEN_H -#define AVCODEC_DSD_TABLEGEN_H - -#include -#include "libavutil/attributes.h" -#include "dsd.h" - -#define HTAPS 48 /** number of FIR constants */ -#define CTABLES ((HTAPS + 7) / 8) /** number of "8 MACs" lookup tables */ - -#include "libavutil/common.h" - -/* - * Properties of this 96-tap lowpass filter when applied on a signal - * with sampling rate of 44100*64 Hz: - * - * () has a delay of 17 microseconds. - * - * () flat response up to 48 kHz - * - * () if you downsample afterwards by a factor of 8, the - * spectrum below 70 kHz is practically alias-free. - * - * () stopband rejection is about 160 dB - * - * The coefficient tables ("ctables") take only 6 Kibi Bytes and - * should fit into a modern processor's fast cache. - */ - -/** - * The 2nd half (48 coeffs) of a 96-tap symmetric lowpass filter - */ -static const double htaps[HTAPS] = { - 0.09950731974056658, 0.09562845727714668, 0.08819647126516944, - 0.07782552527068175, 0.06534876523171299, 0.05172629311427257, - 0.0379429484910187, 0.02490921351762261, 0.0133774746265897, - 0.003883043418804416, -0.003284703416210726, -0.008080250212687497, - -0.01067241812471033, -0.01139427235000863, -0.0106813877974587, - -0.009007905078766049, -0.006828859761015335, -0.004535184322001496, - -0.002425035959059578, -0.0006922187080790708, 0.0005700762133516592, - 0.001353838005269448, 0.001713709169690937, 0.001742046839472948, - 0.001545601648013235, 0.001226696225277855, 0.0008704322683580222, - 0.0005381636200535649, 0.000266446345425276, 7.002968738383528e-05, - -5.279407053811266e-05, -0.0001140625650874684, -0.0001304796361231895, - -0.0001189970287491285, -9.396247155265073e-05, -6.577634378272832e-05, - -4.07492895872535e-05, -2.17407957554587e-05, -9.163058931391722e-06, - -2.017460145032201e-06, 1.249721855219005e-06, 2.166655190537392e-06, - 1.930520892991082e-06, 1.319400334374195e-06, 7.410039764949091e-07, - 3.423230509967409e-07, 1.244182214744588e-07, 3.130441005359396e-08 -}; - -static float ctables[CTABLES][256]; -#endif /* AVCODEC_DSD_TABLEGEN_H */