FreeCalypso > hg > gsm-codec-lib
comparison libgsmhr1/enc_out_order.c @ 505:17c0aabae474
libgsmhr1: integrate fillBitAlloc()
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 19 Jun 2024 01:49:03 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
504:024615de06fe | 505:17c0aabae474 |
---|---|
1 /* | |
2 * This module was derived from host.c in the original GSM 06.06 source, | |
3 * reduced to just fillBitAlloc() function. | |
4 */ | |
5 | |
6 /*_________________________________________________________________________ | |
7 | | | |
8 | Include Files | | |
9 |_________________________________________________________________________| | |
10 */ | |
11 | |
12 #include "typedefs.h" | |
13 #include "namespace.h" | |
14 #include "enc_out_order.h" | |
15 | |
16 /*************************************************************************** | |
17 * | |
18 * FUNCTION NAME: fillBitAlloc | |
19 * | |
20 * PURPOSE: | |
21 * | |
22 * Arrange speech parameters for encoder output | |
23 * | |
24 * INPUTS: | |
25 * | |
26 * The speechcoders codewords: | |
27 * iR0 - Frame energy | |
28 * piVqIndeces[0:2] - LPC vector quantizer codewords | |
29 * iSoftInterp - Soft interpolation bit 1 or 0 | |
30 * iVoicing - voicing mode 0,1,2,3 | |
31 * piLags[0:3] - Frame and delta lag codewords | |
32 * piCodeWrdsA[0:3] - VSELP codevector 1 | |
33 * piCodeWrdsB[0:3] - VSELP codevector 2 (n/a for voiced modes) | |
34 * piGsp0s[0:3] - GSP0 codewords | |
35 * swVadFlag - voice activity detection flag | |
36 * swSP - Speech flag | |
37 * | |
38 * OUTPUTS: | |
39 * | |
40 * pswBAlloc[0:20] - an array into which the coded data is moved | |
41 * | |
42 * RETURN VALUE: | |
43 * | |
44 * none | |
45 * | |
46 * REFERENCES: Sub-clause 2.1 and 4.1.12 of GSM Recomendation 06.20 | |
47 * | |
48 **************************************************************************/ | |
49 | |
50 void fillBitAlloc(int iVoicing, int iR0, int *piVqIndeces, | |
51 int iSoftInterp, int *piLags, | |
52 int *piCodeWrdsA, int *piCodeWrdsB, | |
53 int *piGsp0s, Shortword swVadFlag, | |
54 Shortword swSP, Shortword *pswBAlloc) | |
55 { | |
56 | |
57 /*_________________________________________________________________________ | |
58 | | | |
59 | Automatic Variables | | |
60 |_________________________________________________________________________| | |
61 */ | |
62 | |
63 int i; | |
64 Shortword *pswNxt; | |
65 | |
66 /*_________________________________________________________________________ | |
67 | | | |
68 | Executable Code | | |
69 |_________________________________________________________________________| | |
70 */ | |
71 | |
72 pswNxt = pswBAlloc; | |
73 *pswNxt++ = iR0; | |
74 for (i = 0; i < 3; i++) | |
75 *pswNxt++ = *piVqIndeces++; | |
76 *pswNxt++ = iSoftInterp; | |
77 *pswNxt++ = iVoicing; | |
78 | |
79 /* check voicing mode */ | |
80 if (iVoicing) | |
81 { | |
82 /* voiced mode */ | |
83 for (i = 0; i < N_SUB; i++) | |
84 { | |
85 *pswNxt++ = *piLags++; | |
86 *pswNxt++ = *piCodeWrdsA++; | |
87 *pswNxt++ = *piGsp0s++; | |
88 } | |
89 } | |
90 else | |
91 { /* unvoiced frame */ | |
92 for (i = 0; i < N_SUB; i++) | |
93 { | |
94 *pswNxt++ = *piCodeWrdsA++; | |
95 *pswNxt++ = *piCodeWrdsB++; | |
96 *pswNxt++ = *piGsp0s++; | |
97 } | |
98 } | |
99 *pswNxt++ = swVadFlag; | |
100 *pswNxt++ = swSP; | |
101 } |