/* * Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc. * * This file is part of PortaPack. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef __DSP_FIR_TAPS_H__ #define __DSP_FIR_TAPS_H__ #include #include #include "complex.hpp" /* 3kHz/6.7kHz @ 96kHz. sum(abs(taps)): 89429 */ constexpr std::array taps_64_lp_031_070_tfilter { { 56, 58, 81, 100, 113, 112, 92, 49, -21, -120, -244, -389, -543, -692, -819, -903, -923, -861, -698, -424, -34, 469, 1073, 1756, 2492, 3243, 3972, 4639, 5204, 5634, 5903, 5995, 5903, 5634, 5204, 4639, 3972, 3243, 2492, 1756, 1073, 469, -34, -424, -698, -861, -923, -903, -819, -692, -543, -389, -244, -120, -21, 49, 92, 112, 113, 100, 81, 58, 56, 0, } }; /* 4kHz/7.5kHz @ 96kHz. sum(abs(taps)): 96783 */ constexpr std::array taps_64_lp_042_078_tfilter { { -19, 39, 72, 126, 197, 278, 360, 432, 478, 485, 438, 327, 152, -82, -359, -651, -922, -1132, -1236, -1192, -968, -545, 81, 892, 1852, 2906, 3984, 5012, 5910, 6609, 7053, 7205, 7053, 6609, 5910, 5012, 3984, 2906, 1852, 892, 81, -545, -968, -1192, -1236, -1132, -922, -651, -359, -82, 152, 327, 438, 485, 478, 432, 360, 278, 197, 126, 72, 39, -19, 0, } }; /* 5kHz/8.5kHz @ 96kHz. sum(abs(taps)): 101312 */ constexpr std::array taps_64_lp_052_089_tfilter { { -65, -88, -129, -163, -178, -160, -100, 9, 160, 340, 523, 675, 758, 738, 591, 313, -76, -533, -987, -1355, -1544, -1472, -1077, -335, 738, 2078, 3579, 5104, 6502, 7627, 8355, 8608, 8355, 7627, 6502, 5104, 3579, 2078, 738, -335, -1077, -1472, -1544, -1355, -987, -533, -76, 313, 591, 738, 758, 675, 523, 340, 160, 9, -100, -160, -178, -163, -129, -88, -65, 0, } }; /* 6kHz/9.6kHz @ 96kHz. sum(abs(taps)): 105088 */ constexpr std::array taps_64_lp_063_100_tfilter { { 43, 21, -2, -54, -138, -245, -360, -453, -493, -451, -309, -73, 227, 535, 776, 876, 773, 443, -86, -730, -1357, -1801, -1898, -1515, -585, 869, 2729, 4794, 6805, 8490, 9611, 10004, 9611, 8490, 6805, 4794, 2729, 869, -585, -1515, -1898, -1801, -1357, -730, -86, 443, 773, 876, 776, 535, 227, -73, -309, -451, -493, -453, -360, -245, -138, -54, -2, 21, 43, 0, } }; /* 7kHz/10.4kHz @ 96kHz: sum(abs(taps)): 110157 */ constexpr std::array taps_64_lp_073_108_tfilter { { 79, 145, 241, 334, 396, 394, 306, 130, -109, -360, -550, -611, -494, -197, 229, 677, 1011, 1096, 846, 257, -570, -1436, -2078, -2225, -1670, -327, 1726, 4245, 6861, 9146, 10704, 11257, 10704, 9146, 6861, 4245, 1726, -327, -1670, -2225, -2078, -1436, -570, 257, 846, 1096, 1011, 677, 229, -197, -494, -611, -550, -360, -109, 130, 306, 394, 396, 334, 241, 145, 79, 0, } }; /* 8kHz/11.5kHz @ 96kHz. sum(abs(taps)): 112092 */ constexpr std::array taps_64_lp_083_120_tfilter { { -63, -72, -71, -21, 89, 248, 417, 537, 548, 407, 124, -237, -563, -723, -621, -238, 337, 919, 1274, 1201, 617, -382, -1514, -2364, -2499, -1600, 414, 3328, 6651, 9727, 11899, 12682, 11899, 9727, 6651, 3328, 414, -1600, -2499, -2364, -1514, -382, 617, 1201, 1274, 919, 337, -238, -621, -723, -563, -237, 124, 407, 548, 537, 417, 248, 89, -21, -71, -72, -63, 0, } }; /* 9kHz/12.4kHz @ 96kHz. sum(abs(taps)): 116249 */ constexpr std::array taps_64_lp_094_129_tfilter { { 5, -93, -198, -335, -449, -478, -378, -144, 166, 444, 563, 440, 82, -395, -788, -892, -589, 73, 859, 1421, 1431, 734, -530, -1919, -2798, -2555, -837, 2274, 6220, 10103, 12941, 13981, 12941, 10103, 6220, 2274, -837, -2555, -2798, -1919, -530, 734, 1431, 1421, 859, 73, -589, -892, -788, -395, 82, 440, 563, 444, 166, -144, -378, -478, -449, -335, -198, -93, 5, 0, } }; /* 10kHz/13.4kHz @ 96kHz. sum(abs(taps)): 118511 */ constexpr std::array taps_64_lp_104_140_tfilter { { 89, 159, 220, 208, 84, -147, -412, -597, -588, -345, 58, 441, 595, 391, -128, -730, -1080, -914, -198, 793, 1558, 1594, 678, -942, -2546, -3187, -2084, 992, 5515, 10321, 13985, 15353, 13985, 10321, 5515, 992, -2084, -3187, -2546, -942, 678, 1594, 1558, 793, -198, -914, -1080, -730, -128, 391, 595, 441, 58, -345, -588, -597, -412, -147, 84, 208, 220, 159, 89, 0, } }; /* Wideband FM channel filter * 103kHz/128kHz @ 768kHz */ constexpr std::array taps_64_lp_130_169_tfilter { { 100, 127, 62, -157, -470, -707, -678, -332, 165, 494, 400, -85, -610, -729, -253, 535, 1026, 734, -263, -1264, -1398, -332, 1316, 2259, 1447, -988, -3474, -3769, -385, 6230, 13607, 18450, 18450, 13607, 6230, -385, -3769, -3474, -988, 1447, 2259, 1316, -332, -1398, -1264, -263, 734, 1026, 535, -253, -729, -610, -85, 400, 494, 165, -332, -678, -707, -470, -157, 62, 127, 100, } }; /* Wideband audio filter */ /* 96kHz int16_t input * -> FIR filter, <15kHz (0.156fs) pass, >19kHz (0.198fs) stop * -> 48kHz int16_t output, gain of 1.0 (I think). * Padded to multiple of four taps for unrolled FIR code. * sum(abs(taps)): 125270 */ constexpr std::array taps_64_lp_156_198 { { -27, 166, 104, -36, -174, -129, 109, 287, 148, -232, -430, -130, 427, 597, 49, -716, -778, 137, 1131, 957, -493, -1740, -1121, 1167, 2733, 1252, -2633, -4899, -1336, 8210, 18660, 23254, 18660, 8210, -1336, -4899, -2633, 1252, 2733, 1167, -1121, -1740, -493, 957, 1131, 137, -778, -716, 49, 597, 427, -130, -430, -232, 148, 287, 109, -129, -174, -36, 104, 166, -27, 0, } }; /* Narrowband FM filter */ /* 96kHz int16_t input * -> FIR filter, <4kHz (0.042fs) pass, Hamming window. * -> 48kHz int16_t output, gain of 1.0. * Padded to multiple of four taps for unrolled FIR code. * sum(abs(taps)): 81493 */ constexpr std::array taps_64_lp_042_hamming { { 51, 57, 61, 65, 63, 55, 35, 0, -52, -122, -207, -304, -402, -491, -556, -582, -552, -453, -271, 0, 363, 815, 1343, 1930, 2553, 3183, 3788, 4338, 4802, 5154, 5374, 5449, 5374, 5154, 4802, 4338, 3788, 3183, 2553, 1930, 1343, 815, 363, 0, -271, -453, -552, -582, -556, -491, -402, -304, -207, -122, -52, 0, 35, 55, 63, 65, 61, 57, 51, 0 } }; /* Narrowband FM filter */ /* 96kHz int16_t input * -> FIR filter, <6kHz (0.063fs) pass, Hamming window. * -> 48kHz int16_t output, gain of 1.0. * Padded to multiple of four taps for unrolled FIR code. * sum(abs(taps)): 92477 */ constexpr std::array taps_64_lp_063_hamming { { -20, -40, -59, -75, -83, -78, -52, 0, 77, 173, 272, 352, 386, 348, 221, 0, -300, -644, -974, -1219, -1304, -1158, -730, 0, 1016, 2261, 3641, 5034, 6305, 7325, 7985, 8213, 7985, 7325, 6305, 5034, 3641, 2261, 1016, 0, -730, -1158, -1304, -1219, -974, -644, -300, 0, 221, 348, 386, 352, 272, 173, 77, 0, -52, -78, -83, -75, -59, -40, -20, 0 } }; /* sum(abs(taps)): 85241 */ constexpr std::array taps_64_lp_063_blackman { { 0, 0, -2, -6, -11, -14, -11, 0, 24, 62, 110, 157, 188, 184, 125, 0, -194, -441, -704, -926, -1035, -957, -626, 0, 925, 2109, 3466, 4872, 6182, 7249, 7946, 8189, 7946, 7249, 6182, 4872, 3466, 2109, 925, 0, -626, -957, -1035, -926, -704, -441, -194, 0, 125, 184, 188, 157, 110, 62, 24, 0, -11, -14, -11, -6, -2, 0, 0, 0 } }; /* Narrowband FM filter */ /* 96kHz int16_t input * -> FIR filter, <8kHz (0.083fs) pass, Hamming window. * -> 48kHz int16_t output, gain of 1.0. * Padded to multiple of four taps for unrolled FIR code. * sum(abs(taps)): 99180 */ constexpr std::array taps_64_lp_083_hamming { { -26, 0, 32, 65, 90, 95, 67, 0, -100, -211, -294, -304, -208, 0, 288, 582, 782, 785, 524, 0, -702, -1412, -1901, -1931, -1322, 0, 1962, 4340, 6795, 8932, 10388, 10904, 10388, 8932, 6795, 4340, 1962, 0, -1322, -1931, -1901, -1412, -702, 0, 524, 785, 782, 582, 288, 0, -208, -304, -294, -211, -100, 0, 67, 95, 90, 65, 32, 0, -26, 0 } }; /* sum(abs(taps)): 92568 */ constexpr std::array taps_64_lp_083_blackman { { 0, 0, 1, 5, 12, 17, 15, 0, -32, -77, -119, -136, -101, 0, 164, 355, 508, 541, 381, 0, -560, -1173, -1636, -1717, -1209, 0, 1876, 4221, 6695, 8883, 10388, 10924, 10388, 8883, 6695, 4221, 1876, 0, -1209, -1717, -1636, -1173, -560, 0, 381, 541, 508, 355, 164, 0, -101, -136, -119, -77, -32, 0, 15, 17, 12, 5, 1, 0, 0, 0 } }; /* Narrowband FM filter */ /* 96kHz int16_t input * -> FIR filter, <10kHz (0.104fs) pass, Hamming window. * -> 48kHz int16_t output, gain of 1.0. * Padded to multiple of four taps for unrolled FIR code. * sum(abs(taps)): 106396 */ constexpr std::array taps_64_lp_104_hamming { { 53, 40, 8, -37, -83, -106, -82, 0, 123, 236, 272, 175, -54, -347, -571, -583, -299, 235, 833, 1215, 1116, 422, -728, -1934, -2625, -2254, -512, 2509, 6285, 9975, 12663, 13646, 12663, 9975, 6285, 2509, -512, -2254, -2625, -1934, -728, 422, 1116, 1215, 833, 235, -299, -583, -571, -347, -54, 175, 272, 236, 123, 0, -82, -106, -83, -37, 8, 40, 53, 0 } }; /* sum(abs(taps)): 99426 */ constexpr std::array taps_64_lp_104_blackman { { 0, 0, 0, -3, -11, -19, -18, 0, 39, 85, 110, 78, -26, -184, -325, -355, -194, 161, 605, 926, 889, 350, -626, -1717, -2397, -2109, -489, 2436, 6184, 9906, 12645, 13652, 12645, 9906, 6184, 2436, -489, -2109, -2397, -1717, -626, 350, 889, 926, 605, 161, -194, -355, -325, -184, -26, 78, 110, 85, 39, 0, -18, -19, -11, -3, 0, 0, 0, 0 } }; /* Narrowband AM audio filter */ /* 96kHz int16_t input * -> FIR filter, <3kHz (0.031fs) pass, >6kHz (0.063fs) stop * -> 48kHz int16_t output, gain of 1.0 (I think). * Padded to multiple of four taps for unrolled FIR code. * sum(abs(taps)): 94053 */ /* TODO: Review this filter, it's very quick and dirty. */ constexpr std::array taps_64_lp_031_063 { { -254, 255, 244, 269, 302, 325, 325, 290, 215, 99, -56, -241, -442, -643, -820, -950, -1009, -974, -828, -558, -160, 361, 992, 1707, 2477, 3264, 4027, 4723, 5312, 5761, 6042, 6203, 6042, 5761, 5312, 4723, 4027, 3264, 2477, 1707, 992, 361, -160, -558, -828, -974, -1009, -950, -820, -643, -442, -241, -56, 99, 215, 290, 325, 325, 302, 269, 244, 255, -254, 0, } }; #endif/*__DSP_FIR_TAPS_H__*/