FreeCalypso > hg > gsm-codec-lib
comparison libtwamr/pre_big.c @ 396:38ee82480462
libtwamr: integrate pre_big.c
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 06 May 2024 18:57:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
395:8c7d5eec544c | 396:38ee82480462 |
---|---|
1 /* | |
2 ******************************************************************************** | |
3 * | |
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001 | |
5 * R99 Version 3.3.0 | |
6 * REL-4 Version 4.1.0 | |
7 * | |
8 ******************************************************************************** | |
9 * | |
10 * File : pre_big.c | |
11 * Purpose : Big subframe (2 subframes) preprocessing | |
12 * | |
13 ******************************************************************************** | |
14 */ | |
15 | |
16 /* | |
17 ******************************************************************************** | |
18 * MODULE INCLUDE FILE AND VERSION ID | |
19 ******************************************************************************** | |
20 */ | |
21 #include "namespace.h" | |
22 #include "pre_big.h" | |
23 | |
24 /* | |
25 ******************************************************************************** | |
26 * INCLUDE FILES | |
27 ******************************************************************************** | |
28 */ | |
29 #include "typedef.h" | |
30 #include "basic_op.h" | |
31 #include "oper_32b.h" | |
32 #include "syn_filt.h" | |
33 #include "weight_a.h" | |
34 #include "residu.h" | |
35 #include "no_count.h" | |
36 #include "cnst.h" | |
37 | |
38 /* | |
39 ******************************************************************************** | |
40 * PUBLIC PROGRAM CODE | |
41 ******************************************************************************** | |
42 */ | |
43 int pre_big( | |
44 enum Mode mode, /* i : coder mode */ | |
45 const Word16 gamma1[], /* i : spectral exp. factor 1 */ | |
46 const Word16 gamma1_12k2[],/* i : spectral exp. factor 1 for EFR */ | |
47 const Word16 gamma2[], /* i : spectral exp. factor 2 */ | |
48 Word16 A_t[], /* i : A(z) unquantized, for 4 subframes, Q12 */ | |
49 Word16 frameOffset, /* i : Start position in speech vector, Q0 */ | |
50 Word16 speech[], /* i : speech, Q0 */ | |
51 Word16 mem_w[], /* i/o: synthesis filter memory state, Q0 */ | |
52 Word16 wsp[] /* o : weighted speech Q0 */ | |
53 ) | |
54 { | |
55 Word16 Ap1[MP1]; /* A(z) with spectral expansion */ | |
56 Word16 Ap2[MP1]; /* A(z) with spectral expansion */ | |
57 const Word16 *g1; /* Pointer to correct gammma1 vector */ | |
58 Word16 aOffset; | |
59 Word16 i; | |
60 | |
61 test (); | |
62 if (sub (mode, MR795) <= 0 ) | |
63 { | |
64 g1 = gamma1; move16 (); | |
65 } | |
66 else | |
67 { | |
68 g1 = gamma1_12k2; move16 (); | |
69 } | |
70 | |
71 test (); | |
72 if (frameOffset > 0) { | |
73 aOffset = 2*MP1; move16 (); | |
74 } | |
75 else { | |
76 aOffset = 0; move16 (); | |
77 } | |
78 | |
79 /* process two subframes (which form the "big" subframe) */ | |
80 for (i = 0; i < 2; i++) | |
81 { | |
82 Weight_Ai(&A_t[aOffset], g1, Ap1); | |
83 Weight_Ai(&A_t[aOffset], gamma2, Ap2); | |
84 Residu(Ap1, &speech[frameOffset], &wsp[frameOffset], L_SUBFR); | |
85 | |
86 Syn_filt(Ap2, &wsp[frameOffset], &wsp[frameOffset], L_SUBFR, mem_w, 1); | |
87 aOffset = add (aOffset, MP1); | |
88 frameOffset = add (frameOffset, L_SUBFR); | |
89 } | |
90 | |
91 return 0; | |
92 } |