Fix indentation, merge miss and remove unnecessary comment.
This commit is contained in:
@@ -33,11 +33,7 @@
|
||||
*\return the extracted value.
|
||||
*/
|
||||
static inline uint8_t BIT_STRING_to_uint8(BIT_STRING_t *asn) {
|
||||
//DevCheck ((asn->size == 1), asn->size, 0, 0);
|
||||
if(!(asn->size == 1)) {
|
||||
printf("BIT_STRING_to_uint8 size %ld\n", asn->size);
|
||||
return 0;
|
||||
}
|
||||
DevCheck ((asn->size == 1), asn->size, 0, 0);
|
||||
|
||||
return asn->buf[0] >> asn->bits_unused;
|
||||
}
|
||||
@@ -51,11 +47,7 @@ static inline uint16_t BIT_STRING_to_uint16(BIT_STRING_t *asn) {
|
||||
uint16_t result = 0;
|
||||
int index = 0;
|
||||
|
||||
//DevCheck ((asn->size > 0) && (asn->size <= 2), asn->size, 0, 0);
|
||||
if(!((asn->size > 0) && (asn->size <= 2))) {
|
||||
printf("BIT_STRING_to_uint16 size %ld\n", asn->size);
|
||||
return 0;
|
||||
}
|
||||
DevCheck ((asn->size > 0) && (asn->size <= 2), asn->size, 0, 0);
|
||||
|
||||
switch (asn->size) {
|
||||
case 2:
|
||||
@@ -82,11 +74,7 @@ static inline uint32_t BIT_STRING_to_uint32(BIT_STRING_t *asn) {
|
||||
int index;
|
||||
int shift;
|
||||
|
||||
//DevCheck ((asn->size > 0) && (asn->size <= 4), asn->size, 0, 0);
|
||||
if(!((asn->size > 0) && (asn->size <= 4))) {
|
||||
printf("BIT_STRING_to_uint32 size %ld\n", asn->size);
|
||||
return 0;
|
||||
}
|
||||
DevCheck ((asn->size > 0) && (asn->size <= 4), asn->size, 0, 0);
|
||||
|
||||
shift = ((asn->size - 1) * 8) - asn->bits_unused;
|
||||
for (index = 0; index < (asn->size - 1); index++) {
|
||||
@@ -109,11 +97,7 @@ static inline uint64_t BIT_STRING_to_uint64(BIT_STRING_t *asn) {
|
||||
int index;
|
||||
int shift;
|
||||
|
||||
//DevCheck ((asn->size > 0) && (asn->size <= 8), asn->size, 0, 0);
|
||||
if(!((asn->size > 0) && (asn->size <= 8))) {
|
||||
printf("BIT_STRING_to_uint64 size %ld\n", asn->size);
|
||||
return 0;
|
||||
}
|
||||
DevCheck ((asn->size > 0) && (asn->size <= 8), asn->size, 0, 0);
|
||||
|
||||
shift = ((asn->size - 1) * 8) - asn->bits_unused;
|
||||
for (index = 0; index < (asn->size - 1); index++) {
|
||||
|
||||
+299
-299
@@ -543,284 +543,284 @@ int16_t dB_table_times10[256] = {
|
||||
|
||||
|
||||
uint32_t bit_seach_mask[32] = {
|
||||
0x80000000, 0x40000000, 0x20000000, 0x10000000,
|
||||
0x08000000, 0x04000000, 0x02000000, 0x01000000,
|
||||
0x00800000, 0x00400000, 0x00200000, 0x00100000,
|
||||
0x00080000, 0x00040000, 0x00020000, 0x00010000,
|
||||
0x00008000, 0x00004000, 0x00002000, 0x00001000,
|
||||
0x00000800, 0x00000400, 0x00000200, 0x00000100,
|
||||
0x00000080, 0x00000040, 0x00000020, 0x00000010,
|
||||
0x00000008, 0x00000004, 0x00000002, 0x00000001
|
||||
0x80000000, 0x40000000, 0x20000000, 0x10000000,
|
||||
0x08000000, 0x04000000, 0x02000000, 0x01000000,
|
||||
0x00800000, 0x00400000, 0x00200000, 0x00100000,
|
||||
0x00080000, 0x00040000, 0x00020000, 0x00010000,
|
||||
0x00008000, 0x00004000, 0x00002000, 0x00001000,
|
||||
0x00000800, 0x00000400, 0x00000200, 0x00000100,
|
||||
0x00000080, 0x00000040, 0x00000020, 0x00000010,
|
||||
0x00000008, 0x00000004, 0x00000002, 0x00000001
|
||||
};
|
||||
uint32_t bit_seach_res[32] = {
|
||||
31, 30, 29, 28,
|
||||
27, 26, 25, 24,
|
||||
23, 22, 21, 20,
|
||||
19, 18, 17, 16,
|
||||
15, 14, 13, 12,
|
||||
11, 10, 9, 8,
|
||||
7, 6, 5, 4,
|
||||
3, 2, 1, 0
|
||||
31, 30, 29, 28,
|
||||
27, 26, 25, 24,
|
||||
23, 22, 21, 20,
|
||||
19, 18, 17, 16,
|
||||
15, 14, 13, 12,
|
||||
11, 10, 9, 8,
|
||||
7, 6, 5, 4,
|
||||
3, 2, 1, 0
|
||||
};
|
||||
uint32_t dB_fix_x10_tbl[128] = {
|
||||
0 ,
|
||||
0 ,
|
||||
1 ,
|
||||
1 ,
|
||||
1 ,
|
||||
2 ,
|
||||
2 ,
|
||||
2 ,
|
||||
3 ,
|
||||
3 ,
|
||||
3 ,
|
||||
4 ,
|
||||
4 ,
|
||||
4 ,
|
||||
5 ,
|
||||
5 ,
|
||||
5 ,
|
||||
5 ,
|
||||
6 ,
|
||||
6 ,
|
||||
6 ,
|
||||
7 ,
|
||||
7 ,
|
||||
7 ,
|
||||
7 ,
|
||||
8 ,
|
||||
8 ,
|
||||
8 ,
|
||||
9 ,
|
||||
9 ,
|
||||
9 ,
|
||||
9 ,
|
||||
10 ,
|
||||
10 ,
|
||||
10 ,
|
||||
10 ,
|
||||
11 ,
|
||||
11 ,
|
||||
11 ,
|
||||
12 ,
|
||||
12 ,
|
||||
12 ,
|
||||
12 ,
|
||||
13 ,
|
||||
13 ,
|
||||
13 ,
|
||||
13 ,
|
||||
14 ,
|
||||
14 ,
|
||||
14 ,
|
||||
14 ,
|
||||
15 ,
|
||||
15 ,
|
||||
15 ,
|
||||
15 ,
|
||||
16 ,
|
||||
16 ,
|
||||
16 ,
|
||||
16 ,
|
||||
16 ,
|
||||
17 ,
|
||||
17 ,
|
||||
17 ,
|
||||
17 ,
|
||||
18 ,
|
||||
18 ,
|
||||
18 ,
|
||||
18 ,
|
||||
19 ,
|
||||
19 ,
|
||||
19 ,
|
||||
19 ,
|
||||
19 ,
|
||||
20 ,
|
||||
20 ,
|
||||
20 ,
|
||||
20 ,
|
||||
20 ,
|
||||
21 ,
|
||||
21 ,
|
||||
21 ,
|
||||
21 ,
|
||||
22 ,
|
||||
22 ,
|
||||
22 ,
|
||||
22 ,
|
||||
22 ,
|
||||
23 ,
|
||||
23 ,
|
||||
23 ,
|
||||
23 ,
|
||||
23 ,
|
||||
24 ,
|
||||
24 ,
|
||||
24 ,
|
||||
24 ,
|
||||
24 ,
|
||||
24 ,
|
||||
25 ,
|
||||
25 ,
|
||||
25 ,
|
||||
25 ,
|
||||
25 ,
|
||||
26 ,
|
||||
26 ,
|
||||
26 ,
|
||||
26 ,
|
||||
26 ,
|
||||
27 ,
|
||||
27 ,
|
||||
27 ,
|
||||
27 ,
|
||||
27 ,
|
||||
27 ,
|
||||
28 ,
|
||||
28 ,
|
||||
28 ,
|
||||
28 ,
|
||||
28 ,
|
||||
29 ,
|
||||
29 ,
|
||||
29 ,
|
||||
29 ,
|
||||
29 ,
|
||||
29 ,
|
||||
30 ,
|
||||
30 ,
|
||||
30
|
||||
0 ,
|
||||
0 ,
|
||||
1 ,
|
||||
1 ,
|
||||
1 ,
|
||||
2 ,
|
||||
2 ,
|
||||
2 ,
|
||||
3 ,
|
||||
3 ,
|
||||
3 ,
|
||||
4 ,
|
||||
4 ,
|
||||
4 ,
|
||||
5 ,
|
||||
5 ,
|
||||
5 ,
|
||||
5 ,
|
||||
6 ,
|
||||
6 ,
|
||||
6 ,
|
||||
7 ,
|
||||
7 ,
|
||||
7 ,
|
||||
7 ,
|
||||
8 ,
|
||||
8 ,
|
||||
8 ,
|
||||
9 ,
|
||||
9 ,
|
||||
9 ,
|
||||
9 ,
|
||||
10 ,
|
||||
10 ,
|
||||
10 ,
|
||||
10 ,
|
||||
11 ,
|
||||
11 ,
|
||||
11 ,
|
||||
12 ,
|
||||
12 ,
|
||||
12 ,
|
||||
12 ,
|
||||
13 ,
|
||||
13 ,
|
||||
13 ,
|
||||
13 ,
|
||||
14 ,
|
||||
14 ,
|
||||
14 ,
|
||||
14 ,
|
||||
15 ,
|
||||
15 ,
|
||||
15 ,
|
||||
15 ,
|
||||
16 ,
|
||||
16 ,
|
||||
16 ,
|
||||
16 ,
|
||||
16 ,
|
||||
17 ,
|
||||
17 ,
|
||||
17 ,
|
||||
17 ,
|
||||
18 ,
|
||||
18 ,
|
||||
18 ,
|
||||
18 ,
|
||||
19 ,
|
||||
19 ,
|
||||
19 ,
|
||||
19 ,
|
||||
19 ,
|
||||
20 ,
|
||||
20 ,
|
||||
20 ,
|
||||
20 ,
|
||||
20 ,
|
||||
21 ,
|
||||
21 ,
|
||||
21 ,
|
||||
21 ,
|
||||
22 ,
|
||||
22 ,
|
||||
22 ,
|
||||
22 ,
|
||||
22 ,
|
||||
23 ,
|
||||
23 ,
|
||||
23 ,
|
||||
23 ,
|
||||
23 ,
|
||||
24 ,
|
||||
24 ,
|
||||
24 ,
|
||||
24 ,
|
||||
24 ,
|
||||
24 ,
|
||||
25 ,
|
||||
25 ,
|
||||
25 ,
|
||||
25 ,
|
||||
25 ,
|
||||
26 ,
|
||||
26 ,
|
||||
26 ,
|
||||
26 ,
|
||||
26 ,
|
||||
27 ,
|
||||
27 ,
|
||||
27 ,
|
||||
27 ,
|
||||
27 ,
|
||||
27 ,
|
||||
28 ,
|
||||
28 ,
|
||||
28 ,
|
||||
28 ,
|
||||
28 ,
|
||||
29 ,
|
||||
29 ,
|
||||
29 ,
|
||||
29 ,
|
||||
29 ,
|
||||
29 ,
|
||||
30 ,
|
||||
30 ,
|
||||
30
|
||||
};
|
||||
uint32_t dB_fix_x10_tbl_low[128] = {
|
||||
0 ,
|
||||
0 ,
|
||||
30 ,
|
||||
48 ,
|
||||
60 ,
|
||||
70 ,
|
||||
78 ,
|
||||
85 ,
|
||||
90 ,
|
||||
95 ,
|
||||
100 ,
|
||||
104 ,
|
||||
108 ,
|
||||
111 ,
|
||||
115 ,
|
||||
118 ,
|
||||
120 ,
|
||||
123 ,
|
||||
126 ,
|
||||
128 ,
|
||||
130 ,
|
||||
132 ,
|
||||
134 ,
|
||||
136 ,
|
||||
138 ,
|
||||
140 ,
|
||||
141 ,
|
||||
143 ,
|
||||
145 ,
|
||||
146 ,
|
||||
148 ,
|
||||
149 ,
|
||||
151 ,
|
||||
152 ,
|
||||
153 ,
|
||||
154 ,
|
||||
156 ,
|
||||
157 ,
|
||||
158 ,
|
||||
159 ,
|
||||
160 ,
|
||||
161 ,
|
||||
162 ,
|
||||
163 ,
|
||||
164 ,
|
||||
165 ,
|
||||
166 ,
|
||||
167 ,
|
||||
168 ,
|
||||
169 ,
|
||||
170 ,
|
||||
171 ,
|
||||
172 ,
|
||||
172 ,
|
||||
173 ,
|
||||
174 ,
|
||||
175 ,
|
||||
176 ,
|
||||
176 ,
|
||||
177 ,
|
||||
178 ,
|
||||
179 ,
|
||||
179 ,
|
||||
180 ,
|
||||
181 ,
|
||||
181 ,
|
||||
182 ,
|
||||
183 ,
|
||||
183 ,
|
||||
184 ,
|
||||
185 ,
|
||||
185 ,
|
||||
186 ,
|
||||
186 ,
|
||||
187 ,
|
||||
188 ,
|
||||
188 ,
|
||||
189 ,
|
||||
189 ,
|
||||
190 ,
|
||||
190 ,
|
||||
191 ,
|
||||
191 ,
|
||||
192 ,
|
||||
192 ,
|
||||
193 ,
|
||||
193 ,
|
||||
194 ,
|
||||
194 ,
|
||||
195 ,
|
||||
195 ,
|
||||
196 ,
|
||||
196 ,
|
||||
197 ,
|
||||
197 ,
|
||||
198 ,
|
||||
198 ,
|
||||
199 ,
|
||||
199 ,
|
||||
200 ,
|
||||
200 ,
|
||||
200 ,
|
||||
201 ,
|
||||
201 ,
|
||||
202 ,
|
||||
202 ,
|
||||
203 ,
|
||||
203 ,
|
||||
203 ,
|
||||
204 ,
|
||||
204 ,
|
||||
205 ,
|
||||
205 ,
|
||||
205 ,
|
||||
206 ,
|
||||
206 ,
|
||||
206 ,
|
||||
207 ,
|
||||
207 ,
|
||||
208 ,
|
||||
208 ,
|
||||
208 ,
|
||||
209 ,
|
||||
209 ,
|
||||
209 ,
|
||||
210 ,
|
||||
210 ,
|
||||
210
|
||||
0 ,
|
||||
0 ,
|
||||
30 ,
|
||||
48 ,
|
||||
60 ,
|
||||
70 ,
|
||||
78 ,
|
||||
85 ,
|
||||
90 ,
|
||||
95 ,
|
||||
100 ,
|
||||
104 ,
|
||||
108 ,
|
||||
111 ,
|
||||
115 ,
|
||||
118 ,
|
||||
120 ,
|
||||
123 ,
|
||||
126 ,
|
||||
128 ,
|
||||
130 ,
|
||||
132 ,
|
||||
134 ,
|
||||
136 ,
|
||||
138 ,
|
||||
140 ,
|
||||
141 ,
|
||||
143 ,
|
||||
145 ,
|
||||
146 ,
|
||||
148 ,
|
||||
149 ,
|
||||
151 ,
|
||||
152 ,
|
||||
153 ,
|
||||
154 ,
|
||||
156 ,
|
||||
157 ,
|
||||
158 ,
|
||||
159 ,
|
||||
160 ,
|
||||
161 ,
|
||||
162 ,
|
||||
163 ,
|
||||
164 ,
|
||||
165 ,
|
||||
166 ,
|
||||
167 ,
|
||||
168 ,
|
||||
169 ,
|
||||
170 ,
|
||||
171 ,
|
||||
172 ,
|
||||
172 ,
|
||||
173 ,
|
||||
174 ,
|
||||
175 ,
|
||||
176 ,
|
||||
176 ,
|
||||
177 ,
|
||||
178 ,
|
||||
179 ,
|
||||
179 ,
|
||||
180 ,
|
||||
181 ,
|
||||
181 ,
|
||||
182 ,
|
||||
183 ,
|
||||
183 ,
|
||||
184 ,
|
||||
185 ,
|
||||
185 ,
|
||||
186 ,
|
||||
186 ,
|
||||
187 ,
|
||||
188 ,
|
||||
188 ,
|
||||
189 ,
|
||||
189 ,
|
||||
190 ,
|
||||
190 ,
|
||||
191 ,
|
||||
191 ,
|
||||
192 ,
|
||||
192 ,
|
||||
193 ,
|
||||
193 ,
|
||||
194 ,
|
||||
194 ,
|
||||
195 ,
|
||||
195 ,
|
||||
196 ,
|
||||
196 ,
|
||||
197 ,
|
||||
197 ,
|
||||
198 ,
|
||||
198 ,
|
||||
199 ,
|
||||
199 ,
|
||||
200 ,
|
||||
200 ,
|
||||
200 ,
|
||||
201 ,
|
||||
201 ,
|
||||
202 ,
|
||||
202 ,
|
||||
203 ,
|
||||
203 ,
|
||||
203 ,
|
||||
204 ,
|
||||
204 ,
|
||||
205 ,
|
||||
205 ,
|
||||
205 ,
|
||||
206 ,
|
||||
206 ,
|
||||
206 ,
|
||||
207 ,
|
||||
207 ,
|
||||
208 ,
|
||||
208 ,
|
||||
208 ,
|
||||
209 ,
|
||||
209 ,
|
||||
209 ,
|
||||
210 ,
|
||||
210 ,
|
||||
210
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -855,35 +855,35 @@ int8_t dB_fixed(int x) {
|
||||
*/
|
||||
|
||||
int16_t dB_fixed_x10(uint32_t x) {
|
||||
int16_t dB_power = 0;
|
||||
int16_t dB_power = 0;
|
||||
|
||||
//for new algorithm
|
||||
uint32_t cnt;
|
||||
uint32_t Exponent;
|
||||
uint32_t Mantissa;
|
||||
uint32_t shift_right;
|
||||
uint32_t tbl_resolution = 7;
|
||||
uint32_t tbl_addr_mask;
|
||||
//for new algorithm
|
||||
uint32_t cnt;
|
||||
uint32_t Exponent;
|
||||
uint32_t Mantissa;
|
||||
uint32_t shift_right;
|
||||
uint32_t tbl_resolution = 7;
|
||||
uint32_t tbl_addr_mask;
|
||||
|
||||
if (x < 128){ //OAI alogrithm
|
||||
dB_power = dB_fix_x10_tbl_low[x];
|
||||
}
|
||||
else { //new algorithm
|
||||
tbl_addr_mask = 0x0000007Fu; // (1 << tbl_resolution) - 1;//i.e. 0x0000007F
|
||||
Mantissa = 0;
|
||||
Exponent = 0;
|
||||
for (cnt = 0; cnt < 32; cnt++) {
|
||||
if ((bit_seach_mask[cnt] & x) != 0) {
|
||||
Exponent = bit_seach_res[cnt];
|
||||
Mantissa = x & (~bit_seach_mask[cnt]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
shift_right = Exponent - tbl_resolution;
|
||||
Mantissa = (Mantissa >> shift_right) & tbl_addr_mask;
|
||||
dB_power = dB_fix_x10_tbl[Mantissa] + Exponent * 30u;
|
||||
}
|
||||
return dB_power;
|
||||
if (x < 128){ //OAI alogrithm
|
||||
dB_power = dB_fix_x10_tbl_low[x];
|
||||
}
|
||||
else { //new algorithm
|
||||
tbl_addr_mask = 0x0000007Fu; // (1 << tbl_resolution) - 1;//i.e. 0x0000007F
|
||||
Mantissa = 0;
|
||||
Exponent = 0;
|
||||
for (cnt = 0; cnt < 32; cnt++) {
|
||||
if ((bit_seach_mask[cnt] & x) != 0) {
|
||||
Exponent = bit_seach_res[cnt];
|
||||
Mantissa = x & (~bit_seach_mask[cnt]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
shift_right = Exponent - tbl_resolution;
|
||||
Mantissa = (Mantissa >> shift_right) & tbl_addr_mask;
|
||||
dB_power = dB_fix_x10_tbl[Mantissa] + Exponent * 30u;
|
||||
}
|
||||
return dB_power;
|
||||
}
|
||||
|
||||
int16_t dB_fixed_times10(uint32_t x)
|
||||
|
||||
@@ -68,86 +68,39 @@ int32_t subcarrier_energy(int32_t *input,uint32_t length, int32_t *subcarrier_en
|
||||
}
|
||||
#endif
|
||||
|
||||
//int32_t signal_energy(int32_t *input,uint32_t length)
|
||||
//{
|
||||
//
|
||||
// int32_t i;
|
||||
// int32_t temp,temp2;
|
||||
// register __m64 mm0,mm1,mm2,mm3;
|
||||
// __m64 *in = (__m64 *)input;
|
||||
//
|
||||
//
|
||||
// mm0 = _mm_setzero_si64();//pxor(mm0,mm0);
|
||||
// mm3 = _mm_setzero_si64();//pxor(mm3,mm3);
|
||||
//
|
||||
// for (i=0; i<length>>1; i++) {
|
||||
//
|
||||
// mm1 = in[i];
|
||||
// mm2 = mm1;
|
||||
// mm1 = _m_pmaddwd(mm1,mm1);
|
||||
// mm1 = _m_psradi(mm1,shift);// shift any 32 bits blocs of the word by the value shift
|
||||
// mm0 = _m_paddd(mm0,mm1);// add the two 64 bits words 4 bytes by 4 bytes
|
||||
// // mm2 = _m_psrawi(mm2,shift_DC);
|
||||
// mm3 = _m_paddw(mm3,mm2);// add the two 64 bits words 2 bytes by 2 bytes
|
||||
// }
|
||||
//
|
||||
// mm1 = mm0;
|
||||
// mm0 = _m_psrlqi(mm0,32);
|
||||
// mm0 = _m_paddd(mm0,mm1);
|
||||
// temp = _m_to_int(mm0);
|
||||
// temp/=length;
|
||||
// temp<<=shift; // this is the average of x^2
|
||||
//
|
||||
// // now remove the DC component
|
||||
//
|
||||
//
|
||||
// mm2 = _m_psrlqi(mm3,32);
|
||||
// mm2 = _m_paddw(mm2,mm3);
|
||||
// mm2 = _m_pmaddwd(mm2,mm2);
|
||||
// temp2 = _m_to_int(mm2);
|
||||
// temp2/=(length*length);
|
||||
// // temp2<<=(2*shift_DC);
|
||||
// temp -= temp2;
|
||||
//
|
||||
// _mm_empty();
|
||||
// _m_empty();
|
||||
//
|
||||
// return((temp>0)?temp:1);
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
// Average Power calculation with DC removing
|
||||
//-----------------------------------------------------------------
|
||||
int32_t signal_energy(int32_t *input,uint32_t length)
|
||||
{
|
||||
uint32_t i;
|
||||
int32_t temp;
|
||||
__m128i in, in_clp, i16_min, coe1;
|
||||
__m128 num0, num1, num2, num3, recp1;
|
||||
uint32_t i;
|
||||
int32_t temp;
|
||||
__m128i in, in_clp, i16_min, coe1;
|
||||
__m128 num0, num1, num2, num3, recp1;
|
||||
|
||||
//init
|
||||
num0 = _mm_setzero_ps();
|
||||
num1 = _mm_setzero_ps();
|
||||
i16_min = _mm_set1_epi16(SHRT_MIN);
|
||||
coe1 = _mm_set1_epi16(1);
|
||||
recp1 = _mm_rcp_ps(_mm_cvtepi32_ps(_mm_set1_epi32(length)));
|
||||
//init
|
||||
num0 = _mm_setzero_ps();
|
||||
num1 = _mm_setzero_ps();
|
||||
i16_min = _mm_set1_epi16(SHRT_MIN);
|
||||
coe1 = _mm_set1_epi16(1);
|
||||
recp1 = _mm_rcp_ps(_mm_cvtepi32_ps(_mm_set1_epi32(length)));
|
||||
|
||||
//Acc
|
||||
for (i = 0; i < (length >> 2); i++) {
|
||||
in = _mm_loadu_si128((__m128i *)input);
|
||||
in_clp = _mm_subs_epi16(in, _mm_cmpeq_epi16(in, i16_min));//if in=SHRT_MIN in+1, else in
|
||||
num0 = _mm_add_ps(num0, _mm_cvtepi32_ps(_mm_madd_epi16(in_clp, in_clp)));
|
||||
num1 = _mm_add_ps(num1, _mm_cvtepi32_ps(_mm_madd_epi16(in, coe1)));//DC
|
||||
input += 4;
|
||||
//Acc
|
||||
for (i = 0; i < (length >> 2); i++) {
|
||||
in = _mm_loadu_si128((__m128i *)input);
|
||||
in_clp = _mm_subs_epi16(in, _mm_cmpeq_epi16(in, i16_min));//if in=SHRT_MIN in+1, else in
|
||||
num0 = _mm_add_ps(num0, _mm_cvtepi32_ps(_mm_madd_epi16(in_clp, in_clp)));
|
||||
num1 = _mm_add_ps(num1, _mm_cvtepi32_ps(_mm_madd_epi16(in, coe1)));//DC
|
||||
input += 4;
|
||||
}
|
||||
//Ave
|
||||
num2 = _mm_dp_ps(num0, recp1, 0xFF);//AC power
|
||||
num3 = _mm_dp_ps(num1, recp1, 0xFF);//DC
|
||||
num3 = _mm_mul_ps(num3, num3); //DC power
|
||||
//remove DC
|
||||
temp = _mm_cvtsi128_si32(_mm_cvttps_epi32(_mm_sub_ps(num2, num3)));
|
||||
|
||||
return temp;
|
||||
//Ave
|
||||
num2 = _mm_dp_ps(num0, recp1, 0xFF);//AC power
|
||||
num3 = _mm_dp_ps(num1, recp1, 0xFF);//DC
|
||||
num3 = _mm_mul_ps(num3, num3); //DC power
|
||||
//remove DC
|
||||
temp = _mm_cvtsi128_si32(_mm_cvttps_epi32(_mm_sub_ps(num2, num3)));
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
int32_t signal_energy_amp_shift(int32_t *input,uint32_t length)
|
||||
@@ -198,64 +151,6 @@ int32_t signal_energy_amp_shift(int32_t *input,uint32_t length)
|
||||
|
||||
int32_t signal_energy_nodc(int32_t *input,uint32_t length)
|
||||
{
|
||||
|
||||
// int32_t i;
|
||||
// int32_t temp;
|
||||
// register __m64 mm0,mm1;//,mm2,mm3;
|
||||
// __m64 *in = (__m64 *)input;
|
||||
//
|
||||
//#ifdef MAIN
|
||||
// int16_t *printb;
|
||||
//#endif
|
||||
//
|
||||
// mm0 = _mm_setzero_si64();//_pxor(mm0,mm0);
|
||||
// // mm3 = _mm_setzero_si64();//pxor(mm3,mm3);
|
||||
//
|
||||
// for (i=0; i<length>>1; i++) {
|
||||
//
|
||||
// mm1 = in[i];
|
||||
// mm1 = _m_pmaddwd(mm1,mm1);// SIMD complex multiplication
|
||||
// mm1 = _m_psradi(mm1,shift);
|
||||
// mm0 = _m_paddd(mm0,mm1);
|
||||
// // temp2 = mm0;
|
||||
// // printf("%d %d\n",((int *)&in[i])[0],((int *)&in[i])[1]);
|
||||
//
|
||||
//
|
||||
// // printb = (int16_t *)&mm2;
|
||||
// // printf("mm2 %d : %d %d %d %d\n",i,printb[0],printb[1],printb[2],printb[3]);
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /*
|
||||
// #ifdef MAIN
|
||||
// printb = (int16_t *)&mm3;
|
||||
// printf("%d %d %d %d\n",printb[0],printb[1],printb[2],printb[3]);
|
||||
// #endif
|
||||
// */
|
||||
// mm1 = mm0;
|
||||
//
|
||||
// mm0 = _m_psrlqi(mm0,32);
|
||||
//
|
||||
// mm0 = _m_paddd(mm0,mm1);
|
||||
//
|
||||
// temp = _m_to_int(mm0);
|
||||
//
|
||||
// temp/=length;
|
||||
// temp<<=shift; // this is the average of x^2
|
||||
//
|
||||
//#ifdef MAIN
|
||||
// printf("E x^2 = %d\n",temp);
|
||||
//#endif
|
||||
// _mm_empty();
|
||||
// _m_empty();
|
||||
//
|
||||
//
|
||||
//
|
||||
// return((temp>0)?temp:1);
|
||||
|
||||
|
||||
|
||||
int32_t i;
|
||||
int32_t temp;
|
||||
|
||||
@@ -266,9 +161,9 @@ int32_t signal_energy_nodc(int32_t *input,uint32_t length)
|
||||
mm0 = _mm_setzero_ps();
|
||||
//Acc
|
||||
for (i=0; i<(length>>2); i++) {
|
||||
in = _mm_loadu_si128((__m128i *)input);
|
||||
mm0 = _mm_add_ps(mm0,_mm_cvtepi32_ps(_mm_madd_epi16(in,in)));
|
||||
input += 4;
|
||||
in = _mm_loadu_si128((__m128i *)input);
|
||||
mm0 = _mm_add_ps(mm0,_mm_cvtepi32_ps(_mm_madd_epi16(in,in)));
|
||||
input += 4;
|
||||
}
|
||||
//Ave
|
||||
temp = (int)((((float*)&mm0)[0] +
|
||||
@@ -277,8 +172,6 @@ int32_t signal_energy_nodc(int32_t *input,uint32_t length)
|
||||
((float*)&mm0)[3])/(float)length);
|
||||
|
||||
return temp;
|
||||
|
||||
|
||||
}
|
||||
|
||||
#elif defined(__arm__)
|
||||
@@ -429,62 +322,62 @@ main(int argc,char **argv)
|
||||
int32_t signal_power(int32_t *input, uint32_t length)
|
||||
{
|
||||
|
||||
uint32_t i;
|
||||
int32_t temp;
|
||||
uint32_t i;
|
||||
int32_t temp;
|
||||
|
||||
__m128i in, in_clp, i16_min;
|
||||
__m128 num0, num1;
|
||||
__m128 recp1;
|
||||
__m128i in, in_clp, i16_min;
|
||||
__m128 num0, num1;
|
||||
__m128 recp1;
|
||||
|
||||
//init
|
||||
num0 = _mm_setzero_ps();
|
||||
i16_min = _mm_set1_epi16(SHRT_MIN);
|
||||
recp1 = _mm_rcp_ps(_mm_cvtepi32_ps(_mm_set1_epi32(length)));
|
||||
//Acc
|
||||
for (i = 0; i < (length >> 2); i++) {
|
||||
in = _mm_loadu_si128((__m128i *)input);
|
||||
in_clp = _mm_subs_epi16(in, _mm_cmpeq_epi16(in, i16_min));//if in=SHRT_MIN in+1, else in
|
||||
num0 = _mm_add_ps(num0, _mm_cvtepi32_ps(_mm_madd_epi16(in_clp, in_clp)));
|
||||
input += 4;
|
||||
}
|
||||
//Ave
|
||||
num1 = _mm_dp_ps(num0, recp1, 0xFF);
|
||||
temp = _mm_cvtsi128_si32(_mm_cvttps_epi32(num1));
|
||||
//init
|
||||
num0 = _mm_setzero_ps();
|
||||
i16_min = _mm_set1_epi16(SHRT_MIN);
|
||||
recp1 = _mm_rcp_ps(_mm_cvtepi32_ps(_mm_set1_epi32(length)));
|
||||
//Acc
|
||||
for (i = 0; i < (length >> 2); i++) {
|
||||
in = _mm_loadu_si128((__m128i *)input);
|
||||
in_clp = _mm_subs_epi16(in, _mm_cmpeq_epi16(in, i16_min));//if in=SHRT_MIN in+1, else in
|
||||
num0 = _mm_add_ps(num0, _mm_cvtepi32_ps(_mm_madd_epi16(in_clp, in_clp)));
|
||||
input += 4;
|
||||
}
|
||||
//Ave
|
||||
num1 = _mm_dp_ps(num0, recp1, 0xFF);
|
||||
temp = _mm_cvtsi128_si32(_mm_cvttps_epi32(num1));
|
||||
|
||||
return temp;
|
||||
return temp;
|
||||
}
|
||||
|
||||
int32_t interference_power(int32_t *input, uint32_t length)
|
||||
{
|
||||
|
||||
uint32_t i;
|
||||
int32_t temp;
|
||||
uint32_t i;
|
||||
int32_t temp;
|
||||
|
||||
__m128i in, in_clp, i16_min;
|
||||
__m128i num0, num1, num2, num3;
|
||||
__m128 num4, num5, num6;
|
||||
__m128 recp1;
|
||||
__m128i in, in_clp, i16_min;
|
||||
__m128i num0, num1, num2, num3;
|
||||
__m128 num4, num5, num6;
|
||||
__m128 recp1;
|
||||
|
||||
//init
|
||||
i16_min = _mm_set1_epi16(SHRT_MIN);
|
||||
num5 = _mm_setzero_ps();
|
||||
recp1 = _mm_rcp_ps(_mm_cvtepi32_ps(_mm_set1_epi32(length>>2)));// 1/n, n= length/4
|
||||
//Acc
|
||||
for (i = 0; i < (length >> 2); i++) {
|
||||
in = _mm_loadu_si128((__m128i *)input);
|
||||
in_clp = _mm_subs_epi16(in, _mm_cmpeq_epi16(in, i16_min)); //if in=SHRT_MIN, in+1, else in
|
||||
num0 = _mm_cvtepi16_epi32(in_clp); //lower 2 complex [0], [1]
|
||||
num1 = _mm_cvtepi16_epi32(_mm_shuffle_epi32(in_clp, 0x4E)); //upper 2 complex [2], [3]
|
||||
num2 = _mm_srai_epi32(_mm_add_epi32(num0, num1), 0x01); //average A=complex( [0] + [2] ) / 2, B=complex( [1] + [3] ) / 2
|
||||
num3 = _mm_sub_epi32(num2, _mm_shuffle_epi32(num2, 0x4E)); //complexA-complexB, B-A
|
||||
num4 = _mm_dp_ps(_mm_cvtepi32_ps(num3), _mm_cvtepi32_ps(num3), 0x3F);//C = num3 lower complex power, C, C, C
|
||||
num5 = _mm_add_ps(num5, num4); //Acc Cn, Cn, Cn, Cn,
|
||||
input += 4;
|
||||
}
|
||||
//Interference ve
|
||||
num6 = _mm_mul_ps(num5, recp1); //Cn / n
|
||||
temp = _mm_cvtsi128_si32(_mm_cvttps_epi32(num6));
|
||||
//init
|
||||
i16_min = _mm_set1_epi16(SHRT_MIN);
|
||||
num5 = _mm_setzero_ps();
|
||||
recp1 = _mm_rcp_ps(_mm_cvtepi32_ps(_mm_set1_epi32(length>>2)));// 1/n, n= length/4
|
||||
//Acc
|
||||
for (i = 0; i < (length >> 2); i++) {
|
||||
in = _mm_loadu_si128((__m128i *)input);
|
||||
in_clp = _mm_subs_epi16(in, _mm_cmpeq_epi16(in, i16_min)); //if in=SHRT_MIN, in+1, else in
|
||||
num0 = _mm_cvtepi16_epi32(in_clp); //lower 2 complex [0], [1]
|
||||
num1 = _mm_cvtepi16_epi32(_mm_shuffle_epi32(in_clp, 0x4E)); //upper 2 complex [2], [3]
|
||||
num2 = _mm_srai_epi32(_mm_add_epi32(num0, num1), 0x01); //average A=complex( [0] + [2] ) / 2, B=complex( [1] + [3] ) / 2
|
||||
num3 = _mm_sub_epi32(num2, _mm_shuffle_epi32(num2, 0x4E)); //complexA-complexB, B-A
|
||||
num4 = _mm_dp_ps(_mm_cvtepi32_ps(num3), _mm_cvtepi32_ps(num3), 0x3F);//C = num3 lower complex power, C, C, C
|
||||
num5 = _mm_add_ps(num5, num4); //Acc Cn, Cn, Cn, Cn,
|
||||
input += 4;
|
||||
}
|
||||
//Interference ve
|
||||
num6 = _mm_mul_ps(num5, recp1); //Cn / n
|
||||
temp = _mm_cvtsi128_si32(_mm_cvttps_epi32(num6));
|
||||
|
||||
return temp;
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
||||
@@ -1008,16 +1008,15 @@ void schedule_response(Sched_Rsp_t *Sched_INFO, L1_rxtx_proc_t *proc) {
|
||||
UL_req->ul_config_request_body.number_of_pdus=0;
|
||||
number_ul_pdu=0;
|
||||
}else if (RC.mac[Mod_id]->scheduler_mode == SCHED_MODE_FAIR_RR) {
|
||||
if(ulsch_pdu_num <= RC.rrc[Mod_id]->configuration.radioresourceconfig[CC_id].ue_multiple_max){
|
||||
//LOG_D(PHY, "UL_CONFIG to send to PNF\n");
|
||||
UL_req->sfn_sf = frame << 4 | subframe;
|
||||
oai_nfapi_ul_config_req(UL_req);
|
||||
UL_req->ul_config_request_body.number_of_pdus=0;
|
||||
number_ul_pdu=0;
|
||||
}else{
|
||||
LOG_E(MAC,"NFAPI: frame %d subframe %d ul_req num %d ul pdu %d\n",
|
||||
frame,subframe,number_ul_pdu,ulsch_pdu_num);
|
||||
}
|
||||
if(ulsch_pdu_num <= RC.rrc[Mod_id]->configuration.radioresourceconfig[CC_id].ue_multiple_max){
|
||||
UL_req->sfn_sf = frame << 4 | subframe;
|
||||
oai_nfapi_ul_config_req(UL_req);
|
||||
UL_req->ul_config_request_body.number_of_pdus=0;
|
||||
number_ul_pdu=0;
|
||||
}else{
|
||||
LOG_E(MAC,"NFAPI: frame %d subframe %d ul_req num %d ul pdu %d\n",
|
||||
frame,subframe,number_ul_pdu,ulsch_pdu_num);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -212,13 +212,6 @@ add_msg3(module_id_t module_idP, int CC_id, RA_t *ra, frame_t frameP,
|
||||
hi_dci0_req->sfn_sf = sfnsf_add_subframe(frameP, subframeP, sf_ahead_dl);
|
||||
hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST;
|
||||
|
||||
//if (NFAPI_MODE != NFAPI_MONOLITHIC) {
|
||||
// oai_nfapi_hi_dci0_req(hi_dci0_req);
|
||||
// hi_dci0_req_body->number_of_hi=0;
|
||||
//}
|
||||
|
||||
//LOG_D(MAC, "MSG3: HI_DCI0 SFN/SF:%d number_of_dci:%d number_of_hi:%d\n", NFAPI_SFNSF2DEC(hi_dci0_req->sfn_sf), hi_dci0_req_body->number_of_dci, hi_dci0_req_body->number_of_hi);
|
||||
|
||||
// save UL scheduling information for preprocessor
|
||||
for (j = 0; j < ra->msg3_nb_rb; j++)
|
||||
cc->vrb_map_UL[ra->msg3_first_rb + j] = 1;
|
||||
|
||||
@@ -202,7 +202,7 @@ rx_sdu(const module_id_t enb_mod_idP,
|
||||
}
|
||||
} else { // sduP == NULL => error
|
||||
UE_scheduling_control->pusch_rx_error_num[CC_idP]++;
|
||||
LOG_D(MAC, "[eNB %d][PUSCH %d] CC_id %d %d.%d ULSCH in error in round %d, ul_cqi %d, UE_id %d, RNTI %x (len %d)\n",
|
||||
LOG_W(MAC, "[eNB %d][PUSCH %d] CC_id %d %d.%d ULSCH in error in round %d, ul_cqi %d, UE_id %d, RNTI %x (len %d)\n",
|
||||
enb_mod_idP,
|
||||
harq_pid,
|
||||
CC_idP,
|
||||
@@ -1656,11 +1656,9 @@ schedule_ulsch_rnti(module_id_t module_idP,
|
||||
UE_template_ptr->cshift[harq_pid] = cshift;
|
||||
/* Setting DCI0 NFAPI struct */
|
||||
hi_dci0_pdu = &hi_dci0_req_body->hi_dci0_pdu_list[dci_ul_pdu_idx];
|
||||
//memset((void *) hi_dci0_pdu, 0,sizeof(nfapi_hi_dci0_request_pdu_t));
|
||||
hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_DCI_PDU_TYPE;
|
||||
hi_dci0_pdu->pdu_size = 2 + sizeof(nfapi_hi_dci0_dci_pdu);
|
||||
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dci_format = NFAPI_UL_DCI_FORMAT_0;
|
||||
//hi_dci0_pdu->dci_pdu.dci_pdu_rel8.aggregation_level = aggregation;
|
||||
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.rnti = rnti;
|
||||
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.transmission_power = 6000;
|
||||
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.resource_block_start = UE_template_ptr->pre_first_nb_rb_ul;
|
||||
|
||||
@@ -6711,25 +6711,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
|
||||
);
|
||||
}
|
||||
} else { // remove LCHAN from MAC/PHY
|
||||
#if 0
|
||||
if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) {
|
||||
// DRB has just been removed so remove RLC + PDCP for DRB
|
||||
/* rrc_pdcp_config_req (ctxt_pP->module_id, frameP, 1, CONFIG_ACTION_REMOVE,
|
||||
(ue_mod_idP * NB_RB_MAX) + DRB2LCHAN[i],UNDEF_SECURITY_MODE);
|
||||
*/
|
||||
if (!NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) {
|
||||
rrc_rlc_config_req(ctxt_pP,
|
||||
SRB_FLAG_NO,
|
||||
MBMS_FLAG_NO,
|
||||
CONFIG_ACTION_REMOVE,
|
||||
DRB2LCHAN[i],
|
||||
Rlc_info_um);
|
||||
}
|
||||
}
|
||||
|
||||
ue_context_pP->ue_context.DRB_active[drb_id] = 0;
|
||||
#endif
|
||||
if (DRB_configList->list.array[i]->logicalChannelIdentity) {
|
||||
if (DRB_configList->list.array[i]->logicalChannelIdentity) {
|
||||
DRB2LCHAN[i] = (uint8_t) * DRB_configList->list.array[i]->logicalChannelIdentity;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user