Formatting has been fixed

This commit is contained in:
Belousov Oleg
2026-07-28 08:36:09 +03:00
parent e5a3e8326f
commit 8975d9eb53
2 changed files with 337 additions and 28 deletions
+258 -18
View File
@@ -105,22 +105,262 @@ class FrequencyTranslator {
}
static constexpr std::array<int16_t, 256> sine_q15_{{
0, 804, 1608, 2410, 3212, 4011, 4808, 5602, 6393, 7179, 7962, 8739, 9512, 10278, 11039, 11793,
12539, 13279, 14010, 14732, 15446, 16151, 16846, 17530, 18204, 18868, 19519, 20159, 20787, 21403, 22005, 22594,
23170, 23731, 24279, 24811, 25329, 25832, 26319, 26790, 27245, 27683, 28105, 28510, 28898, 29268, 29621, 29956,
30273, 30571, 30852, 31113, 31356, 31580, 31785, 31971, 32137, 32285, 32412, 32521, 32609, 32678, 32728, 32757,
32767, 32757, 32728, 32678, 32609, 32521, 32412, 32285, 32137, 31971, 31785, 31580, 31356, 31113, 30852, 30571,
30273, 29956, 29621, 29268, 28898, 28510, 28105, 27683, 27245, 26790, 26319, 25832, 25329, 24811, 24279, 23731,
23170, 22594, 22005, 21403, 20787, 20159, 19519, 18868, 18204, 17530, 16846, 16151, 15446, 14732, 14010, 13279,
12539, 11793, 11039, 10278, 9512, 8739, 7962, 7179, 6393, 5602, 4808, 4011, 3212, 2410, 1608, 804,
0, -804, -1608, -2410, -3212, -4011, -4808, -5602, -6393, -7179, -7962, -8739, -9512, -10278, -11039, -11793,
-12539, -13279, -14010, -14732, -15446, -16151, -16846, -17530, -18204, -18868, -19519, -20159, -20787, -21403, -22005, -22594,
-23170, -23731, -24279, -24811, -25329, -25832, -26319, -26790, -27245, -27683, -28105, -28510, -28898, -29268, -29621, -29956,
-30273, -30571, -30852, -31113, -31356, -31580, -31785, -31971, -32137, -32285, -32412, -32521, -32609, -32678, -32728, -32757,
-32767, -32757, -32728, -32678, -32609, -32521, -32412, -32285, -32137, -31971, -31785, -31580, -31356, -31113, -30852, -30571,
-30273, -29956, -29621, -29268, -28898, -28510, -28105, -27683, -27245, -26790, -26319, -25832, -25329, -24811, -24279, -23731,
-23170, -22594, -22005, -21403, -20787, -20159, -19519, -18868, -18204, -17530, -16846, -16151, -15446, -14732, -14010, -13279,
-12539, -11793, -11039, -10278, -9512, -8739, -7962, -7179, -6393, -5602, -4808, -4011, -3212, -2410, -1608, -804,
0,
804,
1608,
2410,
3212,
4011,
4808,
5602,
6393,
7179,
7962,
8739,
9512,
10278,
11039,
11793,
12539,
13279,
14010,
14732,
15446,
16151,
16846,
17530,
18204,
18868,
19519,
20159,
20787,
21403,
22005,
22594,
23170,
23731,
24279,
24811,
25329,
25832,
26319,
26790,
27245,
27683,
28105,
28510,
28898,
29268,
29621,
29956,
30273,
30571,
30852,
31113,
31356,
31580,
31785,
31971,
32137,
32285,
32412,
32521,
32609,
32678,
32728,
32757,
32767,
32757,
32728,
32678,
32609,
32521,
32412,
32285,
32137,
31971,
31785,
31580,
31356,
31113,
30852,
30571,
30273,
29956,
29621,
29268,
28898,
28510,
28105,
27683,
27245,
26790,
26319,
25832,
25329,
24811,
24279,
23731,
23170,
22594,
22005,
21403,
20787,
20159,
19519,
18868,
18204,
17530,
16846,
16151,
15446,
14732,
14010,
13279,
12539,
11793,
11039,
10278,
9512,
8739,
7962,
7179,
6393,
5602,
4808,
4011,
3212,
2410,
1608,
804,
0,
-804,
-1608,
-2410,
-3212,
-4011,
-4808,
-5602,
-6393,
-7179,
-7962,
-8739,
-9512,
-10278,
-11039,
-11793,
-12539,
-13279,
-14010,
-14732,
-15446,
-16151,
-16846,
-17530,
-18204,
-18868,
-19519,
-20159,
-20787,
-21403,
-22005,
-22594,
-23170,
-23731,
-24279,
-24811,
-25329,
-25832,
-26319,
-26790,
-27245,
-27683,
-28105,
-28510,
-28898,
-29268,
-29621,
-29956,
-30273,
-30571,
-30852,
-31113,
-31356,
-31580,
-31785,
-31971,
-32137,
-32285,
-32412,
-32521,
-32609,
-32678,
-32728,
-32757,
-32767,
-32757,
-32728,
-32678,
-32609,
-32521,
-32412,
-32285,
-32137,
-31971,
-31785,
-31580,
-31356,
-31113,
-30852,
-30571,
-30273,
-29956,
-29621,
-29268,
-28898,
-28510,
-28105,
-27683,
-27245,
-26790,
-26319,
-25832,
-25329,
-24811,
-24279,
-23731,
-23170,
-22594,
-22005,
-21403,
-20787,
-20159,
-19519,
-18868,
-18204,
-17530,
-16846,
-16151,
-15446,
-14732,
-14010,
-13279,
-12539,
-11793,
-11039,
-10278,
-9512,
-8739,
-7962,
-7179,
-6393,
-5602,
-4808,
-4011,
-3212,
-2410,
-1608,
-804,
}};
std::array<uint32_t, 256> oscillator_q15_{};
@@ -197,8 +437,8 @@ class FrequencyTranslatingDecimator32By8 {
* a one-sided phase and rounding error across the whole filter. */
uint32_t phase = static_cast<uint32_t>(
-((static_cast<int64_t>(
static_cast<int32_t>(tap_phase_increment)) *
static_cast<int64_t>(taps_count - 1)) /
static_cast<int32_t>(tap_phase_increment)) *
static_cast<int64_t>(taps_count - 1)) /
2));
for (size_t i = 0; i < taps_count; ++i) {
int32_t sine;
+79 -10
View File
@@ -53,8 +53,22 @@ constexpr fir_taps_real<16> taps_audio_wide_halfband_0{
.high_frequency_normalized = 80000.0f / 768000.0f,
.transition_normalized = 224000.0f / 768000.0f,
.taps = {{
-171, 0, 1144, 0, -4481, 0, 19892, 32767,
19892, 0, -4481, 0, 1144, 0, -171, 0,
-171,
0,
1144,
0,
-4481,
0,
19892,
32767,
19892,
0,
-4481,
0,
1144,
0,
-171,
0,
}},
};
@@ -69,14 +83,69 @@ constexpr fir_taps_real<63> taps_audio_spectrum_halfband{
.high_frequency_normalized = 0.23f,
.transition_normalized = 0.04f,
.taps = {{
-15, 0, 37, 0, -70, 0, 117, 0,
-184, 0, 274, 0, -393, 0, 548, 0,
-751, 0, 1018, 0, -1374, 0, 1872, 0,
-2622, 0, 3910, 0, -6794, 0, 20812, 32767,
20812, 0, -6794, 0, 3910, 0, -2622, 0,
1872, 0, -1374, 0, 1018, 0, -751, 0,
548, 0, -393, 0, 274, 0, -184, 0,
117, 0, -70, 0, 37, 0, -16,
-15,
0,
37,
0,
-70,
0,
117,
0,
-184,
0,
274,
0,
-393,
0,
548,
0,
-751,
0,
1018,
0,
-1374,
0,
1872,
0,
-2622,
0,
3910,
0,
-6794,
0,
20812,
32767,
20812,
0,
-6794,
0,
3910,
0,
-2622,
0,
1872,
0,
-1374,
0,
1018,
0,
-751,
0,
548,
0,
-393,
0,
274,
0,
-184,
0,
117,
0,
-70,
0,
37,
0,
-16,
}},
};