filter.h
上传用户:zhongxx05
上传日期:2007-06-06
资源大小:33641k
文件大小:20k
- /* ***** 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,
- -43032346, -32331906, -21606312, -10940661,
- -417711, 9882675, 19884116, 29514227,
- 38705091, 47393698, 55522344, 63038943,
- 69897343, 76057539, 81485865, 86155125,
- 90044660, 93140378, 95434723, 96926598,
- 97621227, 97529999, 96670227, 95064905,
- 92742399, 89736112, 86084118, 81828761,
- 77016252, 71696180, 65921109, 59746062,
- 53228051, 46425587, 39398193, 32205901,
- 24908797, 17566511, 10237792, 2980049,
- -4151073, -11102090, -17822047, -24262878,
- -30379712, -36131156, -41479569, -46391244,
- -50836620, -54790406, -58231714, -61144100,
- -63515615, -65338822, -66610713, -67332692,
- -67510428, -67153742, -66276443, -64896126,
- -63033951, -60714427, -57965106, -54816348,
- -51300987, -47454040, -43312381, -38914419,
- -34299743, -29508809, -24582607, -19562304,
- -14488941, -9403103, -4344629, 647721,
- 5536504, 10285881, 14861872, 19232542,
- 23368267, 27241856, 30828748, 34107134,
- 37058071, 39665560, 41916632, 43801335,
- 45312807, 46447219, 47203750, 47584527,
- 47594572, 47241651, 46536196, 45491146,
- 44121805, 42445665, 40482216, 38252787,
- 35780279, 33089036, 30204553, 27153284,
- 23962449, 20659742, 17273182, 13830832,
- 10360619, 6890121, 3446362, 55587,
- -3256842, -6466698, -9551003, -12488192,
- -15258211, -17842693, -20224983, -22390295,
- -24325722, -26020336, -27465180, -28653326,
- -29579879, -30241899, -30638494, -30770658,
- -30641303, -30255155, -29618650, -28739934,
- -27628664, -26295939, -24754209, -23017133,
- -21099406, -19016712, -16785507, -14422931,
- -11946628, -9374658, -6725271, -4016883,
- -1267836, 1503638, 4279656, 7042658,
- 9775650, 12462256, 15086782, 17634412,
- 20091117, 22443933, 24680884, 26791033,
- 28764632, 30593059, 32268862, 33785812,
- 35138882, 36324208, 37339174, 38182292,
- 38853223, 39352710, 39682630, 39845792,
- 39846027, 39688010, 39377364, 38920333,
- 38324009, 37595982, 36744498, 35778240,
- 34706197, 33537867, 32282814, 30950853,
- 29551924, 28095916, 26592717, 25052145,
- 23483780, 21896962, 20300827, 18704113,
- 17115167, 15541914, 13991898, 12472084,
- 10988986, 9548509, 8156154, 6816651,
- 5534409, 4312924, 3155568, 2064709,
- 1042412, 90245, -791052, -1600833,
- -2339156, -3006590, -3603990, -4132585,
- -4594134, -4990670, -5324430, -5597971,
- -5814131, -5975938, -6086493, -6149109,
- -6167163, -6144187, -6083587, -5988987,
- -5863705, -5711624, -5535424, -5339444,
- -5125711, -4898012, -4659483, -4412168,
- -4159154, -3903030, -3645952, -3389762,
- -3136618, -2888264, -2646193, -2411530,
- -2185548, -1969311, -1763769, -1569414,
- -1386658, -1215714, -1056902, -910332,
- -776065, -653840, -543368, -1287301,
- };
- /*
- * taps = 32
- * pass = 19000/22050
- * stop = 23800/22050
- * ripple = +-0.1dB
- * atten = 90dB
- */
- const int kernel32[16 * UP_KERNEL] = {
- 1990275845, 1984617665, 1973330488, 1956472497,
- 1934130521, 1906419488, 1873481726, 1835486077,
- 1792626859, 1745122665, 1693215029, 1637166929,
- 1577261190, 1513798748, 1447096821, 1377486978,
- 1305313133, 1230929473, 1154698323, 1076987989,
- 998170556, 918619695, 838708458, 758807107,
- 679280959, 600488297, 522778321, 446489193,
- 371946151, 299459728, 229324084, 161815449,
- 97190695, 35686057, -22484019, -77127867,
- -128077433, -175188958, -218343482, -257447204,
- -292431651, -323253700, -349895432, -372363811,
- -390690232, -404929888, -415161006, -421483944,
- -424020141, -422910964, -418316419, -410413773,
- -399396083, -385470622, -368857261, -349786781,
- -328499130, -305241660, -280267340, -253832952,
- -226197304, -197619452, -168356951, -138664150,
- -108790535, -78979145, -49465041, -20473886,
- 7779412, 35091933, 61273890, 86149643,
- 109558609, 131356037, 151413663, 169620226,
- 185881867, 200122380, 212283337, 222324086,
- 230221616, 235970295, 239581488, 241083066,
- 240518785, 237947585, 233442765, 227091094,
- 218991816, 209255603, 198003430, 185365396,
- 171479515, 156490454, 140548255, 123807043,
- 106423727, 88556710, 70364605, 52004986,
- 33633172, 15401037, -2544106, -20060574,
- -37013327, -53274891, -68726211, -83257432,
- -96768569, -109170109, -120383506, -130341580,
- -138988826, -146281611, -152188297, -156689234,
- -159776684, -161454643, -161738570, -160655035,
- -158241275, -154544691, -149622257, -143539866,
- -136371626, -128199096, -119110469, -109199739,
- -98565814, -87311616, -75543164, -63368656,
- -50897532, -38239566, -25503955, -12798442,
- -228454, 12103714, 24099676, 35665700,
- 46713378, 57160264, 66930434, 75954994,
- 84172519, 91529411, 97980212, 103487823,
- 108023651, 111567704, 114108590, 115643457,
- 116177868, 115725598, 114308375, 111955557,
- 108703756, 104596403, 99683268, 94019933,
- 87667238, 80690668, 73159746, 65147373,
- 56729170, 47982801, 38987290, 29822352,
- 20567705, 11302416, 2104258, -6950922,
- -15789793, -24342105, -32541228, -40324634,
- -47634353, -54417372, -60625997, -66218149,
- -71157629, -75414308, -78964284, -81789965,
- -83880110, -85229826, -85840475, -85719587,
- -84880662, -83342983, -81131332, -78275710,
- -74810987, -70776528, -66215796, -61175914,
- -55707206, -49862733, -43697797, -37269437,
- -30635933, -23856293, -16989746, -10095246,
- -3230984, 3546085, 10180699, 16619725,
- 22812555, 28711504, 34272146, 39453633,
- 44218982, 48535311, 52374057, 55711120,
- 58527023, 60806961, 62540870, 63723428,
- 64354011, 64436621, 63979786, 62996399,
- 61503542, 59522271, 57077377, 54197112,
- 50912891, 47258981, 43272168, 38991399,
- 34457422, 29712425, 24799637, 19762972,
- 14646631, 9494742, 4350979, -741786,
- -5741829, -10608918, -15304598, -19792508,
- -24038638, -28011573, -31682715, -35026474,
- -38020427, -40645463, -42885867, -44729415,
- -46167400, -47194656, -47809532, -48013855,
- -47812843, -47215018, -46232066, -44878686,
- -43172426, -41133472, -38784449, -36150169,
- -33257413, -30134651, -26811777, -23319851,
- -19690798, -15957141, -12151711, -8307369,
- -4456734, -631911, 3135772, 6815998,
- 10379718, 13799350, 17048999, 20104638,
- 22944281, 25548111, 27898646, 29980805,
- 31782012, 33292253, 34504114, 35412799,
- 36016109, 36314447, 36310728, 36010343,
- 35421054, 34552884, 33418009, 32030602,
- 30406686, 28563970, 26521663, 24300296,
- 21921523, 19407913, 16782763, 14069877,
- 11293357, 8477406, 5646132, 2823318,
- 32268, -2704410, -5364947, -7928619,
- -10375862, -12688435, -14849550, -16843958,
- -18658087, -20280087, -21699919, -22909399,
- -23902224, -24674005, -25222252, -25546364,
- -25647613, -25529076, -25195584, -24653659,
- -23911425, -22978491, -21865871, -20585856,
- -19151875, -17578385, -15880710, -14074928,
- -12177671, -10206052, -8177432, -6109342,
- -4019295, -1924645, 157530, 2210596,
- 4218460, 6165706, 8037729, 9820799,
- 11502181, 13070236, 14514460, 15825568,
- 16995555, 18017723, 18886705, 19598507,
- 20150485, 20541369, 20771221, 20841431,
- 20754660, 20514794, 20126932, 19597228,
- 18932938, 18142226, 17234171, 16218612,
- 15106079, 13907708, 12635116, 11300281,
- 9915499, 8493220, 7045963, 5586225,
- 4126367, 2678514, 1254476, -134345,
- -1477059, -2763324, -3983457, -5128468,
- -6190155, -7161084, -8034721, -8805411,
- -9468396, -10019896, -10457012, -10777883,
- -10981521, -11067899, -11037917, -10893351,
- -10636814, -10271782, -9802458, -9233796,
- -8571408, -7821524, -6990905, -6086839,
- -5117001, -4089425, -3012425, -1894548,
- -744466, 429093, 1617339, 2811617,
- 4003318, 5184099, 6345806, 7480578,
- 8580998, 9639929, 10650764, 11607341,
- 12504015, 13335681, 14097843, 14786510,
- 15398364, 15930668, 16381316, 16748769,
- 17032174, 17231207, 17346170, 17377878,
- 17327779, 17197748, 16990195, 16707966,
- 16354324, 15932998, 15447891, 14903429,
- 14304148, 13654859, 12960638, 12226573,
- 11457942, 10660080, 9838307, 8997898,
- 8144186, 7282313, 6417332, 5554110,
- 4697438, 3851767, 3021407, 2210318,
- 1422324, 660772, -71087, -770551,
- -1434953, -2062257, -2650569, -3198273,
- -3704376, -4167735, -4587957, -4964796,
- -5298163, -5588381, -5836110, -6042132,
- -6207450, -6333397, -6421413, -6473105,
- -6490188, -6474664, -6428505, -6353872,
- -6252835, -6127788, -5980882, -5814625,
- -5630897, -5432514, -5220850, -4999100,
- -4768676, -4531524, -4290404, -4046375,
- -3801369, -3557177, -3315458, -3077179,
- -2843718, -2616278, -2396106, -2183890,
- -1980381, -1786099, -1601733, -1427631,
- -1264151, -1111328, -969322, -838069,
- -717605, -607665, -508045, -1250722,
- };