FreeCalypso > hg > gsm-codec-lib
annotate doc/AMR-EFR-philosophy @ 384:a8dab7028e4d
libtwamr: integrate lag_wind.c
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 06 May 2024 05:56:50 +0000 |
parents | 83408f67a96c |
children | 9bcf65088006 |
rev | line source |
---|---|
311
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
1 Relation between GSM-EFR and 12k2 mode of AMR |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
2 ============================================= |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
3 |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
4 What are the differences between GSM-EFR codec and the highest 12k2 mode of AMR, |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
5 or MR122 for short? The most obvious difference is in DTX: the format of SID |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
6 frames and even the very paradigm of how DTX works are completely different |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
7 between EFR and AMR. But what about non-DTX operation? If a codec session |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
8 consists solely of good speech frames, no SIDs and no BFI frame gaps, are EFR |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
9 and MR122 strictly identical? |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
10 |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
11 The correct answer is that in the absence of SIDs, EFR and MR122 are directly |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
12 interoperable in that the output of an EFR encoder can be fed to the input of |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
13 an AMR decoder, and vice-versa. However, the two codecs are NOT identical at |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
14 the bit-exact level! The differences are subtle, such that finding them |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
15 requires some intense study; this article documents some of these study |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
16 findings: |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
17 |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
18 https://www.freecalypso.org/hg/efr-experiments/file/tip/Theory-and-mystery |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
19 |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
20 What other DSP/transcoder vendors have done |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
21 =========================================== |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
22 |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
23 ETSI had a tradition of defining standard GSM codecs (FR, HR, EFR) in bit-exact |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
24 form, and every production implementation was required to match the output of |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
25 the official reference bit for bit. However, once AMR came out, the regulation |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
26 on EFR was loosened. GSM 06.54 document from 2000-08 (ETSI TS 100 725 V5.2.0) |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
27 has an appendix-like chapter (chapter 10) whose first paragraph reads: |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
28 |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
29 The 12.2 kbit/s mode of the Adaptive Multi Rate speech coder described |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
30 in TS 26.071 is functionally equivalent to the GSM Enhanced Full Rate |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
31 speech coder. An alternative implementation of the Enhanced Full Rate |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
32 speech service based on the 12.2 kbit/s mode of the Adaptive Multi Rate |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
33 coder is allowed. Alternative implementations shall implement the |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
34 functionality specified in TS 26.071 for the 12.2 kbit/s mode, with the |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
35 exception that the DTX transmission format (GSM 06.81) and the comfort |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
36 noise generation (GSM 06.62) shall be used. |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
37 |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
38 It appears that DSP vendors (for GSM MS or for network transcoders, or perhaps |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
39 both) weren't too happy with the prospect of having to include two different |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
40 versions of _almost_ the same codec algorithm with a bunch of interspersed |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
41 subtle diffs, and so the rules were bent: EFR implementors were given permission |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
42 to deviate from the original bit-exact definition of EFR in order to have more |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
43 commonality with MR122. |
136
8eb0e7a39409
doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 |
311
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
45 Approach adopted for Themyscira GSM codec libraries suite |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
46 ========================================================= |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
47 |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
48 I (Mother Mychaela) previously entertained the idea of creating a unified codec |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
49 library that supports both AMR and EFR with common code, producing a published- |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
50 source, FOSS-culture equivalent of what most proprietary vendors have done. |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
51 However, on further reflection, that idea has been rejected. The current vision |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
52 (as of 2024-04) is that libgsmefr (stable since early 2023) and libtwamr |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
53 (currently a work in progress) shall remain separate and independent libraries, |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
54 the former implementing GSM-EFR (the original bit-exact definition) and the |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
55 latter implementing AMR. My reasons for this decision are: |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
56 |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
57 * Libgsmefr already exists, and it is already a bit of a jewel compared to the |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
58 sorry state of true GSM codec support in the world of FOSS outside Themyscira. |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
59 Giving up on this library and moving to some nebulous new one does not sound |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
60 appealing. |
136
8eb0e7a39409
doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 |
311
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
62 * There does not exist any formal, bit-exact definition for what we informally |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
63 call "EFR version 2": the realization of EFR as implemented by post-AMR-era |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
64 proprietary vendors, some sort of AMR-EFR hybrid. As I see it, it is not my |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
65 place to try to innovate in speech codec design, instead it is my job to |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
66 provide 100% correct, bit-exact implementations of existing solid standards - |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
67 and there is no bit-exact standard to follow for "EFR version 2". |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
68 |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
69 * Libtwamr project: the task of turning the original AMR code from 3GPP into a |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
70 proper library, style-consistent with Themyscira libgsmfr2 and libgsmefr, |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
71 without the ugliness of opencore-amr, is already a lot of work as it is. |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
72 There is no need to make it harder by adding the task of supporting AMR-based |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
73 EFR, especially when the latter lacks formal definition. |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
74 |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
75 Performance issues |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
76 ================== |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
77 |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
78 Right now the only significant downside of libgsmefr compared to |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
79 libopencore-amrnb is that our library is significantly slower: almost 7 times |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
80 slower on non-DTX encode and a little over 3 times slower on SID-free decode. |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
81 However, this performance problem will need to be solved by profiling the code |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
82 to find the slowest spots, comparing the code of individual blocks between ours |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
83 and theirs, and porting over whatever performance-optimizing strategies were |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
84 implemented in OpenCORE code base. The latter code base is a derivative work |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
85 based on 3GPP AMR source, hence the guts of the codec are largely the same |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
86 between 3GPP AMR and libopencore-amrnb; the latter has been significantly |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
87 performance-optimized, but also heavily uglified. But there is no reason why |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
88 the same performance fixes can't be applied to EFR code base - it will simply |
83408f67a96c
doc/AMR-EFR-philosophy: new article
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
89 take work. This work is currently part of our future roadmap. |