FreeCalypso > hg > efr-experiments
annotate src/basicop2.c @ 2:c511bfb36c2a
beginning of EFR2 decoder, using AMR version of AGC module
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 03 Apr 2024 05:47:51 +0000 |
parents | 56410792419a |
children |
rev | line source |
---|---|
0
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 | Basic arithmetic operators. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 | Include-Files | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 #include <stdio.h> |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 #include <stdlib.h> |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 #include "typedef.h" |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 #include "basic_op.h" |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 #include "count.h" |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 extern BASIC_OP counter; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 | Local Functions | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 Word16 saturate (Word32 L_var1); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 | Constants and Globals | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 Flag Overflow = 0; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 Flag Carry = 0; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 | Functions | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 | Function Name : saturate | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 | Limit the 32 bit input to the range of a 16 bit word. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 | L_var1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 | 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 | range : 0x8000 0000 <= L_var1 <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 | var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 Word16 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 saturate (Word32 L_var1) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 Word16 var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 if (L_var1 > 0X00007fffL) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 Overflow = 1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 var_out = MAX_16; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 else if (L_var1 < (Word32) 0xffff8000L) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 Overflow = 1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 var_out = MIN_16; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 Overflow = 0; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 var_out = extract_l (L_var1); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 counter.extract_l--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 return (var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 | Function Name : add | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 | Performs the addition (var1+var2) with overflow control and saturation;| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 | the 16 bit result is set at +32767 when overflow occurs or at -32768 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 | when underflow occurs. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 | Complexity weight : 1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 | var1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 | var2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 | var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 Word16 add (Word16 var1, Word16 var2) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 Word16 var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 Word32 L_sum; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 L_sum = (Word32) var1 + var2; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 var_out = saturate (L_sum); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 counter.add++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 return (var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 | Function Name : sub | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 | Performs the subtraction (var1+var2) with overflow control and satu- | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 | ration; the 16 bit result is set at +32767 when overflow occurs or at | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 | -32768 when underflow occurs. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
154 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
155 | Complexity weight : 1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
156 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
158 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
159 | var1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
160 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
161 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
162 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
163 | var2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
164 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
165 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
166 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
167 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
168 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
169 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
170 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
171 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
172 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
173 | var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
174 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
175 | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
176 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
177 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
178 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
179 Word16 sub (Word16 var1, Word16 var2) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
180 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
181 Word16 var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
182 Word32 L_diff; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
183 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
184 L_diff = (Word32) var1 - var2; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
185 var_out = saturate (L_diff); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
186 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
187 counter.sub++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
188 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
189 return (var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
190 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
191 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
192 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
193 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
194 | Function Name : abs_s | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
195 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
196 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
197 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
198 | Absolute value of var1; abs_s(-32768) = 32767. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
199 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
200 | Complexity weight : 1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
201 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
202 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
203 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
204 | var1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
205 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
206 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
207 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
208 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
209 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
210 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
211 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
212 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
213 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
214 | var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
215 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
216 | range : 0x0000 0000 <= var_out <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
217 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
218 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
219 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
220 Word16 abs_s (Word16 var1) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
221 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
222 Word16 var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
223 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
224 if (var1 == (Word16) 0X8000) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
225 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
226 var_out = MAX_16; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
227 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
228 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
229 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
230 if (var1 < 0) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
231 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
232 var_out = -var1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
233 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
234 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
235 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
236 var_out = var1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
237 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
238 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
239 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
240 counter.abs_s++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
241 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
242 return (var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
243 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
244 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
245 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
246 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
247 | Function Name : shl | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
248 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
249 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
250 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
251 | Arithmetically shift the 16 bit input var1 left var2 positions.Zero fill| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
252 | the var2 LSB of the result. If var2 is negative, arithmetically shift | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
253 | var1 right by -var2 with sign extension. Saturate the result in case of | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
254 | underflows or overflows. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
255 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
256 | Complexity weight : 1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
257 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
258 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
259 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
260 | var1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
261 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
262 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
263 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
264 | var2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
265 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
266 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
267 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
268 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
269 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
270 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
271 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
272 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
273 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
274 | var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
275 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
276 | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
277 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
278 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
279 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
280 Word16 shl (Word16 var1, Word16 var2) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
281 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
282 Word16 var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
283 Word32 result; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
284 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
285 if (var2 < 0) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
286 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
287 var_out = shr (var1, -var2); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
288 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
289 counter.shr--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
290 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
291 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
292 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
293 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
294 result = (Word32) var1 *((Word32) 1 << var2); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
295 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
296 if ((var2 > 15 && var1 != 0) || (result != (Word32) ((Word16) result))) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
297 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
298 Overflow = 1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
299 var_out = (var1 > 0) ? MAX_16 : MIN_16; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
300 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
301 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
302 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
303 var_out = extract_l (result); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
304 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
305 counter.extract_l--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
306 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
307 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
308 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
309 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
310 counter.shl++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
311 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
312 return (var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
313 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
314 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
315 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
316 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
317 | Function Name : shr | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
318 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
319 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
320 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
321 | Arithmetically shift the 16 bit input var1 right var2 positions with | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
322 | sign extension. If var2 is negative, arithmetically shift var1 left by | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
323 | -var2 with sign extension. Saturate the result in case of underflows or | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
324 | overflows. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
325 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
326 | Complexity weight : 1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
327 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
328 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
329 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
330 | var1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
331 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
332 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
333 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
334 | var2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
335 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
336 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
337 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
338 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
339 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
340 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
341 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
342 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
343 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
344 | var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
345 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
346 | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
347 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
348 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
349 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
350 Word16 shr (Word16 var1, Word16 var2) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
351 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
352 Word16 var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
353 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
354 if (var2 < 0) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
355 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
356 var_out = shl (var1, -var2); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
357 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
358 counter.shl--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
359 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
360 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
361 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
362 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
363 if (var2 >= 15) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
364 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
365 var_out = (var1 < 0) ? -1 : 0; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
366 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
367 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
368 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
369 if (var1 < 0) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
370 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
371 var_out = ~((~var1) >> var2); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
372 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
373 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
374 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
375 var_out = var1 >> var2; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
376 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
377 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
378 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
379 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
380 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
381 counter.shr++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
382 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
383 return (var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
384 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
385 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
386 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
387 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
388 | Function Name : mult | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
389 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
390 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
391 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
392 | Performs the multiplication of var1 by var2 and gives a 16 bit result | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
393 | which is scaled i.e.: | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
394 | mult(var1,var2) = extract_l(L_shr((var1 times var2),15)) and | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
395 | mult(-32768,-32768) = 32767. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
396 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
397 | Complexity weight : 1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
398 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
399 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
400 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
401 | var1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
402 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
403 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
404 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
405 | var2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
406 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
407 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
408 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
409 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
410 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
411 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
412 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
413 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
414 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
415 | var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
416 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
417 | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
418 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
419 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
420 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
421 Word16 mult (Word16 var1, Word16 var2) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
422 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
423 Word16 var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
424 Word32 L_product; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
425 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
426 L_product = (Word32) var1 *(Word32) var2; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
427 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
428 L_product = (L_product & (Word32) 0xffff8000L) >> 15; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
429 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
430 if (L_product & (Word32) 0x00010000L) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
431 L_product = L_product | (Word32) 0xffff0000L; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
432 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
433 var_out = saturate (L_product); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
434 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
435 counter.mult++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
436 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
437 return (var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
438 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
439 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
440 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
441 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
442 | Function Name : L_mult | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
443 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
444 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
445 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
446 | L_mult is the 32 bit result of the multiplication of var1 times var2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
447 | with one shift left i.e.: | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
448 | L_mult(var1,var2) = L_shl((var1 times var2),1) and | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
449 | L_mult(-32768,-32768) = 2147483647. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
450 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
451 | Complexity weight : 1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
452 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
453 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
454 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
455 | var1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
456 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
457 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
458 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
459 | var2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
460 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
461 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
462 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
463 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
464 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
465 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
466 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
467 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
468 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
469 | L_var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
470 | 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
471 | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
472 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
473 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
474 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
475 Word32 L_mult (Word16 var1, Word16 var2) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
476 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
477 Word32 L_var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
478 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
479 L_var_out = (Word32) var1 *(Word32) var2; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
480 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
481 if (L_var_out != (Word32) 0x40000000L) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
482 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
483 L_var_out *= 2; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
484 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
485 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
486 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
487 Overflow = 1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
488 L_var_out = MAX_32; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
489 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
490 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
491 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
492 counter.L_mult++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
493 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
494 return (L_var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
495 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
496 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
497 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
498 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
499 | Function Name : negate | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
500 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
501 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
502 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
503 | Negate var1 with saturation, saturate in the case where input is -32768:| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
504 | negate(var1) = sub(0,var1). | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
505 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
506 | Complexity weight : 1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
507 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
508 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
509 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
510 | var1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
511 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
512 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
513 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
514 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
515 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
516 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
517 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
518 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
519 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
520 | var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
521 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
522 | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
523 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
524 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
525 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
526 Word16 negate (Word16 var1) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
527 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
528 Word16 var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
529 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
530 var_out = (var1 == MIN_16) ? MAX_16 : -var1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
531 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
532 counter.negate++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
533 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
534 return (var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
535 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
536 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
537 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
538 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
539 | Function Name : extract_h | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
540 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
541 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
542 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
543 | Return the 16 MSB of L_var1. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
544 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
545 | Complexity weight : 1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
546 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
547 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
548 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
549 | L_var1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
550 | 32 bit long signed integer (Word32 ) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
551 | range : 0x8000 0000 <= L_var1 <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
552 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
553 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
554 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
555 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
556 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
557 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
558 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
559 | var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
560 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
561 | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
562 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
563 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
564 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
565 Word16 extract_h (Word32 L_var1) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
566 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
567 Word16 var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
568 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
569 var_out = (Word16) (L_var1 >> 16); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
570 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
571 counter.extract_h++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
572 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
573 return (var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
574 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
575 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
576 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
577 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
578 | Function Name : extract_l | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
579 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
580 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
581 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
582 | Return the 16 LSB of L_var1. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
583 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
584 | Complexity weight : 1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
585 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
586 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
587 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
588 | L_var1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
589 | 32 bit long signed integer (Word32 ) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
590 | range : 0x8000 0000 <= L_var1 <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
591 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
592 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
593 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
594 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
595 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
596 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
597 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
598 | var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
599 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
600 | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
601 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
602 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
603 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
604 Word16 extract_l (Word32 L_var1) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
605 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
606 Word16 var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
607 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
608 var_out = (Word16) L_var1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
609 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
610 counter.extract_l++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
611 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
612 return (var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
613 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
614 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
615 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
616 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
617 | Function Name : round | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
618 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
619 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
620 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
621 | Round the lower 16 bits of the 32 bit input number into the MS 16 bits | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
622 | with saturation. Shift the resulting bits right by 16 and return the 16 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
623 | bit number: | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
624 | round(L_var1) = extract_h(L_add(L_var1,32768)) | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
625 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
626 | Complexity weight : 1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
627 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
628 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
629 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
630 | L_var1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
631 | 32 bit long signed integer (Word32 ) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
632 | range : 0x8000 0000 <= L_var1 <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
633 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
634 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
635 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
636 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
637 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
638 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
639 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
640 | var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
641 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
642 | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
643 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
644 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
645 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
646 Word16 round (Word32 L_var1) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
647 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
648 Word16 var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
649 Word32 L_rounded; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
650 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
651 L_rounded = L_add (L_var1, (Word32) 0x00008000L); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
652 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
653 counter.L_add--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
654 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
655 var_out = extract_h (L_rounded); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
656 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
657 counter.extract_h--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
658 counter.round++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
659 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
660 return (var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
661 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
662 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
663 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
664 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
665 | Function Name : L_mac | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
666 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
667 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
668 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
669 | Multiply var1 by var2 and shift the result left by 1. Add the 32 bit | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
670 | result to L_var3 with saturation, return a 32 bit result: | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
671 | L_mac(L_var3,var1,var2) = L_add(L_var3,L_mult(var1,var2)). | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
672 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
673 | Complexity weight : 1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
674 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
675 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
676 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
677 | L_var3 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
678 | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
679 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
680 | var1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
681 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
682 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
683 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
684 | var2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
685 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
686 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
687 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
688 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
689 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
690 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
691 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
692 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
693 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
694 | L_var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
695 | 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
696 | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
697 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
698 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
699 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
700 Word32 L_mac (Word32 L_var3, Word16 var1, Word16 var2) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
701 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
702 Word32 L_var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
703 Word32 L_product; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
704 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
705 L_product = L_mult (var1, var2); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
706 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
707 counter.L_mult--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
708 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
709 L_var_out = L_add (L_var3, L_product); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
710 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
711 counter.L_add--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
712 counter.L_mac++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
713 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
714 return (L_var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
715 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
716 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
717 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
718 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
719 | Function Name : L_msu | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
720 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
721 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
722 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
723 | Multiply var1 by var2 and shift the result left by 1. Subtract the 32 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
724 | bit result to L_var3 with saturation, return a 32 bit result: | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
725 | L_msu(L_var3,var1,var2) = L_sub(L_var3,L_mult(var1,var2)). | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
726 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
727 | Complexity weight : 1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
728 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
729 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
730 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
731 | L_var3 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
732 | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
733 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
734 | var1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
735 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
736 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
737 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
738 | var2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
739 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
740 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
741 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
742 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
743 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
744 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
745 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
746 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
747 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
748 | L_var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
749 | 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
750 | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
751 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
752 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
753 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
754 Word32 L_msu (Word32 L_var3, Word16 var1, Word16 var2) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
755 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
756 Word32 L_var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
757 Word32 L_product; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
758 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
759 L_product = L_mult (var1, var2); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
760 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
761 counter.L_mult--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
762 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
763 L_var_out = L_sub (L_var3, L_product); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
764 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
765 counter.L_sub--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
766 counter.L_msu++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
767 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
768 return (L_var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
769 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
770 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
771 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
772 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
773 | Function Name : L_macNs | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
774 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
775 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
776 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
777 | Multiply var1 by var2 and shift the result left by 1. Add the 32 bit | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
778 | result to L_var3 without saturation, return a 32 bit result. Generate | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
779 | carry and overflow values : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
780 | L_macNs(L_var3,var1,var2) = L_add_c(L_var3,L_mult(var1,var2)). | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
781 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
782 | Complexity weight : 1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
783 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
784 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
785 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
786 | L_var3 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
787 | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
788 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
789 | var1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
790 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
791 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
792 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
793 | var2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
794 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
795 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
796 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
797 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
798 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
799 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
800 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
801 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
802 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
803 | L_var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
804 | 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
805 | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
806 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
807 | Caution : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
808 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
809 | In some cases the Carry flag has to be cleared or set before using | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
810 | operators which take into account its value. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
811 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
812 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
813 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
814 Word32 L_macNs (Word32 L_var3, Word16 var1, Word16 var2) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
815 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
816 Word32 L_var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
817 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
818 L_var_out = L_mult (var1, var2); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
819 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
820 counter.L_mult--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
821 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
822 L_var_out = L_add_c (L_var3, L_var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
823 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
824 counter.L_add_c--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
825 counter.L_macNs++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
826 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
827 return (L_var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
828 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
829 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
830 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
831 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
832 | Function Name : L_msuNs | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
833 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
834 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
835 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
836 | Multiply var1 by var2 and shift the result left by 1. Subtract the 32 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
837 | bit result from L_var3 without saturation, return a 32 bit result. Ge- | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
838 | nerate carry and overflow values : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
839 | L_msuNs(L_var3,var1,var2) = L_sub_c(L_var3,L_mult(var1,var2)). | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
840 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
841 | Complexity weight : 1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
842 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
843 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
844 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
845 | L_var3 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
846 | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
847 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
848 | var1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
849 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
850 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
851 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
852 | var2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
853 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
854 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
855 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
856 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
857 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
858 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
859 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
860 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
861 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
862 | L_var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
863 | 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
864 | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
865 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
866 | Caution : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
867 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
868 | In some cases the Carry flag has to be cleared or set before using | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
869 | operators which take into account its value. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
870 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
871 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
872 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
873 Word32 L_msuNs (Word32 L_var3, Word16 var1, Word16 var2) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
874 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
875 Word32 L_var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
876 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
877 L_var_out = L_mult (var1, var2); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
878 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
879 counter.L_mult--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
880 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
881 L_var_out = L_sub_c (L_var3, L_var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
882 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
883 counter.L_sub_c--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
884 counter.L_msuNs++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
885 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
886 return (L_var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
887 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
888 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
889 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
890 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
891 | Function Name : L_add | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
892 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
893 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
894 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
895 | 32 bits addition of the two 32 bits variables (L_var1+L_var2) with | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
896 | overflow control and saturation; the result is set at +2147483647 when | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
897 | overflow occurs or at -2147483648 when underflow occurs. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
898 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
899 | Complexity weight : 2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
900 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
901 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
902 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
903 | L_var1 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
904 | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
905 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
906 | L_var2 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
907 | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
908 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
909 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
910 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
911 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
912 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
913 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
914 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
915 | L_var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
916 | 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
917 | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
918 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
919 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
920 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
921 Word32 L_add (Word32 L_var1, Word32 L_var2) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
922 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
923 Word32 L_var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
924 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
925 L_var_out = L_var1 + L_var2; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
926 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
927 if (((L_var1 ^ L_var2) & MIN_32) == 0) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
928 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
929 if ((L_var_out ^ L_var1) & MIN_32) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
930 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
931 L_var_out = (L_var1 < 0) ? MIN_32 : MAX_32; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
932 Overflow = 1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
933 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
934 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
935 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
936 counter.L_add++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
937 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
938 return (L_var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
939 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
940 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
941 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
942 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
943 | Function Name : L_sub | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
944 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
945 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
946 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
947 | 32 bits subtraction of the two 32 bits variables (L_var1-L_var2) with | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
948 | overflow control and saturation; the result is set at +2147483647 when | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
949 | overflow occurs or at -2147483648 when underflow occurs. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
950 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
951 | Complexity weight : 2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
952 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
953 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
954 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
955 | L_var1 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
956 | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
957 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
958 | L_var2 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
959 | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
960 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
961 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
962 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
963 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
964 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
965 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
966 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
967 | L_var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
968 | 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
969 | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
970 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
971 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
972 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
973 Word32 L_sub (Word32 L_var1, Word32 L_var2) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
974 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
975 Word32 L_var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
976 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
977 L_var_out = L_var1 - L_var2; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
978 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
979 if (((L_var1 ^ L_var2) & MIN_32) != 0) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
980 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
981 if ((L_var_out ^ L_var1) & MIN_32) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
982 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
983 L_var_out = (L_var1 < 0L) ? MIN_32 : MAX_32; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
984 Overflow = 1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
985 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
986 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
987 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
988 counter.L_sub++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
989 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
990 return (L_var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
991 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
992 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
993 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
994 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
995 | Function Name : L_add_c | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
996 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
997 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
998 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
999 | Performs 32 bits addition of the two 32 bits variables (L_var1+L_var2+C)| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1000 | with carry. No saturation. Generate carry and Overflow values. The car- | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1001 | ry and overflow values are binary variables which can be tested and as- | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1002 | signed values. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1003 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1004 | Complexity weight : 2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1005 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1006 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1007 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1008 | L_var1 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1009 | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1010 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1011 | L_var2 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1012 | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1013 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1014 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1015 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1016 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1017 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1018 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1019 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1020 | L_var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1021 | 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1022 | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1023 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1024 | Caution : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1025 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1026 | In some cases the Carry flag has to be cleared or set before using | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1027 | operators which take into account its value. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1028 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1029 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1030 Word32 L_add_c (Word32 L_var1, Word32 L_var2) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1031 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1032 Word32 L_var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1033 Word32 L_test; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1034 Flag carry_int = 0; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1035 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1036 L_var_out = L_var1 + L_var2 + Carry; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1037 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1038 L_test = L_var1 + L_var2; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1039 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1040 if ((L_var1 > 0) && (L_var2 > 0) && (L_test < 0)) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1041 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1042 Overflow = 1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1043 carry_int = 0; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1044 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1045 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1046 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1047 if ((L_var1 < 0) && (L_var2 < 0)) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1048 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1049 if (L_test >= 0) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1050 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1051 Overflow = 1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1052 carry_int = 1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1053 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1054 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1055 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1056 Overflow = 0; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1057 carry_int = 1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1058 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1059 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1060 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1061 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1062 if (((L_var1 ^ L_var2) < 0) && (L_test >= 0)) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1063 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1064 Overflow = 0; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1065 carry_int = 1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1066 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1067 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1068 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1069 Overflow = 0; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1070 carry_int = 0; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1071 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1072 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1073 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1074 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1075 if (Carry) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1076 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1077 if (L_test == MAX_32) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1078 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1079 Overflow = 1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1080 Carry = carry_int; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1081 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1082 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1083 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1084 if (L_test == (Word32) 0xFFFFFFFFL) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1085 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1086 Carry = 1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1087 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1088 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1089 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1090 Carry = carry_int; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1091 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1092 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1093 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1094 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1095 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1096 Carry = carry_int; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1097 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1098 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1099 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1100 counter.L_add_c++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1101 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1102 return (L_var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1103 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1104 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1105 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1106 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1107 | Function Name : L_sub_c | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1108 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1109 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1110 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1111 | Performs 32 bits subtraction of the two 32 bits variables with carry | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1112 | (borrow) : L_var1-L_var2-C. No saturation. Generate carry and Overflow | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1113 | values. The carry and overflow values are binary variables which can | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1114 | be tested and assigned values. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1115 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1116 | Complexity weight : 2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1117 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1118 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1119 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1120 | L_var1 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1121 | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1122 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1123 | L_var2 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1124 | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1125 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1126 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1127 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1128 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1129 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1130 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1131 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1132 | L_var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1133 | 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1134 | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1135 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1136 | Caution : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1137 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1138 | In some cases the Carry flag has to be cleared or set before using | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1139 | operators which take into account its value. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1140 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1141 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1142 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1143 Word32 L_sub_c (Word32 L_var1, Word32 L_var2) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1144 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1145 Word32 L_var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1146 Word32 L_test; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1147 Flag carry_int = 0; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1148 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1149 if (Carry) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1150 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1151 Carry = 0; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1152 if (L_var2 != MIN_32) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1153 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1154 L_var_out = L_add_c (L_var1, -L_var2); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1155 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1156 counter.L_add_c--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1157 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1158 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1159 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1160 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1161 L_var_out = L_var1 - L_var2; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1162 if (L_var1 > 0L) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1163 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1164 Overflow = 1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1165 Carry = 0; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1166 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1167 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1168 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1169 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1170 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1171 L_var_out = L_var1 - L_var2 - (Word32) 0X00000001L; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1172 L_test = L_var1 - L_var2; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1173 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1174 if ((L_test < 0) && (L_var1 > 0) && (L_var2 < 0)) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1175 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1176 Overflow = 1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1177 carry_int = 0; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1178 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1179 else if ((L_test > 0) && (L_var1 < 0) && (L_var2 > 0)) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1180 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1181 Overflow = 1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1182 carry_int = 1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1183 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1184 else if ((L_test > 0) && ((L_var1 ^ L_var2) > 0)) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1185 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1186 Overflow = 0; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1187 carry_int = 1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1188 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1189 if (L_test == MIN_32) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1190 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1191 Overflow = 1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1192 Carry = carry_int; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1193 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1194 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1195 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1196 Carry = carry_int; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1197 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1198 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1199 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1200 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1201 counter.L_sub_c++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1202 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1203 return (L_var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1204 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1205 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1206 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1207 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1208 | Function Name : L_negate | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1209 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1210 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1211 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1212 | Negate the 32 bit variable L_var1 with saturation; saturate in the case | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1213 | where input is -2147483648 (0x8000 0000). | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1214 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1215 | Complexity weight : 2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1216 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1217 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1218 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1219 | L_var1 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1220 | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1221 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1222 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1223 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1224 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1225 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1226 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1227 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1228 | L_var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1229 | 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1230 | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1231 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1232 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1233 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1234 Word32 L_negate (Word32 L_var1) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1235 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1236 Word32 L_var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1237 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1238 L_var_out = (L_var1 == MIN_32) ? MAX_32 : -L_var1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1239 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1240 counter.L_negate++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1241 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1242 return (L_var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1243 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1244 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1245 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1246 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1247 | Function Name : mult_r | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1248 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1249 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1250 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1251 | Same as mult with rounding, i.e.: | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1252 | mult_r(var1,var2) = extract_l(L_shr(((var1 * var2) + 16384),15)) and | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1253 | mult_r(-32768,-32768) = 32767. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1254 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1255 | Complexity weight : 2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1256 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1257 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1258 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1259 | var1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1260 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1261 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1262 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1263 | var2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1264 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1265 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1266 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1267 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1268 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1269 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1270 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1271 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1272 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1273 | var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1274 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1275 | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1276 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1277 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1278 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1279 Word16 mult_r (Word16 var1, Word16 var2) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1280 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1281 Word16 var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1282 Word32 L_product_arr; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1283 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1284 L_product_arr = (Word32) var1 *(Word32) var2; /* product */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1285 L_product_arr += (Word32) 0x00004000L; /* round */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1286 L_product_arr &= (Word32) 0xffff8000L; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1287 L_product_arr >>= 15; /* shift */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1288 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1289 if (L_product_arr & (Word32) 0x00010000L) /* sign extend when necessary */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1290 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1291 L_product_arr |= (Word32) 0xffff0000L; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1292 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1293 var_out = saturate (L_product_arr); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1294 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1295 counter.mult_r++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1296 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1297 return (var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1298 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1299 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1300 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1301 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1302 | Function Name : L_shl | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1303 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1304 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1305 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1306 | Arithmetically shift the 32 bit input L_var1 left var2 positions. Zero | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1307 | fill the var2 LSB of the result. If var2 is negative, arithmetically | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1308 | shift L_var1 right by -var2 with sign extension. Saturate the result in | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1309 | case of underflows or overflows. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1310 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1311 | Complexity weight : 2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1312 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1313 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1314 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1315 | L_var1 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1316 | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1317 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1318 | var2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1319 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1320 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1321 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1322 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1323 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1324 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1325 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1326 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1327 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1328 | L_var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1329 | 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1330 | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1331 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1332 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1333 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1334 Word32 L_shl (Word32 L_var1, Word16 var2) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1335 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1336 Word32 L_var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1337 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1338 if (var2 <= 0) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1339 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1340 L_var_out = L_shr (L_var1, -var2); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1341 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1342 counter.L_shr--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1343 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1344 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1345 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1346 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1347 for (; var2 > 0; var2--) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1348 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1349 if (L_var1 > (Word32) 0X3fffffffL) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1350 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1351 Overflow = 1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1352 L_var_out = MAX_32; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1353 break; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1354 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1355 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1356 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1357 if (L_var1 < (Word32) 0xc0000000L) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1358 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1359 Overflow = 1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1360 L_var_out = MIN_32; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1361 break; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1362 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1363 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1364 L_var1 *= 2; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1365 L_var_out = L_var1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1366 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1367 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1368 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1369 counter.L_shl++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1370 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1371 return (L_var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1372 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1373 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1374 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1375 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1376 | Function Name : L_shr | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1377 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1378 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1379 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1380 | Arithmetically shift the 32 bit input L_var1 right var2 positions with | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1381 | sign extension. If var2 is negative, arithmetically shift L_var1 left | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1382 | by -var2 and zero fill the -var2 LSB of the result. Saturate the result | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1383 | in case of underflows or overflows. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1384 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1385 | Complexity weight : 2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1386 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1387 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1388 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1389 | L_var1 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1390 | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1391 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1392 | var2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1393 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1394 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1395 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1396 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1397 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1398 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1399 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1400 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1401 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1402 | L_var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1403 | 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1404 | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1405 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1406 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1407 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1408 Word32 L_shr (Word32 L_var1, Word16 var2) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1409 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1410 Word32 L_var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1411 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1412 if (var2 < 0) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1413 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1414 L_var_out = L_shl (L_var1, -var2); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1415 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1416 counter.L_shl--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1417 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1418 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1419 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1420 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1421 if (var2 >= 31) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1422 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1423 L_var_out = (L_var1 < 0L) ? -1 : 0; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1424 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1425 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1426 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1427 if (L_var1 < 0) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1428 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1429 L_var_out = ~((~L_var1) >> var2); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1430 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1431 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1432 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1433 L_var_out = L_var1 >> var2; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1434 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1435 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1436 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1437 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1438 counter.L_shr++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1439 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1440 return (L_var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1441 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1442 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1443 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1444 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1445 | Function Name : shr_r | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1446 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1447 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1448 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1449 | Same as shr(var1,var2) but with rounding. Saturate the result in case of| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1450 | underflows or overflows : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1451 | - If var2 is greater than zero : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1452 | if (sub(shl(shr(var1,var2),1),shr(var1,sub(var2,1)))) | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1453 | is equal to zero | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1454 | then | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1455 | shr_r(var1,var2) = shr(var1,var2) | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1456 | else | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1457 | shr_r(var1,var2) = add(shr(var1,var2),1) | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1458 | - If var2 is less than or equal to zero : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1459 | shr_r(var1,var2) = shr(var1,var2). | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1460 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1461 | Complexity weight : 2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1462 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1463 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1464 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1465 | var1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1466 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1467 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1468 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1469 | var2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1470 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1471 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1472 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1473 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1474 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1475 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1476 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1477 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1478 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1479 | var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1480 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1481 | range : 0xffff 8000 <= var_out <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1482 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1483 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1484 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1485 Word16 shr_r (Word16 var1, Word16 var2) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1486 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1487 Word16 var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1488 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1489 if (var2 > 15) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1490 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1491 var_out = 0; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1492 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1493 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1494 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1495 var_out = shr (var1, var2); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1496 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1497 counter.shr--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1498 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1499 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1500 if (var2 > 0) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1501 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1502 if ((var1 & ((Word16) 1 << (var2 - 1))) != 0) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1503 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1504 var_out++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1505 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1506 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1507 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1508 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1509 counter.shr_r++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1510 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1511 return (var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1512 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1513 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1514 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1515 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1516 | Function Name : mac_r | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1517 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1518 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1519 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1520 | Multiply var1 by var2 and shift the result left by 1. Add the 32 bit | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1521 | result to L_var3 with saturation. Round the LS 16 bits of the result | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1522 | into the MS 16 bits with saturation and shift the result right by 16. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1523 | Return a 16 bit result. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1524 | mac_r(L_var3,var1,var2) = round(L_mac(L_var3,var1,var2)) | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1525 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1526 | Complexity weight : 2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1527 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1528 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1529 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1530 | L_var3 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1531 | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1532 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1533 | var1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1534 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1535 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1536 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1537 | var2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1538 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1539 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1540 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1541 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1542 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1543 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1544 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1545 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1546 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1547 | var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1548 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1549 | range : 0x0000 8000 <= L_var_out <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1550 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1551 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1552 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1553 Word16 mac_r (Word32 L_var3, Word16 var1, Word16 var2) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1554 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1555 Word16 var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1556 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1557 L_var3 = L_mac (L_var3, var1, var2); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1558 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1559 counter.L_mac--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1560 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1561 L_var3 = L_add (L_var3, (Word32) 0x00008000L); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1562 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1563 counter.L_add--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1564 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1565 var_out = extract_h (L_var3); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1566 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1567 counter.extract_h--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1568 counter.mac_r++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1569 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1570 return (var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1571 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1572 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1573 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1574 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1575 | Function Name : msu_r | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1576 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1577 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1578 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1579 | Multiply var1 by var2 and shift the result left by 1. Subtract the 32 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1580 | bit result to L_var3 with saturation. Round the LS 16 bits of the res- | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1581 | ult into the MS 16 bits with saturation and shift the result right by | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1582 | 16. Return a 16 bit result. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1583 | msu_r(L_var3,var1,var2) = round(L_msu(L_var3,var1,var2)) | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1584 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1585 | Complexity weight : 2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1586 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1587 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1588 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1589 | L_var3 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1590 | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1591 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1592 | var1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1593 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1594 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1595 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1596 | var2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1597 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1598 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1599 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1600 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1601 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1602 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1603 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1604 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1605 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1606 | var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1607 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1608 | range : 0x0000 8000 <= L_var_out <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1609 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1610 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1611 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1612 Word16 msu_r (Word32 L_var3, Word16 var1, Word16 var2) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1613 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1614 Word16 var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1615 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1616 L_var3 = L_msu (L_var3, var1, var2); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1617 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1618 counter.L_msu--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1619 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1620 L_var3 = L_add (L_var3, (Word32) 0x00008000L); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1621 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1622 counter.L_add--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1623 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1624 var_out = extract_h (L_var3); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1625 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1626 counter.extract_h--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1627 counter.msu_r++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1628 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1629 return (var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1630 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1631 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1632 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1633 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1634 | Function Name : L_deposit_h | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1635 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1636 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1637 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1638 | Deposit the 16 bit var1 into the 16 MS bits of the 32 bit output. The | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1639 | 16 LS bits of the output are zeroed. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1640 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1641 | Complexity weight : 2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1642 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1643 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1644 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1645 | var1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1646 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1647 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1648 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1649 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1650 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1651 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1652 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1653 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1654 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1655 | L_var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1656 | 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1657 | range : 0x8000 0000 <= var_out <= 0x7fff 0000. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1658 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1659 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1660 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1661 Word32 L_deposit_h (Word16 var1) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1662 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1663 Word32 L_var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1664 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1665 L_var_out = (Word32) var1 << 16; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1666 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1667 counter.L_deposit_h++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1668 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1669 return (L_var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1670 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1671 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1672 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1673 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1674 | Function Name : L_deposit_l | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1675 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1676 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1677 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1678 | Deposit the 16 bit var1 into the 16 LS bits of the 32 bit output. The | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1679 | 16 MS bits of the output are sign extended. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1680 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1681 | Complexity weight : 2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1682 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1683 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1684 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1685 | var1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1686 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1687 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1688 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1689 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1690 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1691 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1692 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1693 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1694 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1695 | L_var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1696 | 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1697 | range : 0xFFFF 8000 <= var_out <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1698 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1699 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1700 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1701 Word32 L_deposit_l (Word16 var1) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1702 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1703 Word32 L_var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1704 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1705 L_var_out = (Word32) var1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1706 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1707 counter.L_deposit_l++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1708 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1709 return (L_var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1710 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1711 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1712 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1713 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1714 | Function Name : L_shr_r | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1715 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1716 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1717 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1718 | Same as L_shr(L_var1,var2) but with rounding. Saturate the result in | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1719 | case of underflows or overflows : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1720 | - If var2 is greater than zero : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1721 | if (L_sub(L_shl(L_shr(L_var1,var2),1),L_shr(L_var1,sub(var2,1))))| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1722 | is equal to zero | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1723 | then | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1724 | L_shr_r(L_var1,var2) = L_shr(L_var1,var2) | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1725 | else | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1726 | L_shr_r(L_var1,var2) = L_add(L_shr(L_var1,var2),1) | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1727 | - If var2 is less than or equal to zero : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1728 | L_shr_r(L_var1,var2) = L_shr(L_var1,var2). | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1729 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1730 | Complexity weight : 3 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1731 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1732 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1733 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1734 | L_var1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1735 | 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1736 | range : 0x8000 0000 <= var1 <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1737 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1738 | var2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1739 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1740 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1741 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1742 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1743 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1744 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1745 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1746 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1747 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1748 | L_var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1749 | 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1750 | range : 0x8000 0000 <= var_out <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1751 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1752 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1753 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1754 Word32 L_shr_r (Word32 L_var1, Word16 var2) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1755 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1756 Word32 L_var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1757 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1758 if (var2 > 31) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1759 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1760 L_var_out = 0; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1761 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1762 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1763 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1764 L_var_out = L_shr (L_var1, var2); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1765 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1766 counter.L_shr--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1767 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1768 if (var2 > 0) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1769 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1770 if ((L_var1 & ((Word32) 1 << (var2 - 1))) != 0) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1771 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1772 L_var_out++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1773 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1774 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1775 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1776 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1777 counter.L_shr_r++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1778 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1779 return (L_var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1780 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1781 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1782 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1783 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1784 | Function Name : L_abs | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1785 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1786 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1787 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1788 | Absolute value of L_var1; Saturate in case where the input is | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1789 | -214783648 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1790 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1791 | Complexity weight : 3 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1792 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1793 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1794 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1795 | L_var1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1796 | 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1797 | range : 0x8000 0000 <= var1 <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1798 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1799 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1800 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1801 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1802 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1803 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1804 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1805 | L_var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1806 | 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1807 | range : 0x0000 0000 <= var_out <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1808 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1809 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1810 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1811 Word32 L_abs (Word32 L_var1) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1812 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1813 Word32 L_var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1814 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1815 if (L_var1 == MIN_32) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1816 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1817 L_var_out = MAX_32; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1818 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1819 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1820 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1821 if (L_var1 < 0) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1822 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1823 L_var_out = -L_var1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1824 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1825 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1826 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1827 L_var_out = L_var1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1828 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1829 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1830 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1831 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1832 counter.L_abs++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1833 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1834 return (L_var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1835 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1836 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1837 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1838 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1839 | Function Name : L_sat | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1840 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1841 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1842 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1843 | 32 bit L_var1 is set to 2147483647 if an overflow occured or to | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1844 | -2147483648 if an underflow occured on the most recent L_add_c, | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1845 | L_sub_c, L_macNs or L_msuNs operations. The carry and overflow values | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1846 | are binary values which can be tested and assigned values. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1847 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1848 | Complexity weight : 4 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1849 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1850 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1851 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1852 | L_var1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1853 | 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1854 | range : 0x8000 0000 <= var1 <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1855 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1856 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1857 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1858 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1859 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1860 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1861 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1862 | L_var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1863 | 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1864 | range : 0x8000 0000 <= var_out <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1865 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1866 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1867 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1868 Word32 L_sat (Word32 L_var1) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1869 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1870 Word32 L_var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1871 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1872 L_var_out = L_var1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1873 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1874 if (Overflow) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1875 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1876 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1877 if (Carry) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1878 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1879 L_var_out = MIN_32; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1880 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1881 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1882 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1883 L_var_out = MAX_32; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1884 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1885 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1886 Carry = 0; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1887 Overflow = 0; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1888 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1889 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1890 counter.L_sat++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1891 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1892 return (L_var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1893 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1894 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1895 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1896 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1897 | Function Name : norm_s | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1898 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1899 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1900 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1901 | Produces the number of left shift needed to normalize the 16 bit varia- | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1902 | ble var1 for positive values on the interval with minimum of 16384 and | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1903 | maximum of 32767, and for negative values on the interval with minimum | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1904 | of -32768 and maximum of -16384; in order to normalize the result, the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1905 | following operation must be done : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1906 | norm_var1 = shl(var1,norm_s(var1)). | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1907 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1908 | Complexity weight : 15 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1909 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1910 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1911 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1912 | var1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1913 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1914 | range : 0xffff 8000 <= var1 <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1915 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1916 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1917 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1918 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1919 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1920 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1921 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1922 | var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1923 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1924 | range : 0x0000 0000 <= var_out <= 0x0000 000f. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1925 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1926 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1927 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1928 Word16 norm_s (Word16 var1) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1929 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1930 Word16 var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1931 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1932 if (var1 == 0) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1933 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1934 var_out = 0; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1935 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1936 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1937 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1938 if (var1 == (Word16) 0xffff) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1939 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1940 var_out = 15; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1941 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1942 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1943 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1944 if (var1 < 0) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1945 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1946 var1 = ~var1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1947 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1948 for (var_out = 0; var1 < 0x4000; var_out++) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1949 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1950 var1 <<= 1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1951 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1952 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1953 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1954 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1955 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1956 counter.norm_s++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1957 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1958 return (var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1959 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1960 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1961 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1962 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1963 | Function Name : div_s | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1964 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1965 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1966 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1967 | Produces a result which is the fractional integer division of var1 by | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1968 | var2; var1 and var2 must be positive and var2 must be greater or equal | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1969 | to var1; the result is positive (leading bit equal to 0) and truncated | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1970 | to 16 bits. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1971 | If var1 = var2 then div(var1,var2) = 32767. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1972 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1973 | Complexity weight : 18 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1974 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1975 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1976 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1977 | var1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1978 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1979 | range : 0x0000 0000 <= var1 <= var2 and var2 != 0. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1980 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1981 | var2 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1982 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1983 | range : var1 <= var2 <= 0x0000 7fff and var2 != 0. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1984 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1985 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1986 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1987 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1988 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1989 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1990 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1991 | var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1992 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1993 | range : 0x0000 0000 <= var_out <= 0x0000 7fff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1994 | It's a Q15 value (point between b15 and b14). | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1995 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1996 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1997 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1998 Word16 div_s (Word16 var1, Word16 var2) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1999 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2000 Word16 var_out = 0; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2001 Word16 iteration; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2002 Word32 L_num; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2003 Word32 L_denom; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2004 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2005 if ((var1 > var2) || (var1 < 0) || (var2 < 0)) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2006 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2007 printf ("Division Error var1=%d var2=%d\n", var1, var2); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2008 exit (0); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2009 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2010 if (var2 == 0) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2011 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2012 printf ("Division by 0, Fatal error \n"); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2013 exit (0); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2014 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2015 if (var1 == 0) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2016 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2017 var_out = 0; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2018 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2019 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2020 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2021 if (var1 == var2) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2022 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2023 var_out = MAX_16; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2024 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2025 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2026 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2027 L_num = L_deposit_l (var1); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2028 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2029 counter.L_deposit_l--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2030 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2031 L_denom = L_deposit_l (var2); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2032 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2033 counter.L_deposit_l--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2034 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2035 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2036 for (iteration = 0; iteration < 15; iteration++) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2037 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2038 var_out <<= 1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2039 L_num <<= 1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2040 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2041 if (L_num >= L_denom) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2042 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2043 L_num = L_sub (L_num, L_denom); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2044 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2045 counter.L_sub--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2046 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2047 var_out = add (var_out, 1); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2048 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2049 counter.add--; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2050 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2051 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2052 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2053 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2054 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2055 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2056 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2057 counter.div_s++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2058 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2059 return (var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2060 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2061 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2062 /*___________________________________________________________________________ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2063 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2064 | Function Name : norm_l | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2065 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2066 | Purpose : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2067 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2068 | Produces the number of left shifts needed to normalize the 32 bit varia-| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2069 | ble L_var1 for positive values on the interval with minimum of | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2070 | 1073741824 and maximum of 2147483647, and for negative values on the in-| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2071 | terval with minimum of -2147483648 and maximum of -1073741824; in order | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2072 | to normalize the result, the following operation must be done : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2073 | norm_L_var1 = L_shl(L_var1,norm_l(L_var1)). | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2074 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2075 | Complexity weight : 30 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2076 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2077 | Inputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2078 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2079 | L_var1 | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2080 | 32 bit long signed integer (Word32) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2081 | range : 0x8000 0000 <= var1 <= 0x7fff ffff. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2082 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2083 | Outputs : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2084 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2085 | none | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2086 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2087 | Return Value : | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2088 | | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2089 | var_out | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2090 | 16 bit short signed integer (Word16) whose value falls in the | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2091 | range : 0x0000 0000 <= var_out <= 0x0000 001f. | |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2092 |___________________________________________________________________________| |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2093 */ |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2094 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2095 Word16 norm_l (Word32 L_var1) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2096 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2097 Word16 var_out; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2098 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2099 if (L_var1 == 0) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2100 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2101 var_out = 0; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2102 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2103 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2104 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2105 if (L_var1 == (Word32) 0xffffffffL) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2106 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2107 var_out = 31; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2108 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2109 else |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2110 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2111 if (L_var1 < 0) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2112 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2113 L_var1 = ~L_var1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2114 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2115 for (var_out = 0; L_var1 < (Word32) 0x40000000L; var_out++) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2116 { |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2117 L_var1 <<= 1; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2118 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2119 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2120 } |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2121 |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2122 #if (WMOPS) |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2123 counter.norm_l++; |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2124 #endif |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2125 return (var_out); |
56410792419a
src: original EFR source from ETSI
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2126 } |