FreeCalypso > hg > gsm-codec-lib
annotate libtwamr/mac_32.h @ 518:087a88d25ba2
new program gsmhr-dec-craft
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 01 Sep 2024 18:58:02 +0000 |
parents | 61047a2912a2 |
children |
rev | line source |
---|---|
374
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 ******************************************************************************** |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001 |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 * R99 Version 3.3.0 |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 * REL-4 Version 4.1.0 |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 ******************************************************************************** |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 * File : mac_32.h |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 * Purpose : 32 x 32 and 32 x 16 bit DPF multiy & accumulate |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 * (similar as Mpy_32 and Mpy_32_16 in oper_32b.c) |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 ******************************************************************************** |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 */ |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 /* |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 ******************************************************************************** |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 * MODULE INCLUDE FILE AND VERSION ID |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 ******************************************************************************** |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 */ |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 #ifndef mac_32_h |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 #define mac_32_h "$Id $" |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 /* |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 ******************************************************************************** |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 * INCLUDE FILES |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 ******************************************************************************** |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 */ |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 #include "typedef.h" |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 /* |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 ******************************************************************************** |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 * PUBLIC PROGRAM CODE |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 ******************************************************************************** |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 */ |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 /***************************************************************************** |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 * Function Mac_32() * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 * * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 * Multiply two 32 bit integers (DPF) and accumulate with (normal) 32 bit * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 * integer. The multiplication result is divided by 2**31 * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 * * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 * L_32 = L_32 + (hi1*hi2)<<1 + ( (hi1*lo2)>>15 + (lo1*hi2)>>15 )<<1 * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 * * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 * This operation can also be viewed as the multiplication of two Q31 * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 * number and the result is also in Q31. * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 * * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 * Arguments: * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 * * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 * hi1 hi part of first number * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 * lo1 lo part of first number * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 * hi2 hi part of second number * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 * lo2 lo part of second number * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 * * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 ***************************************************************************** |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 */ |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 Word32 Mac_32 (Word32 L_32, Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2); |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 /***************************************************************************** |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 * Function Mac_32_16() * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 * * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 * Multiply a 16 bit integer by a 32 bit (DPF) and accumulate with (normal)* |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 * 32 bit integer. The multiplication result is divided by 2**15 * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 * * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 * * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 * L_32 = L_32 + (hi1*lo2)<<1 + ((lo1*lo2)>>15)<<1 * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 * * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 * Arguments: * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 * * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 * hi hi part of 32 bit number. * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 * lo lo part of 32 bit number. * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 * n 16 bit number. * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 * * |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 ***************************************************************************** |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 */ |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 Word32 Mac_32_16 (Word32 L_32, Word16 hi, Word16 lo, Word16 n); |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 |
61047a2912a2
libtwamr: integrate mac_32.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 #endif |