FreeCalypso > hg > gsm-codec-lib
annotate libtwamr/pitch_fr.h @ 477:4c9222d95647
libtwamr encoder: always emit frame->mode = mode;
In the original implementation of amr_encode_frame(), the 'mode' member
of the output struct was set to 0xFF if the output frame type is TX_NO_DATA.
This design was made to mimic the mode field (16-bit word) being set to
0xFFFF (or -1) in 3GPP test sequence format - but nothing actually depends
on this struct member being set in any way, and amr_frame_to_tseq()
generates the needed 0xFFFF on its own, based on frame->type being equal
to TX_NO_DATA.
It is simpler and more efficient to always set frame->mode to the actual
encoding mode in amr_encode_frame(), and this new behavior has already
been documented in doc/AMR-library-API description in anticipation of
the present change.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 18 May 2024 22:30:42 +0000 |
parents | be8edf9e6bc1 |
children |
rev | line source |
---|---|
391
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 ******************************************************************************** |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001 |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 * R99 Version 3.3.0 |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 * REL-4 Version 4.1.0 |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 * |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 ******************************************************************************** |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 * |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 * File : pitch_fr.h |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 * Purpose : Find the pitch period with 1/3 or 1/6 subsample |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 * : resolution (closed loop). |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 * |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 ******************************************************************************** |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 */ |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 #ifndef pitch_fr_h |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 #define pitch_fr_h "$Id $" |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 /* |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 ******************************************************************************** |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 * INCLUDE FILES |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 ******************************************************************************** |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 */ |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 #include "tw_amr.h" |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 #include "typedef.h" |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 /* |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 ******************************************************************************** |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 * DEFINITION OF DATA TYPES |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 ******************************************************************************** |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 */ |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 typedef struct { |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 Word16 T0_prev_subframe; /* integer pitch lag of previous sub-frame */ |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 } Pitch_frState; |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 /* |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 ******************************************************************************** |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 * DECLARATION OF PROTOTYPES |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 ******************************************************************************** |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 */ |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 void Pitch_fr_reset (Pitch_frState *st); |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 /* reset of pre processing state (i.e. set state memory to zero) |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 returns 0 on success |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 */ |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 Word16 Pitch_fr ( /* o : pitch period (integer) */ |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 Pitch_frState *st, /* i/o : State struct */ |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 enum Mode mode, /* i : codec mode */ |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 Word16 T_op[], /* i : open loop pitch lags */ |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 Word16 exc[], /* i : excitation buffer */ |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 Word16 xn[], /* i : target vector */ |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 Word16 h[], /* i : impulse response of synthesis and |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 weighting filters */ |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 Word16 L_subfr, /* i : Length of subframe */ |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 Word16 i_subfr, /* i : subframe offset */ |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 Word16 *pit_frac, /* o : pitch period (fractional) */ |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 Word16 *resu3, /* o : subsample resolution 1/3 (=1) or 1/6 (=0) */ |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 Word16 *ana_index /* o : index of encoding */ |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 ); |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 |
be8edf9e6bc1
libtwamr: integrate pitch_fr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 #endif |