📄 filter.h
字号:
/* ***** BEGIN LICENSE BLOCK *****
* Version: RCSL 1.0/RPSL 1.0
*
* Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
*
* The contents of this file, and the files included with this file, are
* subject to the current version of the RealNetworks Public Source License
* Version 1.0 (the "RPSL") available at
* http://www.helixcommunity.org/content/rpsl unless you have licensed
* the file under the RealNetworks Community Source License Version 1.0
* (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
* in which case the RCSL will apply. You may also obtain the license terms
* directly from RealNetworks. You may not use this file except in
* compliance with the RPSL or, if you have a valid RCSL with RealNetworks
* applicable to this file, the RCSL. Please see the applicable RPSL or
* RCSL for the rights, obligations and limitations governing use of the
* contents of the file.
*
* This file is part of the Helix DNA Technology. RealNetworks is the
* developer of the Original Code and owns the copyrights in the portions
* it created.
*
* This file, and the files included with this file, is distributed and made
* available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
*
* Technology Compatibility Kit Test Suite(s) Location:
* http://www.helixcommunity.org/content/tck
*
* Contributor(s):
*
* ***** END LICENSE BLOCK ***** */
/*
* Fixed-point sampling rate conversion library
* Developed by Ken Cooke (kenc@real.com)
* May 2003
*
* Filter kernels for various quality levels.
*/
#define UP_KERNEL 32 /* kernel oversampling factor */
/*
* taps = 8
* pass = 16000/22050
* stop = 28000/22050
* ripple = +-1.0dB
* atten = 70dB
*/
const int kernel8[4 * UP_KERNEL] = {
1879001565, 1873911610, 1863757951, 1848592626,
1828493272, 1803563119, 1773929172, 1739742665,
1701177272, 1658428204, 1611710937, 1561259879,
1507326728, 1450178685, 1390097295, 1327376110,
1262318932, 1195238366, 1126453310, 1056287140,
985066239, 913117020, 840764786, 768331715,
696134487, 624482915, 553678222, 484011125,
415760011, 349190588, 284552798, 222081217,
161992672, 104486554, 49742635, -2078684,
-50836893, -96412767, -138707146, -177642308,
-213161574, -245228450, -273827336, -298962664,
-320657725, -338955053, -353915061, -365614579,
-374146791, -379619894, -382155571, -381887710,
-378962295, -373534303, -365768349, -355834891,
-343911943, -330179940, -314824090, -298030540,
-279985510, -260875771, -240884502, -220192787,
-198977699, -177409855, -155654178, -133869120,
-112204293, -90800790, -69791174, -49297858,
-29433136, -10299103, 8012593, 25421913,
41858596, 57264240, 71589328, 84798253,
96861104, 107762994, 117493566, 126054838,
133457671, 139717252, 144859836, 148917603,
151927671, 153934093, 154986307, 155136297,
154440221, 152958026, 150750970, 147881235,
144412609, 140410354, 135938742, 131061529,
125840255, 120337708, 114609632, 108718628,
102707014, 96639539, 90552789, 84494105,
78509926, 72630046, 66888103, 61316996,
55942557, 50783013, 45857706, 41183457,
36772926, 32632154, 28765514, 25175294,
21862888, 18825357, 16057571, 13551601,
11299183, 9289876, 7512705, 15368497,
};
/*
* taps = 16
* pass = 17250/22050
* stop = 24750/22050
* ripple = +-0.5dB
* atten = 85dB
*/
const int kernel16[8 * UP_KERNEL] = {
1772753427, 1768295635, 1759400840, 1746110473,
1728486420, 1706610620, 1680584635, 1650529060,
1616582839, 1578902491, 1537661198, 1493047871,
1445266049, 1394532773, 1341077375, 1285140196,
1226971242, 1166828824, 1104978100, 1041689674,
977238050, 911900221, 845954105, 779677112,
713344646, 647228645, 581596204, 516708156,
452817767, 390169466, 328997619, 269525423,
211963791, 156510441, 103348943, 52647959,
4560521, -40776553, -83243188, -122736402,
-159170661, -192477983, -222608098, -249528345,
-273223609, -293696024, -310964677, -325065190,
-336049146, -343983537, -348950042, -351044268,
-350374922, -347062876, -341240265, -333049402,
-322641783, -310176960, -295821428, -279747485,
-262132075, -243155602, -223000815, -201851599,
-179891878, -157304477, -134270061, -110966061,
-87565668, -64236926, -41141737, -18435109,
3735704, 25231872, 45923652, 65690988,
84423956, 102023247, 118400464, 133478412,
147191291, 159484772, 170316062, 179653858,
187478194, 193780283, 198562251, 201836795,
203626807, 203964915, 202893026, 200461680,
196729596, 191762895, 185634560, 178423651,
170214623, 161096601, 151162585, 140508748,
129233630, 117437402, 105221155, 92686086,
79932864, 67060915, 54167742, 41348293,
28694405, 16294185, 4231539, -7414351,
-18569381, -29165025, -39138519, -48433311,
-56999141, -64792317, -71775832, -77919390,
-83199522, -87599463, -91109187, -93725246,
-95450571, -96294389, -96271898, -95404001,
-93717050, -91242487, -88016457, -84079476,
-79475972, -74253916, -68464337, -62160947,
-55399586, -48237901, -40734789, -32949959,
-24943587, -16775725, -8506091, -193412,
8104698, 16332272, 24435320, 32362065,
40063289, 47492652, 54606815, 61365761,
67732897, 73675233, 79163497, 84172241,
88679846, 92668611, 96124754, 99038359,
101403283, 103217261, 104481509, 105200961,
105383674, 105041214, 104187935, 102841137,
101020750, 98749077, 96050579, 92951742,
89480614, 85666826, 81541121, 77135223,
72481528, 67613007, 62562707, 57363773,
52049071, 46651111, 41201580, 35731605,
30271028, 24848880, 19492433, 14228017,
9080032, 4071379, -776760, -5445141,
-9916311, -14174663, -18206732, -22000736,
-25546943, -28837522, -31866591, -34629889,
-37125205, -39351894, -41311079, -43005222,
-44438601, -45616478, -46545792, -47234101,
-47690732, -47925245, -47948518, -47772059,
-47407643, -46868216, -46166458, -45315498,
-44328902, -43219981, -42002029, -40688423,
-39292376, -37826515, -36303369, -34734966,
-33132996, -31508261, -29871435, -28232146,
-26599910, -24982768, -23389134, -21825774,
-20299220, -18815980, -17379148, -15995464,
-14667014, -13397047, -12188347, -11042978,
-9961352, -8944601, -7992966, -7106237,
-6283110, -5522755, -4823830, -4184893,
-3603447, -3077086, -2603099, -2179230,
-1802723, -1470865, -1180331, -2334686,
};
/*
* taps = 24
* pass = 18250/22050
* stop = 24150/22050
* ripple = +-0.25dB
* atten = 90dB
*/
const int kernel24[12 * UP_KERNEL] = {
1903680272, 1898539655, 1888283738, 1872962998,
1852652784, 1827452860, 1797486816, 1762901335,
1723865332, 1680568939, 1633222403, 1582054830,
1527312850, 1469259165, 1408171014, 1344338557,
1278063188, 1209655792, 1139434949, 1067725109,
994854739, 921154453, 846955153, 772586168,
698373422, 624637645, 551692607, 479843427,
409384950, 340600182, 273758831, 209115927,
146910558, 87364704, 30682197, -22952212,
-73373633, -120437716, -164021176, -204022192,
-240360662, -272978325, -301838750, -326927179,
-348250247, -365835569, -379731200, -390004978,
-396743753, -400052494, -400053326, -396884436,
-390698919, -381663542, -369957432, -355770720,
-339303126, -320762510, -300363391, -278325465,
-254872080, -230228762, -204621705, -178276322,
-151415804, -124259728, -97022720, -69913162,
-43131988, -16871521, 8685582, 33367305,
57013175, 79475048, 100617797, 120319921,
138474010, 154987145, 169781162, 182792816,
193973847, 203290933, 210725543, 216273684,
219945567, 221765158, 221769674, 220008953,
216544795, 211450197, 204808549, 196712751,
187264299, 176572329, 164752615, 151926545,
138220095, 123762762, 108686526, 93124803,
77211396, 61079502, 44860710, 28684057,
12675108, -3044906, -18359906, -33159721,
-47340793, -60806805, -73469243, -85247906,
-96071306, -105877035, -114612016, -122232717,
-128705249, -134005422, -138118708, -141040130,
-142774093, -143334146, -142742657, -141030458,
-138236423, -134406974, -129595573, -123862141,
-117272462, -109897540, -101812937, -93098079,
-83835576, -74110492, -64009638, -53620864,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -