FreeCalypso > hg > gsm-codec-lib
annotate libtwamr/dhf_subst.c @ 536:a3300483ae74
doc/FR1-library-API: document return value from gsmfr_tfo_xfrm_*
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 21 Sep 2024 20:48:58 +0000 |
parents | f0496507d409 |
children |
rev | line source |
---|---|
355
9beb01439a90
libtwamr: implement DHF check function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
431
f0496507d409
libtwamr: implement amr_dhf_subst_efr()
Mychaela Falconia <falcon@freecalypso.org>
parents:
355
diff
changeset
|
2 * The function implemented in this module is an aid for AMR-EFR interworking: |
f0496507d409
libtwamr: implement amr_dhf_subst_efr()
Mychaela Falconia <falcon@freecalypso.org>
parents:
355
diff
changeset
|
3 * it is meant to be invoked directly after amr_encode_frame(), it checks |
f0496507d409
libtwamr: implement amr_dhf_subst_efr()
Mychaela Falconia <falcon@freecalypso.org>
parents:
355
diff
changeset
|
4 * the encoder output for MR122 DHF, and if the generated frame exactly |
f0496507d409
libtwamr: implement amr_dhf_subst_efr()
Mychaela Falconia <falcon@freecalypso.org>
parents:
355
diff
changeset
|
5 * matches MR122 DHF, it is changed to GSM-EFR DHF. |
355
9beb01439a90
libtwamr: implement DHF check function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 */ |
9beb01439a90
libtwamr: implement DHF check function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 |
9beb01439a90
libtwamr: implement DHF check function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <stdint.h> |
9beb01439a90
libtwamr: implement DHF check function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <string.h> |
9beb01439a90
libtwamr: implement DHF check function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include "tw_amr.h" |
9beb01439a90
libtwamr: implement DHF check function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 |
431
f0496507d409
libtwamr: implement amr_dhf_subst_efr()
Mychaela Falconia <falcon@freecalypso.org>
parents:
355
diff
changeset
|
12 void amr_dhf_subst_efr(struct amr_param_frame *frame) |
355
9beb01439a90
libtwamr: implement DHF check function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 { |
431
f0496507d409
libtwamr: implement amr_dhf_subst_efr()
Mychaela Falconia <falcon@freecalypso.org>
parents:
355
diff
changeset
|
14 if (frame->type != TX_SPEECH_GOOD) |
f0496507d409
libtwamr: implement amr_dhf_subst_efr()
Mychaela Falconia <falcon@freecalypso.org>
parents:
355
diff
changeset
|
15 return; |
f0496507d409
libtwamr: implement amr_dhf_subst_efr()
Mychaela Falconia <falcon@freecalypso.org>
parents:
355
diff
changeset
|
16 if (frame->mode != MR122) |
f0496507d409
libtwamr: implement amr_dhf_subst_efr()
Mychaela Falconia <falcon@freecalypso.org>
parents:
355
diff
changeset
|
17 return; |
f0496507d409
libtwamr: implement amr_dhf_subst_efr()
Mychaela Falconia <falcon@freecalypso.org>
parents:
355
diff
changeset
|
18 if (memcmp(frame->param, amr_dhf_mr122, AMR_MAX_PRM * sizeof(int16_t))) |
f0496507d409
libtwamr: implement amr_dhf_subst_efr()
Mychaela Falconia <falcon@freecalypso.org>
parents:
355
diff
changeset
|
19 return; |
f0496507d409
libtwamr: implement amr_dhf_subst_efr()
Mychaela Falconia <falcon@freecalypso.org>
parents:
355
diff
changeset
|
20 memcpy(frame->param, amr_dhf_gsmefr, AMR_MAX_PRM * sizeof(int16_t)); |
355
9beb01439a90
libtwamr: implement DHF check function
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 } |