From patchwork Thu Jun 17 02:31:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28439 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp202544iol; Wed, 16 Jun 2021 19:38:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5FHEILGbvnri2/pLqD1uD5oKCWQsi7wYGsIh5GIu3xUDCyq5OgpvclZMyNvCI3NfeLUCb X-Received: by 2002:aa7:c799:: with SMTP id n25mr3376882eds.16.1623897489090; Wed, 16 Jun 2021 19:38:09 -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 12si4176546ejk.74.2021.06.16.19.38.08; Wed, 16 Jun 2021 19:38:09 -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=FycsF0rl; 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 648A7689C2E; Thu, 17 Jun 2021 05:33:59 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-oln040092073101.outbound.protection.outlook.com [40.92.73.101]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0FD656881C6 for ; Thu, 17 Jun 2021 05:33:57 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iEyNUdc1xxyv91YozJc2EJSSVP8GEEGXwdFU9rRaSP49S6B8toON7Sni06gaoPXVn+9/DZ9rz0tp9zAyIwSjiWOUx8fDBlydv4g4JtnrO1oE7j0t64a1heJSaNCofcr9zehqgGDuZpSqK5W7tJt9ZfIBrEQxdTqUGYqqk0TwRBv8B422VaDWYIVw3s75SGMxNqLxnTuVZbovVPj3MSO55T8WGXzYSrnKBv3qYJUnsNCvdoiFSoCdYVOsdKrm+kmGodD0R5FBo8Xvo+75SCe1s96TUk0Rruv4m4sFWtZi6laUfguicOwGkLxXZhKJj0PFbv/wyCD4p/cm/l//gLaDbA== 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=S9Dqfz9DagXdkT6sDwztEOcFcO8acyyZb1JFM+x4cEU=; b=LXatggD/q4/rly97I37oo3VuECttjcSwrEWUfiG2zhzeb44lxX+f3u+XbpCt7CuWfJhCzjnc5qYnDhtjDW2mFXYrW1Bwg9imXohp6JJqgqI9Mqbjek7Xim7cu2vCbq0WO8G8LrYJuHNhUGWscqOtME8qId9YeleQq3+W/pIVWrUrD/DDDLEGIZXtBB/YYgrVqUo8ollnHmAFdXQJBJRlVt3fll+mOHdwQvMwZloElTXC5zG87BMSIaD4oG77nWmfjlA5f3z180PjX0RIccUp+7bCfg5kgCMCyF1ENTR8rOJ8XFVjWj7qV5rs5uMt48vwr7Ynx0htJon/BQt4Hkh3cQ== 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=S9Dqfz9DagXdkT6sDwztEOcFcO8acyyZb1JFM+x4cEU=; b=FycsF0rlh4WjTJZaLB4IQvFp5ROvbE35+UQxuXt/NyJMThfw7U5n2yluaSNPVdxCDlpHNdLAxWafN4Hxz6wgWmMsiBJd5wg+Fz2bcBb4L3I7Mn+hNjGmvwMvwT+m7OYRetkbBAnEBpCe0FA3BKQFivxKiGHKn4BLcp/2st9IP6op8MGp+lQtUAXWadTsBWC3hjjyxYTDrlhRPQqSL84Sf3jPwrxbvZIcHLr6KR1jzNwrXvtXAvcSyjEO/rBlDI05dSMHTTJVbfgulVYfJad1N/3yPcvoe13UdwGNG/5GREzUOAEwQU6pfZT2Kwtu7qBOtV/VAWDfvaj8b/SwnPPgMQ== Received: from HE1EUR04FT053.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0d::4f) by HE1EUR04HT130.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0d::217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.16; Thu, 17 Jun 2021 02:33:56 +0000 Received: from VI1PR0301MB2159.eurprd03.prod.outlook.com (2a01:111:e400:7e0d::4b) by HE1EUR04FT053.mail.protection.outlook.com (2a01:111:e400:7e0d::298) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.16 via Frontend Transport; Thu, 17 Jun 2021 02:33:56 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:CF4260BCB8BE3C6ADB1EB12F1CC0F97631C3BAB0F982CBCF855117897E809731; UpperCasedChecksum:1ACC510C4256C624B4115DA04D8D3E9A168A02853FFC841A5327A2D081B7BC99; SizeAsReceived:7778; Count:50 Received: from VI1PR0301MB2159.eurprd03.prod.outlook.com ([fe80::d9b:66ba:63ad:967b]) by VI1PR0301MB2159.eurprd03.prod.outlook.com ([fe80::d9b:66ba:63ad:967b%5]) with mapi id 15.20.4242.019; Thu, 17 Jun 2021 02:33:56 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 17 Jun 2021 04:31:54 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [0Wx8/Uqe/IdLq19xgfiTCFFWUx6dfYg2] X-ClientProxiedBy: AM0PR04CA0115.eurprd04.prod.outlook.com (2603:10a6:208:55::20) To VI1PR0301MB2159.eurprd03.prod.outlook.com (2603:10a6:800:26::20) X-Microsoft-Original-Message-ID: <20210617023202.1318312-32-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.97.82) by AM0PR04CA0115.eurprd04.prod.outlook.com (2603:10a6:208:55::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.16 via Frontend Transport; Thu, 17 Jun 2021 02:33:25 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: b4cc1d82-afd1-4010-cc50-08d9313848e5 X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNU/fTcAoeunGvvJC2vgMUdOdqX/h1J1dx4ENh5GaPtlnGZcCPcLQhMlKxyvCf5+NbTKsPDSP+2E93/mm2fGLYlti3h38TI7EN+lDDKTv+pIlMMEalXw+AEbnuv6ue14NhYpuol0voCQYhDJz9K0zWzl10H3ENeyCIn056hvvM3t8QldiOfts3KVKVP/MhWNzaUAeLKsDki9QDagVnHWiuqme74xC441HCGOtmoB5EQmqgV9FSUx1uV9teZpyq/JCHmoNetImE5E+A7DcLz6y0yW0P/xaSVPNkxogDJ5hrXfEwO6gNw/eDlQD7sCcnqXFYv/Ni45rrZVqLfIO3rLg0EXfFw2AUbdLXuM6rI1RwoTM9IjaqDH6ZRurJ2/95bU2QfDYxxPyy7PK5ct97e9TuRPBORwVdNcWRZmn/X/ab0dLG0r9MvVsdofZvukNmWcMxJM5BbnLbSnkprmoa7wfsQ+TXMoQFQI0nc501oHOmPJG/My/2paa/9+IJUJ4XshD4MHbHKxUvuLOsaDDXmCBX4UmvNHKjbFfoAzFCUkMlE/VkSNV7fLNnQi28l+NAyXxeO+kAv3MBSi07PVwPhnVq8XyP2wv2bgFOHraxchdzqTTB5AHplUaN+flJTAuO9xoStdI7POXRbxHgWSrSpUDTmT8rhzy8dOIMbe+M4Lp+JdRv7x0XTLUdsI1J7MBMRpsn9OZ8w8Buaa/m0wacJMl+oCP3Y6X32CLuQ= X-MS-TrafficTypeDiagnostic: HE1EUR04HT130: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4ix6HDhFyJ7S/vyrWsQuVnwGdHc0r0hwbSVs3djlu/iCJZ1tqVW2xaQ2p6sh8rFfHnZcSARjM61rJXkE60QCWE/1PcTgOWFd6hn7qSUc2xfN70cB+2NSCk1bjMengyA2O6a3C/TWBicKmiJZemhz6lCM+zZVc91mTmeYBETRMNEU7sQoYlMxJwOEMK4v9QenTvsw4268KWM/eQkz5BDGf0mTrgcPQHNuQUtAMWHQtIkh9T0bJPuuzuSbuUNDWEsAMvinKLyCA3CZOie4hI/F4hmYZwBGI0oN75dapgsM80mp3Lya/UfvHgrszATEiDczrcWiZf9/0+dvJQQXQPkZptIomYmmL4mWxTx00WQvvRor4Hc5NFtJubs0sZ8tCh2W0bzlZhzjBuSzFCDb3Irk7w== X-MS-Exchange-AntiSpam-MessageData: bzfFIQ41ZEc3eTYguJPBdQcOF1rhQUSLuHklzDom/L3+lUaq7iZv0f0is8pXhW9W8Dtcsy2KO1e827KQ3Agw4Q1/McZdm878PwpdmvmersC/WYsUNXM7zteHldSBbqsR8+/9rUqLCcW9FmvhzavTfw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b4cc1d82-afd1-4010-cc50-08d9313848e5 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2021 02:33:26.2844 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: HE1EUR04FT053.eop-eur04.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: HE1EUR04HT130 Subject: [FFmpeg-devel] [PATCH 33/41] avcodec/adpcm_data: Move tables only used by adpcm.c to it 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: p3Hs+rLtJAc1 Signed-off-by: Andreas Rheinhardt --- libavcodec/adpcm.c | 141 ++++++++++++++++++++++++++++++++++++++-- libavcodec/adpcm_data.c | 127 ------------------------------------ libavcodec/adpcm_data.h | 6 -- 3 files changed, 134 insertions(+), 140 deletions(-) diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index 3a16acfb68..84dbaee777 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -82,6 +82,11 @@ static const int8_t xa_adpcm_table[5][2] = { { 122, -60 } }; +static const int16_t afc_coeffs[2][16] = { + { 0, 2048, 0, 1024, 4096, 3584, 3072, 4608, 4200, 4800, 5120, 2048, 1024, -1024, -1024, -2048 }, + { 0, 0, 2048, 1024, -2048, -1536, -1024, -2560, -2248, -2300, -3072, -2048, -1024, 1024, 0, 0 } +}; + static const int16_t ea_adpcm_table[] = { 0, 240, 460, 392, 0, 0, -208, -220, @@ -90,6 +95,128 @@ static const int16_t ea_adpcm_table[] = { 0, -1, -3, -4 }; +/* + * Dumped from the binaries: + * - FantasticJourney.exe - 0x794D2, DGROUP:0x47A4D2 + * - BigRaceUSA.exe - 0x9B8AA, DGROUP:0x49C4AA + * - Timeshock!.exe - 0x8506A, DGROUP:0x485C6A + */ +static const int8_t ima_cunning_index_table[9] = { + -1, -1, -1, -1, 1, 2, 3, 4, -1 +}; + +/* + * Dumped from the binaries: + * - FantasticJourney.exe - 0x79458, DGROUP:0x47A458 + * - BigRaceUSA.exe - 0x9B830, DGROUP:0x49C430 + * - Timeshock!.exe - 0x84FF0, DGROUP:0x485BF0 + */ +static const int16_t ima_cunning_step_table[61] = { + 1, 1, 1, 1, 2, 2, 3, 3, 4, 5, + 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, + 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, + 192, 224, 256, 320, 384, 448, 512, 640, 768, 896, + 1024, 1280, 1536, 1792, 2048, 2560, 3072, 3584, 4096, 5120, + 6144, 7168, 8192, 10240, 12288, 14336, 16384, 20480, 24576, 28672, 0 +}; + +static const int8_t adpcm_index_table2[4] = { + -1, 2, + -1, 2, +}; + +static const int8_t adpcm_index_table3[8] = { + -1, -1, 1, 2, + -1, -1, 1, 2, +}; + +static const int8_t adpcm_index_table5[32] = { + -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 4, 6, 8, 10, 13, 16, + -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 4, 6, 8, 10, 13, 16, +}; + +static const int8_t * const adpcm_index_tables[4] = { + &adpcm_index_table2[0], + &adpcm_index_table3[0], + &ff_adpcm_index_table[0], + &adpcm_index_table5[0], +}; + +static const int16_t mtaf_stepsize[32][16] = { + { 1, 5, 9, 13, 16, 20, 24, 28, + -1, -5, -9, -13, -16, -20, -24, -28, }, + { 2, 6, 11, 15, 20, 24, 29, 33, + -2, -6, -11, -15, -20, -24, -29, -33, }, + { 2, 7, 13, 18, 23, 28, 34, 39, + -2, -7, -13, -18, -23, -28, -34, -39, }, + { 3, 9, 15, 21, 28, 34, 40, 46, + -3, -9, -15, -21, -28, -34, -40, -46, }, + { 3, 11, 18, 26, 33, 41, 48, 56, + -3, -11, -18, -26, -33, -41, -48, -56, }, + { 4, 13, 22, 31, 40, 49, 58, 67, + -4, -13, -22, -31, -40, -49, -58, -67, }, + { 5, 16, 26, 37, 48, 59, 69, 80, + -5, -16, -26, -37, -48, -59, -69, -80, }, + { 6, 19, 31, 44, 57, 70, 82, 95, + -6, -19, -31, -44, -57, -70, -82, -95, }, + { 7, 22, 38, 53, 68, 83, 99, 114, + -7, -22, -38, -53, -68, -83, -99, -114, }, + { 9, 27, 45, 63, 81, 99, 117, 135, + -9, -27, -45, -63, -81, -99, -117, -135, }, + { 10, 32, 53, 75, 96, 118, 139, 161, + -10, -32, -53, -75, -96, -118, -139, -161, }, + { 12, 38, 64, 90, 115, 141, 167, 193, + -12, -38, -64, -90, -115, -141, -167, -193, }, + { 15, 45, 76, 106, 137, 167, 198, 228, + -15, -45, -76, -106, -137, -167, -198, -228, }, + { 18, 54, 91, 127, 164, 200, 237, 273, + -18, -54, -91, -127, -164, -200, -237, -273, }, + { 21, 65, 108, 152, 195, 239, 282, 326, + -21, -65, -108, -152, -195, -239, -282, -326, }, + { 25, 77, 129, 181, 232, 284, 336, 388, + -25, -77, -129, -181, -232, -284, -336, -388, }, + { 30, 92, 153, 215, 276, 338, 399, 461, + -30, -92, -153, -215, -276, -338, -399, -461, }, + { 36, 109, 183, 256, 329, 402, 476, 549, + -36, -109, -183, -256, -329, -402, -476, -549, }, + { 43, 130, 218, 305, 392, 479, 567, 654, + -43, -130, -218, -305, -392, -479, -567, -654, }, + { 52, 156, 260, 364, 468, 572, 676, 780, + -52, -156, -260, -364, -468, -572, -676, -780, }, + { 62, 186, 310, 434, 558, 682, 806, 930, + -62, -186, -310, -434, -558, -682, -806, -930, }, + { 73, 221, 368, 516, 663, 811, 958, 1106, + -73, -221, -368, -516, -663, -811, -958, -1106, }, + { 87, 263, 439, 615, 790, 966, 1142, 1318, + -87, -263, -439, -615, -790, -966, -1142, -1318, }, + { 104, 314, 523, 733, 942, 1152, 1361, 1571, + -104, -314, -523, -733, -942, -1152, -1361, -1571, }, + { 124, 374, 623, 873, 1122, 1372, 1621, 1871, + -124, -374, -623, -873, -1122, -1372, -1621, -1871, }, + { 148, 445, 743, 1040, 1337, 1634, 1932, 2229, + -148, -445, -743, -1040, -1337, -1634, -1932, -2229, }, + { 177, 531, 885, 1239, 1593, 1947, 2301, 2655, + -177, -531, -885, -1239, -1593, -1947, -2301, -2655, }, + { 210, 632, 1053, 1475, 1896, 2318, 2739, 3161, + -210, -632, -1053, -1475, -1896, -2318, -2739, -3161, }, + { 251, 753, 1255, 1757, 2260, 2762, 3264, 3766, + -251, -753, -1255, -1757, -2260, -2762, -3264, -3766, }, + { 299, 897, 1495, 2093, 2692, 3290, 3888, 4486, + -299, -897, -1495, -2093, -2692, -3290, -3888, -4486, }, + { 356, 1068, 1781, 2493, 3206, 3918, 4631, 5343, + -356, -1068, -1781, -2493, -3206, -3918, -4631, -5343, }, + { 424, 1273, 2121, 2970, 3819, 4668, 5516, 6365, + -424, -1273, -2121, -2970, -3819, -4668, -5516, -6365, }, +}; + +static const int16_t oki_step_table[49] = { + 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, + 41, 45, 50, 55, 60, 66, 73, 80, 88, 97, + 107, 118, 130, 143, 157, 173, 190, 209, 230, 253, + 279, 307, 337, 371, 408, 449, 494, 544, 598, 658, + 724, 796, 876, 963, 1060, 1166, 1282, 1411, 1552 +}; + // padded to zero where table size is less then 16 static const int8_t swf_index_tables[4][16] = { /*2*/ { -1, 2 }, @@ -335,8 +462,8 @@ static inline int16_t adpcm_ima_cunning_expand_nibble(ADPCMChannelStatus *c, int nibble = sign_extend(nibble & 0xF, 4); - step = ff_adpcm_ima_cunning_step_table[c->step_index]; - step_index = c->step_index + ff_adpcm_ima_cunning_index_table[abs(nibble)]; + step = ima_cunning_step_table[c->step_index]; + step_index = c->step_index + ima_cunning_index_table[abs(nibble)]; step_index = av_clip(step_index, 0, 60); predictor = c->predictor + step * nibble; @@ -354,7 +481,7 @@ static inline int16_t adpcm_ima_wav_expand_nibble(ADPCMChannelStatus *c, GetBitC shift = bps - 1; nibble = get_bits_le(gb, bps), step = ff_adpcm_step_table[c->step_index]; - step_index = c->step_index + ff_adpcm_index_tables[bps - 2][nibble]; + step_index = c->step_index + adpcm_index_tables[bps - 2][nibble]; step_index = av_clip(step_index, 0, 88); sign = nibble & (1 << shift); @@ -419,7 +546,7 @@ static inline int16_t adpcm_ima_oki_expand_nibble(ADPCMChannelStatus *c, int nib { int step_index, predictor, sign, delta, diff, step; - step = ff_adpcm_oki_step_table[c->step_index]; + step = oki_step_table[c->step_index]; step_index = c->step_index + ff_adpcm_index_table[(unsigned)nibble]; step_index = av_clip(step_index, 0, 48); @@ -493,7 +620,7 @@ static inline int16_t adpcm_yamaha_expand_nibble(ADPCMChannelStatus *c, uint8_t static inline int16_t adpcm_mtaf_expand_nibble(ADPCMChannelStatus *c, uint8_t nibble) { - c->predictor += ff_adpcm_mtaf_stepsize[c->step][nibble]; + c->predictor += mtaf_stepsize[c->step][nibble]; c->predictor = av_clip_int16(c->predictor); c->step += ff_adpcm_index_table[nibble]; c->step = av_clip_uintp2(c->step, 5); @@ -1836,8 +1963,8 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data, int byte = bytestream2_get_byteu(&gb); int scale = 1 << (byte >> 4); int index = byte & 0xf; - int factor1 = ff_adpcm_afc_coeffs[0][index]; - int factor2 = ff_adpcm_afc_coeffs[1][index]; + int factor1 = afc_coeffs[0][index]; + int factor2 = afc_coeffs[1][index]; /* Decode 16 samples. */ for (int n = 0; n < 16; n++) { diff --git a/libavcodec/adpcm_data.c b/libavcodec/adpcm_data.c index 4c81799bd0..df8aeacb99 100644 --- a/libavcodec/adpcm_data.c +++ b/libavcodec/adpcm_data.c @@ -27,33 +27,11 @@ /* ff_adpcm_step_table[] and ff_adpcm_index_table[] are from the ADPCM reference source */ -static const int8_t adpcm_index_table2[4] = { - -1, 2, - -1, 2, -}; - -static const int8_t adpcm_index_table3[8] = { - -1, -1, 1, 2, - -1, -1, 1, 2, -}; - const int8_t ff_adpcm_index_table[16] = { -1, -1, -1, -1, 2, 4, 6, 8, -1, -1, -1, -1, 2, 4, 6, 8, }; -static const int8_t adpcm_index_table5[32] = { - -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 4, 6, 8, 10, 13, 16, - -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 4, 6, 8, 10, 13, 16, -}; - -const int8_t * const ff_adpcm_index_tables[4] = { - &adpcm_index_table2[0], - &adpcm_index_table3[0], - &ff_adpcm_index_table[0], - &adpcm_index_table5[0], -}; - /** * This is the step table. Note that many programs use slight deviations from * this table, but such deviations are negligible: @@ -70,14 +48,6 @@ const int16_t ff_adpcm_step_table[89] = { 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767 }; -const int16_t ff_adpcm_oki_step_table[49] = { - 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, - 41, 45, 50, 55, 60, 66, 73, 80, 88, 97, - 107, 118, 130, 143, 157, 173, 190, 209, 230, 253, - 279, 307, 337, 371, 408, 449, 494, 544, 598, 658, - 724, 796, 876, 963, 1060, 1166, 1282, 1411, 1552 -}; - /* These are for MS-ADPCM */ /* ff_adpcm_AdaptationTable[], ff_adpcm_AdaptCoeff1[], and ff_adpcm_AdaptCoeff2[] are from libsndfile */ @@ -105,100 +75,3 @@ const int8_t ff_adpcm_yamaha_difflookup[] = { 1, 3, 5, 7, 9, 11, 13, 15, -1, -3, -5, -7, -9, -11, -13, -15 }; - -const int16_t ff_adpcm_afc_coeffs[2][16] = { - { 0, 2048, 0, 1024, 4096, 3584, 3072, 4608, 4200, 4800, 5120, 2048, 1024, -1024, -1024, -2048 }, - { 0, 0, 2048, 1024, -2048, -1536, -1024, -2560, -2248, -2300, -3072, -2048, -1024, 1024, 0, 0 } -}; - -const int16_t ff_adpcm_mtaf_stepsize[32][16] = { - { 1, 5, 9, 13, 16, 20, 24, 28, - -1, -5, -9, -13, -16, -20, -24, -28, }, - { 2, 6, 11, 15, 20, 24, 29, 33, - -2, -6, -11, -15, -20, -24, -29, -33, }, - { 2, 7, 13, 18, 23, 28, 34, 39, - -2, -7, -13, -18, -23, -28, -34, -39, }, - { 3, 9, 15, 21, 28, 34, 40, 46, - -3, -9, -15, -21, -28, -34, -40, -46, }, - { 3, 11, 18, 26, 33, 41, 48, 56, - -3, -11, -18, -26, -33, -41, -48, -56, }, - { 4, 13, 22, 31, 40, 49, 58, 67, - -4, -13, -22, -31, -40, -49, -58, -67, }, - { 5, 16, 26, 37, 48, 59, 69, 80, - -5, -16, -26, -37, -48, -59, -69, -80, }, - { 6, 19, 31, 44, 57, 70, 82, 95, - -6, -19, -31, -44, -57, -70, -82, -95, }, - { 7, 22, 38, 53, 68, 83, 99, 114, - -7, -22, -38, -53, -68, -83, -99, -114, }, - { 9, 27, 45, 63, 81, 99, 117, 135, - -9, -27, -45, -63, -81, -99, -117, -135, }, - { 10, 32, 53, 75, 96, 118, 139, 161, - -10, -32, -53, -75, -96, -118, -139, -161, }, - { 12, 38, 64, 90, 115, 141, 167, 193, - -12, -38, -64, -90, -115, -141, -167, -193, }, - { 15, 45, 76, 106, 137, 167, 198, 228, - -15, -45, -76, -106, -137, -167, -198, -228, }, - { 18, 54, 91, 127, 164, 200, 237, 273, - -18, -54, -91, -127, -164, -200, -237, -273, }, - { 21, 65, 108, 152, 195, 239, 282, 326, - -21, -65, -108, -152, -195, -239, -282, -326, }, - { 25, 77, 129, 181, 232, 284, 336, 388, - -25, -77, -129, -181, -232, -284, -336, -388, }, - { 30, 92, 153, 215, 276, 338, 399, 461, - -30, -92, -153, -215, -276, -338, -399, -461, }, - { 36, 109, 183, 256, 329, 402, 476, 549, - -36, -109, -183, -256, -329, -402, -476, -549, }, - { 43, 130, 218, 305, 392, 479, 567, 654, - -43, -130, -218, -305, -392, -479, -567, -654, }, - { 52, 156, 260, 364, 468, 572, 676, 780, - -52, -156, -260, -364, -468, -572, -676, -780, }, - { 62, 186, 310, 434, 558, 682, 806, 930, - -62, -186, -310, -434, -558, -682, -806, -930, }, - { 73, 221, 368, 516, 663, 811, 958, 1106, - -73, -221, -368, -516, -663, -811, -958, -1106, }, - { 87, 263, 439, 615, 790, 966, 1142, 1318, - -87, -263, -439, -615, -790, -966, -1142, -1318, }, - { 104, 314, 523, 733, 942, 1152, 1361, 1571, - -104, -314, -523, -733, -942, -1152, -1361, -1571, }, - { 124, 374, 623, 873, 1122, 1372, 1621, 1871, - -124, -374, -623, -873, -1122, -1372, -1621, -1871, }, - { 148, 445, 743, 1040, 1337, 1634, 1932, 2229, - -148, -445, -743, -1040, -1337, -1634, -1932, -2229, }, - { 177, 531, 885, 1239, 1593, 1947, 2301, 2655, - -177, -531, -885, -1239, -1593, -1947, -2301, -2655, }, - { 210, 632, 1053, 1475, 1896, 2318, 2739, 3161, - -210, -632, -1053, -1475, -1896, -2318, -2739, -3161, }, - { 251, 753, 1255, 1757, 2260, 2762, 3264, 3766, - -251, -753, -1255, -1757, -2260, -2762, -3264, -3766, }, - { 299, 897, 1495, 2093, 2692, 3290, 3888, 4486, - -299, -897, -1495, -2093, -2692, -3290, -3888, -4486, }, - { 356, 1068, 1781, 2493, 3206, 3918, 4631, 5343, - -356, -1068, -1781, -2493, -3206, -3918, -4631, -5343, }, - { 424, 1273, 2121, 2970, 3819, 4668, 5516, 6365, - -424, -1273, -2121, -2970, -3819, -4668, -5516, -6365, }, -}; - -/* - * Dumped from the binaries: - * - FantasticJourney.exe - 0x794D2, DGROUP:0x47A4D2 - * - BigRaceUSA.exe - 0x9B8AA, DGROUP:0x49C4AA - * - Timeshock!.exe - 0x8506A, DGROUP:0x485C6A - */ -const int8_t ff_adpcm_ima_cunning_index_table[9] = { - -1, -1, -1, -1, 1, 2, 3, 4, -1 -}; - -/* - * Dumped from the binaries: - * - FantasticJourney.exe - 0x79458, DGROUP:0x47A458 - * - BigRaceUSA.exe - 0x9B830, DGROUP:0x49C430 - * - Timeshock!.exe - 0x84FF0, DGROUP:0x485BF0 - */ -const int16_t ff_adpcm_ima_cunning_step_table[61] = { - 1, 1, 1, 1, 2, 2, 3, 3, 4, 5, - 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, - 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, - 192, 224, 256, 320, 384, 448, 512, 640, 768, 896, - 1024, 1280, 1536, 1792, 2048, 2560, 3072, 3584, 4096, 5120, - 6144, 7168, 8192, 10240, 12288, 14336, 16384, 20480, 24576, 28672, 0 -}; diff --git a/libavcodec/adpcm_data.h b/libavcodec/adpcm_data.h index d678bfc71a..7dec6499f8 100644 --- a/libavcodec/adpcm_data.h +++ b/libavcodec/adpcm_data.h @@ -31,18 +31,12 @@ static const uint8_t ff_adpcm_ima_block_sizes[4] = { 4, 12, 4, 20 }; static const uint8_t ff_adpcm_ima_block_samples[4] = { 16, 32, 8, 32 }; -extern const int8_t * const ff_adpcm_index_tables[4]; extern const int8_t ff_adpcm_index_table[16]; extern const int16_t ff_adpcm_step_table[89]; -extern const int16_t ff_adpcm_oki_step_table[49]; extern const int16_t ff_adpcm_AdaptationTable[]; extern const uint8_t ff_adpcm_AdaptCoeff1[]; extern const int8_t ff_adpcm_AdaptCoeff2[]; extern const int16_t ff_adpcm_yamaha_indexscale[]; extern const int8_t ff_adpcm_yamaha_difflookup[]; -extern const int16_t ff_adpcm_afc_coeffs[2][16]; -extern const int16_t ff_adpcm_mtaf_stepsize[32][16]; -extern const int8_t ff_adpcm_ima_cunning_index_table[9]; -extern const int16_t ff_adpcm_ima_cunning_step_table[61]; #endif /* AVCODEC_ADPCM_DATA_H */