FreeCalypso > hg > gsm-codec-lib
annotate libgsmefr/basic_op.h @ 347:1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 21 Apr 2024 23:17:21 +0000 |
parents | 38326102fc43 |
children | ed8762eea8a1 |
rev | line source |
---|---|
347
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1 /* |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
2 * This version of basic_op.h for GSM-EFR codec has been created at |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
3 * Themyscira Wireless with the aim of performance improvement. |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
4 * The original version contained only function declarations, |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
5 * resulting in a function call for every elementary operation; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
6 * the present version implements most of these operations as inline |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
7 * functions. |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
8 * |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
9 * Elimination of Overflow flag: examination of EFR code reveals that |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
10 * both Carry and Overflow flags are accessed outside of basicop2.c |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
11 * only in g_pitch.c, as part of a code sequence that uses L_macNs. |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
12 * Since the Overflow flag is not checked anywhere else, we can eliminate |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
13 * its setting from all other elementary operation functions, saving |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
14 * some cycles and code size. |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
15 * |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
16 * Non-portability: we assume real target machines, not hypothetical |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
17 * ones. Specifically, we assume that >> does an arithmetic right shift |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
18 * (sign bit fill). |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
19 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
20 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
21 /* for the few functions that still use them */ |
38
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 extern __thread Flag Overflow; |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 extern __thread Flag Carry; |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 |
347
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
25 #define MAX_32 (Word32)0x7fffffff |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
26 #define MIN_32 (Word32)0x80000000 |
38
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 #define MAX_16 (Word16)0x7fff |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 #define MIN_16 (Word16)0x8000 |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 |
347
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
31 /* likely and unlikely conditional paths */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
32 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
33 #define likely(x) __builtin_expect(!!(x), 1) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
34 #define unlikely(x) __builtin_expect(!!(x), 0) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
35 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
36 /* Word16 operations */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
37 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
38 /*___________________________________________________________________________ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
39 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
40 | Function Name : add | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
41 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
42 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
43 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
44 | Performs the addition (var1+var2) with overflow control and saturation;| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
45 | the 16 bit result is set at +32767 when overflow occurs or at -32768 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
46 | when underflow occurs. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
47 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
48 | Complexity weight : 1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
49 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
50 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
51 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
52 | var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
53 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
54 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
55 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
56 | var2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
57 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
58 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
59 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
60 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
61 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
62 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
63 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
64 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
65 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
66 | var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
67 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
68 | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
69 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
70 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
71 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
72 static inline Word16 add (Word16 var1, Word16 var2) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
73 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
74 Word32 L_sum; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
75 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
76 L_sum = (Word32) var1 + var2; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
77 if (unlikely(L_sum > MAX_16)) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
78 return MAX_16; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
79 else if (unlikely(L_sum < MIN_16)) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
80 return MIN_16; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
81 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
82 return L_sum; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
83 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
84 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
85 /*___________________________________________________________________________ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
86 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
87 | Function Name : sub | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
88 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
89 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
90 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
91 | Performs the subtraction (var1+var2) with overflow control and satu- | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
92 | ration; the 16 bit result is set at +32767 when overflow occurs or at | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
93 | -32768 when underflow occurs. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
94 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
95 | Complexity weight : 1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
96 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
97 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
98 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
99 | var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
100 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
101 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
102 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
103 | var2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
104 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
105 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
106 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
107 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
108 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
109 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
110 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
111 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
112 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
113 | var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
114 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
115 | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
116 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
117 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
118 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
119 static inline Word16 sub (Word16 var1, Word16 var2) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
120 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
121 Word32 L_diff; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
122 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
123 L_diff = (Word32) var1 - var2; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
124 if (unlikely(L_diff > MAX_16)) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
125 return MAX_16; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
126 else if (unlikely(L_diff < MIN_16)) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
127 return MIN_16; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
128 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
129 return L_diff; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
130 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
131 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
132 /*___________________________________________________________________________ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
133 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
134 | Function Name : abs_s | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
135 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
136 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
137 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
138 | Absolute value of var1; abs_s(-32768) = 32767. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
139 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
140 | Complexity weight : 1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
141 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
142 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
143 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
144 | var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
145 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
146 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
147 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
148 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
149 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
150 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
151 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
152 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
153 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
154 | var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
155 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
156 | range : 0x0000 0000 <= var_out <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
157 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
158 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
159 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
160 static inline Word16 abs_s (Word16 var1) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
161 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
162 Word16 var_out; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
163 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
164 if (unlikely(var1 == (Word16) 0X8000)) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
165 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
166 var_out = MAX_16; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
167 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
168 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
169 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
170 if (var1 < 0) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
171 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
172 var_out = -var1; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
173 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
174 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
175 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
176 var_out = var1; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
177 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
178 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
179 return (var_out); |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
180 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
181 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
182 /*___________________________________________________________________________ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
183 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
184 | Function Name : shl | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
185 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
186 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
187 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
188 | Arithmetically shift the 16 bit input var1 left var2 positions.Zero fill| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
189 | the var2 LSB of the result. If var2 is negative, arithmetically shift | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
190 | var1 right by -var2 with sign extension. Saturate the result in case of | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
191 | underflows or overflows. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
192 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
193 | Complexity weight : 1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
194 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
195 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
196 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
197 | var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
198 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
199 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
200 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
201 | var2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
202 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
203 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
204 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
205 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
206 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
207 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
208 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
209 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
210 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
211 | var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
212 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
213 | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
214 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
215 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
216 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
217 static inline Word16 shl (Word16 var1, Word16 var2) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
218 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
219 Word32 result; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
220 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
221 if (var2 < 0) { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
222 var2 = -var2; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
223 if (unlikely(var2 >= 15)) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
224 return (var1 < 0) ? -1 : 0; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
225 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
226 return var1 >> var2; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
227 } else { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
228 result = (Word32) var1 << var2; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
229 if (var1 > 0) { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
230 if (unlikely((var2 >= 15) || (result & 0xFFFF8000))) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
231 return MAX_16; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
232 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
233 return (Word16) result; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
234 } else if (var1 < 0) { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
235 if (unlikely((var2 >= 16) || ((result & 0xFFFF8000) != 0xFFFF8000))) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
236 return MIN_16; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
237 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
238 return (Word16) result; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
239 } else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
240 return 0; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
241 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
242 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
243 |
38
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
244 /*___________________________________________________________________________ |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
245 | | |
347
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
246 | Function Name : shr | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
247 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
248 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
249 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
250 | Arithmetically shift the 16 bit input var1 right var2 positions with | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
251 | sign extension. If var2 is negative, arithmetically shift var1 left by | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
252 | -var2 with sign extension. Saturate the result in case of underflows or | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
253 | overflows. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
254 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
255 | Complexity weight : 1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
256 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
257 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
258 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
259 | var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
260 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
261 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
262 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
263 | var2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
264 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
265 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
266 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
267 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
268 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
269 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
270 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
271 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
272 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
273 | var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
274 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
275 | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
276 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
277 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
278 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
279 static inline Word16 shr (Word16 var1, Word16 var2) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
280 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
281 Word32 result; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
282 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
283 if (var2 < 0) { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
284 var2 = -var2; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
285 result = (Word32) var1 << var2; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
286 if (var1 > 0) { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
287 if (unlikely((var2 >= 15) || (result & 0xFFFF8000))) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
288 return MAX_16; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
289 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
290 return (Word16) result; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
291 } else if (var1 < 0) { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
292 if (unlikely((var2 >= 16) || ((result & 0xFFFF8000) != 0xFFFF8000))) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
293 return MIN_16; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
294 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
295 return (Word16) result; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
296 } else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
297 return 0; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
298 } else { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
299 if (unlikely(var2 >= 15)) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
300 return (var1 < 0) ? -1 : 0; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
301 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
302 return var1 >> var2; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
303 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
304 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
305 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
306 /*___________________________________________________________________________ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
307 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
308 | Function Name : mult | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
309 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
310 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
311 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
312 | Performs the multiplication of var1 by var2 and gives a 16 bit result | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
313 | which is scaled i.e.: | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
314 | mult(var1,var2) = extract_l(L_shr((var1 times var2),15)) and | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
315 | mult(-32768,-32768) = 32767. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
316 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
317 | Complexity weight : 1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
318 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
319 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
320 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
321 | var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
322 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
323 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
324 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
325 | var2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
326 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
327 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
328 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
329 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
330 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
331 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
332 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
333 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
334 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
335 | var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
336 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
337 | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
338 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
339 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
340 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
341 static inline Word16 mult (Word16 var1, Word16 var2) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
342 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
343 if (unlikely(var1 == MIN_16 && var2 == MIN_16)) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
344 return MAX_16; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
345 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
346 return ((Word32) var1 * var2) >> 15; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
347 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
348 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
349 /*___________________________________________________________________________ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
350 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
351 | Function Name : negate | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
352 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
353 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
354 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
355 | Negate var1 with saturation, saturate in the case where input is -32768:| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
356 | negate(var1) = sub(0,var1). | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
357 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
358 | Complexity weight : 1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
359 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
360 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
361 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
362 | var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
363 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
364 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
365 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
366 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
367 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
368 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
369 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
370 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
371 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
372 | var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
373 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
374 | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
375 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
376 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
377 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
378 static inline Word16 negate (Word16 var1) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
379 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
380 Word16 var_out; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
381 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
382 var_out = (var1 == MIN_16) ? MAX_16 : -var1; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
383 return (var_out); |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
384 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
385 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
386 /*___________________________________________________________________________ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
387 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
388 | Function Name : extract_h | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
389 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
390 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
391 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
392 | Return the 16 MSB of L_var1. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
393 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
394 | Complexity weight : 1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
395 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
396 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
397 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
398 | L_var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
399 | 32 bit long signed integer (Word32 ) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
400 | range : 0x8000 0000 <= L_var1 <= 0x7fff ffff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
401 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
402 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
403 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
404 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
405 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
406 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
407 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
408 | var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
409 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
410 | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
411 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
412 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
413 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
414 static inline Word16 extract_h (Word32 L_var1) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
415 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
416 Word16 var_out; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
417 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
418 var_out = (Word16) (L_var1 >> 16); |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
419 return (var_out); |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
420 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
421 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
422 /*___________________________________________________________________________ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
423 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
424 | Function Name : extract_l | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
425 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
426 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
427 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
428 | Return the 16 LSB of L_var1. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
429 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
430 | Complexity weight : 1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
431 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
432 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
433 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
434 | L_var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
435 | 32 bit long signed integer (Word32 ) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
436 | range : 0x8000 0000 <= L_var1 <= 0x7fff ffff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
437 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
438 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
439 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
440 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
441 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
442 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
443 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
444 | var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
445 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
446 | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
447 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
448 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
449 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
450 static inline Word16 extract_l (Word32 L_var1) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
451 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
452 Word16 var_out; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
453 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
454 var_out = (Word16) L_var1; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
455 return (var_out); |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
456 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
457 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
458 /*___________________________________________________________________________ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
459 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
460 | Function Name : round | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
461 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
462 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
463 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
464 | Round the lower 16 bits of the 32 bit input number into the MS 16 bits | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
465 | with saturation. Shift the resulting bits right by 16 and return the 16 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
466 | bit number: | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
467 | round(L_var1) = extract_h(L_add(L_var1,32768)) | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
468 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
469 | Complexity weight : 1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
470 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
471 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
472 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
473 | L_var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
474 | 32 bit long signed integer (Word32 ) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
475 | range : 0x8000 0000 <= L_var1 <= 0x7fff ffff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
476 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
477 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
478 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
479 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
480 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
481 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
482 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
483 | var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
484 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
485 | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
486 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
487 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
488 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
489 static inline Word16 round (Word32 L_var1) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
490 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
491 if (unlikely(L_var1 >= 0x7fff8000)) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
492 return MAX_16; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
493 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
494 return (L_var1 + 0x8000) >> 16; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
495 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
496 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
497 /* Word32 operations */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
498 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
499 /*___________________________________________________________________________ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
500 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
501 | Function Name : L_add | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
502 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
503 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
504 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
505 | 32 bits addition of the two 32 bits variables (L_var1+L_var2) with | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
506 | overflow control and saturation; the result is set at +2147483647 when | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
507 | overflow occurs or at -2147483648 when underflow occurs. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
508 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
509 | Complexity weight : 2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
510 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
511 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
512 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
513 | L_var1 32 bit long signed integer (Word32) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
514 | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
515 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
516 | L_var2 32 bit long signed integer (Word32) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
517 | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
518 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
519 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
520 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
521 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
522 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
523 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
524 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
525 | L_var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
526 | 32 bit long signed integer (Word32) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
527 | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
528 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
529 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
530 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
531 static inline Word32 L_add (Word32 L_var1, Word32 L_var2) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
532 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
533 Word32 L_var_out; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
534 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
535 L_var_out = L_var1 + L_var2; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
536 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
537 if (((L_var1 ^ L_var2) & MIN_32) == 0) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
538 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
539 if ((L_var_out ^ L_var1) & MIN_32) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
540 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
541 L_var_out = (L_var1 < 0) ? MIN_32 : MAX_32; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
542 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
543 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
544 return (L_var_out); |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
545 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
546 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
547 /*___________________________________________________________________________ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
548 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
549 | Function Name : L_sub | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
550 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
551 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
552 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
553 | 32 bits subtraction of the two 32 bits variables (L_var1-L_var2) with | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
554 | overflow control and saturation; the result is set at +2147483647 when | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
555 | overflow occurs or at -2147483648 when underflow occurs. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
556 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
557 | Complexity weight : 2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
558 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
559 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
560 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
561 | L_var1 32 bit long signed integer (Word32) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
562 | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
563 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
564 | L_var2 32 bit long signed integer (Word32) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
565 | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
566 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
567 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
568 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
569 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
570 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
571 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
572 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
573 | L_var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
574 | 32 bit long signed integer (Word32) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
575 | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | |
38
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
576 |___________________________________________________________________________| |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
577 */ |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
578 |
347
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
579 static inline Word32 L_sub (Word32 L_var1, Word32 L_var2) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
580 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
581 Word32 L_var_out; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
582 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
583 L_var_out = L_var1 - L_var2; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
584 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
585 if (((L_var1 ^ L_var2) & MIN_32) != 0) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
586 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
587 if ((L_var_out ^ L_var1) & MIN_32) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
588 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
589 L_var_out = (L_var1 < 0) ? MIN_32 : MAX_32; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
590 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
591 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
592 return (L_var_out); |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
593 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
594 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
595 /*___________________________________________________________________________ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
596 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
597 | Function Name : L_mult | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
598 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
599 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
600 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
601 | L_mult is the 32 bit result of the multiplication of var1 times var2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
602 | with one shift left i.e.: | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
603 | L_mult(var1,var2) = L_shl((var1 times var2),1) and | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
604 | L_mult(-32768,-32768) = 2147483647. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
605 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
606 | Complexity weight : 1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
607 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
608 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
609 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
610 | var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
611 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
612 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
613 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
614 | var2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
615 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
616 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
617 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
618 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
619 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
620 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
621 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
622 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
623 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
624 | L_var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
625 | 32 bit long signed integer (Word32) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
626 | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
627 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
628 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
629 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
630 static inline Word32 L_mult (Word16 var1, Word16 var2) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
631 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
632 if (unlikely(var1 == MIN_16 && var2 == MIN_16)) { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
633 Overflow = 1; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
634 return MAX_32; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
635 } else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
636 return ((Word32) var1 * var2) << 1; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
637 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
638 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
639 /*___________________________________________________________________________ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
640 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
641 | Function Name : L_mac | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
642 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
643 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
644 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
645 | Multiply var1 by var2 and shift the result left by 1. Add the 32 bit | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
646 | result to L_var3 with saturation, return a 32 bit result: | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
647 | L_mac(L_var3,var1,var2) = L_add(L_var3,L_mult(var1,var2)). | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
648 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
649 | Complexity weight : 1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
650 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
651 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
652 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
653 | L_var3 32 bit long signed integer (Word32) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
654 | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
655 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
656 | var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
657 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
658 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
659 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
660 | var2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
661 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
662 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
663 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
664 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
665 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
666 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
667 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
668 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
669 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
670 | L_var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
671 | 32 bit long signed integer (Word32) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
672 | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
673 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
674 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
675 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
676 static inline Word32 L_mac (Word32 L_var3, Word16 var1, Word16 var2) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
677 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
678 Word32 L_var_out; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
679 Word32 L_product; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
680 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
681 L_product = L_mult (var1, var2); |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
682 L_var_out = L_add (L_var3, L_product); |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
683 return (L_var_out); |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
684 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
685 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
686 /*___________________________________________________________________________ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
687 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
688 | Function Name : L_msu | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
689 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
690 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
691 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
692 | Multiply var1 by var2 and shift the result left by 1. Subtract the 32 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
693 | bit result to L_var3 with saturation, return a 32 bit result: | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
694 | L_msu(L_var3,var1,var2) = L_sub(L_var3,L_mult(var1,var2)). | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
695 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
696 | Complexity weight : 1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
697 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
698 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
699 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
700 | L_var3 32 bit long signed integer (Word32) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
701 | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
702 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
703 | var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
704 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
705 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
706 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
707 | var2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
708 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
709 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
710 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
711 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
712 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
713 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
714 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
715 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
716 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
717 | L_var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
718 | 32 bit long signed integer (Word32) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
719 | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
720 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
721 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
722 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
723 static inline Word32 L_msu (Word32 L_var3, Word16 var1, Word16 var2) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
724 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
725 Word32 L_var_out; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
726 Word32 L_product; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
727 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
728 L_product = L_mult (var1, var2); |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
729 L_var_out = L_sub (L_var3, L_product); |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
730 return (L_var_out); |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
731 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
732 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
733 /*___________________________________________________________________________ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
734 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
735 | Function Name : L_negate | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
736 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
737 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
738 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
739 | Negate the 32 bit variable L_var1 with saturation; saturate in the case | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
740 | where input is -2147483648 (0x8000 0000). | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
741 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
742 | Complexity weight : 2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
743 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
744 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
745 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
746 | L_var1 32 bit long signed integer (Word32) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
747 | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
748 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
749 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
750 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
751 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
752 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
753 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
754 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
755 | L_var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
756 | 32 bit long signed integer (Word32) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
757 | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
758 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
759 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
760 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
761 static inline Word32 L_negate (Word32 L_var1) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
762 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
763 Word32 L_var_out; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
764 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
765 L_var_out = (L_var1 == MIN_32) ? MAX_32 : -L_var1; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
766 return (L_var_out); |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
767 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
768 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
769 /*___________________________________________________________________________ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
770 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
771 | Function Name : L_shl | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
772 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
773 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
774 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
775 | Arithmetically shift the 32 bit input L_var1 left var2 positions. Zero | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
776 | fill the var2 LSB of the result. If var2 is negative, arithmetically | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
777 | shift L_var1 right by -var2 with sign extension. Saturate the result in | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
778 | case of underflows or overflows. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
779 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
780 | Complexity weight : 2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
781 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
782 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
783 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
784 | L_var1 32 bit long signed integer (Word32) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
785 | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
786 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
787 | var2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
788 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
789 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
790 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
791 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
792 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
793 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
794 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
795 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
796 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
797 | L_var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
798 | 32 bit long signed integer (Word32) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
799 | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
800 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
801 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
802 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
803 static inline Word32 L_shl (Word32 L_var1, Word16 var2) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
804 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
805 Word32 L_var_out; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
806 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
807 if (var2 < 0) { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
808 var2 = -var2; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
809 if (unlikely(var2 >= 31)) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
810 L_var_out = (L_var1 < 0) ? -1 : 0; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
811 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
812 L_var_out = L_var1 >> var2; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
813 } else { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
814 L_var_out = L_var1 << var2; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
815 if (unlikely(L_var_out >> var2 != L_var1)) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
816 L_var_out = (L_var1 >> 31) ^ MAX_32; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
817 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
818 return (L_var_out); |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
819 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
820 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
821 /*___________________________________________________________________________ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
822 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
823 | Function Name : L_shr | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
824 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
825 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
826 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
827 | Arithmetically shift the 32 bit input L_var1 right var2 positions with | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
828 | sign extension. If var2 is negative, arithmetically shift L_var1 left | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
829 | by -var2 and zero fill the -var2 LSB of the result. Saturate the result | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
830 | in case of underflows or overflows. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
831 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
832 | Complexity weight : 2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
833 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
834 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
835 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
836 | L_var1 32 bit long signed integer (Word32) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
837 | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
838 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
839 | var2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
840 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
841 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
842 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
843 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
844 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
845 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
846 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
847 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
848 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
849 | L_var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
850 | 32 bit long signed integer (Word32) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
851 | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
852 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
853 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
854 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
855 static inline Word32 L_shr (Word32 L_var1, Word16 var2) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
856 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
857 Word32 L_var_out; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
858 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
859 if (var2 < 0) { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
860 var2 = -var2; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
861 L_var_out = L_var1 << var2; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
862 if (unlikely(L_var_out >> var2 != L_var1)) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
863 L_var_out = (L_var1 >> 31) ^ MAX_32; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
864 } else { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
865 if (unlikely(var2 >= 31)) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
866 L_var_out = (L_var1 < 0) ? -1 : 0; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
867 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
868 L_var_out = L_var1 >> var2; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
869 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
870 return (L_var_out); |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
871 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
872 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
873 /*___________________________________________________________________________ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
874 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
875 | Function Name : L_deposit_h | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
876 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
877 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
878 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
879 | Deposit the 16 bit var1 into the 16 MS bits of the 32 bit output. The | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
880 | 16 LS bits of the output are zeroed. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
881 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
882 | Complexity weight : 2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
883 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
884 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
885 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
886 | var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
887 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
888 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
889 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
890 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
891 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
892 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
893 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
894 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
895 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
896 | L_var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
897 | 32 bit long signed integer (Word32) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
898 | range : 0x8000 0000 <= var_out <= 0x7fff 0000. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
899 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
900 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
901 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
902 static inline Word32 L_deposit_h (Word16 var1) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
903 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
904 Word32 L_var_out; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
905 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
906 L_var_out = (Word32) var1 << 16; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
907 return (L_var_out); |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
908 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
909 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
910 /*___________________________________________________________________________ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
911 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
912 | Function Name : L_deposit_l | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
913 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
914 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
915 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
916 | Deposit the 16 bit var1 into the 16 LS bits of the 32 bit output. The | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
917 | 16 MS bits of the output are sign extended. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
918 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
919 | Complexity weight : 2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
920 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
921 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
922 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
923 | var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
924 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
925 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
926 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
927 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
928 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
929 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
930 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
931 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
932 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
933 | L_var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
934 | 32 bit long signed integer (Word32) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
935 | range : 0xFFFF 8000 <= var_out <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
936 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
937 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
938 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
939 static inline Word32 L_deposit_l (Word16 var1) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
940 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
941 Word32 L_var_out; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
942 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
943 L_var_out = (Word32) var1; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
944 return (L_var_out); |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
945 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
946 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
947 /*___________________________________________________________________________ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
948 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
949 | Function Name : L_abs | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
950 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
951 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
952 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
953 | Absolute value of L_var1; Saturate in case where the input is | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
954 | -214783648 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
955 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
956 | Complexity weight : 3 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
957 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
958 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
959 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
960 | L_var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
961 | 32 bit long signed integer (Word32) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
962 | range : 0x8000 0000 <= var1 <= 0x7fff ffff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
963 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
964 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
965 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
966 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
967 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
968 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
969 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
970 | L_var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
971 | 32 bit long signed integer (Word32) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
972 | range : 0x0000 0000 <= var_out <= 0x7fff ffff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
973 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
974 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
975 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
976 static inline Word32 L_abs (Word32 L_var1) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
977 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
978 Word32 L_var_out; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
979 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
980 if (L_var1 == MIN_32) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
981 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
982 L_var_out = MAX_32; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
983 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
984 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
985 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
986 if (L_var1 < 0) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
987 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
988 L_var_out = -L_var1; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
989 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
990 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
991 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
992 L_var_out = L_var1; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
993 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
994 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
995 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
996 return (L_var_out); |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
997 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
998 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
999 /* additional ops */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1000 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1001 /*___________________________________________________________________________ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1002 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1003 | Function Name : mult_r | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1004 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1005 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1006 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1007 | Same as mult with rounding, i.e.: | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1008 | mult_r(var1,var2) = extract_l(L_shr(((var1 * var2) + 16384),15)) and | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1009 | mult_r(-32768,-32768) = 32767. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1010 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1011 | Complexity weight : 2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1012 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1013 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1014 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1015 | var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1016 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1017 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1018 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1019 | var2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1020 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1021 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1022 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1023 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1024 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1025 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1026 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1027 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1028 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1029 | var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1030 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1031 | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1032 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1033 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1034 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1035 static inline Word16 mult_r (Word16 var1, Word16 var2) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1036 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1037 Word16 var_out; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1038 Word32 L_product_arr; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1039 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1040 L_product_arr = (Word32) var1 *(Word32) var2; /* product */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1041 L_product_arr += (Word32) 0x00004000L; /* round */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1042 L_product_arr &= (Word32) 0xffff8000L; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1043 L_product_arr >>= 15; /* shift */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1044 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1045 if (unlikely(L_product_arr > MAX_16)) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1046 return MAX_16; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1047 else if (unlikely(L_product_arr < MIN_16)) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1048 return MIN_16; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1049 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1050 return L_product_arr; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1051 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1052 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1053 /*___________________________________________________________________________ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1054 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1055 | Function Name : norm_s | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1056 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1057 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1058 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1059 | Produces the number of left shift needed to normalize the 16 bit varia- | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1060 | ble var1 for positive values on the interval with minimum of 16384 and | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1061 | maximum of 32767, and for negative values on the interval with minimum | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1062 | of -32768 and maximum of -16384; in order to normalize the result, the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1063 | following operation must be done : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1064 | norm_var1 = shl(var1,norm_s(var1)). | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1065 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1066 | Complexity weight : 15 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1067 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1068 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1069 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1070 | var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1071 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1072 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1073 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1074 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1075 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1076 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1077 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1078 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1079 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1080 | var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1081 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1082 | range : 0x0000 0000 <= var_out <= 0x0000 000f. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1083 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1084 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1085 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1086 static inline Word16 norm_s (Word16 var1) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1087 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1088 Word16 var_out; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1089 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1090 if (var1 == 0) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1091 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1092 var_out = 0; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1093 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1094 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1095 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1096 if (var1 == (Word16) 0xffff) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1097 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1098 var_out = 15; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1099 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1100 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1101 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1102 if (var1 < 0) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1103 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1104 var1 = ~var1; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1105 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1106 for (var_out = 0; var1 < 0x4000; var_out++) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1107 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1108 var1 <<= 1; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1109 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1110 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1111 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1112 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1113 return (var_out); |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1114 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1115 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1116 /*___________________________________________________________________________ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1117 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1118 | Function Name : norm_l | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1119 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1120 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1121 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1122 | Produces the number of left shifts needed to normalize the 32 bit varia-| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1123 | ble L_var1 for positive values on the interval with minimum of | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1124 | 1073741824 and maximum of 2147483647, and for negative values on the in-| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1125 | terval with minimum of -2147483648 and maximum of -1073741824; in order | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1126 | to normalize the result, the following operation must be done : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1127 | norm_L_var1 = L_shl(L_var1,norm_l(L_var1)). | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1128 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1129 | Complexity weight : 30 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1130 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1131 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1132 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1133 | L_var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1134 | 32 bit long signed integer (Word32) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1135 | range : 0x8000 0000 <= var1 <= 0x7fff ffff. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1136 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1137 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1138 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1139 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1140 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1141 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1142 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1143 | var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1144 | 16 bit short signed integer (Word16) whose value falls in the | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1145 | range : 0x0000 0000 <= var_out <= 0x0000 001f. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1146 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1147 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1148 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1149 static inline Word16 norm_l (Word32 L_var1) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1150 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1151 Word16 var_out; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1152 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1153 if (L_var1 == 0) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1154 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1155 var_out = 0; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1156 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1157 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1158 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1159 if (L_var1 == (Word32) 0xffffffffL) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1160 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1161 var_out = 31; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1162 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1163 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1164 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1165 if (L_var1 < 0) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1166 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1167 L_var1 = ~L_var1; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1168 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1169 for (var_out = 0; L_var1 < (Word32) 0x40000000L; var_out++) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1170 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1171 L_var1 <<= 1; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1172 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1173 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1174 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1175 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1176 return (var_out); |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1177 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1178 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1179 /* ETSI functions that aren't inlined */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1180 |
38
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1181 Word32 L_macNs (Word32 L_var3, Word16 var1, Word16 var2); /* Mac without |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1182 sat, 1 */ |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1183 Word32 L_msuNs (Word32 L_var3, Word16 var1, Word16 var2); /* Msu without |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1184 sat, 1 */ |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1185 Word32 L_add_c (Word32 L_var1, Word32 L_var2); /* Long add with c, 2 */ |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1186 Word32 L_sub_c (Word32 L_var1, Word32 L_var2); /* Long sub with c, 2 */ |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1187 Word16 shr_r (Word16 var1, Word16 var2); /* Shift right with |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1188 round, 2 */ |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1189 Word16 mac_r (Word32 L_var3, Word16 var1, Word16 var2); /* Mac with |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1190 rounding,2 */ |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1191 Word16 msu_r (Word32 L_var3, Word16 var1, Word16 var2); /* Msu with |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1192 rounding,2 */ |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1193 Word32 L_shr_r (Word32 L_var1, Word16 var2); /* Long shift right with |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1194 round, 3 */ |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1195 Word32 L_sat (Word32 L_var1); /* Long saturation, 4 */ |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1196 Word16 div_s (Word16 var1, Word16 var2); /* Short division, 18 */ |