FreeCalypso > hg > gsm-codec-lib
annotate libgsmefr/basic_op.h @ 349:ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 22 Apr 2024 08:14:20 +0000 |
parents | 1c514150c033 |
children | 9b05bbc23b8a |
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 |
349
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
7 * functions. (Further update: for extra speed-up, the some inline |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
8 * function implementations have been lifted from PacketVideo AMR |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
9 * version, aka libopencore-amrnb.) |
347
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
10 * |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
11 * 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
|
12 * 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
|
13 * 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
|
14 * 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
|
15 * 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
|
16 * 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
|
17 * |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
18 * 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
|
19 * 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
|
20 * (sign bit fill). |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
21 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
22 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
23 /* 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
|
24 extern __thread Flag Overflow; |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 extern __thread Flag Carry; |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 |
347
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
27 #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
|
28 #define MIN_32 (Word32)0x80000000 |
38
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 #define MAX_16 (Word16)0x7fff |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 #define MIN_16 (Word16)0x8000 |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 |
347
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
33 /* 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
|
34 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
35 #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
|
36 #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
|
37 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
38 /* Word16 operations */ |
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 /*___________________________________________________________________________ |
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 | Function Name : add | |
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 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
45 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
46 | 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
|
47 | 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
|
48 | when underflow occurs. | |
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 | Complexity weight : 1 | |
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 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
53 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
54 | var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
55 | 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
|
56 | 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
|
57 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
58 | var2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
59 | 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
|
60 | 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
|
61 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
62 | Outputs : | |
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 | none | |
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 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
67 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
68 | var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
69 | 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
|
70 | 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
|
71 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
72 */ |
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 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
|
75 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
76 Word32 L_sum; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
77 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
78 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
|
79 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
|
80 return MAX_16; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
81 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
|
82 return MIN_16; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
83 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
84 return L_sum; |
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 /*___________________________________________________________________________ |
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 | Function Name : sub | |
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 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
92 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
93 | 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
|
94 | 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
|
95 | -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
|
96 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
97 | Complexity weight : 1 | |
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 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
100 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
101 | var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
102 | 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
|
103 | 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
|
104 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
105 | var2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
106 | 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
|
107 | 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
|
108 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
109 | Outputs : | |
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 | none | |
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 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
114 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
115 | var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
116 | 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
|
117 | 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
|
118 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
119 */ |
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 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
|
122 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
123 Word32 L_diff; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
124 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
125 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
|
126 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
|
127 return MAX_16; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
128 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
|
129 return MIN_16; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
130 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
131 return L_diff; |
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 /*___________________________________________________________________________ |
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 | 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
|
137 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
138 | Purpose : | |
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 | 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
|
141 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
142 | Complexity weight : 1 | |
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 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
145 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
146 | var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
147 | 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
|
148 | 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
|
149 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
150 | Outputs : | |
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 | none | |
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 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
155 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
156 | var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
157 | 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
|
158 | 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
|
159 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
160 */ |
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 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
|
163 { |
349
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
164 Word16 y = var1 - (var1 < 0); |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
165 y = y ^ (y >> 15); |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
166 return (y); |
347
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 |
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 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
171 | Function Name : shl | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
172 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
173 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
174 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
175 | 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
|
176 | 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
|
177 | 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
|
178 | underflows or overflows. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
179 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
180 | Complexity weight : 1 | |
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 | Inputs : | |
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 | var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
185 | 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
|
186 | 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
|
187 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
188 | var2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
189 | 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
|
190 | 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
|
191 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
192 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
193 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
194 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
195 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
196 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
197 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
198 | var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
199 | 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
|
200 | 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
|
201 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
202 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
203 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
204 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
|
205 { |
349
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
206 Word16 var_out; |
347
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
207 |
349
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
208 if (unlikely(var2 < 0)) { |
347
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
209 var2 = -var2; |
349
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
210 if (unlikely(var2 > 15)) |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
211 var2 = 15; |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
212 var_out = var1 >> var2; |
347
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
213 } else { |
349
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
214 if (unlikely(var2 > 15)) |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
215 var2 = 15; |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
216 var_out = var1 << var2; |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
217 if (unlikely(var_out >> var2 != var1)) |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
218 { |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
219 var_out = (var1 >> 15) ^ MAX_16; |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
220 } |
347
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
221 } |
349
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
222 return var_out; |
347
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
223 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
224 |
38
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
225 /*___________________________________________________________________________ |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
226 | | |
347
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
227 | Function Name : shr | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
228 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
229 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
230 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
231 | 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
|
232 | 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
|
233 | -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
|
234 | overflows. | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
235 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
236 | Complexity weight : 1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
237 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
238 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
239 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
240 | var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
241 | 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
|
242 | 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
|
243 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
244 | var2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
245 | 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
|
246 | 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
|
247 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
248 | Outputs : | |
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 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
251 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
252 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
253 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
254 | var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
255 | 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
|
256 | 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
|
257 |___________________________________________________________________________| |
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 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
260 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
|
261 { |
349
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
262 Word16 var_out; |
347
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
263 |
349
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
264 if (unlikely(var2 < 0)) { |
347
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
265 var2 = -var2; |
349
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
266 if (unlikely(var2 > 15)) |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
267 var2 = 15; |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
268 var_out = var1 << var2; |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
269 if (unlikely(var_out >> var2 != var1)) |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
270 { |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
271 var_out = (var1 >> 15) ^ MAX_16; |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
272 } |
347
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
273 } else { |
349
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
274 if (unlikely(var2 > 15)) |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
275 var2 = 15; |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
276 var_out = var1 >> var2; |
347
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
277 } |
349
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
278 return var_out; |
347
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
279 } |
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 /*___________________________________________________________________________ |
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 | Function Name : mult | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
284 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
285 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
286 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
287 | 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
|
288 | 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
|
289 | 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
|
290 | 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
|
291 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
292 | Complexity weight : 1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
293 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
294 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
295 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
296 | var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
297 | 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
|
298 | 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
|
299 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
300 | var2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
301 | 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
|
302 | 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
|
303 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
304 | Outputs : | |
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 | none | |
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 | Return Value : | |
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 | var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
311 | 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
|
312 | 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
|
313 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
314 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
315 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
316 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
|
317 { |
349
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
318 register Word32 product; |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
319 |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
320 product = ((Word32) var1 * var2) >> 15; |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
321 |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
322 /* Saturate result (if necessary). */ |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
323 /* var1 * var2 >0x00007fff is the only case */ |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
324 /* that saturation occurs. */ |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
325 |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
326 if (unlikely(product > 0x00007fff)) |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
327 product = (Word32) MAX_16; |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
328 |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
329 /* Return the product as a 16 bit value by type casting Word32 to Word16 */ |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
330 |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
331 return ((Word16) product); |
347
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 |
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 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
336 | Function Name : negate | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
337 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
338 | Purpose : | |
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 | 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
|
341 | 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
|
342 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
343 | Complexity weight : 1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
344 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
345 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
346 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
347 | var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
348 | 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
|
349 | 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
|
350 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
351 | Outputs : | |
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 | none | |
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 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
356 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
357 | var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
358 | 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
|
359 | 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
|
360 |___________________________________________________________________________| |
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 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
363 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
|
364 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
365 Word16 var_out; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
366 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
367 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
|
368 return (var_out); |
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 |
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 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
373 | 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
|
374 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
375 | Purpose : | |
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 | 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
|
378 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
379 | Complexity weight : 1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
380 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
381 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
382 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
383 | L_var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
384 | 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
|
385 | 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
|
386 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
387 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
388 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
389 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
390 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
391 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
392 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
393 | var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
394 | 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
|
395 | 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
|
396 |___________________________________________________________________________| |
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 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
399 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
|
400 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
401 Word16 var_out; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
402 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
403 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
|
404 return (var_out); |
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 |
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 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
409 | 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
|
410 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
411 | Purpose : | |
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 | 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
|
414 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
415 | Complexity weight : 1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
416 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
417 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
418 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
419 | L_var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
420 | 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
|
421 | 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
|
422 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
423 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
424 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
425 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
426 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
427 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
428 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
429 | var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
430 | 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
|
431 | 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
|
432 |___________________________________________________________________________| |
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 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
435 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
|
436 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
437 Word16 var_out; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
438 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
439 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
|
440 return (var_out); |
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 |
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 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
445 | Function Name : round | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
446 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
447 | Purpose : | |
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 | 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
|
450 | 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
|
451 | bit number: | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
452 | 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
|
453 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
454 | Complexity weight : 1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
455 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
456 | Inputs : | |
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 | L_var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
459 | 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
|
460 | 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
|
461 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
462 | Outputs : | |
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 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
465 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
466 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
467 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
468 | var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
469 | 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
|
470 | 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
|
471 |___________________________________________________________________________| |
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 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
474 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
|
475 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
476 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
|
477 return MAX_16; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
478 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
479 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
|
480 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
481 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
482 /* Word32 operations */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
483 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
484 /*___________________________________________________________________________ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
485 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
486 | 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
|
487 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
488 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
489 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
490 | 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
|
491 | 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
|
492 | 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
|
493 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
494 | Complexity weight : 2 | |
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 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
497 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
498 | 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
|
499 | 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
|
500 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
501 | 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
|
502 | 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
|
503 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
504 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
505 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
506 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
507 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
508 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
509 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
510 | L_var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
511 | 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
|
512 | 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
|
513 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
514 */ |
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 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
|
517 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
518 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
|
519 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
520 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
|
521 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
522 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
|
523 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
524 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
|
525 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
526 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
|
527 } |
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 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
|
530 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
531 |
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 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
534 | 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
|
535 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
536 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
537 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
538 | 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
|
539 | 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
|
540 | 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
|
541 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
542 | Complexity weight : 2 | |
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 | Inputs : | |
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 | 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
|
547 | 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
|
548 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
549 | 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
|
550 | 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
|
551 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
552 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
553 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
554 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
555 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
556 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
557 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
558 | L_var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
559 | 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
|
560 | 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
|
561 |___________________________________________________________________________| |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
562 */ |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
563 |
347
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
564 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
|
565 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
566 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
|
567 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
568 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
|
569 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
570 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
|
571 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
572 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
|
573 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
574 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
|
575 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
576 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
577 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
|
578 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
579 |
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 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
582 | 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
|
583 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
584 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
585 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
586 | 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
|
587 | 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
|
588 | 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
|
589 | 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
|
590 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
591 | Complexity weight : 1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
592 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
593 | Inputs : | |
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 | var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
596 | 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
|
597 | 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
|
598 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
599 | var2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
600 | 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
|
601 | 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
|
602 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
603 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
604 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
605 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
606 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
607 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
608 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
609 | L_var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
610 | 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
|
611 | 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
|
612 |___________________________________________________________________________| |
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 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
615 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
|
616 { |
349
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
617 register Word32 L_product; |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
618 |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
619 L_product = (Word32) var1 * var2; |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
620 |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
621 if (likely(L_product != (Word32) 0x40000000)) |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
622 { |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
623 L_product <<= 1; /* Multiply by 2 */ |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
624 } |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
625 else |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
626 { |
347
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
627 Overflow = 1; |
349
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
628 L_product = MAX_32; |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
629 } |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
630 |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
631 return (L_product); |
347
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
632 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
633 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
634 /*___________________________________________________________________________ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
635 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
636 | 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
|
637 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
638 | Purpose : | |
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 | 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
|
641 | 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
|
642 | 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
|
643 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
644 | Complexity weight : 1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
645 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
646 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
647 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
648 | 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
|
649 | 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
|
650 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
651 | var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
652 | 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
|
653 | 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
|
654 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
655 | var2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
656 | 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
|
657 | 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
|
658 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
659 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
660 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
661 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
662 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
663 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
664 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
665 | L_var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
666 | 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
|
667 | 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
|
668 |___________________________________________________________________________| |
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 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
671 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
|
672 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
673 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
|
674 Word32 L_product; |
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 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
|
677 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
|
678 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
|
679 } |
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 /*___________________________________________________________________________ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
682 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
683 | 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
|
684 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
685 | Purpose : | |
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 | 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
|
688 | 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
|
689 | 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
|
690 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
691 | Complexity weight : 1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
692 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
693 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
694 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
695 | 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
|
696 | 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
|
697 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
698 | var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
699 | 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
|
700 | 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
|
701 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
702 | var2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
703 | 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
|
704 | 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
|
705 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
706 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
707 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
708 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
709 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
710 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
711 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
712 | L_var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
713 | 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
|
714 | 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
|
715 |___________________________________________________________________________| |
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 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
718 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
|
719 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
720 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
|
721 Word32 L_product; |
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 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
|
724 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
|
725 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
|
726 } |
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 /*___________________________________________________________________________ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
729 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
730 | 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
|
731 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
732 | Purpose : | |
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 | 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
|
735 | 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
|
736 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
737 | Complexity weight : 2 | |
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 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
740 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
741 | 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
|
742 | 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
|
743 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
744 | Outputs : | |
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 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
747 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
748 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
749 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
750 | L_var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
751 | 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
|
752 | 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
|
753 |___________________________________________________________________________| |
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 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
756 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
|
757 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
758 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
|
759 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
760 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
|
761 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
|
762 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
763 |
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 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
766 | 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
|
767 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
768 | Purpose : | |
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 | 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
|
771 | 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
|
772 | 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
|
773 | 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
|
774 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
775 | Complexity weight : 2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
776 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
777 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
778 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
779 | 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
|
780 | 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
|
781 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
782 | var2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
783 | 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
|
784 | 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
|
785 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
786 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
787 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
788 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
789 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
790 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
791 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
792 | L_var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
793 | 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
|
794 | 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
|
795 |___________________________________________________________________________| |
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 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
798 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
|
799 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
800 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
|
801 |
349
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
802 if (unlikely(var2 < 0)) { |
347
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
803 var2 = -var2; |
349
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
804 if (unlikely(var2 > 31)) |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
805 var2 = 31; |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
806 L_var_out = L_var1 >> var2; |
347
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
807 } else { |
349
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
808 if (unlikely(var2 > 31)) |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
809 var2 = 31; |
347
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 << var2; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
811 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
|
812 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
|
813 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
814 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
|
815 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
816 |
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 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
819 | 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
|
820 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
821 | Purpose : | |
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 | 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
|
824 | 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
|
825 | 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
|
826 | 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
|
827 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
828 | Complexity weight : 2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
829 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
830 | Inputs : | |
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 | 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
|
833 | 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
|
834 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
835 | var2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
836 | 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
|
837 | 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
|
838 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
839 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
840 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
841 | none | |
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 | Return Value : | |
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 | L_var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
846 | 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
|
847 | 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
|
848 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
849 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
850 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
851 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
|
852 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
853 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
|
854 |
349
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
855 if (unlikely(var2 < 0)) { |
347
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
856 var2 = -var2; |
349
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
857 if (unlikely(var2 > 31)) |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
858 var2 = 31; |
347
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
859 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
|
860 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
|
861 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
|
862 } else { |
349
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
863 if (unlikely(var2 > 31)) |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
864 var2 = 31; |
ed8762eea8a1
libgsmefr: use some inline functions from PacketVideo
Mychaela Falconia <falcon@freecalypso.org>
parents:
347
diff
changeset
|
865 L_var_out = L_var1 >> var2; |
347
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
866 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
867 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
|
868 } |
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 /*___________________________________________________________________________ |
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 | 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
|
873 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
874 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
875 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
876 | 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
|
877 | 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
|
878 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
879 | Complexity weight : 2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
880 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
881 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
882 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
883 | var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
884 | 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
|
885 | 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
|
886 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
887 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
888 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
889 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
890 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
891 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
892 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
893 | L_var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
894 | 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
|
895 | 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
|
896 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
897 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
898 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
899 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
|
900 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
901 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
|
902 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
903 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
|
904 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
|
905 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
906 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
907 /*___________________________________________________________________________ |
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 | 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
|
910 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
911 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
912 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
913 | 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
|
914 | 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
|
915 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
916 | Complexity weight : 2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
917 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
918 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
919 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
920 | var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
921 | 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
|
922 | 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
|
923 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
924 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
925 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
926 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
927 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
928 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
929 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
930 | L_var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
931 | 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
|
932 | 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
|
933 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
934 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
935 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
936 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
|
937 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
938 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
|
939 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
940 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
|
941 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
|
942 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
943 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
944 /*___________________________________________________________________________ |
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 | 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
|
947 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
948 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
949 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
950 | 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
|
951 | -214783648 | |
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 | Complexity weight : 3 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
954 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
955 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
956 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
957 | L_var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
958 | 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
|
959 | 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
|
960 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
961 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
962 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
963 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
964 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
965 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
966 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
967 | L_var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
968 | 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
|
969 | 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
|
970 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
971 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
972 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
973 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
|
974 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
975 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
|
976 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
977 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
|
978 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
979 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
|
980 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
981 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
982 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
983 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
|
984 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
985 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
|
986 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
987 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
988 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
989 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
|
990 } |
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 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
993 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
|
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 /* additional ops */ |
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 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1000 | 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
|
1001 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1002 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1003 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1004 | 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
|
1005 | 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
|
1006 | 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
|
1007 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1008 | Complexity weight : 2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1009 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1010 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1011 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1012 | var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1013 | 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
|
1014 | 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
|
1015 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1016 | var2 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1017 | 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
|
1018 | 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
|
1019 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1020 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1021 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1022 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1023 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1024 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1025 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1026 | var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1027 | 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
|
1028 | 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
|
1029 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1030 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1031 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1032 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
|
1033 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1034 Word16 var_out; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1035 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
|
1036 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1037 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
|
1038 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
|
1039 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
|
1040 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
|
1041 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1042 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
|
1043 return MAX_16; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1044 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
|
1045 return MIN_16; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1046 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1047 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
|
1048 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1049 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1050 /*___________________________________________________________________________ |
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 | 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
|
1053 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1054 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1055 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1056 | 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
|
1057 | 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
|
1058 | 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
|
1059 | 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
|
1060 | 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
|
1061 | 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
|
1062 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1063 | Complexity weight : 15 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1064 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1065 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1066 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1067 | var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1068 | 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
|
1069 | 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
|
1070 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1071 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1072 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1073 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1074 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1075 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1076 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1077 | var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1078 | 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
|
1079 | 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
|
1080 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1081 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1082 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1083 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
|
1084 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1085 Word16 var_out; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1086 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1087 if (var1 == 0) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1088 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1089 var_out = 0; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1090 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1091 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1092 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1093 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
|
1094 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1095 var_out = 15; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1096 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1097 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1098 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1099 if (var1 < 0) |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1100 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1101 var1 = ~var1; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1102 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1103 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
|
1104 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1105 var1 <<= 1; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1106 } |
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 } |
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 return (var_out); |
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 /*___________________________________________________________________________ |
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 | 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
|
1116 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1117 | Purpose : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1118 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1119 | 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
|
1120 | 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
|
1121 | 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
|
1122 | 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
|
1123 | 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
|
1124 | 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
|
1125 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1126 | Complexity weight : 30 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1127 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1128 | Inputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1129 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1130 | L_var1 | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1131 | 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
|
1132 | 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
|
1133 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1134 | Outputs : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1135 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1136 | none | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1137 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1138 | Return Value : | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1139 | | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1140 | var_out | |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1141 | 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
|
1142 | 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
|
1143 |___________________________________________________________________________| |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1144 */ |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1145 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1146 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
|
1147 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1148 Word16 var_out; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1149 |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1150 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
|
1151 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1152 var_out = 0; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1153 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1154 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1155 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1156 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
|
1157 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1158 var_out = 31; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1159 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1160 else |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1161 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1162 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
|
1163 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1164 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
|
1165 } |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1166 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
|
1167 { |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1168 L_var1 <<= 1; |
1c514150c033
libgsmefr: first big perf opt: inline most basic_op.h functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
1169 } |
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 } |
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 return (var_out); |
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 /* 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
|
1177 |
38
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1178 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
|
1179 sat, 1 */ |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1180 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
|
1181 sat, 1 */ |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1182 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
|
1183 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
|
1184 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
|
1185 round, 2 */ |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1186 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
|
1187 rounding,2 */ |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1188 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
|
1189 rounding,2 */ |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1190 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
|
1191 round, 3 */ |
38326102fc43
libgsmefr: beginning to integrate code from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1192 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
|
1193 Word16 div_s (Word16 var1, Word16 var2); /* Short division, 18 */ |