FreeCalypso > hg > gsm-codec-lib
annotate doc/FR1-Rx-DTX-detail @ 585:3c6bf0d26ee7 default tip
TW-TS-005 reader: fix maximum line length bug
TW-TS-005 section 4.1 states:
The maximum allowed length of each line is 80 characters, not
including the OS-specific newline encoding.
The implementation of this line length limit in the TW-TS-005 hex file
reader function in the present suite was wrong, such that lines of
the full maximum length could not be read. Fix it.
Note that this bug affects comment lines too, not just actual RTP
payloads. Neither Annex A nor Annex B features an RTP payload format
that goes to the maximum of 40 bytes, but if a comment line goes to
the maximum allowed length of 80 characters not including the
terminating newline, the bug will be triggered, necessitating
the present fix.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 25 Feb 2025 07:49:28 +0000 |
parents | 62943a1ad64e |
children |
rev | line source |
---|---|
552
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 Rx DTX handler implementation details |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 ===================================== |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 As explained in the basic FR1-Rx-DTX article, an Rx DTX handler has to be |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 inserted between the output of the Rx radio subsystem and the input to the |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 basic GSM 06.10 speech decoder. In ThemWi codec library architecture, we |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 normally run a full decoder for GSM-FR that combines the Rx DTX handler and |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 the basic 06.10 decoder, and the Rx DTX handler block by itself also serves |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 as a TFO transform. |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 This Rx DTX handler is based on several GSM specs: 06.11 for the error |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 concealment function, 06.12 for the comfort noise insertion function, and 06.31 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 for overall Rx DTX handling. However, these specs give a lot of leeway to |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 implementors, hence it is prudent to document the specific choices made in the |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 present ThemWi implementation. |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 Error concealment implementation |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 ================================ |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 Error concealment is also called substitution and muting of lost frames. The |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 implementation of this function in Themyscira libgsmfr2 is based on the Example |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 solution presented in chapter 6 of 3GPP TS 46.011 (formerly GSM 06.11), applying |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 the most literal reading to this spec section. |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 When unusable frames (as defined in GSM 06.31) occur during speech state (i.e., |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 not following a SID), the present logic kicks in. For the first BFI following |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 good speech, the last speech frame is repeated verbatim. On the second BFI the |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 muting logic of Xmaxc reduction kicks in, decrementing each of the 4 Xmaxc |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 parameters by 4 with each emitted frame. RPE grid position parameters are |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 randomized at the same time. The frame in which all 4 Xmaxc parameters equal 0 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 (either because they were already 0 or because they got reduced to 0 by the |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 muting sequence) is the last frame emitted in this state; all subsequent BFIs |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 will be turned into fixed-bit-pattern silence frames as given in TS 46.011 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 Table 1. |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 If a BFI comes in when the Rx DTX handler is in its reset (or homed) state, the |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 output proceeds directly to silence frames. |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 Comfort noise insertion |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 ======================= |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 Comfort noise generation and updating is specified in GSM 06.12 section 6.1. |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 Most of this section is very straightforward, and is implemented in ThemWi |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 libgsmfr2 exactly as specified, except for the very last sentence in that |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 section: |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 "When updating the comfort noise, the parameters above should preferably be |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 interpolated over a few frames to obtain smooth transitions." |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 ThemWi implementation of Rx DTX handler in libgsmfr2 does not do this "should |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 preferably" part: no interpolation is done on CN parameters; as soon as each |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 SID update comes in, the new parameters are used immediately for all generated |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 CN frames. |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 Because the spec says "should preferably" rather than "shall", we can "get away" |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 with not implementing CN interpolation. But there is an even more profound |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 issue: we have yet to find anyone else's implementation, which we could use as |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 guidance, that does CN parameter interpolation for FRv1. (Such interpolation |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 is mandatory and defined in bit-exact terms for HRv1 and EFR, but FRv1 is a |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 different story.) |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 We had a hope that Nokia TCSM2 (a historical hw implementation of GSM TRAU |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 network element) might implement CN interpolation for FRv1 - but our |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 experimental findings on that platform are inconclusive: |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 * When acting as a TFO transform for FRv1, this TRAU does not interpolate CN |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 parameters, it makes abrupt changes in CN output just like our implementation |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 - but it effects a strange delay of 24 frames, suggesting that they have some |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 code paths that assume CN interpolation would be applied. |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 * When the TRAU acts as a regular speech decoder (not TFO), it is not clear how |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 it performs any of Rx DTX functions: Nokia chose to not implement the optional |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 in-band homing feature for FRv1, thus we have no way to explore bit-exact |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 behaviour of their speech decoder via test sequences. |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 Another enticing idea would be to statically reverse-engineer the DSP ROM of TI |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 Calypso chip and thus recover its complete speech Rx chain - but of course the |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 effort would be extremely massive, and is not likely to happen any time soon. |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 Until we either get around to the far-future task of Calypso DSP static |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 reversing or find some other implementation of GSM-FR Rx DTX handler that does |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 CN interpolation and whose operation we can replicate, we shall stick to the |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 simple approach of not doing CN interpolation. |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 Handling of SID frames with Xmaxc discrepancy |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 ============================================= |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 Per GSM 06.12 section 5.2, all 4 subframe Xmaxc parameters in a SID frame are |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 supposed to be equal, encoding the quantized form of mean(Xmax). However, what |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 should Rx DTX implementations do when they receive an otherwise-valid SID frame |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 in which these 4 parameters are not all equal? In our implementation, we handle |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 such discrepancy as follows: |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 * In those frame positions in which we receive a fresh SID (initial or update), |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 the CN frame we emit is a direct transformation of the received SID, and all |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 4 Xmaxc parameters are passed through intact. |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 * When we emit CN frames based on remembered LARc and Xmaxc parameters, we use |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 the last-subframe Xmaxc from the most recently received SID frame. |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 Lost SID handling and CN muting |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 =============================== |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 |
555
62943a1ad64e
doc/FR1-Rx-DTX-detail: grammar fix
Mychaela Falconia <falcon@freecalypso.org>
parents:
552
diff
changeset
|
104 In accord with GSM 06.11 section 5.3, when we receive an unusable frame in a |
552
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 TAF position during CN insertion state, we set a flag that remembers this |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 condition, but don't switch to CN muting right away. Per section 5.4 of the |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 same spec, we initiate CN muting when a second lost SID event occurs (unusable |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 frame received in a TAF position) without intervening good speech frames or |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 accepted SID frames. |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 When we do enter CN muting state, we decrement CN Xmaxc (always the same for |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 all 4 subframes) by 4 on each output frame, following the Example solution of |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 3GPP TS 46.011 (formerly GSM 06.11) chapter 6. Once this CN Xmaxc reaches 0, |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 we switch to emitting fixed-bit-pattern silence frames of TS 46.011 Table 1. |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 Handling of invalid SID frames |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 ============================== |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 In agreement with GSM 06.31 spec, we recognize invalid SID and invoke the |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 appropriate handler in all 3 combinations: BFI=0 SID=1, BFI=1 SID=1, and |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 BFI=1 SID=2. The real complexity, however, lies in what that invalid SID |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 handler actually does: |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 * If invalid SID arrives when we are already in CN insertion state, we treat it |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 the same as an unusable frame (continue CN output with current parameters), |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 but the flag of lost SID is reset, as required by our interpretation of the |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 specs. |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 * If invalid SID arrives in CN muting state, i.e., after two consecutive lost |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 SID events, the muting continues unaffected, i.e., we don't "rejuvenate" |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 already-started-muting comfort noise upon receiving invalid SID. |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 * If invalid SID arrives in good speech state, meaning that we are supposed to |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 begin a CN insertion period but we didn't get usable parameters for it, we |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 obtain LARc and mean(Xmax) parameters from the last good speech frame, |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 following the second option permitted by the "NOTE" at the end of GSM 06.31 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 section 6.1.2. To get Xmaxc for CN, we dequantize all 4 Xmaxc parameters of |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 the last good speech frame, average them, then requantize. |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 * If invalid SID arrives in speech muting state, the invalid SID is ignored and |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 speech muting continues unaffected. |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 * If invalid SID arrives in NO_DATA state (initial state out of reset, or the |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 state after either speech or CN muting has fully decayed), we emit the fixed |
6ab066180ec2
doc: new article FR1-Rx-DTX-detail
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 silence frame of TS 46.011 Table 1. |