-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSFUGraph.src
122 lines (106 loc) · 4.19 KB
/
SFUGraph.src
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
SFU_CreateGraph("SFUGraph");
Defines:
CIC_N = 8; CIC_M = 2; CIC_R = 64; CIC_Shift = 26;
/* CIC Filter parameters for Input 3.072 MHz, Output: 48 KHz, DynOut = N*Log2(R*M) = 8*Log2(128) = 56 => Shift = 24 for Q31, 31 for Q24 */
Filters:
/* {CRFB_INT, {B0, B1, B2, B3, B4, mB5,
mA0, mA1, mA2, mA3, mA4,
mG0, mG1,
PRS0, PRS1, LBS0, LBS1,
QP, QN
}
}
*/
Modulator_Lin = {CRFB_INT, {5540, 70669, 458739, 2098672, 4665325, -8388608,
-5540, -70669, -458739, -2098672, -4665325,
-4248414, -1500259,
-23, -23, -8, -8,
0x2000000, -0x2000000
}
};
/* {F_LIMITER, {GSm0, GSm1, ESmU0, ESmU1, ESmD0, ESmD1, KLow, KUp, HC0, HC1, HC2, HC3, HC4, HC5}} */
Lim1 =
{
LIMITER,
{
// GSm0, GSm1
8304722, 83885, // gain smooth
// ESmU0, ESmU1
4194304, 4194304, // envelope smooth up
// ESmD0, ESmD1
8367636, 20971, // envelope smooth down
// KLow KUp
4996776, 14082828, // knee thresholds (9dB)
// HC0 HC1 HC2 HC3 HC4 HC5
8825263, -60131372, 165356217, -226595183, 138739640, 3282384 // knee coeffs
}
};
low_pass =
{
IIR_BQ_DF2,
{
7,
{1824866486, -1857862629, 1824866486, 1253386164, -1011150449, 30, -30},
{1712998928, -1607856615, 1712998928, 1264736859, -949070892, -1, -30},
{1485667560, -1142185902, 1485667560, 1291717454, -856131197, -1, -30},
{1162158380, -469195325, 1162158380, 1333597547, -728109650, -1, -30},
{1700546851, 665236287, 1700546851, 1381972250, -585686140, -1, -30},
{1172792389, 1980345068, 1172792389, 1416600017, -485001248, -2, -30},
{1146334814, -1203631827, 1146334814, 1257472648, -1054745291, -1, -30},
-38
}
};
high_filter_48K_50_to_100 =
{
IIR_BQ_DF2,
{
4,
{872502937, -1744894556, 872502937, 2132701300, -1059726658, 30, -30},
{878054114, -1756055335, 878054114, 2109794639, -1037245619, 1, -30},
{941417629, -1882827977, 941417629, 2059596646, -988041281, 2, -30},
{860620255, -1721093514, 860620255, 2143111282, -1069999529, 4, -30},
-36
}
};
Nodes:
PdmIn = Node(PDM_IN, CIC_N, CIC_M, CIC_R, CIC_Shift); // 3.072 MHZ Pdm In -> 48 KHz PCM out
Resampler48To16kHz = Node(RESAMPLER.0, -3, 0); // 48 KHz PCM -> 16 KHz PCM out
MemOut = Node(MEM_OUT);
MemIn = Node(MEM_IN);
Norm = Node(NORMSAT.0);
Lim1 = Node(LIMITER, 3, Lim1);
split = Node(SPLITTER.0, 2);
Resampler16To48kHz = Node(RESAMPLER.1, 3, 0); // 16 KHz PCM -> 48 KHz PCM out
PdmOut1 = Node(PDM_OUT, 4, Modulator_Lin); // 48 KHz PCM -> 3.072 MHZ Pdm Out
PdmOut2 = Node(PDM_OUT, 4, Modulator_Lin); // 48 KHz PCM -> 3.072 MHZ Pdm Out
hp_filter_in = Node(GFU.1, high_filter_48K_50_to_100);
hp_filter_out = Node(GFU.2, high_filter_48K_50_to_100);
Configure:
PdmIn.EnableRTCheck = 1;
//PdmOut1.EnableRTCheck = 1;
Norm.EnableSat = 0;
Norm.Precision = 24;
Norm.Scaling = 0;
//Lim1.Decimation = 0;
hp_filter_in.ExtendedPrecision = 1;
hp_filter_in.Reconfigurable = 1;
hp_filter_in.Saturate = 1;
hp_filter_in.VolumeEnable = 0;
hp_filter_in.Volume = 0;
hp_filter_out.ExtendedPrecision = 1;
hp_filter_out.Reconfigurable = 1;
hp_filter_out.Saturate = 1;
hp_filter_out.VolumeEnable = 0;
hp_filter_out.Volume = 0;
Connects:
Connect(PdmIn, hp_filter_in);
Connect(hp_filter_in, Resampler48To16kHz);
Connect(Resampler48To16kHz, MemOut);
Connect(MemIn, Resampler16To48kHz);
Connect(Resampler16To48kHz, hp_filter_out);
Connect(hp_filter_out, Lim1);
Connect(Lim1, Norm);
Connect(Norm, split);
Connect(split.0, PdmOut1);
Connect(split.1, PdmOut2);
SFU_CloseGraph();