FreeCalypso > hg > gsm-net-reveng
annotate doc/TFO-xform/FRv1 @ 37:4ab7cc414ed2
doc/TFO-xform/EFR: document CN insertion
| author | Mychaela Falconia <falcon@freecalypso.org> | 
|---|---|
| date | Tue, 03 Sep 2024 21:20:47 +0000 | 
| parents | 35d38348c880 | 
| children | 
| rev | line source | 
|---|---|
| 34 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 1 Rx DTX handler situation in FRv1 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 2 ================================ | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 3 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 4 Before we address the question of how one should implement TFO transform for | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 5 FRv1, let's begin with a more basic question: how does the Rx DTX handler (the | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 6 "front end" part of the speech decoder in an end-terminal implementation) work | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 7 in FRv1? In both HRv1 and EFR, error-free comfort noise generation functions | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 8 of this Rx DTX handler are normative per the specs at bit-exact level, while | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 9 error handling functions are specified only as a non-normative example - and | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 10 the supplied reference C sources implement the full Rx DTX handler (both the | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 11 normative part and the "example" part) as an inseparable part of the speech | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 12 decoder. But not so for FRv1: there is no reference C source and there are no | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 13 bit-exact definitions for any part of Rx DTX handler logic. All Rx DTX handler | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 14 functions are defined only in English prose (no code), and even in the most | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 15 normative parts the language used in the specs is quite loose. | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 16 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 17 Based on what is specified (verbally, loosely) in GSM 06.11 and 06.12, there | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 18 are two principal ways in which an Rx-ECU-capable, Rx-DTX-capable FRv1 speech | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 19 decoder can be implemented: | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 20 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 21 Fully modular approach: the basic GSM 06.10 decoder block (which is bit-exact, | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 22 but cannot handle BFIs or SID frames) remains absolutely unmodified, while the | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 23 Rx DTX handler (which includes both error concealment and CN generation) is | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 24 implemented as a modular piece, with an "honest-to-god" 260-bit 06.10 frame | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 25 interface between the two blocks. | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 26 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 27 Non-modular approach: the Rx DTX handler and the 06.10-based speech decoder are | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 28 integrated more tightly, and there is no possible stream of "pure" 06.10 codec | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 29 frames that would produce the same bit-exact PCM output as the actually | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 30 implemented "full decoder" with the built-in Rx DTX handler. | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 31 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 32 Cursory reading of GSM 06.11 and 06.12 specs strongly suggests that they call | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 33 for the fully modular approach as defined above. However, because neither spec | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 34 includes any bit-exact definitions, there is no formal stipulation that the | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 35 modular approach shall be used - it is entirely conceivable that someone could | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 36 implement a non-modular approach, and they would still be spec-compliant. | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 37 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 38 Why would anyone implement the non-modular approach when the fully modular one | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 39 seems much simpler? After all, the bit-exact basic 06.10 decoder already | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 40 exists - surely it is easier to build a separate front-end to it than dig into | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 41 the guts of that pre-existing box? There is, however, one aspect that could | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 42 sway implementors toward the non-modular approach: interpolation of CN | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 43 parameter updates during prolonged DTX pauses. GSM 06.12 (or rather its latest | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 44 incarnation as 3GPP TS 46.012) says, at the very end of section 6.1: | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 45 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 46 "When updating the comfort noise, the parameters above should preferably be | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 47 interpolated over a few frames to obtain smooth transitions." | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 48 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 49 This kind of CN parameter interpolation is mandatory in the newer HRv1 and EFR | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 50 codecs where the CN generator function is defined in bit-exact terms, hence it | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 51 makes sense that some implementors may have chosen to back-port the same feature | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 52 to FRv1. | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 53 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 54 CN parameter interpolation: deeper analysis of the problem | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 55 ========================================================== | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 56 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 57 How does this interpolation feature affect the choice of modular or non-modular | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 58 design? As a non-expert on the subject of codec design, I am not able to say | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 59 authoritatively if it is possible to implement the feature of CN parameter | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 60 interpolation (and do it well) while staying with the fully modular design in | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 61 which the basic 06.10 decoder block remains absolutely unchanged, or if high- | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 62 quality implementation of this feature would require foregoing the modularity | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 63 and moving the CN-specific interpolation function somewhere inside that block, | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 64 e.g., between the output of GSM 06.10 section 4.2.8 and the input to section | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 65 4.2.9, as referenced from section 4.3.3 for the decoder. | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 66 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 67 We can, however, look at how ETSI handled this problem in other codecs for | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 68 which they did mandate CN parameter interpolation in bit-exact form. HRv1 is | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 69 the best point of comparison in this regard because of this detail: the Rx DTX | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 70 handler front-end part of the official bit-exact HRv1 decoder (delivered as C | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 71 source this time, not just verbiage) is _almost_ modular, i.e., one could | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 72 _almost_ detach it into a modular piece whose output could be fed to the | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 73 decoder as a new "cleaned up" stream of HRv1 codec frames. Where is the | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 74 "almost" part? Answer: interpolation of CN parameters! When HRv1 decoder is | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 75 in CN insertion state, it dequantizes R0 and LPC parameters from SID frames | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 76 only when initial and update frames come in - but when it generates the actual | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 77 CN between those updates, it performs smooth linear interpolation on the decoded | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 78 parameters, *without* requantizing them into something that can be retransmitted | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 79 as new HRv1 codec frames representing the CN. | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 80 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 81 Once again, as a non-expert on the subject of codec design, I am not able to say | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 82 authoritatively if the same approach that was prescribed by ETSI for HRv1 would | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 83 also work for FRv1, or if CN parameter interpolation for FRv1 can be done well | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 84 by requantizing the interpolated parameters for each individual CN output frame | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 85 and feeding them to a strictly unmodified 06.10 decoder block. It is the case, | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 86 however, that there is no pre-existing implementation available to us which we | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 87 can look at that does CN parameter interpolation for FRv1 - the TFO transform | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 88 in Nokia TCSM2 does _not_ interpolate - hence without a reference to look at, | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 89 this optional feature is a can of worms which we should stay away from. | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 90 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 91 Front-end part of the speech decoder and TFO transform | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 92 ====================================================== | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 93 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 94 If the party who implemented the regular end-decoder for FRv1 chose the fully | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 95 modular approach, either by disregarding the call for interpolation of CN | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 96 parameters (the spec language is "should preferably", rather than "shall") or | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 97 by requantizing the interpolated parameters on each CN output frame, then a | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 98 corresponding implementation of TFO transform for non-DTXd operation becomes | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 99 trivial: the modularized Rx DTX handler front-end can also serve unchanged as | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 100 the TFO transform! | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 101 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 102 This just-described situation holds for the current Themyscira Wireless | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 103 implementation of FRv1 codec, named libgsmfr2. (The 2 in the library name | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 104 refers to the major version of library API and dependency structure; the codec | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 105 it implements is still FRv1.) Specifically: | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 106 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 107 * The full decoder implementation in libgsmfr2 follows the modular approach: | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 108 the front-end Rx DTX handler preprocessor feeds "cleaned up" FRv1 codec frames | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 109 to an unmodified GSM 06.10 decoder. | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 110 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 111 * No interpolation is done on CN parameters: as soon as each SID update comes | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 112 in, the new parameters are used immediately for all generated CN frames. | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 113 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 114 The preprocessor part of libgsmfr2 is thus already suitable to serve as a TFO | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 115 transform for FRv1. However, before formally adopting it as such, I have had a | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 116 long-standing desire to see how this function was implemented by other vendors; | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 117 particularly, how it's been implemented in real historical TRAUs. | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 118 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 119 Nokia TCSM2 TRAU implementation | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 120 =============================== | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 121 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 122 As of 2024-08, we finally have a working bank-of-TRAUs apparatus in our lab: | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 123 Nokia TCSM2. This TRAU implements TFO for FRv1, HRv1 and EFR, hence we finally | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 124 got the ability to see how this vendor (Nokia) implemented the elusive TFO | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 125 transform. | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 126 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 127 Here are our findings: | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 128 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 129 Error concealment function | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 130 -------------------------- | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 131 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 132 Themyscira implementation is based on the "example solution" of TS 46.011 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 133 chapter 6; Nokia's implementation appears to be very similar, with only a few | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 134 visible differences: | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 135 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 136 * When the ECU enters the state of "speech muting" (after the first speech-state | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 137 BFI for which the last good speech frame is simply repeated), instead of | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 138 decrementing each of the 4 Xmaxcr numbers by 4, it decrements them by 11, | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 139 thereby producing noticeably faster muting than what the spec calls for. | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 140 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 141 * The state of emitting fixed silence frames is entered not after the | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 142 algorithmically-muted frame in which the lowest Xmaxcr reached 0 (my reading | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 143 of the "example solution" in the spec), but after the state of algorithmic | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 144 muting (decrementing Xmaxcr's by 11 each time) persisted for exactly 5 frames. | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 145 If the original speech frame had its highest Xmaxcr equal to 63, the last | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 146 algorithmically muted frame before fixed silence frames will have 8 in that | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 147 Xmaxcr; if all starting Xmaxcr numbers were low, there will be 5 frames with | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 148 all zeros in Xmaxcr, random Mcr and other parameters unchanged before the | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 149 switch to fixed silence frames. | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 150 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 151 Nokia's TFO transform exhibits additional logic whereby the first good speech | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 152 frame after prolonged BFIs has its highest Xmaxcr reduced (but not messed with | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 153 otherwise); if that good speech frame is again followed by BFIs, the ECU goes | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 154 back to silence frame output right away - or at least that's what we saw in one | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 155 experiment. This aspect has not been studied in detail. | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 156 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 157 Comfort noise generation (DTXd=0) | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 158 --------------------------------- | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 159 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 160 The comfort noise output from Nokia's TFO transform generally agrees with my | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 161 reading of GSM 06.12 spec section 6.1, the section that describes CN generation. | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 162 However, the following parts were surprising/unexpected: | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 163 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 164 1) The TRAU reacts to SID updates with a delay of 24 frames. Suppose that frame | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 165 #20 in the input is the initial SID, frame #24 (TAF position) is the first | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 166 SID update, frame #48 is the next SID update and so forth. In the output | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 167 from Nokia's TFO transform, the updated parameters from input frame #24 will | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 168 appear in output frame #48, those from input frame #48 will appear in output | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 169 frame #72 and so forth. There is no sensible explanation for this extraneous | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 170 buffering delay; at first I thought it was an artifact of the CN parameter | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 171 interpolation mechanism, but: | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 172 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 173 2) No interpolation is done! I deliberately constructed input sequences in | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 174 which each subsequent SID update has wildly different parameters from the | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 175 previous, and when the changeover does happen in the DL output after the | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 176 strange delay of 24 frames, the change is immediate and abrupt. | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 177 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 178 CN muting after two missed SID updates (BFI received instead of SID in the TAF | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 179 position twice in a row) is done the same way as speech muting: the TRAU emits | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 180 exactly 5 frames with decreasing Xmaxcr (same decrement by 11), then switches | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 181 to emitting fixed silence frames. | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 182 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 183 SID forwarding (DTXd=1) | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 184 ----------------------- | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 185 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 186 When DTXd is enabled on the destination call leg and the input frame stream to | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 187 the TFO transform includes SID frames (considering only valid SID for now), the | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 188 transform does not generate comfort noise - instead received SID frames are | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 189 passed through to call leg B DL, unless they are invalid SID or the muting | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 190 mechanism has to kick in because of lost SID updates. | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 191 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 192 Nokia's implementation does pass valid SID frames through (I haven't tested | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 193 invalid SID yet), but it applies the same weird delay of 24 frames to the | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 194 switchover point for each update as it does when generating CN for DTXd=0. | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 195 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 196 However, the part where Nokia's TFO transform (at least for FRv1) is plain | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 197 broken is CN muting in the case of lost SID updates. Here is what it does: it | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 198 decrements Xmaxcr by 4 (yes, by 4, not by 11) once every 24 frames (probably in | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 199 each TAF position), such that if the level of CN was very high before channel | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 200 breakdown, it will take up to 7.68 s before this CN is fully muted at the end | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 201 receiver. | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 202 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 203 GSM 06.12 section 5.4 says: "For the second lost SID frame, a muting technique | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 204 shall be used on the comfort noise that will gradually decrease the output | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 205 level, resulting in silencing of the output after a maximum of 320 ms." The | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 206 spec gives a maximum of 320 ms for total muting of CN, but with Nokia's TFO | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 207 transform in DTXd=1 case, that maximum time is 7.68 s - spec requirement | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 208 violated. | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 209 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 210 Only TFO, or regular FRv1 decoder too? | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 211 -------------------------------------- | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 212 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 213 How does the regular FRv1 speech decoder (the one that ultimately emits G.711) | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 214 in Nokia TCSM2 TRAU implementation compare to what we've observed with their | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 215 TFO transform? Do they use a modular design where the regular decoder is a copy | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 216 of the same TFO transform followed by a standard GSM 06.10 decoder block, or do | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 217 they do something fancier? | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 218 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 219 Unfortunately we have no realistic way to answer this question: Nokia chose to | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 220 not implement the optional in-band homing mechanism for FRv1, thus we have no | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 221 way to pass test sequences through the TRAU in the decoder direction and see if | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 222 the output matches our hypothesis as to decoder logic. Hence the TFO transform | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 223 is the only part whose detailed behaviour we can realistically study in this | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 224 TRAU. | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 225 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 226 Take-away for Themyscira implementation | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 227 ======================================= | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 228 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 229 My take-away points from the preceding examination of FRv1 TFO transform in | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 230 Nokia TCSM2 are: | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 231 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 232 * Our current Rx DTX handler front-end in libgsmfr2 is fine - Nokia's | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 233 implementation is not any fancier at least in the case of TFO. | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 234 | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 235 * Modularity is a good thing, and so is consistency. There is nothing wrong | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 236 with using the same Rx DTX handler block both as our TFO transform and as the | 
| 
35d38348c880
doc/TFO-xform/FRv1: article written
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 237 front-end portion of the full decoder in end terminal operation. | 
