Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

data_bandlimit_step.c 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #include <stdint.h>
  2. // band limited step function, 17kHz limit for 44.1kSPS.
  3. // step goes from -BASE_AMPLITUDE to +BASE_AMPLITUDE nominally
  4. // [ only store the first half of the table due to its odd symmetry ]
  5. // the extra first entry allows for the interpolation code not to overrun on reflected table,
  6. // the last extra entry allows for interpolation not to overrun when non-reflected
  7. const int16_t step_table [258] = // size is N/2+2 where N = SUPPORT * SCALE * 2
  8. {
  9. -24576,
  10. -24551, -24550, -24549, -24548, -24546, -24544, -24542, -24540, -24538, -24537, -24537, -24537, -24539, -24543, -24547, -24553,
  11. -24560, -24569, -24579, -24590, -24602, -24614, -24627, -24639, -24651, -24663, -24673, -24682, -24689, -24693, -24695, -24694,
  12. -24691, -24684, -24674, -24661, -24646, -24627, -24607, -24585, -24561, -24536, -24511, -24486, -24463, -24441, -24421, -24403,
  13. -24390, -24380, -24374, -24373, -24377, -24386, -24400, -24418, -24441, -24469, -24499, -24533, -24569, -24607, -24645, -24683,
  14. -24720, -24755, -24786, -24814, -24836, -24854, -24865, -24870, -24867, -24858, -24842, -24819, -24789, -24753, -24712, -24666,
  15. -24617, -24566, -24513, -24460, -24408, -24359, -24314, -24274, -24239, -24212, -24193, -24182, -24181, -24189, -24206, -24233,
  16. -24268, -24312, -24364, -24422, -24485, -24552, -24621, -24691, -24760, -24826, -24889, -24945, -24994, -25034, -25064, -25084,
  17. -25091, -25087, -25070, -25041, -25000, -24948, -24886, -24815, -24736, -24652, -24564, -24473, -24383, -24296, -24213, -24136,
  18. -24068, -24011, -23965, -23934, -23916, -23914, -23928, -23958, -24003, -24064, -24137, -24224, -24320, -24426, -24537, -24653,
  19. -24769, -24884, -24994, -25097, -25190, -25271, -25337, -25387, -25418, -25430, -25422, -25394, -25345, -25276, -25188, -25084,
  20. -24964, -24832, -24691, -24542, -24391, -24240, -24092, -23953, -23824, -23710, -23613, -23537, -23484, -23456, -23454, -23478,
  21. -23531, -23610, -23714, -23843, -23993, -24162, -24347, -24542, -24745, -24950, -25153, -25348, -25531, -25697, -25841, -25960,
  22. -26048, -26104, -26125, -26108, -26054, -25961, -25831, -25665, -25466, -25238, -24984, -24710, -24422, -24125, -23828, -23535,
  23. -23256, -22998, -22766, -22570, -22414, -22304, -22246, -22244, -22300, -22417, -22594, -22831, -23126, -23475, -23872, -24311,
  24. -24785, -25283, -25795, -26311, -26816, -27300, -27747, -28143, -28476, -28731, -28894, -28953, -28896, -28711, -28390, -27923,
  25. -27305, -26530, -25596, -24501, -23246, -21836, -20274, -18569, -16729, -14766, -12691, -10521, -8269, -5953, -3591, -1200,
  26. 1200
  27. };
  28. /* // this version is for SCALE = 64, but with interpolation isn't really needed
  29. int16_t edge_table [1026] = // size is N/2+2 where N = SUPPORT * SCALE * 2
  30. {
  31. -24576,
  32. -24551, -24551, -24551, -24551, -24551, -24550, -24550, -24550, -24550, -24549, -24549, -24549, -24548, -24548, -24547, -24547,
  33. -24547, -24546, -24546, -24545, -24544, -24544, -24543, -24543, -24542, -24542, -24541, -24541, -24540, -24540, -24539, -24539,
  34. -24539, -24538, -24538, -24538, -24537, -24537, -24537, -24537, -24537, -24537, -24537, -24537, -24537, -24537, -24538, -24538,
  35. -24539, -24539, -24540, -24540, -24541, -24542, -24543, -24544, -24545, -24546, -24548, -24549, -24551, -24552, -24554, -24556,
  36. -24557, -24559, -24561, -24563, -24566, -24568, -24570, -24573, -24575, -24578, -24580, -24583, -24586, -24588, -24591, -24594,
  37. -24597, -24600, -24603, -24606, -24609, -24612, -24616, -24619, -24622, -24625, -24628, -24631, -24635, -24638, -24641, -24644,
  38. -24647, -24650, -24653, -24656, -24659, -24661, -24664, -24667, -24669, -24672, -24674, -24677, -24679, -24681, -24683, -24685,
  39. -24686, -24688, -24689, -24690, -24692, -24693, -24693, -24694, -24695, -24695, -24695, -24695, -24695, -24694, -24694, -24693,
  40. -24692, -24691, -24690, -24688, -24687, -24685, -24683, -24680, -24678, -24675, -24672, -24669, -24666, -24663, -24659, -24656,
  41. -24652, -24648, -24643, -24639, -24634, -24630, -24625, -24620, -24615, -24609, -24604, -24599, -24593, -24587, -24582, -24576,
  42. -24570, -24564, -24558, -24552, -24545, -24539, -24533, -24527, -24520, -24514, -24508, -24502, -24496, -24489, -24483, -24477,
  43. -24471, -24466, -24460, -24454, -24449, -24443, -24438, -24433, -24428, -24423, -24418, -24414, -24410, -24406, -24402, -24398,
  44. -24395, -24391, -24388, -24386, -24383, -24381, -24379, -24377, -24376, -24375, -24374, -24374, -24373, -24373, -24374, -24374,
  45. -24375, -24377, -24378, -24380, -24382, -24385, -24388, -24391, -24394, -24398, -24402, -24406, -24411, -24416, -24421, -24427,
  46. -24432, -24438, -24445, -24451, -24458, -24465, -24472, -24480, -24488, -24496, -24504, -24512, -24520, -24529, -24538, -24547,
  47. -24556, -24565, -24574, -24583, -24593, -24602, -24612, -24621, -24631, -24641, -24650, -24660, -24669, -24679, -24688, -24697,
  48. -24706, -24715, -24724, -24733, -24742, -24750, -24759, -24767, -24775, -24782, -24790, -24797, -24804, -24810, -24817, -24823,
  49. -24828, -24834, -24839, -24843, -24848, -24852, -24855, -24858, -24861, -24864, -24866, -24867, -24868, -24869, -24869, -24869,
  50. -24869, -24868, -24866, -24864, -24862, -24859, -24856, -24852, -24848, -24844, -24839, -24834, -24828, -24822, -24815, -24808,
  51. -24800, -24793, -24784, -24776, -24767, -24758, -24748, -24738, -24728, -24717, -24706, -24695, -24684, -24672, -24660, -24648,
  52. -24636, -24623, -24611, -24598, -24585, -24572, -24559, -24546, -24533, -24520, -24506, -24493, -24480, -24467, -24454, -24441,
  53. -24428, -24415, -24402, -24390, -24377, -24365, -24354, -24342, -24331, -24320, -24309, -24298, -24288, -24279, -24269, -24260,
  54. -24252, -24243, -24236, -24228, -24222, -24215, -24210, -24204, -24199, -24195, -24191, -24188, -24186, -24183, -24182, -24181,
  55. -24181, -24181, -24182, -24183, -24185, -24188, -24191, -24194, -24199, -24204, -24209, -24215, -24222, -24229, -24237, -24245,
  56. -24254, -24264, -24274, -24284, -24295, -24307, -24319, -24331, -24344, -24357, -24371, -24385, -24399, -24414, -24429, -24445,
  57. -24461, -24477, -24493, -24510, -24526, -24543, -24560, -24577, -24595, -24612, -24630, -24647, -24665, -24682, -24700, -24717,
  58. -24734, -24751, -24768, -24785, -24802, -24818, -24834, -24850, -24866, -24881, -24896, -24910, -24924, -24938, -24951, -24964,
  59. -24976, -24988, -24999, -25010, -25020, -25029, -25038, -25046, -25054, -25061, -25067, -25072, -25077, -25081, -25085, -25087,
  60. -25089, -25091, -25091, -25091, -25090, -25088, -25085, -25082, -25077, -25073, -25067, -25060, -25053, -25045, -25036, -25027,
  61. -25017, -25006, -24994, -24982, -24969, -24955, -24941, -24926, -24910, -24894, -24878, -24860, -24842, -24824, -24805, -24786,
  62. -24766, -24746, -24726, -24705, -24684, -24663, -24641, -24619, -24597, -24575, -24552, -24530, -24507, -24485, -24462, -24440,
  63. -24417, -24395, -24372, -24350, -24328, -24307, -24285, -24264, -24243, -24223, -24203, -24183, -24164, -24145, -24127, -24110,
  64. -24093, -24076, -24061, -24046, -24031, -24018, -24005, -23993, -23981, -23971, -23961, -23952, -23944, -23937, -23931, -23926,
  65. -23922, -23918, -23916, -23914, -23914, -23914, -23916, -23918, -23922, -23926, -23932, -23938, -23946, -23954, -23964, -23974,
  66. -23985, -23997, -24011, -24025, -24040, -24056, -24073, -24090, -24109, -24128, -24148, -24169, -24190, -24213, -24236, -24259,
  67. -24283, -24308, -24334, -24359, -24386, -24413, -24440, -24467, -24495, -24523, -24552, -24581, -24609, -24638, -24667, -24697,
  68. -24726, -24755, -24784, -24813, -24841, -24870, -24898, -24926, -24953, -24980, -25007, -25034, -25059, -25084, -25109, -25133,
  69. -25156, -25179, -25201, -25222, -25242, -25261, -25280, -25297, -25314, -25329, -25344, -25357, -25370, -25381, -25391, -25400,
  70. -25408, -25415, -25420, -25425, -25428, -25429, -25430, -25429, -25427, -25424, -25419, -25413, -25406, -25398, -25388, -25377,
  71. -25365, -25351, -25336, -25320, -25303, -25285, -25265, -25244, -25223, -25200, -25176, -25150, -25124, -25097, -25069, -25040,
  72. -25010, -24980, -24948, -24916, -24883, -24849, -24815, -24780, -24745, -24709, -24672, -24635, -24598, -24561, -24523, -24486,
  73. -24448, -24410, -24372, -24334, -24296, -24258, -24221, -24184, -24147, -24111, -24075, -24039, -24004, -23970, -23936, -23903,
  74. -23871, -23840, -23809, -23780, -23751, -23724, -23697, -23672, -23648, -23625, -23603, -23583, -23564, -23546, -23530, -23515,
  75. -23502, -23490, -23480, -23471, -23464, -23459, -23455, -23453, -23452, -23453, -23456, -23461, -23467, -23475, -23485, -23496,
  76. -23509, -23524, -23540, -23558, -23578, -23599, -23622, -23647, -23673, -23701, -23730, -23761, -23793, -23826, -23861, -23898,
  77. -23935, -23974, -24014, -24055, -24098, -24141, -24185, -24230, -24277, -24323, -24371, -24419, -24468, -24518, -24568, -24618,
  78. -24669, -24720, -24771, -24822, -24873, -24925, -24976, -25027, -25077, -25128, -25178, -25227, -25276, -25324, -25371, -25418,
  79. -25464, -25509, -25552, -25595, -25636, -25677, -25715, -25753, -25789, -25824, -25856, -25888, -25917, -25945, -25971, -25995,
  80. -26017, -26038, -26056, -26072, -26086, -26098, -26107, -26115, -26120, -26123, -26123, -26121, -26117, -26111, -26102, -26091,
  81. -26077, -26061, -26043, -26022, -25999, -25973, -25945, -25915, -25883, -25848, -25811, -25772, -25730, -25687, -25641, -25593,
  82. -25543, -25492, -25438, -25383, -25326, -25267, -25207, -25145, -25081, -25016, -24950, -24883, -24815, -24745, -24675, -24603,
  83. -24531, -24458, -24385, -24311, -24237, -24163, -24088, -24014, -23939, -23865, -23791, -23717, -23644, -23572, -23500, -23429,
  84. -23360, -23291, -23224, -23157, -23093, -23030, -22968, -22908, -22851, -22795, -22741, -22690, -22640, -22594, -22549, -22508,
  85. -22469, -22432, -22399, -22369, -22341, -22317, -22296, -22278, -22264, -22253, -22245, -22241, -22240, -22243, -22250, -22261,
  86. -22275, -22292, -22314, -22339, -22368, -22401, -22438, -22479, -22523, -22571, -22623, -22678, -22738, -22801, -22867, -22938,
  87. -23011, -23088, -23169, -23253, -23340, -23430, -23524, -23620, -23719, -23822, -23926, -24034, -24144, -24256, -24370, -24487,
  88. -24605, -24725, -24847, -24970, -25094, -25220, -25347, -25474, -25602, -25731, -25860, -25989, -26118, -26246, -26374, -26502,
  89. -26628, -26753, -26877, -27000, -27121, -27240, -27356, -27471, -27582, -27691, -27797, -27900, -27999, -28095, -28186, -28274,
  90. -28357, -28436, -28509, -28578, -28642, -28700, -28753, -28800, -28841, -28875, -28903, -28925, -28940, -28947, -28948, -28941,
  91. -28927, -28905, -28875, -28837, -28791, -28737, -28674, -28602, -28522, -28432, -28334, -28227, -28110, -27984, -27849, -27704,
  92. -27549, -27385, -27211, -27027, -26833, -26629, -26416, -26192, -25959, -25715, -25461, -25198, -24924, -24640, -24346, -24043,
  93. -23729, -23406, -23073, -22730, -22377, -22015, -21643, -21262, -20872, -20472, -20063, -19646, -19220, -18785, -18341, -17889,
  94. -17429, -16961, -16486, -16002, -15511, -15013, -14508, -13996, -13477, -12953, -12421, -11884, -11342, -10794, -10240, -9682,
  95. -9119, -8552, -7980, -7405, -6826, -6243, -5658, -5070, -4479, -3887, -3292, -2696, -2098, -1499, -900, -300,
  96. 300
  97. } ;
  98. */