FreeCalypso > hg > freecalypso-tools
comparison doc/Audio-mode-config @ 838:02d92d49c9f8
doc/Audio-mode-config: update for old vs new AEC
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Fri, 30 Jul 2021 05:21:19 +0000 |
| parents | 0321cd08b19f |
| children | 6a0fcbca8ac7 |
comparison
equal
deleted
inserted
replaced
| 837:724a6bc2a4b8 | 838:02d92d49c9f8 |
|---|---|
| 50 /aud/modename.vol is the corresponding volume setting file | 50 /aud/modename.vol is the corresponding volume setting file |
| 51 | 51 |
| 52 This paradigm is a good fit for "dumbphone" handsets in which there usually | 52 This paradigm is a good fit for "dumbphone" handsets in which there usually |
| 53 will be several different voice audio configurations for classic handheld | 53 will be several different voice audio configurations for classic handheld |
| 54 operation, for the hands-free loudspeaker mode, for operation with a wired | 54 operation, for the hands-free loudspeaker mode, for operation with a wired |
| 55 headset, and if the phone uses a loudspeaker (as opposed to a piezo buzzer) to | 55 headset, and if the phone uses its hands-free loudspeaker plus the Calypso DSP |
| 56 play ringtones and uses the Calypso DSP to generate those ringtone melodies, | 56 to play ringtones (as opposed to using a buzzer on BU/PWT or a ringtone player |
| 57 there will also need to be an output-only audio configuration for ringing. | 57 chip that drives the speaker bypassing the voice path), there will also need to |
| 58 be an output-only audio configuration for ringing. | |
| 58 | 59 |
| 59 How do the audio mode config files under /aud come into being? It appears that | 60 How do the audio mode config files under /aud come into being? It appears that |
| 60 TI's original intent was that a configuration would be manually constructed on | 61 TI's original intent was that a configuration would be manually constructed on |
| 61 a test device via TMSH auw commands, saved in the FFS of that test device with | 62 a test device via TMSH auw commands, saved in the FFS of that test device with |
| 62 the aus command, then read out of that test device FFS in binary form and | 63 the aus command, then read out of that test device FFS in binary form and |
| 91 up or down in the UI, the *.vol file _corresponding to the current mode_ will | 92 up or down in the UI, the *.vol file _corresponding to the current mode_ will |
| 92 be updated by the running fw. Thus the fw would maintain a separate notion of | 93 be updated by the running fw. Thus the fw would maintain a separate notion of |
| 93 the current volume for ringing, for the earpiece speaker, for the hands-free | 94 the current volume for ringing, for the earpiece speaker, for the hands-free |
| 94 loudspeaker and for the wired headset, something which Pirelli's fw very | 95 loudspeaker and for the wired headset, something which Pirelli's fw very |
| 95 notoriously fails to do. | 96 notoriously fails to do. |
| 97 | |
| 98 Old vs. new AEC | |
| 99 =============== | |
| 100 | |
| 101 One of the settings in the audio mode config structure underwent an evolutionary | |
| 102 change within the span of history that is relevant to FreeCalypso - this setting | |
| 103 is the configuration for AEC, the Acoustic Echo Cancellation functional block | |
| 104 of the Calypso DSP. As TI's GSM DSPs evolved (before, during and after the | |
| 105 Calypso era), their AEC implementation evolved along with the rest, and | |
| 106 different evolutionary versions of AEC require different configuration and | |
| 107 tuning parameters. When the audio mode facility was first implemented, the AEC | |
| 108 block in TI's GSM DSPs of that time was controlled with a single 16-bit control | |
| 109 word; the people in the SSA group who implemented RiViera Audio Service then | |
| 110 decided to split different bits from this one DSP control word into 5 different | |
| 111 parameter words, and the result was the "old" 5-word AEC config. | |
| 112 | |
| 113 But the version of AEC implemented in the DSP ROM in the Calypso silicon version | |
| 114 we work with is slightly newer; this version corresponds to what TI's L1 code | |
| 115 calls L1_NEW_AEC. However, the waters then got muddied: for reasons which we | |
| 116 (FreeCalypso team) cannot understand (perhaps miscommunication between different | |
| 117 groups at TI), TI's TCS211 reference firmware shipped with L1_NEW_AEC disabled | |
| 118 (C preprocessor symbol set to 0 instead of 1), even though the underlying DSP | |
| 119 AEC block (combination of ROM and official patches) is the "new" kind and not | |
| 120 the "old" one. There are two fallouts from this software misconfiguration on | |
| 121 TI's part: | |
| 122 | |
| 123 1) If one takes stock TCS211 from TI or any derivative version in which this | |
| 124 aspect is unchanged (all mokoN firmwares, and all FC firmwares up to | |
| 125 Magnetite) and tries to enable AEC, the result will be a poor AEC | |
| 126 configuration: the old echo level and long vs short settings do nothing on | |
| 127 the new DSP, whereas the new tunable parameters will remain at their defaults | |
| 128 with no way to tweak them. I (Mother Mychaela) can only guess that this | |
| 129 situation is what Openmoko must have run into when they tried to get AEC | |
| 130 working. | |
| 131 | |
| 132 2) When someone downstream of TI figures out that L1_NEW_AEC needs to be changed | |
| 133 from 0 to 1 and actually makes that change, like we did in our Tourmaline fw, | |
| 134 the format and size of the audio mode binary structure change, and all old | |
| 135 audio mode config files become invalid. | |
| 136 | |
| 137 Our FreeCalypso work is affected by point 2 above: we started working with audio | |
| 138 mode config files in 2017, using the old AEC configuration, and only made the | |
| 139 switch to L1_NEW_AEC in 2021. We now have two kinds of audio mode config binary | |
| 140 files: the old kind that are 164 bytes long, and the new kind that are 176 bytes | |
| 141 long. Our Tourmaline firmware has L1_NEW_AEC enabled, while Magnetite (our | |
| 142 legacy backward compatiblity fw) has it disabled. | |
| 143 | |
| 144 To prevent loading of garbage into AEC config when an audio mode file of the | |
| 145 wrong kind is loaded, we have implemented the following workaround in both | |
| 146 Tourmaline and Magnetite: if the loaded mode config file has the wrong length, | |
| 147 the AEC config is set to the default disabled state instead of whatever is in | |
| 148 the mode file - loading an AEC config of the wrong format is not possible. | |
| 96 | 149 |
| 97 Default audio configuration | 150 Default audio configuration |
| 98 =========================== | 151 =========================== |
| 99 | 152 |
| 100 The default audio config set in the Iota ABB registers and in the DSP when no | 153 The default audio config set in the Iota ABB registers and in the DSP when no |
| 121 fir 24 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 | 174 fir 24 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 |
| 122 } | 175 } |
| 123 sidetone -5 | 176 sidetone -5 |
| 124 aec 0 0 0 0 0 | 177 aec 0 0 0 0 0 |
| 125 | 178 |
| 179 The above version is the one produced by Magnetite and earlier firmwares without | |
| 180 L1_NEW_AEC; in the new Tourmaline version the last line changes to: | |
| 181 | |
| 182 aec-new 0 0 0x1 0x7FFF 0x1FFF 0x4000 0x32 0x1000 0x1000 0 0 0 | |
| 183 | |
| 126 The meaning is as follows: | 184 The meaning is as follows: |
| 127 | 185 |
| 128 * voice-path is the DSP digital voice path setting, 0 means the standard | 186 * voice-path is the DSP digital voice path setting, 0 means the standard |
| 129 configuration with the voice channel going between GSM and the local analog | 187 configuration with the voice channel going between GSM and the local analog |
| 130 voice hardware attached to the ABB. | 188 voice hardware attached to the ABB. |
| 142 is NOT set, i.e., the normal configuration. | 200 is NOT set, i.e., the normal configuration. |
| 143 | 201 |
| 144 * DSP FIR filters do nothing, as coefficient 0 is set to unity and all other | 202 * DSP FIR filters do nothing, as coefficient 0 is set to unity and all other |
| 145 coefficients are set to zero. | 203 coefficients are set to zero. |
| 146 | 204 |
| 147 * The AEC mechanism in the DSP is disabled. | 205 * The AEC mechanism in the DSP is disabled, although the format of the bits that |
| 206 say so is different between old and new AEC versions. In the new version | |
| 207 there are a number of tunable settings that only kick in when AEC is enabled; | |
| 208 when AEC is disabled by default, these tunable knobs still have sensible | |
| 209 defaults that aren't all zeros. | |
| 148 | 210 |
| 149 Creating your own audio mode configurations | 211 Creating your own audio mode configurations |
| 150 =========================================== | 212 =========================================== |
| 151 | 213 |
| 152 The input to our tiaud-compile utility can contain every setting shown in the | 214 The input to our tiaud-compile utility can contain every setting shown in the |
| 181 input to tiaud-compile you can put each coefficient on its own fir line, put | 243 input to tiaud-compile you can put each coefficient on its own fir line, put |
| 182 all 31 coefficients on the same line, or group them in any other way you like. | 244 all 31 coefficients on the same line, or group them in any other way you like. |
| 183 The grouping used in the tiaud-decomp output has been chosen for line length | 245 The grouping used in the tiaud-decomp output has been chosen for line length |
| 184 reasons. | 246 reasons. |
| 185 | 247 |
| 186 * The numbers given on fir and aec lines are 16-bit values that go directly into | 248 aec vs aec-new in tiaud-compile input |
| 187 the DSP; the former are FIR coefficients and the latter are bit masks. They | 249 ===================================== |
| 188 can be given as either decimal or hexadecimal with 0x prefix in the ASCII | 250 |
| 189 input to tiaud-compile. | 251 tiaud-compile accepts both aec (old) and aec-new settings; aec must be followed |
| 252 by 5 numbers, aec-new must be followed by 12 numbers. Each number is a 16-bit | |
| 253 value, and they go into the binary structure without further interpretation by | |
| 254 tiaud-compile - instead the firmware is the entity that gives them meaning. | |
| 255 Numbers without 0x prefix are interpreted as decimal. | |
| 256 | |
| 257 tiaud-compile will generate one type or the other of the binary output file, | |
| 258 following these rules: | |
| 259 | |
| 260 * If an aec setting is given, a 164 byte file will be produced, with the 5 AEC | |
| 261 words being the given ones. | |
| 262 | |
| 263 * If an aec-new setting is given, a 176 byte file will be produced, with the 12 | |
| 264 AEC words being the given ones. | |
| 265 | |
| 266 * If neither setting is given, a 164 byte file will be produced, with the 5 AEC | |
| 267 words of the old type being all zeros. Thanks to the modified audio mode | |
| 268 loading code in our firmwares, these 164 byte mode files can still be used | |
| 269 with current Tourmaline fw, with AEC set to its default disabled state. |
