FreeCalypso > hg > gsm-codec-lib
annotate libtwamr/e_homing.c @ 513:03a40ac2e931
libgsmhr1: implement validation for *.cod frames
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 25 Aug 2024 19:00:03 +0000 |
parents | 2a094af3d384 |
children |
rev | line source |
---|---|
361
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 ***************************************************************************** |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001 |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 * R99 Version 3.3.0 |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 * REL-4 Version 4.1.0 |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 * |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 ***************************************************************************** |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 * |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 * File : e_homing.c |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 * |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 ***************************************************************************** |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 */ |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 /* |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 ***************************************************************************** |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 * MODULE INCLUDE FILE AND VERSION ID |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 ***************************************************************************** |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 */ |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 #include "namespace.h" |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 #include "e_homing.h" |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 /* |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 ***************************************************************************** |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 * INCLUDE FILES |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 ***************************************************************************** |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 */ |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 #include "typedef.h" |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 #include "cnst.h" |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 /* |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 ***************************************************************************** |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 * PUBLIC PROGRAM CODE |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 ***************************************************************************** |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 */ |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 /* |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 ******************************************************************************** |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 * |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 * Function : encoder_homing_frame_test |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 * In : input_frame[] one frame of speech samples |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 * Out : none |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 * Calls : none |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 * Tables : none |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 * Compile Defines : none |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 * Return : 0 input frame does not match the encoder homing frame pattern |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 * 1 input frame matches the encoder homing frame pattern |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 * Information : Checks if all samples of the input frame matches the encoder |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 * homing frame pattern, which is 0x0008 for all samples. |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 * |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 ******************************************************************************** |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 */ |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 |
419
2a094af3d384
libtwamr: implement encoder top level
Mychaela Falconia <falcon@freecalypso.org>
parents:
361
diff
changeset
|
56 Word16 encoder_homing_frame_test (const Word16 input_frame[]) |
361
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 { |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 Word16 i, j; |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 /* check 160 input samples for matching EHF_MASK: defined in e_homing.h */ |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 for (i = 0; i < L_FRAME; i++) |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 { |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 j = input_frame[i] ^ EHF_MASK; |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 if (j) |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 break; |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 } |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 return !j; |
9aa554f8cf39
libtwamr: integrate e_homing.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 } |