FreeCalypso > hg > gsm-codec-lib
annotate doc/AMR-EFR-conversion @ 465:026bdc1f0dda
amrefr-tseq-enc: use the new DHF xform that matches T-Mobile
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 12 May 2024 21:43:35 +0000 |
parents | 78739fda2856 |
children |
rev | line source |
---|---|
312
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
1 Please see our AMR-EFR-philosophy article for an analysis of differences between |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
2 EFR and MR122 (12k2 mode of AMR), and for a discussion of how we handle the |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
3 relation between these two codecs. The following article was written in late |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
4 2022, before these issues were properly understood: |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
5 |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
6 2022-December description |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
7 ------------------------- |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
8 |
136
8eb0e7a39409
doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 We have two simple utilities that allow one to experiment with "dumb" bit- |
8eb0e7a39409
doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 shuffling conversion between AMR 12k2 and EFR codec formats, to explore |
8eb0e7a39409
doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 capabilities and limitations of this approach. |
8eb0e7a39409
doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 |
8eb0e7a39409
doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 gsm-amr2efr reads an AMR speech recording in RFC 4867 storage format (the common |
8eb0e7a39409
doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 .amr format) and converts it to EFR in gsmx format. The AMR input to this |
8eb0e7a39409
doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 utility must consists of MR122 frames only - no other AMR modes, no SID and no |
8eb0e7a39409
doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 NO_DATA gaps. The intent is that one can take a starting speech sample in WAV |
8eb0e7a39409
doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 format, encode it into AMR with amrnb-enc from opencore-amrnb (by default that |
8eb0e7a39409
doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 utility produces MR122 encoding without DTX), and then convert the AMR output to |
8eb0e7a39409
doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 EFR with gsm-amr2efr. One can then encode the same starting-point WAV speech |
8eb0e7a39409
doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 sample with gsmefr-encode (matching official EFR from ETSI) and compare the two |
8eb0e7a39409
doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 EFR outputs. When you do this experiment, you will see that the two EFR outputs |
8eb0e7a39409
doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 will be different (you can then analyze encoded speech parameter diffs with |
8eb0e7a39409
doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 gsmrec-dump), but each version can be fed to an EFR decoder, resulting in |
8eb0e7a39409
doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 OK-sounding speech. |
8eb0e7a39409
doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 |
8eb0e7a39409
doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 gsm-efr2amr performs the opposite conversion: it reads an EFR session recording |
8eb0e7a39409
doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 in gsmx format and converts it to AMR storage format. The input to gsm-efr2amr |
8eb0e7a39409
doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 is allowed to contain Themyscira BFI markers in addition to EFR frames; these |
8eb0e7a39409
doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 BFI markers will be turned into AMR NO_DATA frames. The same input can also |
8eb0e7a39409
doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 contain EFR SID frames - however, gsm-efr2amr will not detect them and won't |
8eb0e7a39409
doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 give them any special handling, instead they will be bit-reshuffled into MR122 |
8eb0e7a39409
doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 just like EFR speech frames. The result of such "dumb" conversion is invalid |
8eb0e7a39409
doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 AMR, and when you decode it with amrnb-dec, you will hear some strange noises. |
312
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
34 |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
35 2024-April addendum |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
36 ------------------- |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
37 |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
38 In addition to the SID issue noted above (if the input to gsm-efr2amr contains |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
39 any SID frames, the output will be invalid AMR), these dumb conversion methods |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
40 fail to take action on any embedded decoder homing frames. The correct DHF is |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
41 different between EFR and MR122, hence a better converter could be made to |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
42 recognize EFR DHFs in EFR->AMR direction and convert them to MR122 DHF, and do |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
43 the opposite in AMR->EFR direction. However, the implementation of AMR in |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
44 libopencore-amrnb has the homing feature stripped out altogether, hence doing |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
45 DHF conversion would be pointless as long as amrnb-enc and amrnb-dec utilities |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
46 are involved. |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
47 |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
48 Thoughts on more proper conversion |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
49 ================================== |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
50 |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
51 Imagine this hypothetical scenario: you operate a GSM network, and you |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
52 preferentially use EFR codec. You are then able to obtain TrFO interconnection |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
53 with some other mobile network of more "modern" kind, and that "modern" network |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
54 uses AMR exclusively, with no ability to use any GSM-only codecs. (The latter |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
55 situation holds for UMTS and VoLTE, for example.) Ordinarily, under these |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
56 circumstances TrFO won't be possible - instead you have to interconnect in |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
57 G.711, have each side transcode its respective codec, and put up with double |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
58 transcoding. But what if the AMR side can be told to use MR122 only, without |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
59 any of the lower modes? Such arrangement would make no sense in GSM (just use |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
60 EFR instead and save the headache of dealing with AMR), but it might be sensible |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
61 to ask the UMTS/VoLTE side for that MR122-only config of AMR-NB. |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
62 |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
63 In this hypothetical scenario, would it be possible to pass speech frames |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
64 transparently, doing only the necessary bit reshuffling, and only invoke some |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
65 slick innovative algorithm during speech pauses to translate between EFR and |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
66 AMR SID paradigms? |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
67 |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
68 Right now this idea is fantasy only. I don't know enough about VoLTE to tell |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
69 whether or not an MR122-only config of AMR-NB would work there, I have no idea |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
70 what codec config VoLTE operators run with currently when the other end of the |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
71 call is G.711 PSTN, and there is very little chance that any of the nation-scale |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
72 mobile operators would agree to a private peering interconnect with some tiny |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
73 community GSM network - while interconnection through fully public, open-to- |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
74 everyone IP-PSTN routes allows only G.711 and nothing else, no cellular TrFO. |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
75 |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
76 Nonetheless, the idea of TrFO conversion between EFR and MR122-only AMR remains |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
77 interesting as a theoretical exercise, and we currently leave it there, just as |
78739fda2856
doc/AMR-EFR-conversion: update for current understanding
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
78 food for thought. |