##// END OF EJS Templates
Initial commit
thomas -
r0:f328b9239ea0 default
parent child
Show More
1 NO CONTENT: new file 100644
NO CONTENT: new file 100644
This diff has been collapsed as it changes many lines, (743 lines changed) Show them Hide them
@@ -0,0 +1,743
1 #include "basic_parameters_1_ICD_issue1rev6.h"
2 #include <math.h>
3 #include <stdio.h>
4
5 float k44_pe = 1;
6 float k55_pe = 1;
7 float k45_pe_re = 1;
8 float k45_pe_im = 1;
9
10 float k14_sx_re = 1;
11 float k14_sx_im = 1;
12 float k15_sx_re = 1;
13 float k15_sx_im = 1;
14 float k24_sx_re = 1;
15 float k24_sx_im = 1;
16 float k25_sx_re = 1;
17 float k25_sx_im = 1;
18 float k34_sx_re = 1;
19 float k34_sx_im = 1;
20 float k35_sx_re = 1;
21 float k35_sx_im = 1;
22
23 float k24_ny_re = 1;
24 float k24_ny_im = 1;
25 float k25_ny_re = 1;
26 float k25_ny_im = 1;
27 float k34_ny_re = 1;
28 float k34_ny_im = 1;
29 float k35_ny_re = 1;
30 float k35_ny_im = 1;
31
32 float k24_nz_re = 1;
33 float k24_nz_im = 1;
34 float k25_nz_re = 1;
35 float k25_nz_im = 1;
36 float k34_nz_re = 1;
37 float k34_nz_im = 1;
38 float k35_nz_re = 1;
39 float k35_nz_im = 1;
40
41 float alpha_M = 45 * (3.1415927/180);
42
43 void BP1_set(){
44 int i, exponent;
45 // int j;
46 float PSDB, PSDE, tmp, NVEC_V0, NVEC_V1, NVEC_V2, aux, tr_SB_SB,
47 e_cross_b_re, e_cross_b_im,
48 n_cross_e_scal_b_re, n_cross_e_scal_b_im,
49 ny, nz, bx_bx_star, vphi,
50 significand;
51 signed char nbitexp, nbitsig, expmin, expmax; // 8 bits
52 short int rangesig; // 16 bits
53 unsigned short int psd, tmp_u_short_int; // 16 bits
54 unsigned short int *pt_u_short_int; // pointer on unsigned 16-bit words
55 unsigned char tmp_u_char; // 8 bits
56 unsigned char *pt_u_char; // pointer on unsigned 8-bit bytes
57
58 // unsigned char toto_u_char;
59 // unsigned char *pt_toto_u_char;
60 // signed char toto_s_char;
61 // float toto_f;
62
63 printf("Number of bins: %d\n", NB_BINS_COMPRESSED_MATRIX_f0);
64 printf("BP1 : \n");
65
66 // initialization for managing the exponents of the floating point data:
67 nbitexp = 5; // number of bits for the exponent
68 expmax = 30; // maximum value of the exponent
69 expmin = expmax - (1 << nbitexp) + 1; // accordingly the minimum exponent value
70 printf("nbitexp : %d, expmax : %d, expmin : %d\n", nbitexp, expmax, expmin);
71 // for floating point data to be recorded on 12-bit words:
72 nbitsig = 12 - nbitexp; // number of bits for the significand
73 rangesig = (1 << nbitsig)-1; // == 2^nbitsig - 1
74 printf("nbitsig : %d, rangesig : %d\n", nbitsig, rangesig);
75
76 for(i=0; i<1; i++){
77 //==============================================
78 // BP1 PSDB == PA_LFR_SC_BP1_PB_F0 == 12 bits = 5 bits (exponent) + 7 bits (significand)
79 PSDB = compressed_spectral_matrix_f0[i*30] // S11
80 + compressed_spectral_matrix_f0[i*30+10] // S22
81 + compressed_spectral_matrix_f0[i*30+18]; // S33
82
83 significand = frexpf(PSDB/3, &exponent); // 0.5 <= significand < 1
84 // PSDB/3 = significand * 2^exponent
85 // the division by 3 is to ensure that max value <= 2^30
86
87 printf("PSDB / 3 : %16.8e\n",PSDB/3);
88 printf("significand : %16.8e\n",significand);
89 printf("exponent : %d\n" ,exponent);
90
91 if (exponent < expmin) { // value should be >= 0.5 * 2^expmin
92 exponent = expmin;
93 significand = 0.5; // min value that can be recorded
94 }
95 if (exponent > expmax) { // value should be < 0.5 * 2^(expmax+1)
96 exponent = expmax;
97 significand = 1.0; // max value that can be recorded
98 }
99 if (significand == 0) {// in that case exponent == 0 too
100 exponent = expmin;
101 significand = 0.5; // min value that can be recorded
102 }
103
104 psd = (unsigned short int) ((significand*2-1)*rangesig + 0.5); // shift and cast into a 16-bit unsigned int with rounding
105 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
106 tmp_u_short_int = (unsigned short int) (exponent-expmin); // shift and cast into a 16-bit unsigned int
107 // where just the first nbitexp bits are used (0, ..., 2^nbitexp-1)
108 pt_u_short_int = (unsigned short int*) &LFR_BP1_F0[i*9+7]; // affect an unsigned short int pointer with the
109 // adress where the 16-bit word result will be stored
110 *pt_u_short_int = psd | (tmp_u_short_int << nbitsig); // put the exponent bits (nbitexp) next to the
111 // left place of the significand bits (nbitsig), making
112 // the 16-bit word to be recorded, and record it using the pointer
113 #ifdef DEBUG_TCH
114 printf("psd for PSDB significand : %d\n",psd);
115 printf("tmp_u_short_int for PSDB exponent : %d\n",tmp_u_short_int);
116 printf("*pt_u_short_int for PSDB significand + exponent: %.3d or %.4x\n",*pt_u_short_int, *pt_u_short_int);
117 printf("LFR_BP1_F0[i*9+8] : %.3d or %.2x\n",LFR_BP1_F0[i*9+8], LFR_BP1_F0[i*9+8]);
118 printf("LFR_BP1_F0[i*9+7] : %.3d or %.2x\n",LFR_BP1_F0[i*9+7], LFR_BP1_F0[i*9+7]);
119 #endif
120
121 //toto_f = 32768*32768; // max value ?
122 //toto_f = 1./3; // min value ?
123 //significand = frexp(toto_f, &exponent);
124 //printf("toto_f : %16.8e\n",toto_f);
125 //printf("significand : %16.8e\n",significand);
126 //printf("exponent : %d\n" ,exponent);
127
128 //==============================================
129 // BP1 PSDE == PA_LFR_SC_BP1_PE_F0 == 12 bits = 5 bits (exponent) + 7 bits (significand)
130 PSDE = compressed_spectral_matrix_f0[i*30+24] * k44_pe // S44
131 + compressed_spectral_matrix_f0[i*30+28] * k55_pe // S55
132 + compressed_spectral_matrix_f0[i*30+26] * k45_pe_re // S45 Re
133 - compressed_spectral_matrix_f0[i*30+27] * k45_pe_im; // S45 Im
134
135 significand = frexpf(PSDE/2, &exponent); // 0.5 <= significand < 1
136 // PSDE/2 = significand * 2^exponent
137 // the division by 2 is to ensure that max value <= 2^30
138 // should be reconsidered by taking into account the k-coefficients ...
139
140 printf("PSDE / 2 : %16.8e\n",PSDE/2);
141 printf("significand : %16.8e\n",significand);
142 printf("exponent : %d\n" ,exponent);
143
144 if (exponent < expmin) { // value should be >= 0.5 * 2^expmin
145 exponent = expmin;
146 significand = 0.5; // min value that can be recorded
147 }
148 if (exponent > expmax) { // value should be < 0.5 * 2^(expmax+1)
149 exponent = expmax;
150 significand = 1.0; // max value that can be recorded
151 }
152 if (significand == 0) {// in that case exponent == 0 too
153 exponent = expmin;
154 significand = 0.5; // min value that can be recorded
155 }
156
157 psd = (unsigned short int) ((significand*2-1)*rangesig + 0.5); // shift and cast into a 16-bit unsigned int with rounding
158 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
159 tmp_u_short_int = (unsigned short int) (exponent-expmin); // shift and cast into a 16-bit unsigned int
160 // where just the first nbitexp bits are used (0, ..., 2^nbitexp-1)
161 pt_u_short_int = (unsigned short int*) &LFR_BP1_F0[i*9+5]; // affect an unsigned short int pointer with the
162 // adress where the 16-bit word result will be stored
163 *pt_u_short_int = psd | (tmp_u_short_int << nbitsig); // put the exponent bits (nbitexp) next to the
164 // left place of the significand bits (nbitsig), making
165 // the 16-bit word to be recorded, and record it using the pointer
166 printf("psd for PSDE significand : %d\n",psd);
167 printf("tmp_u_short_int for PSDE exponent : %d\n",tmp_u_short_int);
168 printf("*pt_u_short_int for PSDE significand + exponent: %.3d or %.4x\n",*pt_u_short_int, *pt_u_short_int);
169 printf("LFR_BP1_F0[i*9+6] : %.3d or %.2x\n",LFR_BP1_F0[i*9+6], LFR_BP1_F0[i*9+6]);
170 printf("LFR_BP1_F0[i*9+5] : %.3d or %.2x\n",LFR_BP1_F0[i*9+5], LFR_BP1_F0[i*9+5]);
171
172 //==============================================================================
173 // BP1 normal wave vector == PA_LFR_SC_BP1_NVEC_V0_F0 == 8 bits
174 // == PA_LFR_SC_BP1_NVEC_V1_F0 == 8 bits
175 // == PA_LFR_SC_BP1_NVEC_V2_F0 == 1 sign bit
176 tmp = sqrt( compressed_spectral_matrix_f0[i*30+3] *compressed_spectral_matrix_f0[i*30+3] //Im S12
177 +compressed_spectral_matrix_f0[i*30+5] *compressed_spectral_matrix_f0[i*30+5] //Im S13
178 +compressed_spectral_matrix_f0[i*30+13]*compressed_spectral_matrix_f0[i*30+13] //Im S23
179 );
180 NVEC_V0 = compressed_spectral_matrix_f0[i*30+13]/ tmp; // S23 Im => n1
181 NVEC_V1 = -compressed_spectral_matrix_f0[i*30+5] / tmp; // S13 Im => n2
182 NVEC_V2 = compressed_spectral_matrix_f0[i*30+3] / tmp; // S12 Im => n3
183
184 printf("NVEC_V0 : %16.8e\n",NVEC_V0);
185 printf("NVEC_V1 : %16.8e\n",NVEC_V1);
186 printf("NVEC_V2 : %16.8e\n",NVEC_V2);
187
188 LFR_BP1_F0[i*9+4] = (unsigned char) (NVEC_V0*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
189 LFR_BP1_F0[i*9+3] = (unsigned char) (NVEC_V1*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
190 pt_u_char = (unsigned char*) &NVEC_V2; // affect an unsigned char pointer with the adress of NVEC_V2
191 LFR_BP1_F0[i*9+2] = pt_u_char[3] & 0x80; // extract the sign bit of NVEC_V2 (32-bit float, sign bit in the 4th octet)
192 // record it at the 8th bit position (from the right to the left) of LFR_BP1_F0[i*9+2]
193
194 printf("LFR_BP1_F0[i*9+4] for NVEC_V0 : %u\n",LFR_BP1_F0[i*9+4]);
195 printf("LFR_BP1_F0[i*9+3] for NVEC_V1 : %u\n",LFR_BP1_F0[i*9+3]);
196 printf("LFR_BP1_F0[i*9+2] for NVEC_V2 : %u\n",LFR_BP1_F0[i*9+2]);
197
198 //toto_f = 128.9999 ;
199 //toto_s_char = (signed char) toto_f;
200 //printf("toto_s_char : %d\n",toto_s_char);
201
202 //toto_f = 255.999 ;
203 //toto_u_char = (unsigned char) (toto_f);
204 //printf("toto_u_char : %d\n",toto_u_char);
205
206 //toto_f = -1110.999 ;
207 //pt_toto_u_char = (unsigned char*) &toto_f;
208 //printf("pt_toto_u_char : %u\n", pt_toto_u_char[3] & 0x80);
209
210 //=======================================================
211 // BP1 ellipticity == PA_LFR_SC_BP1_ELLIP_F0 == 4 bits
212 aux = 2*tmp / PSDB; // compute the ellipticity
213
214 printf("ellipticity : %16.8e\n",aux);
215
216 tmp_u_char = (unsigned char) (aux*15 + 0.5); // shift and cast into a 8-bit unsigned char with rounding
217 // where just the first 4 bits are used (0, ..., 15)
218 LFR_BP1_F0[i*9+2] = LFR_BP1_F0[i*9+2] | (tmp_u_char << 3); // put these 4 bits next to the right place
219 // of the sign bit of NVEC_V2 (recorded
220 // previously in LFR_BP1_F0[i*9+2])
221
222 printf("tmp_u_char for ellipticity : %u\n",tmp_u_char);
223 printf("LFR_BP1_F0[i*9+2] for NVEC_V2 + ellipticity : %u\n",LFR_BP1_F0[i*9+2]);
224
225 //==============================================================
226 // BP1 degree of polarization == PA_LFR_SC_BP1_DOP_F0 == 3 bits
227 tr_SB_SB = compressed_spectral_matrix_f0[i*30] *compressed_spectral_matrix_f0[i*30]
228 + compressed_spectral_matrix_f0[i*30+10]*compressed_spectral_matrix_f0[i*30+10]
229 + compressed_spectral_matrix_f0[i*30+18]*compressed_spectral_matrix_f0[i*30+18]
230 + 2 * compressed_spectral_matrix_f0[i*30+2] *compressed_spectral_matrix_f0[i*30+2]
231 + 2 * compressed_spectral_matrix_f0[i*30+3] *compressed_spectral_matrix_f0[i*30+3]
232 + 2 * compressed_spectral_matrix_f0[i*30+4] *compressed_spectral_matrix_f0[i*30+4]
233 + 2 * compressed_spectral_matrix_f0[i*30+5] *compressed_spectral_matrix_f0[i*30+5]
234 + 2 * compressed_spectral_matrix_f0[i*30+12]*compressed_spectral_matrix_f0[i*30+12]
235 + 2 * compressed_spectral_matrix_f0[i*30+13]*compressed_spectral_matrix_f0[i*30+13];
236 aux = PSDB*PSDB;
237 tmp = ( 3*tr_SB_SB - aux ) / ( 2 * aux ); // compute the degree of polarisation
238
239 printf("DOP : %16.8e\n",tmp);
240
241 tmp_u_char = (unsigned char) (tmp*7 + 0.5);// shift and cast into a 8-bit unsigned char with rounding
242 // where just the first 3 bits are used (0, ..., 7)
243 LFR_BP1_F0[i*9+2] = LFR_BP1_F0[i*9+2] | tmp_u_char; // record these 3 bits at the 3 first bit positions
244 // (from the right to the left) of LFR_BP1_F0[i*9+2]
245
246 printf("tmp_u_char for DOP : %u\n",tmp_u_char);
247 printf("LFR_BP1_F0[i*9+2] for NVEC_V2 + ellipticity + DOP : %u\n",LFR_BP1_F0[i*9+2]);
248
249 //=======================================================================================
250 // BP1 X_SO-component of the Poynting flux == PA_LFR_SC_BP1_SX_F0 == 8 (+ 2) bits
251 // = 5 bits (exponent) + 3 bits (significand)
252 // + 1 sign bit + 1 argument bit (two sectors)
253 e_cross_b_re = compressed_spectral_matrix_f0[i*30+20]*k34_sx_re //S34 Re
254 + compressed_spectral_matrix_f0[i*30+22]*k35_sx_re //S35 Re
255 + compressed_spectral_matrix_f0[i*30+6] *k14_sx_re //S14 Re
256 + compressed_spectral_matrix_f0[i*30+8] *k15_sx_re //S15 Re
257 + compressed_spectral_matrix_f0[i*30+14]*k24_sx_re //S24 Re
258 + compressed_spectral_matrix_f0[i*30+16]*k25_sx_re //S25 Re
259 + compressed_spectral_matrix_f0[i*30+21]*k34_sx_im //S34 Im
260 + compressed_spectral_matrix_f0[i*30+23]*k35_sx_im //S35 Im
261 + compressed_spectral_matrix_f0[i*30+7] *k14_sx_im //S14 Im
262 + compressed_spectral_matrix_f0[i*30+9] *k15_sx_im //S15 Im
263 + compressed_spectral_matrix_f0[i*30+15]*k24_sx_im //S24 Im
264 + compressed_spectral_matrix_f0[i*30+17]*k25_sx_im; //S25 Im
265 // Im(S_ji) = -Im(S_ij)
266 // k_ji = k_ij
267 e_cross_b_im = compressed_spectral_matrix_f0[i*30+20]*k34_sx_im //S34 Re
268 + compressed_spectral_matrix_f0[i*30+22]*k35_sx_im //S35 Re
269 + compressed_spectral_matrix_f0[i*30+6] *k14_sx_im //S14 Re
270 + compressed_spectral_matrix_f0[i*30+8] *k15_sx_im //S15 Re
271 + compressed_spectral_matrix_f0[i*30+14]*k24_sx_im //S24 Re
272 + compressed_spectral_matrix_f0[i*30+16]*k25_sx_im //S25 Re
273 - compressed_spectral_matrix_f0[i*30+21]*k34_sx_re //S34 Im
274 - compressed_spectral_matrix_f0[i*30+23]*k35_sx_re //S35 Im
275 - compressed_spectral_matrix_f0[i*30+7] *k14_sx_re //S14 Im
276 - compressed_spectral_matrix_f0[i*30+9] *k15_sx_re //S15 Im
277 - compressed_spectral_matrix_f0[i*30+15]*k24_sx_re //S24 Im
278 - compressed_spectral_matrix_f0[i*30+17]*k25_sx_re; //S25 Im
279
280 printf("ReaSX / 2 : %16.8e\n",e_cross_b_re/2);
281
282 pt_u_char = (unsigned char*) &e_cross_b_re; // Affect an unsigned char pointer with the adress of e_cross_b_re
283 LFR_BP1_F0[i*9+8] = LFR_BP1_F0[i*9+8] | (pt_u_char[3] & 0x80); // Extract its sign bit (32-bit float, sign bit in the 4th octet)
284 // Record it at the 8th bit position (from the right to the left)
285 // of LFR_BP1_F0[i*9+8]
286 pt_u_char[3] = (pt_u_char[3] & 0x7f); // Make e_cross_b_re be positive in any case: |ReaSX|
287
288 significand = frexpf(e_cross_b_re/2, &exponent);// 0.5 <= significand < 1
289 // ReaSX/2 = significand * 2^exponent
290 // The division by 2 is to ensure that max value <= 2^30 (rough estimate)
291 // Should be reconsidered by taking into account the k-coefficients ...
292
293 if (exponent < expmin) { // value should be >= 0.5 * 2^expmin
294 exponent = expmin;
295 significand = 0.5; // min value that can be recorded
296 }
297 if (exponent > expmax) { // value should be < 0.5 * 2^(expmax+1)
298 exponent = expmax;
299 significand = 1.0; // max value that can be recorded
300 }
301 if (significand == 0) {// in that case exponent == 0 too
302 exponent = expmin;
303 significand = 0.5; // min value that can be recorded
304 }
305 printf("|ReaSX| / 2 : %16.8e\n",e_cross_b_re/2);
306 printf("significand : %16.8e\n",significand);
307 printf("exponent : %d\n" ,exponent);
308
309 LFR_BP1_F0[i*9+1] = (unsigned char) ((significand*2-1)*7 + 0.5); // Shift and cast into a 8-bit unsigned char with rounding
310 // where just the first 3 bits are used (0, ..., 7)
311 tmp_u_char = (unsigned char) (exponent-expmin); // Shift and cast into a 8-bit unsigned char where
312 // just the first 5 bits are used (0, ..., 2^5-1)
313 printf("LFR_BP1_F0[i*9+1] for ReaSX significand : %u\n",LFR_BP1_F0[i*9+1]);
314 printf("tmp_u_char for ReaSX exponent : %d\n",tmp_u_char);
315 LFR_BP1_F0[i*9+1] = LFR_BP1_F0[i*9+1] | (tmp_u_char << 3); // shift these 5 bits to the left before logical addition
316 // with LFR_BP1_F0[i*9+1]
317 printf("LFR_BP1_F0[i*9+1] for ReaSX exponent + significand : %u\n",LFR_BP1_F0[i*9+1]);
318 printf("LFR_BP1_F0[i*9+8] for ReaSX sign + PSDB 'exponent' : %u\n",LFR_BP1_F0[i*9+8]);
319
320 printf("ImaSX / 2 : %16.8e\n",e_cross_b_im/2);
321
322 pt_u_char = (unsigned char*) &e_cross_b_im; // Affect an unsigned char pointer with the adress of e_cross_b_im
323 pt_u_char[3] = pt_u_char[3] & 0x7f; // Make e_cross_b_im be positive in any case: |ImaSX|
324 tmp_u_char = (e_cross_b_im > e_cross_b_re) ? 0x40 : 0x00; // Determine the sector argument of SX. If |Im| > |Re| affect
325 // an unsigned 8-bit char with 01000000; otherwise with null.
326 LFR_BP1_F0[i*9+8] = LFR_BP1_F0[i*9+8] | tmp_u_char; // Record it as a sign bit at the 7th bit position (from the right
327 // to the left) of LFR_BP1_F0[i*9+7], by simple logical addition.
328
329 printf("|ImaSX| / 2 : %16.8e\n",e_cross_b_im/2);
330 printf("ArgSX sign : %u\n",tmp_u_char);
331 printf("LFR_BP1_F0[i*9+8] for ReaSX & ArgSX signs + PSDB 'exponent' : %u\n",LFR_BP1_F0[i*9+8]);
332
333 //======================================================================
334 // BP1 phase velocity estimator == PA_LFR_SC_BP1_VPHI_F0 == 8 (+ 2) bits
335 // = 5 bits (exponent) + 3 bits (significand)
336 // + 1 sign bit + 1 argument bit (two sectors)
337 ny = sin(alpha_M)*NVEC_V1 + cos(alpha_M)*NVEC_V2;
338 nz = NVEC_V0;
339 bx_bx_star = cos(alpha_M)*cos(alpha_M)*compressed_spectral_matrix_f0[i*30+10] // S22 Re
340 + sin(alpha_M)*sin(alpha_M)*compressed_spectral_matrix_f0[i*30+18] // S33 Re
341 - 2*sin(alpha_M)*cos(alpha_M)*compressed_spectral_matrix_f0[i*30+12]; // S23 Re
342
343 n_cross_e_scal_b_re = ny * (compressed_spectral_matrix_f0[i*30+14]*k24_ny_re //S24 Re
344 +compressed_spectral_matrix_f0[i*30+16]*k25_ny_re //S25 Re
345 +compressed_spectral_matrix_f0[i*30+20]*k34_ny_re //S34 Re
346 +compressed_spectral_matrix_f0[i*30+22]*k35_ny_re //S35 Re
347 +compressed_spectral_matrix_f0[i*30+15]*k24_ny_im //S24 Im
348 +compressed_spectral_matrix_f0[i*30+17]*k25_ny_im //S25 Im
349 +compressed_spectral_matrix_f0[i*30+21]*k34_ny_im //S34 Im
350 +compressed_spectral_matrix_f0[i*30+23]*k35_ny_im) //S35 Im
351 + nz * (compressed_spectral_matrix_f0[i*30+14]*k24_nz_re //S24 Re
352 +compressed_spectral_matrix_f0[i*30+16]*k25_nz_re //S25 Re
353 +compressed_spectral_matrix_f0[i*30+20]*k34_nz_re //S34 Re
354 +compressed_spectral_matrix_f0[i*30+22]*k35_nz_re //S35 Re
355 +compressed_spectral_matrix_f0[i*30+15]*k24_nz_im //S24 Im
356 +compressed_spectral_matrix_f0[i*30+17]*k25_nz_im //S25 Im
357 +compressed_spectral_matrix_f0[i*30+21]*k34_nz_im //S34 Im
358 +compressed_spectral_matrix_f0[i*30+23]*k35_nz_im);//S35 Im
359 // Im(S_ji) = -Im(S_ij)
360 // k_ji = k_ij
361 n_cross_e_scal_b_im = ny * (compressed_spectral_matrix_f0[i*30+14]*k24_ny_im //S24 Re
362 +compressed_spectral_matrix_f0[i*30+16]*k25_ny_im //S25 Re
363 +compressed_spectral_matrix_f0[i*30+20]*k34_ny_im //S34 Re
364 +compressed_spectral_matrix_f0[i*30+22]*k35_ny_im //S35 Re
365 -compressed_spectral_matrix_f0[i*30+15]*k24_ny_re //S24 Im
366 -compressed_spectral_matrix_f0[i*30+17]*k25_ny_re //S25 Im
367 -compressed_spectral_matrix_f0[i*30+21]*k34_ny_re //S34 Im
368 -compressed_spectral_matrix_f0[i*30+23]*k35_ny_re) //S35 Im
369 + nz * (compressed_spectral_matrix_f0[i*30+14]*k24_nz_im //S24 Re
370 +compressed_spectral_matrix_f0[i*30+16]*k25_nz_im //S25 Re
371 +compressed_spectral_matrix_f0[i*30+20]*k34_nz_im //S34 Re
372 +compressed_spectral_matrix_f0[i*30+22]*k35_nz_im //S35 Re
373 -compressed_spectral_matrix_f0[i*30+15]*k24_nz_re //S24 Im
374 -compressed_spectral_matrix_f0[i*30+17]*k25_nz_re //S25 Im
375 -compressed_spectral_matrix_f0[i*30+21]*k34_nz_re //S34 Im
376 -compressed_spectral_matrix_f0[i*30+23]*k35_nz_re);//S35 Im
377
378 printf("n_cross_e_scal_b_re : %16.8e\n",n_cross_e_scal_b_re);
379 printf("n_cross_e_scal_b_im : %16.8e\n",n_cross_e_scal_b_im);
380 // vphi = n_cross_e_scal_b_re / bx_bx_star => sign(VPHI) = sign(n_cross_e_scal_b_re)
381 pt_u_char = (unsigned char*) &n_cross_e_scal_b_re; // Affect an unsigned char pointer with the adress of n_cross_e_scal_b_re
382 LFR_BP1_F0[i*9+7] = LFR_BP1_F0[i*9+7] | (pt_u_char[3] & 0x80); // Extract its sign bit (32-bit float, sign bit in the 4th octet)
383 // Record it at the 8th bit position (from the right to the left)
384 // of LFR_BP1_F0[i*9+7]
385 pt_u_char[3] = (pt_u_char[3] & 0x7f); // Make n_cross_e_scal_b_re be positive in any case: |n_cross_e_scal_b_re|
386 vphi = n_cross_e_scal_b_re / bx_bx_star; // Compute |VPHI|
387
388 significand = frexpf(vphi/2, &exponent); // 0.5 <= significand < 1
389 // vphi/2 = significand * 2^exponent
390 // The division by 2 is to ensure that max value <= 2^30 (rough estimate)
391 // Should be reconsidered by taking into account the k-coefficients ...
392
393 if (exponent < expmin) { // value should be >= 0.5 * 2^expmin
394 exponent = expmin;
395 significand = 0.5; // min value that can be recorded
396 }
397 if (exponent > expmax) { // value should be < 0.5 * 2^(expmax+1)
398 exponent = expmax;
399 significand = 1.0; // max value that can be recorded
400 }
401 if (significand == 0) {// in that case exponent == 0 too
402 exponent = expmin;
403 significand = 0.5; // min value that can be recorded
404 }
405 printf("|VPHI| / 2 : %16.8e\n",vphi/2);
406 printf("significand : %16.8e\n",significand);
407 printf("exponent : %d\n" ,exponent);
408
409 LFR_BP1_F0[i*9+0] = (unsigned char) ((significand*2-1)*7 + 0.5); // Shift and cast into a 8-bit unsigned char with rounding
410 // where just the first 3 bits are used (0, ..., 7)
411 tmp_u_char = (unsigned char) (exponent-expmin); // Shift and cast into a 8-bit unsigned char where
412 // just the first 5 bits are used (0, ..., 2^5-1)
413 printf("LFR_BP1_F0[i*9+0] for VPHI significand : %u\n",LFR_BP1_F0[i*9+0]);
414 printf("tmp_u_char for VPHI exponent : %d\n",tmp_u_char);
415 LFR_BP1_F0[i*9+0] = LFR_BP1_F0[i*9+0] | (tmp_u_char << 3); // shift these 5 bits to the left before logical addition
416 // with LFR_BP1_F0[i*9+0]
417 printf("LFR_BP1_F0[i*9+0] for VPHI exponent + significand : %u\n",LFR_BP1_F0[i*9+0]);
418 printf("LFR_BP1_F0[i*9+6] for VPHI sign + PSDE 'exponent' : %u\n",LFR_BP1_F0[i*9+6]);
419
420 pt_u_char = (unsigned char*) &n_cross_e_scal_b_im; // Affect an unsigned char pointer with the adress of n_cross_e_scal_b_im
421 pt_u_char[3] = pt_u_char[3] & 0x7f; // Make n_cross_e_scal_b_im be positive in any case: |ImaSX|
422 tmp_u_char = (n_cross_e_scal_b_im > n_cross_e_scal_b_re) ? 0x40 : 0x00; // Determine the sector argument of SX. If |Im| > |Re| affect
423 // an unsigned 8-bit char with 01000000; otherwise with null.
424 LFR_BP1_F0[i*9+6] = LFR_BP1_F0[i*9+6] | tmp_u_char; // Record it as a sign bit at the 7th bit position (from the right
425 // to the left) of LFR_BP1_F0[i*9+6], by simple logical addition.
426
427 printf("|n_cross_e_scal_b_im| : %16.8e\n",n_cross_e_scal_b_im);
428 printf("|n_cross_e_scal_b_im|/bx_bx_star/2: %16.8e\n",n_cross_e_scal_b_im/bx_bx_star/2);
429 printf("ArgNEBX sign : %u\n",tmp_u_char);
430 printf("LFR_BP1_F0[i*9+6] for VPHI & ArgNEBX signs + PSDE 'exponent' : %u\n",LFR_BP1_F0[i*9+6]);
431
432 }
433 }
434
435 void BP2_set(){
436 int i, exponent;
437 float aux, significand, cross_re, cross_im;
438 signed char nbitexp, nbitsig, expmin, expmax; // 8 bits
439 short int rangesig; // 16 bits
440 unsigned short int autocor, tmp_u_short_int; // 16 bits
441 unsigned short int *pt_u_short_int; // pointer on unsigned 16-bit words
442
443 printf("Number of bins: %d\n", NB_BINS_COMPRESSED_MATRIX_f0);
444 printf("BP2 : \n");
445
446 // For floating point data to be recorded on 16-bit words :
447 nbitexp = 6; // number of bits for the exponent
448 nbitsig = 16 - nbitexp; // number of bits for the significand
449 rangesig = (1 << nbitsig)-1; // == 2^nbitsig - 1
450 printf("nbitexp : %d, nbitsig : %d, rangesig : %d\n", nbitexp, nbitsig, rangesig);
451 expmax = 32;
452 expmin = expmax - (1 << nbitexp) + 1;
453 printf("expmin : %d, expmax : %d\n", expmin, expmax);
454
455 for(i = 0; i<1; i++){
456 //==============================================
457 // BP2 normalized cross correlations == PA_LFR_SC_BP2_CROSS_F0 == 10 * (8+8) bits
458 // == PA_LFR_SC_BP2_CROSS_RE_0_F0 == 8 bits
459 // == PA_LFR_SC_BP2_CROSS_IM_0_F0 == 8 bits
460 // == PA_LFR_SC_BP2_CROSS_RE_1_F0 == 8 bits
461 // == PA_LFR_SC_BP2_CROSS_IM_1_F0 == 8 bits
462 // == PA_LFR_SC_BP2_CROSS_RE_2_F0 == 8 bits
463 // == PA_LFR_SC_BP2_CROSS_IM_2_F0 == 8 bits
464 // == PA_LFR_SC_BP2_CROSS_RE_3_F0 == 8 bits
465 // == PA_LFR_SC_BP2_CROSS_IM_3_F0 == 8 bits
466 // == PA_LFR_SC_BP2_CROSS_RE_4_F0 == 8 bits
467 // == PA_LFR_SC_BP2_CROSS_IM_4_F0 == 8 bits
468 // == PA_LFR_SC_BP2_CROSS_RE_5_F0 == 8 bits
469 // == PA_LFR_SC_BP2_CROSS_IM_5_F0 == 8 bits
470 // == PA_LFR_SC_BP2_CROSS_RE_6_F0 == 8 bits
471 // == PA_LFR_SC_BP2_CROSS_IM_6_F0 == 8 bits
472 // == PA_LFR_SC_BP2_CROSS_RE_7_F0 == 8 bits
473 // == PA_LFR_SC_BP2_CROSS_IM_7_F0 == 8 bits
474 // == PA_LFR_SC_BP2_CROSS_RE_8_F0 == 8 bits
475 // == PA_LFR_SC_BP2_CROSS_IM_8_F0 == 8 bits
476 // == PA_LFR_SC_BP2_CROSS_RE_9_F0 == 8 bits
477 // == PA_LFR_SC_BP2_CROSS_IM_9_F0 == 8 bits
478 // S12
479 aux = sqrt(compressed_spectral_matrix_f0[i*30]*compressed_spectral_matrix_f0[i*30+10]);
480 cross_re = compressed_spectral_matrix_f0[i*30+2] / aux;
481 cross_im = compressed_spectral_matrix_f0[i*30+3] / aux;
482 LFR_BP2_F0[i*30+19] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
483 LFR_BP2_F0[i*30+9] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
484 printf("LFR_BP2_F0[i*30+19] for cross12_re (%16.8e) : %.3u\n",cross_re, LFR_BP2_F0[i*30+19]);
485 printf("LFR_BP2_F0[i*30+9] for cross12_im (%16.8e) : %.3u\n",cross_im, LFR_BP2_F0[i*30+9]);
486
487 // S13
488 aux = sqrt(compressed_spectral_matrix_f0[i*30]*compressed_spectral_matrix_f0[i*30+18]);
489 cross_re = compressed_spectral_matrix_f0[i*30+4] / aux;
490 cross_im = compressed_spectral_matrix_f0[i*30+5] / aux;
491 LFR_BP2_F0[i*30+18] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
492 LFR_BP2_F0[i*30+8] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
493 printf("LFR_BP2_F0[i*30+18] for cross13_re (%16.8e) : %.3u\n",cross_re, LFR_BP2_F0[i*30+18]);
494 printf("LFR_BP2_F0[i*30+8] for cross13_im (%16.8e) : %.3u\n",cross_im, LFR_BP2_F0[i*30+8]);
495
496 // S14
497 aux = sqrt(compressed_spectral_matrix_f0[i*30]*compressed_spectral_matrix_f0[i*30+24]);
498 cross_re = compressed_spectral_matrix_f0[i*30+6] / aux;
499 cross_im = compressed_spectral_matrix_f0[i*30+7] / aux;
500 LFR_BP2_F0[i*30+17] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
501 LFR_BP2_F0[i*30+7] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
502 printf("LFR_BP2_F0[i*30+17] for cross14_re (%16.8e) : %.3u\n",cross_re, LFR_BP2_F0[i*30+17]);
503 printf("LFR_BP2_F0[i*30+7] for cross14_im (%16.8e) : %.3u\n",cross_im, LFR_BP2_F0[i*30+7]);
504 // S15
505 aux = sqrt(compressed_spectral_matrix_f0[i*30]*compressed_spectral_matrix_f0[i*30+28]);
506 cross_re = compressed_spectral_matrix_f0[i*30+8] / aux;
507 cross_im = compressed_spectral_matrix_f0[i*30+9] / aux;
508 LFR_BP2_F0[i*30+16] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
509 LFR_BP2_F0[i*30+6] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
510 printf("LFR_BP2_F0[i*30+16] for cross15_re (%16.8e) : %.3u\n",cross_re, LFR_BP2_F0[i*30+16]);
511 printf("LFR_BP2_F0[i*30+6] for cross15_im (%16.8e) : %.3u\n",cross_im, LFR_BP2_F0[i*30+6]);
512 // S23
513 aux = sqrt(compressed_spectral_matrix_f0[i*30+10]*compressed_spectral_matrix_f0[i*30+18]);
514 cross_re = compressed_spectral_matrix_f0[i*30+12] / aux;
515 cross_im = compressed_spectral_matrix_f0[i*30+13] / aux;
516 LFR_BP2_F0[i*30+15] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
517 LFR_BP2_F0[i*30+5] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
518 printf("LFR_BP2_F0[i*30+15] for cross23_re (%16.8e) : %.3u\n",cross_re, LFR_BP2_F0[i*30+15]);
519 printf("LFR_BP2_F0[i*30+5] for cross23_im (%16.8e) : %.3u\n",cross_im, LFR_BP2_F0[i*30+5]);
520 // S24
521 aux = sqrt(compressed_spectral_matrix_f0[i*30+10]*compressed_spectral_matrix_f0[i*30+24]);
522 cross_re = compressed_spectral_matrix_f0[i*30+14] / aux;
523 cross_im = compressed_spectral_matrix_f0[i*30+15] / aux;
524 LFR_BP2_F0[i*30+14] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
525 LFR_BP2_F0[i*30+4] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
526 printf("LFR_BP2_F0[i*30+14] for cross24_re (%16.8e) : %.3u\n",cross_re, LFR_BP2_F0[i*30+14]);
527 printf("LFR_BP2_F0[i*30+4] for cross24_im (%16.8e) : %.3u\n",cross_im, LFR_BP2_F0[i*30+4]);
528 // S25
529 aux = sqrt(compressed_spectral_matrix_f0[i*30+10]*compressed_spectral_matrix_f0[i*30+28]);
530 cross_re = compressed_spectral_matrix_f0[i*30+16] / aux;
531 cross_im = compressed_spectral_matrix_f0[i*30+17] / aux;
532 LFR_BP2_F0[i*30+13] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
533 LFR_BP2_F0[i*30+3] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
534 printf("LFR_BP2_F0[i*30+13] for cross25_re (%16.8e) : %.3u\n",cross_re, LFR_BP2_F0[i*30+13]);
535 printf("LFR_BP2_F0[i*30+3] for cross25_im (%16.8e) : %.3u\n",cross_im, LFR_BP2_F0[i*30+3]);
536 // S34
537 aux = sqrt(compressed_spectral_matrix_f0[i*30+18]*compressed_spectral_matrix_f0[i*30+24]);
538 cross_re = compressed_spectral_matrix_f0[i*30+20] / aux;
539 cross_im = compressed_spectral_matrix_f0[i*30+21] / aux;
540 LFR_BP2_F0[i*30+12] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
541 LFR_BP2_F0[i*30+2] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
542 printf("LFR_BP2_F0[i*30+12] for cross34_re (%16.8e) : %.3u\n",cross_re, LFR_BP2_F0[i*30+12]);
543 printf("LFR_BP2_F0[i*30+2] for cross34_im (%16.8e) : %.3u\n",cross_im, LFR_BP2_F0[i*30+2]);
544 // S35
545 aux = sqrt(compressed_spectral_matrix_f0[i*30+18]*compressed_spectral_matrix_f0[i*30+28]);
546 cross_re = compressed_spectral_matrix_f0[i*30+22] / aux;
547 cross_im = compressed_spectral_matrix_f0[i*30+23] / aux;
548 LFR_BP2_F0[i*30+11] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
549 LFR_BP2_F0[i*30+1] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
550 printf("LFR_BP2_F0[i*30+11] for cross35_re (%16.8e) : %.3u\n",cross_re, LFR_BP2_F0[i*30+11]);
551 printf("LFR_BP2_F0[i*30+1] for cross35_im (%16.8e) : %.3u\n",cross_im, LFR_BP2_F0[i*30+1]);
552 // S45
553 aux = sqrt(compressed_spectral_matrix_f0[i*30+24]*compressed_spectral_matrix_f0[i*30+28]);
554 cross_re = compressed_spectral_matrix_f0[i*30+26] / aux;
555 cross_im = compressed_spectral_matrix_f0[i*30+27] / aux;
556 LFR_BP2_F0[i*30+10] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
557 LFR_BP2_F0[i*30+0] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
558 printf("LFR_BP2_F0[i*30+10] for cross45_re (%16.8e) : %.3u\n",cross_re, LFR_BP2_F0[i*30+10]);
559 printf("LFR_BP2_F0[i*30+0] for cross45_im (%16.8e) : %.3u\n",cross_im, LFR_BP2_F0[i*30+0]);
560
561 //==============================================
562 // BP2 auto correlations == PA_LFR_SC_BP2_AUTO_F0 == 5*16 bits = 5*[6 bits (exponent) + 10 bits (significand)]
563 // == PA_LFR_SC_BP2_AUTO_A0_F0 == 16 bits
564 // == PA_LFR_SC_BP2_AUTO_A1_F0 == 16 bits
565 // == PA_LFR_SC_BP2_AUTO_A2_F0 == 16 bits
566 // == PA_LFR_SC_BP2_AUTO_A3_F0 == 16 bits
567 // == PA_LFR_SC_BP2_AUTO_A4_F0 == 16 bits
568 // S11
569 significand = frexpf(compressed_spectral_matrix_f0[i*30], &exponent); // 0.5 <= significand < 1
570 // S11 = significand * 2^exponent
571 printf("S11 : %16.8e\n",compressed_spectral_matrix_f0[i*30]);
572 printf("significand : %16.8e\n",significand);
573 printf("exponent : %d\n" ,exponent);
574
575 if (exponent < expmin) { // value should be >= 0.5 * 2^expmin
576 exponent = expmin;
577 significand = 0.5; // min value that can be recorded
578 }
579 if (exponent > expmax) { // value should be < 0.5 * 2^(expmax+1)
580 exponent = expmax;
581 significand = 1.0; // max value that can be recorded
582 }
583 if (significand == 0) {// in that case exponent == 0 too
584 exponent = expmin;
585 significand = 0.5; // min value that can be recorded
586 }
587
588 autocor = (unsigned short int) ((significand*2-1)*rangesig + 0.5); // shift and cast into a 16-bit unsigned int with rounding
589 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
590 tmp_u_short_int = (unsigned short int) (exponent-expmin); // shift and cast into a 16-bit unsigned int
591 // where just the first nbitexp bits are used (0, ..., 2^nbitexp-1)
592 pt_u_short_int = (unsigned short int*) &LFR_BP2_F0[i*30+28]; // affect an unsigned short int pointer with the
593 // adress where the 16-bit word result will be stored
594 *pt_u_short_int = autocor | (tmp_u_short_int << nbitsig); // put the exponent bits (nbitexp) next to the
595 // left place of the significand bits (nbitsig), making
596 // the 16-bit word to be recorded, and record it using the pointer
597 //printf("size of autocor : %d\n",sizeof(autocor) );
598 //printf("size of tmp_u_short_int : %d\n",sizeof(tmp_u_short_int) );
599 printf("autocor for S11 significand : %u\n",autocor );
600 printf("tmp_u_char for S11 exponent : %u\n",tmp_u_short_int );
601 printf("*pt_u_short_int for S11 significand + exponent: %u or %x\n",*pt_u_short_int, *pt_u_short_int);
602 printf("LFR_BP2_F0[i*30+29] : %u or %x\n",LFR_BP2_F0[i*30+29], LFR_BP2_F0[i*30+29]);
603 printf("LFR_BP2_F0[i*30+28] : %u or %x\n",LFR_BP2_F0[i*30+28], LFR_BP2_F0[i*30+28]);
604 // S22
605 significand = frexpf(compressed_spectral_matrix_f0[i*30+10], &exponent); // 0.5 <= significand < 1
606 // S22 = significand * 2^exponent
607 printf("S22 : %16.8e\n",compressed_spectral_matrix_f0[i*30+10]);
608 printf("significand : %16.8e\n",significand);
609 printf("exponent : %d\n" ,exponent);
610
611 if (exponent < expmin) { // value should be >= 0.5 * 2^expmin
612 exponent = expmin;
613 significand = 0.5; // min value that can be recorded
614 }
615 if (exponent > expmax) { // value should be < 0.5 * 2^(expmax+1)
616 exponent = expmax;
617 significand = 1.0; // max value that can be recorded
618 }
619 if (significand == 0) {// in that case exponent == 0 too
620 exponent = expmin;
621 significand = 0.5; // min value that can be recorded
622 }
623
624 autocor = (unsigned short int) ((significand*2-1)*rangesig + 0.5); // shift and cast into a 16-bit unsigned int with rounding
625 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
626 tmp_u_short_int = (unsigned short int) (exponent-expmin); // shift and cast into a 16-bit unsigned int
627 // where just the first nbitexp bits are used (0, ..., 2^nbitexp-1)
628 pt_u_short_int = (unsigned short int*) &LFR_BP2_F0[i*30+26]; // affect an unsigned short int pointer with the
629 // adress where the 16-bit word result will be stored
630 *pt_u_short_int = autocor | (tmp_u_short_int << nbitsig); // put the exponent bits (nbitexp) next to the
631 // left place of the significand bits (nbitsig), making
632 // the 16-bit word to be recorded, and record it using the pointer
633 printf("autocor for S22 significand : %d\n",autocor );
634 printf("tmp_u_char for S22 exponent : %d\n",tmp_u_short_int );
635 printf("*pt_u_short_int for S22 significand + exponent: %.3d or %x\n",*pt_u_short_int, *pt_u_short_int);
636 printf("LFR_BP2_F0[i*30+27] : %.3d or %x\n",LFR_BP2_F0[i*30+27], LFR_BP2_F0[i*30+27]);
637 printf("LFR_BP2_F0[i*30+26] : %.3d or %x\n",LFR_BP2_F0[i*30+26], LFR_BP2_F0[i*30+26]);
638 // S33
639 significand = frexpf(compressed_spectral_matrix_f0[i*30+18], &exponent); // 0.5 <= significand < 1
640 // S33 = significand * 2^exponent
641 printf("S33 : %16.8e\n",compressed_spectral_matrix_f0[i*30+18]);
642 printf("significand : %16.8e\n",significand);
643 printf("exponent : %d\n" ,exponent);
644
645 if (exponent < expmin) { // value should be >= 0.5 * 2^expmin
646 exponent = expmin;
647 significand = 0.5; // min value that can be recorded
648 }
649 if (exponent > expmax) { // value should be < 0.5 * 2^(expmax+1)
650 exponent = expmax;
651 significand = 1.0; // max value that can be recorded
652 }
653 if (significand == 0) {// in that case exponent == 0 too
654 exponent = expmin;
655 significand = 0.5; // min value that can be recorded
656 }
657
658 autocor = (unsigned short int) ((significand*2-1)*rangesig + 0.5); // shift and cast into a 16-bit unsigned int with rounding
659 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
660 tmp_u_short_int = (unsigned short int) (exponent-expmin); // shift and cast into a 16-bit unsigned int
661 // where just the first nbitexp bits are used (0, ..., 2^nbitexp-1)
662 pt_u_short_int = (unsigned short int*) &LFR_BP2_F0[i*30+24]; // affect an unsigned short int pointer with the
663 // adress where the 16-bit word result will be stored
664 *pt_u_short_int = autocor | (tmp_u_short_int << nbitsig); // put the exponent bits (nbitexp) next to the
665 // left place of the significand bits (nbitsig), making
666 // the 16-bit word to be recorded, and record it using the pointer
667 printf("autocor for S33 significand : %d\n",autocor );
668 printf("tmp_u_char for S33 exponent : %d\n",tmp_u_short_int );
669 printf("*pt_u_short_int for S33 significand + exponent: %.3d or %x\n",*pt_u_short_int, *pt_u_short_int);
670 printf("LFR_BP2_F0[i*30+25] : %.3d or %x\n",LFR_BP2_F0[i*30+25], LFR_BP2_F0[i*30+25]);
671 printf("LFR_BP2_F0[i*30+24] : %.3d or %x\n",LFR_BP2_F0[i*30+24], LFR_BP2_F0[i*30+24]);
672 // S44
673 significand = frexpf(compressed_spectral_matrix_f0[i*30+24], &exponent); // 0.5 <= significand < 1
674 // S44 = significand * 2^exponent
675 printf("S44 : %16.8e\n",compressed_spectral_matrix_f0[i*30+24]);
676 printf("significand : %16.8e\n",significand);
677 printf("exponent : %d\n" ,exponent);
678
679 if (exponent < expmin) { // value should be >= 0.5 * 2^expmin
680 exponent = expmin;
681 significand = 0.5; // min value that can be recorded
682 }
683 if (exponent > expmax) { // value should be < 0.5 * 2^(expmax+1)
684 exponent = expmax;
685 significand = 1.0; // max value that can be recorded
686 }
687 if (significand == 0) {// in that case exponent == 0 too
688 exponent = expmin;
689 significand = 0.5; // min value that can be recorded
690 }
691
692 autocor = (unsigned short int) ((significand*2-1)*rangesig + 0.5); // shift and cast into a 16-bit unsigned int with rounding
693 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
694 tmp_u_short_int = (unsigned short int) (exponent-expmin); // shift and cast into a 16-bit unsigned int
695 // where just the first nbitexp bits are used (0, ..., 2^nbitexp-1)
696 pt_u_short_int = (unsigned short int*) &LFR_BP2_F0[i*30+22]; // affect an unsigned short int pointer with the
697 // adress where the 16-bit word result will be stored
698 *pt_u_short_int = autocor | (tmp_u_short_int << nbitsig); // put the exponent bits (nbitexp) next to the
699 // left place of the significand bits (nbitsig), making
700 // the 16-bit word to be recorded, and record it using the pointer
701 printf("autocor for S44 significand : %d\n",autocor );
702 printf("tmp_u_char for S44 exponent : %d\n",tmp_u_short_int );
703 printf("*pt_u_short_int for S44 significand + exponent: %.3d or %x\n",*pt_u_short_int, *pt_u_short_int);
704 printf("LFR_BP2_F0[i*30+23] : %.3d or %x\n",LFR_BP2_F0[i*30+23], LFR_BP2_F0[i*30+23]);
705 printf("LFR_BP2_F0[i*30+22] : %.3d or %x\n",LFR_BP2_F0[i*30+22], LFR_BP2_F0[i*30+22]);
706 // S55
707 significand = frexpf(compressed_spectral_matrix_f0[i*30+28], &exponent); // 0.5 <= significand < 1
708 // S55 = significand * 2^exponent
709 printf("S55 : %16.8e\n",compressed_spectral_matrix_f0[i*30+28]);
710 printf("significand : %16.8e\n",significand);
711 printf("exponent : %d\n" ,exponent);
712
713 if (exponent < expmin) { // value should be >= 0.5 * 2^expmin
714 exponent = expmin;
715 significand = 0.5; // min value that can be recorded
716 }
717 if (exponent > expmax) { // value should be < 0.5 * 2^(expmax+1)
718 exponent = expmax;
719 significand = 1.0; // max value that can be recorded
720 }
721 if (significand == 0) {// in that case exponent == 0 too
722 exponent = expmin;
723 significand = 0.5; // min value that can be recorded
724 }
725
726 autocor = (unsigned short int) ((significand*2-1)*rangesig + 0.5); // shift and cast into a 16-bit unsigned int with rounding
727 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
728 tmp_u_short_int = (unsigned short int) (exponent-expmin); // shift and cast into a 16-bit unsigned int
729 // where just the first nbitexp bits are used (0, ..., 2^nbitexp-1)
730 pt_u_short_int = (unsigned short int*) &LFR_BP2_F0[i*30+20]; // affect an unsigned short int pointer with the
731 // adress where the 16-bit word result will be stored
732 *pt_u_short_int = autocor | (tmp_u_short_int << nbitsig); // put the exponent bits (nbitexp) next to the
733 // left place of the significand bits (nbitsig), making
734 // the 16-bit word to be recorded, and record it using the pointer
735 printf("autocor for S55 significand : %d\n",autocor );
736 printf("tmp_u_char for S55 exponent : %d\n",tmp_u_short_int );
737 printf("*pt_u_short_int for S55 significand + exponent: %.3d or %x\n",*pt_u_short_int, *pt_u_short_int);
738 printf("LFR_BP2_F0[i*30+21] : %.3d or %x\n",LFR_BP2_F0[i*30+21], LFR_BP2_F0[i*30+21]);
739 printf("LFR_BP2_F0[i*30+20] : %.3d or %x\n",LFR_BP2_F0[i*30+20], LFR_BP2_F0[i*30+20]);
740
741 }
742 }
743
@@ -0,0 +1,29
1 #ifndef BASIC_PARAMETERS_H_INCLUDED
2 #define BASIC_PARAMETERS_H_INCLUDED
3
4 #define LPP_SPECTRAL_MATRIX_CTRL 0x80000700
5 #define LPP_SPECTRAL_MATRIX_1 0x80000704
6 #define LPP_SPECTRAL_MATRIX_2 0x80000708
7
8 #define NB_BINS_SPECTRAL_MATRIX 128
9 #define NB_VALUES_PER_SPECTRAL_MATRIX 30
10 #define TOTAL_SIZE_SPECTRAL_MATRIX NB_BINS_SPECTRAL_MATRIX * NB_VALUES_PER_SPECTRAL_MATRIX
11 #define NB_BINS_COMPRESSED_MATRIX_f0 2
12 #define SIZE_COMPRESSED_SPECTRAL_MATRIX_f1 13
13 #define SIZE_COMPRESSED_SPECTRAL_MATRIX_f2 12
14 #define TOTAL_SIZE_COMPRESSED_MATRIX_f0 NB_BINS_COMPRESSED_MATRIX_f0 * NB_VALUES_PER_SPECTRAL_MATRIX
15 #define NB_AVERAGE_NORMAL_f0 4
16
17 volatile int spectral_matrix_f0_a[TOTAL_SIZE_SPECTRAL_MATRIX];
18 volatile int spectral_matrix_f0_b[TOTAL_SIZE_SPECTRAL_MATRIX];
19 int averaged_spectral_matrix_f0[TOTAL_SIZE_SPECTRAL_MATRIX];
20
21 extern float compressed_spectral_matrix_f0[ ];
22
23 extern unsigned char LFR_BP1_F0[ ];
24 extern unsigned char LFR_BP2_F0[ ];
25
26 void BP1_set();
27 void BP2_set();
28
29 #endif // BASIC_PARAMETERS_H_INCLUDED
This diff has been collapsed as it changes many lines, (625 lines changed) Show them Hide them
@@ -0,0 +1,625
1 #include "basic_parameters_1_ICD_issue1rev6.h"
2 #include <math.h>
3 #include <stdio.h>
4
5 float k44_pe = 1;
6 float k55_pe = 1;
7 float k45_pe_re = 1;
8 float k45_pe_im = 1;
9
10 float k14_sx_re = 1;
11 float k14_sx_im = 1;
12 float k15_sx_re = 1;
13 float k15_sx_im = 1;
14 float k24_sx_re = 1;
15 float k24_sx_im = 1;
16 float k25_sx_re = 1;
17 float k25_sx_im = 1;
18 float k34_sx_re = 1;
19 float k34_sx_im = 1;
20 float k35_sx_re = 1;
21 float k35_sx_im = 1;
22
23 float k24_ny_re = 1;
24 float k24_ny_im = 1;
25 float k25_ny_re = 1;
26 float k25_ny_im = 1;
27 float k34_ny_re = 1;
28 float k34_ny_im = 1;
29 float k35_ny_re = 1;
30 float k35_ny_im = 1;
31
32 float k24_nz_re = 1;
33 float k24_nz_im = 1;
34 float k25_nz_re = 1;
35 float k25_nz_im = 1;
36 float k34_nz_re = 1;
37 float k34_nz_im = 1;
38 float k35_nz_re = 1;
39 float k35_nz_im = 1;
40
41 float alpha_M = 45;
42
43 void BP1_set(){
44 int i, j;
45 unsigned char tmp_u_char;
46 unsigned char *pt_u_char;
47 float significand;
48 int exponent;
49 float PSDB, PSDE;
50 float NVEC_V0, NVEC_V1, NVEC_V2;
51 float aux, tr_SB_SB, tmp;
52 float e_cross_b_re, e_cross_b_im;
53 float n_cross_e_scal_b_re = 0, n_cross_e_scal_b_im = 0;
54 float nx = 0, ny = 0;
55 float bz_bz_star = 0;
56
57 unsigned char toto_u_char;
58 unsigned char *pt_toto_u_char;
59 signed char toto_s_char;
60 float toto_f;
61
62 FILE *infile;
63 infile = fopen("sm_test1.dat", "rb"); // open explicitely a binary file !!! ...
64 if(infile == NULL) {
65 printf("Hello I cannot open the file!\n");
66 return 0;
67 }
68 (void) fread(compressed_spectral_matrix_f0, sizeof(compressed_spectral_matrix_f0), 1, infile);
69 (void) fclose(infile);
70 //printf("size of compressed_spectral_matrix_f0 : %d\n", sizeof(compressed_spectral_matrix_f0));
71 printf("compressed_spectral_matrix_f0 : \n");
72 for (i = 0; i < 15; i++) {
73 printf("Element number %.2d (%.2d & %.2d) => Re:%16.8e Im:%16.8e\n", i+1, 2*i, 2*i+1,
74 compressed_spectral_matrix_f0[2*i],
75 compressed_spectral_matrix_f0[2*i+1]);
76 }
77
78 printf("Number of bins: %d\n", NB_BINS_COMPRESSED_MATRIX_f0);
79 printf("BP1 : \n");
80 for(i=0; i<1; i++){
81 //==============================================
82 // BP1 PSD == B PAR_LFR_SC_BP1_PB_F0 == 12 bits = 5 bits (exponent) + 7 bits (significand)
83 PSDB = compressed_spectral_matrix_f0[i*30] // S11
84 + compressed_spectral_matrix_f0[i*30+10] // S22
85 + compressed_spectral_matrix_f0[i*30+18]; // S33
86
87 significand = frexpf(PSDB/3, &exponent); // 0.5 <= significand < 1
88 // PSDB = significand * 2^exponent
89 // the division by 3 is to ensure that max value <= 2^30
90
91 printf("PSDB : %16.8e\n",PSDB);
92 printf("significand : %16.8e\n",significand);
93 printf("exponent : %d\n" ,exponent);
94
95 if (exponent < 0) { // value is >= 0.5 * 2^0 (min value included)
96 exponent = 0;
97 significand = 0.5; // min value that can be recorded
98 }
99
100 if (exponent > 31) { // value is < 1.0 * 2^31 (max value excluded)
101 exponent = 31;
102 significand = 0.999; // max value that can be recorded
103 // (a minimum of 3 decimal is important !...)
104 }
105
106 if (significand == 0) {// in that case exponent == 0 too
107 significand = 0.5; // min value that can be recorded
108 }
109
110 LFR_BP1_F0[i*9+8] = (unsigned char) (significand*256 -128); // shift and cast into a 8-bit unsigned char
111 // where just the first 7 bits are used (0, ..., 127)
112 LFR_BP1_F0[i*9+7] = (unsigned char) exponent; // shift and cast into a 8-bit unsigned char
113 // where just the first 5 bits are used (0, ..., 31)
114
115 printf("LFR_BP1_F0[i*9+8] for PSDB significand : %u\n",LFR_BP1_F0[i*9+8]);
116 printf("LFR_BP1_F0[i*9+7] for PSDB exponent : %u\n",LFR_BP1_F0[i*9+7]);
117
118 //toto_f = 32768*32768; // max value ?
119 //significand = frexp(toto_f, &exponent);
120 //printf("toto_f : %16.8e\n",toto_f);
121 //printf("significand : %16.8e\n",significand);
122 //printf("exponent : %d\n" ,exponent);
123
124 //==============================================
125 // BP1 PSD == E PAR_LFR_SC_BP1_PE_F0 == 12 bits = 5 bits (exponent) + 7 bits (significand)
126 PSDE = compressed_spectral_matrix_f0[i*30+24] * k44_pe // S44
127 + compressed_spectral_matrix_f0[i*30+28] * k55_pe // S55
128 + compressed_spectral_matrix_f0[i*30+26] * k45_pe_re // S45 Re
129 - compressed_spectral_matrix_f0[i*30+27] * k45_pe_im; // S45 Im
130
131 significand = frexpf(PSDE/2, &exponent); // 0.5 <= significand < 1
132 // PSDE = significand * 2^exponent
133 // the division by 2 is to ensure that max value < 2^31
134
135 printf("PSDE : %16.8e\n",PSDE);
136 printf("significand : %16.8e\n",significand);
137 printf("exponent : %d\n" ,exponent);
138
139 if (exponent < 0) { // value is >= 0.5 * 2^0 (min value included)
140 exponent = 0;
141 significand = 0.5; // min value that can be recorded
142 }
143
144 if (exponent > 31) { // value is < 1.0 * 2^31 (max value excluded)
145 exponent = 31;
146 significand = 0.999; // max value that can be recorded
147 // (a minimum of 3 decimal is important !...)
148 }
149
150 if (significand == 0) {// in that case exponent == 0 too
151 significand = 0.5; // min value that can be recorded
152 }
153
154 LFR_BP1_F0[i*9+6] = (unsigned char) (significand*256 -128); // shift and cast into a 8-bit unsigned char
155 // where just the first 7 bits are used (0, ..., 127)
156 LFR_BP1_F0[i*9+5] = (unsigned char) exponent; // shift and cast into a 8-bit unsigned char
157 // where just the first 5 bits are used (0, ..., 31)
158
159 printf("LFR_BP1_F0[i*9+6] for PSDE significand : %u\n",LFR_BP1_F0[i*9+6]);
160 printf("LFR_BP1_F0[i*9+5] for PSDE exponent : %u\n",LFR_BP1_F0[i*9+5]);
161
162 //toto_f = 1./3; // min value ?
163 //significand = frexp(toto_f, &exponent);
164 //printf("toto_f : %16.8e\n",toto_f);
165 //printf("significand : %16.8e\n",significand);
166 //printf("exponent : %d\n" ,exponent);
167
168 //==============================================================================
169 // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits
170 // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits
171 // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 sign bit
172 tmp = sqrt( compressed_spectral_matrix_f0[i*30+3] *compressed_spectral_matrix_f0[i*30+3] //Im S12
173 +compressed_spectral_matrix_f0[i*30+5] *compressed_spectral_matrix_f0[i*30+5] //Im S13
174 +compressed_spectral_matrix_f0[i*30+13]*compressed_spectral_matrix_f0[i*30+13] //Im S23
175 );
176 NVEC_V0 = compressed_spectral_matrix_f0[i*30+13]/ tmp; // Im S23
177 NVEC_V1 = -compressed_spectral_matrix_f0[i*30+5] / tmp; // Im S13
178 NVEC_V2 = compressed_spectral_matrix_f0[i*30+3] / tmp; // Im S12
179
180 printf("NVEC_V0 : %16.8e\n",NVEC_V0);
181 printf("NVEC_V1 : %16.8e\n",NVEC_V1);
182 printf("NVEC_V2 : %16.8e\n",NVEC_V2);
183
184 LFR_BP1_F0[i*9+4] = (unsigned char) (NVEC_V0*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
185 LFR_BP1_F0[i*9+3] = (unsigned char) (NVEC_V1*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
186 pt_u_char = (unsigned char*) &NVEC_V2; // affect an unsigned char pointer with the adress of NVEC_V2
187 LFR_BP1_F0[i*9+2] = pt_u_char[3] & 0x80; // extract the sign bit of NVEC_V2 (32-bit float, sign bit in the 4th octet)
188 // record it at the 8th bit position of LFR_BP1_F0[i*9+2]
189
190 printf("LFR_BP1_F0[i*9+4] for NVEC_V0 : %u\n",LFR_BP1_F0[i*9+4]);
191 printf("LFR_BP1_F0[i*9+3] for NVEC_V1 : %u\n",LFR_BP1_F0[i*9+3]);
192 printf("LFR_BP1_F0[i*9+2] for NVEC_V2 : %u\n",LFR_BP1_F0[i*9+2]);
193
194 //toto_f = 128.9999 ;
195 //toto_s_char = (signed char) toto_f;
196 //printf("toto_s_char : %d\n",toto_s_char);
197
198 //toto_f = 255.999 ;
199 //toto_u_char = (unsigned char) (toto_f);
200 //printf("toto_u_char : %d\n",toto_u_char);
201
202 //toto_f = -1110.999 ;
203 //pt_toto_u_char = (unsigned char*) &toto_f;
204 //printf("pt_toto_u_char : %u\n", pt_toto_u_char[3] & 0x80);
205
206 //=======================================================
207 // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits
208 aux = 2*tmp / PSDB; // compute the ellipticity
209
210 printf("ellipticity : %16.8e\n",aux);
211
212 tmp_u_char = (unsigned char) (aux*15.999);// shift and cast into a 8-bit unsigned char
213 // where just the first 4 bits are used (0, ..., 15)
214 LFR_BP1_F0[i*9+2] = LFR_BP1_F0[i*9+2] | (tmp_u_char << 3); // put these 4 bits next to the right place
215 // of the sign bit of NVEC_V2 (recorded
216 // previously in LFR_BP1_F0[i*9+2])
217
218 printf("tmp_u_char for ellipticity : %u\n",tmp_u_char);
219 printf("LFR_BP1_F0[i*9+2] for NVEC_V2 + ellipticity : %u\n",LFR_BP1_F0[i*9+2]);
220
221 //==============================================================
222 // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits
223 tr_SB_SB = compressed_spectral_matrix_f0[i*30] *compressed_spectral_matrix_f0[i*30]
224 + compressed_spectral_matrix_f0[i*30+10]*compressed_spectral_matrix_f0[i*30+10]
225 + compressed_spectral_matrix_f0[i*30+18]*compressed_spectral_matrix_f0[i*30+18]
226 + 2 * compressed_spectral_matrix_f0[i*30+2] *compressed_spectral_matrix_f0[i*30+2]
227 + 2 * compressed_spectral_matrix_f0[i*30+3] *compressed_spectral_matrix_f0[i*30+3]
228 + 2 * compressed_spectral_matrix_f0[i*30+4] *compressed_spectral_matrix_f0[i*30+4]
229 + 2 * compressed_spectral_matrix_f0[i*30+5] *compressed_spectral_matrix_f0[i*30+5]
230 + 2 * compressed_spectral_matrix_f0[i*30+12]*compressed_spectral_matrix_f0[i*30+12]
231 + 2 * compressed_spectral_matrix_f0[i*30+13]*compressed_spectral_matrix_f0[i*30+13];
232
233 aux = PSDB*PSDB; // compute the degree of polarisation
234 tmp = ( 3*tr_SB_SB - aux ) / ( 2 * aux );
235
236 printf("DOP : %16.8e\n",tmp);
237
238 tmp_u_char = (unsigned char) (tmp*7.999);// shift and cast into a 8-bit unsigned char
239 // where just the first 3 bits are used (0, ..., 7)
240 LFR_BP1_F0[i*9+2] = LFR_BP1_F0[i*9+2] | tmp_u_char; // record these 3 bits at the 3 first
241 // bit positions of LFR_BP1_F0[i*9+2]
242
243 printf("tmp_u_char for DOP : %u\n",tmp_u_char);
244 printf("LFR_BP1_F0[i*9+2] for NVEC_V2 + ellipticity + DOP : %u\n",LFR_BP1_F0[i*9+2]);
245
246 //=======================================================================================
247 // BP1 X_SO-component of the Poynting flux == PAR_LFR_SC_BP1_SX_F0 == 12 bits
248 // = 5 bits (exponent) + 5 bits (significand)
249 // + 1 sign bit + 1 argument bit (two sectors)
250 e_cross_b_re = compressed_spectral_matrix_f0[i*30+20]*k34_sx_re
251 + compressed_spectral_matrix_f0[i*30+22]*k35_sx_re
252 + compressed_spectral_matrix_f0[i*30+6] *k14_sx_re
253 + compressed_spectral_matrix_f0[i*30+8] *k15_sx_re
254 + compressed_spectral_matrix_f0[i*30+14]*k24_sx_re
255 + compressed_spectral_matrix_f0[i*30+16]*k25_sx_re
256 + compressed_spectral_matrix_f0[i*30+21]*k34_sx_im
257 + compressed_spectral_matrix_f0[i*30+23]*k35_sx_im
258 + compressed_spectral_matrix_f0[i*30+7] *k14_sx_im
259 + compressed_spectral_matrix_f0[i*30+9] *k15_sx_im
260 + compressed_spectral_matrix_f0[i*30+15]*k24_sx_im
261 + compressed_spectral_matrix_f0[i*30+17]*k25_sx_im;
262 // Im(S_ji) = -Im(S_ij)
263 // k_ji = k_ij
264 e_cross_b_im = compressed_spectral_matrix_f0[i*30+20]*k34_sx_im
265 + compressed_spectral_matrix_f0[i*30+22]*k35_sx_im
266 + compressed_spectral_matrix_f0[i*30+6] *k14_sx_im
267 + compressed_spectral_matrix_f0[i*30+8] *k15_sx_im
268 + compressed_spectral_matrix_f0[i*30+14]*k24_sx_im
269 + compressed_spectral_matrix_f0[i*30+16]*k25_sx_im
270 - compressed_spectral_matrix_f0[i*30+21]*k34_sx_re
271 - compressed_spectral_matrix_f0[i*30+23]*k35_sx_re
272 - compressed_spectral_matrix_f0[i*30+7] *k14_sx_re
273 - compressed_spectral_matrix_f0[i*30+9] *k15_sx_re
274 - compressed_spectral_matrix_f0[i*30+15]*k24_sx_re
275 - compressed_spectral_matrix_f0[i*30+17]*k25_sx_re;
276
277 printf("ReaSX : %16.8e\n",e_cross_b_re);
278
279 pt_u_char = (unsigned char*) &e_cross_b_re; // affect an unsigned char pointer with the adress of e_cross_b_re
280 //LFR_BP1_F0[i*9+7] = LFR_BP1_F0[i*9+7] | (pt_u_char[3] & 0x80); // extract the sign bit of e_cross_b_re (32-bit float, sign bit in the 4th octet)
281 // record it at the 8th bit position of LFR_BP1_F0[i*9+7]
282 pt_u_char[3] = pt_u_char[3] & 0x7f; // make e_cross_b_re be positive in any case: |ReaSX|
283
284 significand = frexpf(e_cross_b_re, &exponent);
285
286 printf("|ReaSX| : %16.8e\n",e_cross_b_re);
287 printf("significand : %16.8e\n",significand);
288 printf("exponent : %d\n" ,exponent);
289 //printf("LFR_BP1_F0[i*9+7] for PSDB exponent + ReaSX sign : %u\n",LFR_BP1_F0[i*9+7]);
290
291 LFR_BP1_F0[i*9+1] = (unsigned char) (significand*64 -32); // shift and cast into a 8-bit unsigned char
292 // where just the first 5 bits are used (0, ..., 31)
293 LFR_BP1_F0[i*9+1] = (unsigned char) exponent+28; // shift and cast into a 8-bit unsigned char
294 // where just the first 6 bits are used (0, ..., 63)
295 // Γ  rΓ©flΓ©chir ...
296
297 // tmp = e_cross_b_re * e_cross_b_im;
298 // pt_char = (unsigned char*) &tmp;
299 // LFR_BP1_F0[i*9+1] = LFR_BP1_F0[i*9+1] | (pt_char[0] & 0x80); // extract the sign of ArgSz
300
301 printf("ImaSX : %16.8e\n",e_cross_b_im);
302
303 pt_u_char = (unsigned char*) &e_cross_b_im; // affect an unsigned char pointer with the adress of e_cross_b_im
304 pt_u_char[3] = pt_u_char[3] & 0x7f; // make e_cross_b_im be positive in any case: |ImaSX|
305 tmp_u_char = (e_cross_b_im > e_cross_b_re) ? 0x40 : 0x00; // determine the sector argument of SX
306 //LFR_BP1_F0[i*9+7] = LFR_BP1_F0[i*9+7] | tmp_u_char; // record it as a sign bit at the 7th bit position of LFR_BP1_F0[i*9+7]
307
308 printf("|ImaSX| : %16.8e\n",e_cross_b_im);
309 printf("argSX sign : %d\n",tmp_u_char);
310 //printf("LFR_BP1_F0[i*9+7] for PSDB exponent + ReaSX sign + argSX sign: %u\n",LFR_BP1_F0[i*9+7]);
311
312 //======================================================================
313 //======================================================================
314 }
315 }
316
317 void BP2_set(){
318 int i, exponent;
319 float aux, significand, cross_re, cross_im;
320 signed char nbitexp, nbitsig, expmin, expmax; // 8 bits
321 short int rangesig; // 16 bits
322 unsigned short int autocor, tmp_u_short_int; // 16 bits
323 unsigned short int *pt_u_short_int; // pointer on unsigned 16-bit words
324
325 printf("Number of bins: %d\n", NB_BINS_COMPRESSED_MATRIX_f0);
326 printf("BP2 : \n");
327
328 // For floating point data to be recorded on 16-bit words :
329 nbitexp = 6; // number of bits for the exponent
330 nbitsig = 16 - nbitexp; // number of bits for the significand
331 rangesig = (1 << nbitsig)-1; // == 2^nbitsig - 1
332 printf("nbitexp : %d, nbitsig : %d, rangesig : %d\n", nbitexp, nbitsig, rangesig);
333 expmax = 32;
334 expmin = expmax - (1 << nbitexp) + 1;
335 printf("expmin : %d, expmax : %d\n", expmin, expmax);
336
337 for(i = 0; i<1; i++){
338 //==============================================
339 // BP2 normalized cross correlations == PA_LFR_SC_BP2_CROSS_F0 == 10 * (8+8) bits
340 // == PA_LFR_SC_BP2_CROSS_RE_0_F0 == 8 bits
341 // == PA_LFR_SC_BP2_CROSS_IM_0_F0 == 8 bits
342 // == PA_LFR_SC_BP2_CROSS_RE_1_F0 == 8 bits
343 // == PA_LFR_SC_BP2_CROSS_IM_1_F0 == 8 bits
344 // == PA_LFR_SC_BP2_CROSS_RE_2_F0 == 8 bits
345 // == PA_LFR_SC_BP2_CROSS_IM_2_F0 == 8 bits
346 // == PA_LFR_SC_BP2_CROSS_RE_3_F0 == 8 bits
347 // == PA_LFR_SC_BP2_CROSS_IM_3_F0 == 8 bits
348 // == PA_LFR_SC_BP2_CROSS_RE_4_F0 == 8 bits
349 // == PA_LFR_SC_BP2_CROSS_IM_4_F0 == 8 bits
350 // == PA_LFR_SC_BP2_CROSS_RE_5_F0 == 8 bits
351 // == PA_LFR_SC_BP2_CROSS_IM_5_F0 == 8 bits
352 // == PA_LFR_SC_BP2_CROSS_RE_6_F0 == 8 bits
353 // == PA_LFR_SC_BP2_CROSS_IM_6_F0 == 8 bits
354 // == PA_LFR_SC_BP2_CROSS_RE_7_F0 == 8 bits
355 // == PA_LFR_SC_BP2_CROSS_IM_7_F0 == 8 bits
356 // == PA_LFR_SC_BP2_CROSS_RE_8_F0 == 8 bits
357 // == PA_LFR_SC_BP2_CROSS_IM_8_F0 == 8 bits
358 // == PA_LFR_SC_BP2_CROSS_RE_9_F0 == 8 bits
359 // == PA_LFR_SC_BP2_CROSS_IM_9_F0 == 8 bits
360 // S12
361 aux = sqrt(compressed_spectral_matrix_f0[i*30]*compressed_spectral_matrix_f0[i*30+10]);
362 cross_re = compressed_spectral_matrix_f0[i*30+2] / aux;
363 cross_im = compressed_spectral_matrix_f0[i*30+3] / aux;
364 LFR_BP2_F0[i*30+19] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
365 LFR_BP2_F0[i*30+9] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
366 printf("LFR_BP2_F0[i*30+19] for cross12_re (%16.8e) : %u\n",cross_re, LFR_BP2_F0[i*30+19]);
367 printf("LFR_BP2_F0[i*30+9] for cross12_im (%16.8e) : %u\n",cross_im, LFR_BP2_F0[i*30+9]);
368
369 // S13
370 aux = sqrt(compressed_spectral_matrix_f0[i*30]*compressed_spectral_matrix_f0[i*30+18]);
371 cross_re = compressed_spectral_matrix_f0[i*30+4] / aux;
372 cross_im = compressed_spectral_matrix_f0[i*30+5] / aux;
373 LFR_BP2_F0[i*30+18] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
374 LFR_BP2_F0[i*30+8] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
375 printf("LFR_BP2_F0[i*30+18] for cross13_re (%16.8e) : %u\n",cross_re, LFR_BP2_F0[i*30+18]);
376 printf("LFR_BP2_F0[i*30+8] for cross13_im (%16.8e) : %u\n",cross_im, LFR_BP2_F0[i*30+8]);
377
378 // S14
379 aux = sqrt(compressed_spectral_matrix_f0[i*30]*compressed_spectral_matrix_f0[i*30+24]);
380 cross_re = compressed_spectral_matrix_f0[i*30+6] / aux;
381 cross_im = compressed_spectral_matrix_f0[i*30+7] / aux;
382 LFR_BP2_F0[i*30+17] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
383 LFR_BP2_F0[i*30+7] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
384 printf("LFR_BP2_F0[i*30+17] for cross14_re (%16.8e) : %u\n",cross_re, LFR_BP2_F0[i*30+17]);
385 printf("LFR_BP2_F0[i*30+7] for cross14_im (%16.8e) : %u\n",cross_im, LFR_BP2_F0[i*30+7]);
386 // S15
387 aux = sqrt(compressed_spectral_matrix_f0[i*30]*compressed_spectral_matrix_f0[i*30+28]);
388 cross_re = compressed_spectral_matrix_f0[i*30+8] / aux;
389 cross_im = compressed_spectral_matrix_f0[i*30+9] / aux;
390 LFR_BP2_F0[i*30+16] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
391 LFR_BP2_F0[i*30+6] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
392 printf("LFR_BP2_F0[i*30+16] for cross15_re (%16.8e) : %u\n",cross_re, LFR_BP2_F0[i*30+16]);
393 printf("LFR_BP2_F0[i*30+6] for cross15_im (%16.8e) : %u\n",cross_im, LFR_BP2_F0[i*30+6]);
394 // S23
395 aux = sqrt(compressed_spectral_matrix_f0[i*30+10]*compressed_spectral_matrix_f0[i*30+18]);
396 cross_re = compressed_spectral_matrix_f0[i*30+12] / aux;
397 cross_im = compressed_spectral_matrix_f0[i*30+13] / aux;
398 LFR_BP2_F0[i*30+15] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
399 LFR_BP2_F0[i*30+5] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
400 printf("LFR_BP2_F0[i*30+15] for cross23_re (%16.8e) : %u\n",cross_re, LFR_BP2_F0[i*30+15]);
401 printf("LFR_BP2_F0[i*30+5] for cross23_im (%16.8e) : %u\n",cross_im, LFR_BP2_F0[i*30+5]);
402 // S24
403 aux = sqrt(compressed_spectral_matrix_f0[i*30+10]*compressed_spectral_matrix_f0[i*30+24]);
404 cross_re = compressed_spectral_matrix_f0[i*30+14] / aux;
405 cross_im = compressed_spectral_matrix_f0[i*30+15] / aux;
406 LFR_BP2_F0[i*30+14] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
407 LFR_BP2_F0[i*30+4] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
408 printf("LFR_BP2_F0[i*30+14] for cross24_re (%16.8e) : %u\n",cross_re, LFR_BP2_F0[i*30+14]);
409 printf("LFR_BP2_F0[i*30+4] for cross24_im (%16.8e) : %u\n",cross_im, LFR_BP2_F0[i*30+4]);
410 // S25
411 aux = sqrt(compressed_spectral_matrix_f0[i*30+10]*compressed_spectral_matrix_f0[i*30+28]);
412 cross_re = compressed_spectral_matrix_f0[i*30+16] / aux;
413 cross_im = compressed_spectral_matrix_f0[i*30+17] / aux;
414 LFR_BP2_F0[i*30+13] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
415 LFR_BP2_F0[i*30+3] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
416 printf("LFR_BP2_F0[i*30+13] for cross25_re (%16.8e) : %u\n",cross_re, LFR_BP2_F0[i*30+13]);
417 printf("LFR_BP2_F0[i*30+3] for cross25_im (%16.8e) : %u\n",cross_im, LFR_BP2_F0[i*30+3]);
418 // S34
419 aux = sqrt(compressed_spectral_matrix_f0[i*30+18]*compressed_spectral_matrix_f0[i*30+24]);
420 cross_re = compressed_spectral_matrix_f0[i*30+20] / aux;
421 cross_im = compressed_spectral_matrix_f0[i*30+21] / aux;
422 LFR_BP2_F0[i*30+12] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
423 LFR_BP2_F0[i*30+2] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
424 printf("LFR_BP2_F0[i*30+12] for cross34_re (%16.8e) : %u\n",cross_re, LFR_BP2_F0[i*30+12]);
425 printf("LFR_BP2_F0[i*30+2] for cross34_im (%16.8e) : %u\n",cross_im, LFR_BP2_F0[i*30+2]);
426 // S35
427 aux = sqrt(compressed_spectral_matrix_f0[i*30+18]*compressed_spectral_matrix_f0[i*30+28]);
428 cross_re = compressed_spectral_matrix_f0[i*30+22] / aux;
429 cross_im = compressed_spectral_matrix_f0[i*30+23] / aux;
430 LFR_BP2_F0[i*30+11] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
431 LFR_BP2_F0[i*30+1] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
432 printf("LFR_BP2_F0[i*30+11] for cross35_re (%16.8e) : %u\n",cross_re, LFR_BP2_F0[i*30+11]);
433 printf("LFR_BP2_F0[i*30+1] for cross35_im (%16.8e) : %u\n",cross_im, LFR_BP2_F0[i*30+1]);
434 // S45
435 aux = sqrt(compressed_spectral_matrix_f0[i*30+24]*compressed_spectral_matrix_f0[i*30+28]);
436 cross_re = compressed_spectral_matrix_f0[i*30+26] / aux;
437 cross_im = compressed_spectral_matrix_f0[i*30+27] / aux;
438 LFR_BP2_F0[i*30+10] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
439 LFR_BP2_F0[i*30+0] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
440 printf("LFR_BP2_F0[i*30+10] for cross45_re (%16.8e) : %u\n",cross_re, LFR_BP2_F0[i*30+10]);
441 printf("LFR_BP2_F0[i*30+0] for cross45_im (%16.8e) : %u\n",cross_im, LFR_BP2_F0[i*30+0]);
442
443 //==============================================
444 // BP2 auto correlations == PA_LFR_SC_BP2_AUTO_F0 == 5*16 bits = 5*[6 bits (exponent) + 10 bits (significand)]
445 // == PA_LFR_SC_BP2_AUTO_A0_F0 == 16 bits
446 // == PA_LFR_SC_BP2_AUTO_A1_F0 == 16 bits
447 // == PA_LFR_SC_BP2_AUTO_A2_F0 == 16 bits
448 // == PA_LFR_SC_BP2_AUTO_A3_F0 == 16 bits
449 // == PA_LFR_SC_BP2_AUTO_A4_F0 == 16 bits
450 // S11
451 significand = frexpf(compressed_spectral_matrix_f0[i*30], &exponent); // 0.5 <= significand < 1
452 // S11 = significand * 2^exponent
453 printf("S11 : %16.8e\n",compressed_spectral_matrix_f0[i*30]);
454 printf("significand : %16.8e\n",significand);
455 printf("exponent : %d\n" ,exponent);
456
457 if (exponent < expmin) { // value should be >= 0.5 * 2^expmin
458 exponent = expmin;
459 significand = 0.5; // min value that can be recorded
460 }
461 if (exponent > expmax) { // value should be < 0.5 * 2^(expmax+1)
462 exponent = expmax;
463 significand = 1.0; // max value that can be recorded
464 }
465 if (significand == 0) {// in that case exponent == 0 too
466 exponent = expmin;
467 significand = 0.5; // min value that can be recorded
468 }
469
470 autocor = (unsigned short int) ((significand*2-1)*rangesig + 0.5); // shift and cast into a 16-bit unsigned int with rounding
471 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
472 tmp_u_short_int = (unsigned short int) (exponent-expmin); // shift and cast into a 16-bit unsigned int
473 // where just the first nbitexp bits are used (0, ..., 2^nbitexp-1)
474 pt_u_short_int = (unsigned short int*) &LFR_BP2_F0[i*30+28]; // affect an unsigned short int pointer with the
475 // adress where the 16-bit word result will be stored
476 *pt_u_short_int = autocor | (tmp_u_short_int << nbitsig); // put the exponent bits (nbitexp) next to the
477 // left place of the significand bits (nbitsig), making
478 // the 16-bit word to be recorded, and record it using the pointer
479 //printf("size of autocor : %d\n",sizeof(autocor) );
480 //printf("size of tmp_u_short_int : %d\n",sizeof(tmp_u_short_int) );
481 printf("autocor for S11 significand : %u\n",autocor );
482 printf("tmp_u_char for S11 exponent : %u\n",tmp_u_short_int );
483 printf("*pt_u_short_int for S11 significand + exponent: %u or %x\n",*pt_u_short_int, *pt_u_short_int);
484 printf("LFR_BP2_F0[i*30+29] : %u or %x\n",LFR_BP2_F0[i*30+29], LFR_BP2_F0[i*30+29]);
485 printf("LFR_BP2_F0[i*30+28] : %u or %x\n",LFR_BP2_F0[i*30+28], LFR_BP2_F0[i*30+28]);
486 // S22
487 significand = frexpf(compressed_spectral_matrix_f0[i*30+10], &exponent); // 0.5 <= significand < 1
488 // S22 = significand * 2^exponent
489 printf("S22 : %16.8e\n",compressed_spectral_matrix_f0[i*30+10]);
490 printf("significand : %16.8e\n",significand);
491 printf("exponent : %d\n" ,exponent);
492
493 if (exponent < expmin) { // value should be >= 0.5 * 2^expmin
494 exponent = expmin;
495 significand = 0.5; // min value that can be recorded
496 }
497 if (exponent > expmax) { // value should be < 0.5 * 2^(expmax+1)
498 exponent = expmax;
499 significand = 1.0; // max value that can be recorded
500 }
501 if (significand == 0) {// in that case exponent == 0 too
502 exponent = expmin;
503 significand = 0.5; // min value that can be recorded
504 }
505
506 autocor = (unsigned short int) ((significand*2-1)*rangesig + 0.5); // shift and cast into a 16-bit unsigned int with rounding
507 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
508 tmp_u_short_int = (unsigned short int) (exponent-expmin); // shift and cast into a 16-bit unsigned int
509 // where just the first nbitexp bits are used (0, ..., 2^nbitexp-1)
510 pt_u_short_int = (unsigned short int*) &LFR_BP2_F0[i*30+26]; // affect an unsigned short int pointer with the
511 // adress where the 16-bit word result will be stored
512 *pt_u_short_int = autocor | (tmp_u_short_int << nbitsig); // put the exponent bits (nbitexp) next to the
513 // left place of the significand bits (nbitsig), making
514 // the 16-bit word to be recorded, and record it using the pointer
515 printf("autocor for S22 significand : %d\n",autocor );
516 printf("tmp_u_char for S22 exponent : %d\n",tmp_u_short_int );
517 printf("*pt_u_short_int for S22 significand + exponent: %d or %x\n",*pt_u_short_int, *pt_u_short_int);
518 printf("LFR_BP2_F0[i*30+27] : %d or %x\n",LFR_BP2_F0[i*30+27], LFR_BP2_F0[i*30+27]);
519 printf("LFR_BP2_F0[i*30+26] : %d or %x\n",LFR_BP2_F0[i*30+26], LFR_BP2_F0[i*30+26]);
520 // S33
521 significand = frexpf(compressed_spectral_matrix_f0[i*30+18], &exponent); // 0.5 <= significand < 1
522 // S33 = significand * 2^exponent
523 printf("S33 : %16.8e\n",compressed_spectral_matrix_f0[i*30+18]);
524 printf("significand : %16.8e\n",significand);
525 printf("exponent : %d\n" ,exponent);
526
527 if (exponent < expmin) { // value should be >= 0.5 * 2^expmin
528 exponent = expmin;
529 significand = 0.5; // min value that can be recorded
530 }
531 if (exponent > expmax) { // value should be < 0.5 * 2^(expmax+1)
532 exponent = expmax;
533 significand = 1.0; // max value that can be recorded
534 }
535 if (significand == 0) {// in that case exponent == 0 too
536 exponent = expmin;
537 significand = 0.5; // min value that can be recorded
538 }
539
540 autocor = (unsigned short int) ((significand*2-1)*rangesig + 0.5); // shift and cast into a 16-bit unsigned int with rounding
541 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
542 tmp_u_short_int = (unsigned short int) (exponent-expmin); // shift and cast into a 16-bit unsigned int
543 // where just the first nbitexp bits are used (0, ..., 2^nbitexp-1)
544 pt_u_short_int = (unsigned short int*) &LFR_BP2_F0[i*30+24]; // affect an unsigned short int pointer with the
545 // adress where the 16-bit word result will be stored
546 *pt_u_short_int = autocor | (tmp_u_short_int << nbitsig); // put the exponent bits (nbitexp) next to the
547 // left place of the significand bits (nbitsig), making
548 // the 16-bit word to be recorded, and record it using the pointer
549 printf("autocor for S33 significand : %d\n",autocor );
550 printf("tmp_u_char for S33 exponent : %d\n",tmp_u_short_int );
551 printf("*pt_u_short_int for S33 significand + exponent: %d or %x\n",*pt_u_short_int, *pt_u_short_int);
552 printf("LFR_BP2_F0[i*30+25] : %d or %x\n",LFR_BP2_F0[i*30+25], LFR_BP2_F0[i*30+25]);
553 printf("LFR_BP2_F0[i*30+24] : %d or %x\n",LFR_BP2_F0[i*30+24], LFR_BP2_F0[i*30+24]);
554 // S44
555 significand = frexpf(compressed_spectral_matrix_f0[i*30+24], &exponent); // 0.5 <= significand < 1
556 // S44 = significand * 2^exponent
557 printf("S44 : %16.8e\n",compressed_spectral_matrix_f0[i*30+24]);
558 printf("significand : %16.8e\n",significand);
559 printf("exponent : %d\n" ,exponent);
560
561 if (exponent < expmin) { // value should be >= 0.5 * 2^expmin
562 exponent = expmin;
563 significand = 0.5; // min value that can be recorded
564 }
565 if (exponent > expmax) { // value should be < 0.5 * 2^(expmax+1)
566 exponent = expmax;
567 significand = 1.0; // max value that can be recorded
568 }
569 if (significand == 0) {// in that case exponent == 0 too
570 exponent = expmin;
571 significand = 0.5; // min value that can be recorded
572 }
573
574 autocor = (unsigned short int) ((significand*2-1)*rangesig + 0.5); // shift and cast into a 16-bit unsigned int with rounding
575 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
576 tmp_u_short_int = (unsigned short int) (exponent-expmin); // shift and cast into a 16-bit unsigned int
577 // where just the first nbitexp bits are used (0, ..., 2^nbitexp-1)
578 pt_u_short_int = (unsigned short int*) &LFR_BP2_F0[i*30+22]; // affect an unsigned short int pointer with the
579 // adress where the 16-bit word result will be stored
580 *pt_u_short_int = autocor | (tmp_u_short_int << nbitsig); // put the exponent bits (nbitexp) next to the
581 // left place of the significand bits (nbitsig), making
582 // the 16-bit word to be recorded, and record it using the pointer
583 printf("autocor for S44 significand : %d\n",autocor );
584 printf("tmp_u_char for S44 exponent : %d\n",tmp_u_short_int );
585 printf("*pt_u_short_int for S44 significand + exponent: %d or %x\n",*pt_u_short_int, *pt_u_short_int);
586 printf("LFR_BP2_F0[i*30+23] : %d or %x\n",LFR_BP2_F0[i*30+23], LFR_BP2_F0[i*30+23]);
587 printf("LFR_BP2_F0[i*30+22] : %d or %x\n",LFR_BP2_F0[i*30+22], LFR_BP2_F0[i*30+22]);
588 // S55
589 significand = frexpf(compressed_spectral_matrix_f0[i*30+28], &exponent); // 0.5 <= significand < 1
590 // S55 = significand * 2^exponent
591 printf("S55 : %16.8e\n",compressed_spectral_matrix_f0[i*30+28]);
592 printf("significand : %16.8e\n",significand);
593 printf("exponent : %d\n" ,exponent);
594
595 if (exponent < expmin) { // value should be >= 0.5 * 2^expmin
596 exponent = expmin;
597 significand = 0.5; // min value that can be recorded
598 }
599 if (exponent > expmax) { // value should be < 0.5 * 2^(expmax+1)
600 exponent = expmax;
601 significand = 1.0; // max value that can be recorded
602 }
603 if (significand == 0) {// in that case exponent == 0 too
604 exponent = expmin;
605 significand = 0.5; // min value that can be recorded
606 }
607
608 autocor = (unsigned short int) ((significand*2-1)*rangesig + 0.5); // shift and cast into a 16-bit unsigned int with rounding
609 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
610 tmp_u_short_int = (unsigned short int) (exponent-expmin); // shift and cast into a 16-bit unsigned int
611 // where just the first nbitexp bits are used (0, ..., 2^nbitexp-1)
612 pt_u_short_int = (unsigned short int*) &LFR_BP2_F0[i*30+20]; // affect an unsigned short int pointer with the
613 // adress where the 16-bit word result will be stored
614 *pt_u_short_int = autocor | (tmp_u_short_int << nbitsig); // put the exponent bits (nbitexp) next to the
615 // left place of the significand bits (nbitsig), making
616 // the 16-bit word to be recorded, and record it using the pointer
617 printf("autocor for S55 significand : %d\n",autocor );
618 printf("tmp_u_char for S55 exponent : %d\n",tmp_u_short_int );
619 printf("*pt_u_short_int for S55 significand + exponent: %d or %x\n",*pt_u_short_int, *pt_u_short_int);
620 printf("LFR_BP2_F0[i*30+21] : %d or %x\n",LFR_BP2_F0[i*30+21], LFR_BP2_F0[i*30+21]);
621 printf("LFR_BP2_F0[i*30+20] : %d or %x\n",LFR_BP2_F0[i*30+20], LFR_BP2_F0[i*30+20]);
622
623 }
624 }
625
@@ -0,0 +1,29
1 #ifndef BASIC_PARAMETERS_H_INCLUDED
2 #define BASIC_PARAMETERS_H_INCLUDED
3
4 #define LPP_SPECTRAL_MATRIX_CTRL 0x80000700
5 #define LPP_SPECTRAL_MATRIX_1 0x80000704
6 #define LPP_SPECTRAL_MATRIX_2 0x80000708
7
8 #define NB_BINS_SPECTRAL_MATRIX 128
9 #define NB_VALUES_PER_SPECTRAL_MATRIX 30
10 #define TOTAL_SIZE_SPECTRAL_MATRIX NB_BINS_SPECTRAL_MATRIX * NB_VALUES_PER_SPECTRAL_MATRIX
11 #define NB_BINS_COMPRESSED_MATRIX_f0 2
12 #define SIZE_COMPRESSED_SPECTRAL_MATRIX_f1 13
13 #define SIZE_COMPRESSED_SPECTRAL_MATRIX_f2 12
14 #define TOTAL_SIZE_COMPRESSED_MATRIX_f0 NB_BINS_COMPRESSED_MATRIX_f0 * NB_VALUES_PER_SPECTRAL_MATRIX
15 #define NB_AVERAGE_NORMAL_f0 4
16
17 volatile int spectral_matrix_f0_a[TOTAL_SIZE_SPECTRAL_MATRIX];
18 volatile int spectral_matrix_f0_b[TOTAL_SIZE_SPECTRAL_MATRIX];
19 int averaged_spectral_matrix_f0[TOTAL_SIZE_SPECTRAL_MATRIX];
20
21 float compressed_spectral_matrix_f0[TOTAL_SIZE_COMPRESSED_MATRIX_f0];
22
23 unsigned char LFR_BP1_F0[NB_BINS_COMPRESSED_MATRIX_f0*9];
24 unsigned char LFR_BP2_F0[NB_BINS_COMPRESSED_MATRIX_f0*30];
25
26 void BP1_set();
27 void BP2_set();
28
29 #endif // BASIC_PARAMETERS_H_INCLUDED
This diff has been collapsed as it changes many lines, (756 lines changed) Show them Hide them
@@ -0,0 +1,756
1 #include "basic_parameters_1_ICD_issue1rev6.h"
2 #include <math.h>
3 #include <stdio.h>
4
5 float k44_pe = 1;
6 float k55_pe = 1;
7 float k45_pe_re = 1;
8 float k45_pe_im = 1;
9
10 float k14_sx_re = 1;
11 float k14_sx_im = 1;
12 float k15_sx_re = 1;
13 float k15_sx_im = 1;
14 float k24_sx_re = 1;
15 float k24_sx_im = 1;
16 float k25_sx_re = 1;
17 float k25_sx_im = 1;
18 float k34_sx_re = 1;
19 float k34_sx_im = 1;
20 float k35_sx_re = 1;
21 float k35_sx_im = 1;
22
23 float k24_ny_re = 1;
24 float k24_ny_im = 1;
25 float k25_ny_re = 1;
26 float k25_ny_im = 1;
27 float k34_ny_re = 1;
28 float k34_ny_im = 1;
29 float k35_ny_re = 1;
30 float k35_ny_im = 1;
31
32 float k24_nz_re = 1;
33 float k24_nz_im = 1;
34 float k25_nz_re = 1;
35 float k25_nz_im = 1;
36 float k34_nz_re = 1;
37 float k34_nz_im = 1;
38 float k35_nz_re = 1;
39 float k35_nz_im = 1;
40
41 float alpha_M = 45 * (3.1415927/180);
42
43 void BP1_set(){
44 int i, j, exponent;
45 float PSDB, PSDE, tmp, NVEC_V0, NVEC_V1, NVEC_V2, aux, tr_SB_SB,
46 e_cross_b_re, e_cross_b_im,
47 n_cross_e_scal_b_re, n_cross_e_scal_b_im,
48 ny, nz, bx_bx_star, vphi,
49 significand;
50 signed char nbitexp, nbitsig, expmin, expmax; // 8 bits
51 short int rangesig; // 16 bits
52 unsigned short int psd, tmp_u_short_int; // 16 bits
53 unsigned short int *pt_u_short_int; // pointer on unsigned 16-bit words
54 unsigned char tmp_u_char; // 8 bits
55 unsigned char *pt_u_char; // pointer on unsigned 8-bit bytes
56
57 unsigned char toto_u_char;
58 unsigned char *pt_toto_u_char;
59 signed char toto_s_char;
60 float toto_f;
61
62 FILE *infile;
63 infile = fopen("sm_test1.dat", "rb"); // open explicitely a binary file !!! ...
64 if(infile == NULL) {
65 printf("Hello I cannot open the file!\n");
66 return 0;
67 }
68 (void) fread(compressed_spectral_matrix_f0, sizeof(compressed_spectral_matrix_f0), 1, infile);
69 (void) fclose(infile);
70 //printf("size of compressed_spectral_matrix_f0 : %d\n", sizeof(compressed_spectral_matrix_f0));
71 printf("compressed_spectral_matrix_f0 : \n");
72 for (i = 0; i < 15; i++) {
73 printf("Element number %.2d (%.2d & %.2d) => Re:%16.8e Im:%16.8e\n", i+1, 2*i, 2*i+1,
74 compressed_spectral_matrix_f0[2*i],
75 compressed_spectral_matrix_f0[2*i+1]);
76 }
77
78 printf("Number of bins: %d\n", NB_BINS_COMPRESSED_MATRIX_f0);
79 printf("BP1 : \n");
80
81 // initialization for managing the exponents of the floating point data:
82 nbitexp = 5; // number of bits for the exponent
83 expmax = 30; // maximum value of the exponent
84 expmin = expmax - (1 << nbitexp) + 1; // accordingly the minimum exponent value
85 printf("nbitexp : %d, expmax : %d, expmin : %d\n", nbitexp, expmax, expmin);
86 // for floating point data to be recorded on 12-bit words:
87 nbitsig = 12 - nbitexp; // number of bits for the significand
88 rangesig = (1 << nbitsig)-1; // == 2^nbitsig - 1
89 printf("nbitsig : %d, rangesig : %d\n", nbitsig, rangesig);
90
91 for(i=0; i<1; i++){
92 //==============================================
93 // BP1 PSDB == PA_LFR_SC_BP1_PB_F0 == 12 bits = 5 bits (exponent) + 7 bits (significand)
94 PSDB = compressed_spectral_matrix_f0[i*30] // S11
95 + compressed_spectral_matrix_f0[i*30+10] // S22
96 + compressed_spectral_matrix_f0[i*30+18]; // S33
97
98 significand = frexpf(PSDB/3, &exponent); // 0.5 <= significand < 1
99 // PSDB/3 = significand * 2^exponent
100 // the division by 3 is to ensure that max value <= 2^30
101
102 printf("PSDB / 3 : %16.8e\n",PSDB/3);
103 printf("significand : %16.8e\n",significand);
104 printf("exponent : %d\n" ,exponent);
105
106 if (exponent < expmin) { // value should be >= 0.5 * 2^expmin
107 exponent = expmin;
108 significand = 0.5; // min value that can be recorded
109 }
110 if (exponent > expmax) { // value should be < 0.5 * 2^(expmax+1)
111 exponent = expmax;
112 significand = 1.0; // max value that can be recorded
113 }
114 if (significand == 0) {// in that case exponent == 0 too
115 exponent = expmin;
116 significand = 0.5; // min value that can be recorded
117 }
118
119 psd = (unsigned short int) ((significand*2-1)*rangesig + 0.5); // shift and cast into a 16-bit unsigned int with rounding
120 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
121 tmp_u_short_int = (unsigned short int) (exponent-expmin); // shift and cast into a 16-bit unsigned int
122 // where just the first nbitexp bits are used (0, ..., 2^nbitexp-1)
123 pt_u_short_int = (unsigned short int*) &LFR_BP1_F0[i*9+7]; // affect an unsigned short int pointer with the
124 // adress where the 16-bit word result will be stored
125 *pt_u_short_int = psd | (tmp_u_short_int << nbitsig); // put the exponent bits (nbitexp) next to the
126 // left place of the significand bits (nbitsig), making
127 // the 16-bit word to be recorded, and record it using the pointer
128 printf("psd for PSDB significand : %d\n",psd);
129 printf("tmp_u_short_int for PSDB exponent : %d\n",tmp_u_short_int);
130 printf("*pt_u_short_int for PSDB significand + exponent: %.3d or %.4x\n",*pt_u_short_int, *pt_u_short_int);
131 printf("LFR_BP1_F0[i*9+8] : %.3d or %.2x\n",LFR_BP1_F0[i*9+8], LFR_BP1_F0[i*9+8]);
132 printf("LFR_BP1_F0[i*9+7] : %.3d or %.2x\n",LFR_BP1_F0[i*9+7], LFR_BP1_F0[i*9+7]);
133
134 //toto_f = 32768*32768; // max value ?
135 //toto_f = 1./3; // min value ?
136 //significand = frexp(toto_f, &exponent);
137 //printf("toto_f : %16.8e\n",toto_f);
138 //printf("significand : %16.8e\n",significand);
139 //printf("exponent : %d\n" ,exponent);
140
141 //==============================================
142 // BP1 PSDE == PA_LFR_SC_BP1_PE_F0 == 12 bits = 5 bits (exponent) + 7 bits (significand)
143 PSDE = compressed_spectral_matrix_f0[i*30+24] * k44_pe // S44
144 + compressed_spectral_matrix_f0[i*30+28] * k55_pe // S55
145 + compressed_spectral_matrix_f0[i*30+26] * k45_pe_re // S45 Re
146 - compressed_spectral_matrix_f0[i*30+27] * k45_pe_im; // S45 Im
147
148 significand = frexpf(PSDE/2, &exponent); // 0.5 <= significand < 1
149 // PSDE/2 = significand * 2^exponent
150 // the division by 2 is to ensure that max value <= 2^30
151 // should be reconsidered by taking into account the k-coefficients ...
152
153 printf("PSDE / 2 : %16.8e\n",PSDE/2);
154 printf("significand : %16.8e\n",significand);
155 printf("exponent : %d\n" ,exponent);
156
157 if (exponent < expmin) { // value should be >= 0.5 * 2^expmin
158 exponent = expmin;
159 significand = 0.5; // min value that can be recorded
160 }
161 if (exponent > expmax) { // value should be < 0.5 * 2^(expmax+1)
162 exponent = expmax;
163 significand = 1.0; // max value that can be recorded
164 }
165 if (significand == 0) {// in that case exponent == 0 too
166 exponent = expmin;
167 significand = 0.5; // min value that can be recorded
168 }
169
170 psd = (unsigned short int) ((significand*2-1)*rangesig + 0.5); // shift and cast into a 16-bit unsigned int with rounding
171 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
172 tmp_u_short_int = (unsigned short int) (exponent-expmin); // shift and cast into a 16-bit unsigned int
173 // where just the first nbitexp bits are used (0, ..., 2^nbitexp-1)
174 pt_u_short_int = (unsigned short int*) &LFR_BP1_F0[i*9+5]; // affect an unsigned short int pointer with the
175 // adress where the 16-bit word result will be stored
176 *pt_u_short_int = psd | (tmp_u_short_int << nbitsig); // put the exponent bits (nbitexp) next to the
177 // left place of the significand bits (nbitsig), making
178 // the 16-bit word to be recorded, and record it using the pointer
179 printf("psd for PSDE significand : %d\n",psd);
180 printf("tmp_u_short_int for PSDE exponent : %d\n",tmp_u_short_int);
181 printf("*pt_u_short_int for PSDE significand + exponent: %.3d or %.4x\n",*pt_u_short_int, *pt_u_short_int);
182 printf("LFR_BP1_F0[i*9+6] : %.3d or %.2x\n",LFR_BP1_F0[i*9+6], LFR_BP1_F0[i*9+6]);
183 printf("LFR_BP1_F0[i*9+5] : %.3d or %.2x\n",LFR_BP1_F0[i*9+5], LFR_BP1_F0[i*9+5]);
184
185 //==============================================================================
186 // BP1 normal wave vector == PA_LFR_SC_BP1_NVEC_V0_F0 == 8 bits
187 // == PA_LFR_SC_BP1_NVEC_V1_F0 == 8 bits
188 // == PA_LFR_SC_BP1_NVEC_V2_F0 == 1 sign bit
189 tmp = sqrt( compressed_spectral_matrix_f0[i*30+3] *compressed_spectral_matrix_f0[i*30+3] //Im S12
190 +compressed_spectral_matrix_f0[i*30+5] *compressed_spectral_matrix_f0[i*30+5] //Im S13
191 +compressed_spectral_matrix_f0[i*30+13]*compressed_spectral_matrix_f0[i*30+13] //Im S23
192 );
193 NVEC_V0 = compressed_spectral_matrix_f0[i*30+13]/ tmp; // S23 Im => n1
194 NVEC_V1 = -compressed_spectral_matrix_f0[i*30+5] / tmp; // S13 Im => n2
195 NVEC_V2 = compressed_spectral_matrix_f0[i*30+3] / tmp; // S12 Im => n3
196
197 printf("NVEC_V0 : %16.8e\n",NVEC_V0);
198 printf("NVEC_V1 : %16.8e\n",NVEC_V1);
199 printf("NVEC_V2 : %16.8e\n",NVEC_V2);
200
201 LFR_BP1_F0[i*9+4] = (unsigned char) (NVEC_V0*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
202 LFR_BP1_F0[i*9+3] = (unsigned char) (NVEC_V1*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
203 pt_u_char = (unsigned char*) &NVEC_V2; // affect an unsigned char pointer with the adress of NVEC_V2
204 LFR_BP1_F0[i*9+2] = pt_u_char[3] & 0x80; // extract the sign bit of NVEC_V2 (32-bit float, sign bit in the 4th octet)
205 // record it at the 8th bit position (from the right to the left) of LFR_BP1_F0[i*9+2]
206
207 printf("LFR_BP1_F0[i*9+4] for NVEC_V0 : %u\n",LFR_BP1_F0[i*9+4]);
208 printf("LFR_BP1_F0[i*9+3] for NVEC_V1 : %u\n",LFR_BP1_F0[i*9+3]);
209 printf("LFR_BP1_F0[i*9+2] for NVEC_V2 : %u\n",LFR_BP1_F0[i*9+2]);
210
211 //toto_f = 128.9999 ;
212 //toto_s_char = (signed char) toto_f;
213 //printf("toto_s_char : %d\n",toto_s_char);
214
215 //toto_f = 255.999 ;
216 //toto_u_char = (unsigned char) (toto_f);
217 //printf("toto_u_char : %d\n",toto_u_char);
218
219 //toto_f = -1110.999 ;
220 //pt_toto_u_char = (unsigned char*) &toto_f;
221 //printf("pt_toto_u_char : %u\n", pt_toto_u_char[3] & 0x80);
222
223 //=======================================================
224 // BP1 ellipticity == PA_LFR_SC_BP1_ELLIP_F0 == 4 bits
225 aux = 2*tmp / PSDB; // compute the ellipticity
226
227 printf("ellipticity : %16.8e\n",aux);
228
229 tmp_u_char = (unsigned char) (aux*15 + 0.5); // shift and cast into a 8-bit unsigned char with rounding
230 // where just the first 4 bits are used (0, ..., 15)
231 LFR_BP1_F0[i*9+2] = LFR_BP1_F0[i*9+2] | (tmp_u_char << 3); // put these 4 bits next to the right place
232 // of the sign bit of NVEC_V2 (recorded
233 // previously in LFR_BP1_F0[i*9+2])
234
235 printf("tmp_u_char for ellipticity : %u\n",tmp_u_char);
236 printf("LFR_BP1_F0[i*9+2] for NVEC_V2 + ellipticity : %u\n",LFR_BP1_F0[i*9+2]);
237
238 //==============================================================
239 // BP1 degree of polarization == PA_LFR_SC_BP1_DOP_F0 == 3 bits
240 tr_SB_SB = compressed_spectral_matrix_f0[i*30] *compressed_spectral_matrix_f0[i*30]
241 + compressed_spectral_matrix_f0[i*30+10]*compressed_spectral_matrix_f0[i*30+10]
242 + compressed_spectral_matrix_f0[i*30+18]*compressed_spectral_matrix_f0[i*30+18]
243 + 2 * compressed_spectral_matrix_f0[i*30+2] *compressed_spectral_matrix_f0[i*30+2]
244 + 2 * compressed_spectral_matrix_f0[i*30+3] *compressed_spectral_matrix_f0[i*30+3]
245 + 2 * compressed_spectral_matrix_f0[i*30+4] *compressed_spectral_matrix_f0[i*30+4]
246 + 2 * compressed_spectral_matrix_f0[i*30+5] *compressed_spectral_matrix_f0[i*30+5]
247 + 2 * compressed_spectral_matrix_f0[i*30+12]*compressed_spectral_matrix_f0[i*30+12]
248 + 2 * compressed_spectral_matrix_f0[i*30+13]*compressed_spectral_matrix_f0[i*30+13];
249 aux = PSDB*PSDB;
250 tmp = ( 3*tr_SB_SB - aux ) / ( 2 * aux ); // compute the degree of polarisation
251
252 printf("DOP : %16.8e\n",tmp);
253
254 tmp_u_char = (unsigned char) (tmp*7 + 0.5);// shift and cast into a 8-bit unsigned char with rounding
255 // where just the first 3 bits are used (0, ..., 7)
256 LFR_BP1_F0[i*9+2] = LFR_BP1_F0[i*9+2] | tmp_u_char; // record these 3 bits at the 3 first bit positions
257 // (from the right to the left) of LFR_BP1_F0[i*9+2]
258
259 printf("tmp_u_char for DOP : %u\n",tmp_u_char);
260 printf("LFR_BP1_F0[i*9+2] for NVEC_V2 + ellipticity + DOP : %u\n",LFR_BP1_F0[i*9+2]);
261
262 //=======================================================================================
263 // BP1 X_SO-component of the Poynting flux == PA_LFR_SC_BP1_SX_F0 == 8 (+ 2) bits
264 // = 5 bits (exponent) + 3 bits (significand)
265 // + 1 sign bit + 1 argument bit (two sectors)
266 e_cross_b_re = compressed_spectral_matrix_f0[i*30+20]*k34_sx_re //S34 Re
267 + compressed_spectral_matrix_f0[i*30+22]*k35_sx_re //S35 Re
268 + compressed_spectral_matrix_f0[i*30+6] *k14_sx_re //S14 Re
269 + compressed_spectral_matrix_f0[i*30+8] *k15_sx_re //S15 Re
270 + compressed_spectral_matrix_f0[i*30+14]*k24_sx_re //S24 Re
271 + compressed_spectral_matrix_f0[i*30+16]*k25_sx_re //S25 Re
272 + compressed_spectral_matrix_f0[i*30+21]*k34_sx_im //S34 Im
273 + compressed_spectral_matrix_f0[i*30+23]*k35_sx_im //S35 Im
274 + compressed_spectral_matrix_f0[i*30+7] *k14_sx_im //S14 Im
275 + compressed_spectral_matrix_f0[i*30+9] *k15_sx_im //S15 Im
276 + compressed_spectral_matrix_f0[i*30+15]*k24_sx_im //S24 Im
277 + compressed_spectral_matrix_f0[i*30+17]*k25_sx_im; //S25 Im
278 // Im(S_ji) = -Im(S_ij)
279 // k_ji = k_ij
280 e_cross_b_im = compressed_spectral_matrix_f0[i*30+20]*k34_sx_im //S34 Re
281 + compressed_spectral_matrix_f0[i*30+22]*k35_sx_im //S35 Re
282 + compressed_spectral_matrix_f0[i*30+6] *k14_sx_im //S14 Re
283 + compressed_spectral_matrix_f0[i*30+8] *k15_sx_im //S15 Re
284 + compressed_spectral_matrix_f0[i*30+14]*k24_sx_im //S24 Re
285 + compressed_spectral_matrix_f0[i*30+16]*k25_sx_im //S25 Re
286 - compressed_spectral_matrix_f0[i*30+21]*k34_sx_re //S34 Im
287 - compressed_spectral_matrix_f0[i*30+23]*k35_sx_re //S35 Im
288 - compressed_spectral_matrix_f0[i*30+7] *k14_sx_re //S14 Im
289 - compressed_spectral_matrix_f0[i*30+9] *k15_sx_re //S15 Im
290 - compressed_spectral_matrix_f0[i*30+15]*k24_sx_re //S24 Im
291 - compressed_spectral_matrix_f0[i*30+17]*k25_sx_re; //S25 Im
292
293 printf("ReaSX / 2 : %16.8e\n",e_cross_b_re/2);
294
295 pt_u_char = (unsigned char*) &e_cross_b_re; // Affect an unsigned char pointer with the adress of e_cross_b_re
296 LFR_BP1_F0[i*9+8] = LFR_BP1_F0[i*9+8] | (pt_u_char[3] & 0x80); // Extract its sign bit (32-bit float, sign bit in the 4th octet)
297 // Record it at the 8th bit position (from the right to the left)
298 // of LFR_BP1_F0[i*9+8]
299 pt_u_char[3] = (pt_u_char[3] & 0x7f); // Make e_cross_b_re be positive in any case: |ReaSX|
300
301 significand = frexpf(e_cross_b_re/2, &exponent);// 0.5 <= significand < 1
302 // ReaSX/2 = significand * 2^exponent
303 // The division by 2 is to ensure that max value <= 2^30 (rough estimate)
304 // Should be reconsidered by taking into account the k-coefficients ...
305
306 if (exponent < expmin) { // value should be >= 0.5 * 2^expmin
307 exponent = expmin;
308 significand = 0.5; // min value that can be recorded
309 }
310 if (exponent > expmax) { // value should be < 0.5 * 2^(expmax+1)
311 exponent = expmax;
312 significand = 1.0; // max value that can be recorded
313 }
314 if (significand == 0) {// in that case exponent == 0 too
315 exponent = expmin;
316 significand = 0.5; // min value that can be recorded
317 }
318 printf("|ReaSX| / 2 : %16.8e\n",e_cross_b_re/2);
319 printf("significand : %16.8e\n",significand);
320 printf("exponent : %d\n" ,exponent);
321
322 LFR_BP1_F0[i*9+1] = (unsigned char) ((significand*2-1)*7 + 0.5); // Shift and cast into a 8-bit unsigned char with rounding
323 // where just the first 3 bits are used (0, ..., 7)
324 tmp_u_char = (unsigned char) (exponent-expmin); // Shift and cast into a 8-bit unsigned char where
325 // just the first 5 bits are used (0, ..., 2^5-1)
326 printf("LFR_BP1_F0[i*9+1] for ReaSX significand : %u\n",LFR_BP1_F0[i*9+1]);
327 printf("tmp_u_char for ReaSX exponent : %d\n",tmp_u_char);
328 LFR_BP1_F0[i*9+1] = LFR_BP1_F0[i*9+1] | (tmp_u_char << 3); // shift these 5 bits to the left before logical addition
329 // with LFR_BP1_F0[i*9+1]
330 printf("LFR_BP1_F0[i*9+1] for ReaSX exponent + significand : %u\n",LFR_BP1_F0[i*9+1]);
331 printf("LFR_BP1_F0[i*9+8] for ReaSX sign + PSDB 'exponent' : %u\n",LFR_BP1_F0[i*9+8]);
332
333 printf("ImaSX / 2 : %16.8e\n",e_cross_b_im/2);
334
335 pt_u_char = (unsigned char*) &e_cross_b_im; // Affect an unsigned char pointer with the adress of e_cross_b_im
336 pt_u_char[3] = pt_u_char[3] & 0x7f; // Make e_cross_b_im be positive in any case: |ImaSX|
337 tmp_u_char = (e_cross_b_im > e_cross_b_re) ? 0x40 : 0x00; // Determine the sector argument of SX. If |Im| > |Re| affect
338 // an unsigned 8-bit char with 01000000; otherwise with null.
339 LFR_BP1_F0[i*9+8] = LFR_BP1_F0[i*9+8] | tmp_u_char; // Record it as a sign bit at the 7th bit position (from the right
340 // to the left) of LFR_BP1_F0[i*9+7], by simple logical addition.
341
342 printf("|ImaSX| / 2 : %16.8e\n",e_cross_b_im/2);
343 printf("ArgSX sign : %u\n",tmp_u_char);
344 printf("LFR_BP1_F0[i*9+8] for ReaSX & ArgSX signs + PSDB 'exponent' : %u\n",LFR_BP1_F0[i*9+8]);
345
346 //======================================================================
347 // BP1 phase velocity estimator == PA_LFR_SC_BP1_VPHI_F0 == 8 (+ 2) bits
348 // = 5 bits (exponent) + 3 bits (significand)
349 // + 1 sign bit + 1 argument bit (two sectors)
350 ny = sin(alpha_M)*NVEC_V1 + cos(alpha_M)*NVEC_V2;
351 nz = NVEC_V0;
352 bx_bx_star = cos(alpha_M)*cos(alpha_M)*compressed_spectral_matrix_f0[i*30+10] // S22 Re
353 + sin(alpha_M)*sin(alpha_M)*compressed_spectral_matrix_f0[i*30+18] // S33 Re
354 - 2*sin(alpha_M)*cos(alpha_M)*compressed_spectral_matrix_f0[i*30+12]; // S23 Re
355
356 n_cross_e_scal_b_re = ny * (compressed_spectral_matrix_f0[i*30+14]*k24_ny_re //S24 Re
357 +compressed_spectral_matrix_f0[i*30+16]*k25_ny_re //S25 Re
358 +compressed_spectral_matrix_f0[i*30+20]*k34_ny_re //S34 Re
359 +compressed_spectral_matrix_f0[i*30+22]*k35_ny_re //S35 Re
360 +compressed_spectral_matrix_f0[i*30+15]*k24_ny_im //S24 Im
361 +compressed_spectral_matrix_f0[i*30+17]*k25_ny_im //S25 Im
362 +compressed_spectral_matrix_f0[i*30+21]*k34_ny_im //S34 Im
363 +compressed_spectral_matrix_f0[i*30+23]*k35_ny_im) //S35 Im
364 + nz * (compressed_spectral_matrix_f0[i*30+14]*k24_nz_re //S24 Re
365 +compressed_spectral_matrix_f0[i*30+16]*k25_nz_re //S25 Re
366 +compressed_spectral_matrix_f0[i*30+20]*k34_nz_re //S34 Re
367 +compressed_spectral_matrix_f0[i*30+22]*k35_nz_re //S35 Re
368 +compressed_spectral_matrix_f0[i*30+15]*k24_nz_im //S24 Im
369 +compressed_spectral_matrix_f0[i*30+17]*k25_nz_im //S25 Im
370 +compressed_spectral_matrix_f0[i*30+21]*k34_nz_im //S34 Im
371 +compressed_spectral_matrix_f0[i*30+23]*k35_nz_im);//S35 Im
372 // Im(S_ji) = -Im(S_ij)
373 // k_ji = k_ij
374 n_cross_e_scal_b_im = ny * (compressed_spectral_matrix_f0[i*30+14]*k24_ny_im //S24 Re
375 +compressed_spectral_matrix_f0[i*30+16]*k25_ny_im //S25 Re
376 +compressed_spectral_matrix_f0[i*30+20]*k34_ny_im //S34 Re
377 +compressed_spectral_matrix_f0[i*30+22]*k35_ny_im //S35 Re
378 -compressed_spectral_matrix_f0[i*30+15]*k24_ny_re //S24 Im
379 -compressed_spectral_matrix_f0[i*30+17]*k25_ny_re //S25 Im
380 -compressed_spectral_matrix_f0[i*30+21]*k34_ny_re //S34 Im
381 -compressed_spectral_matrix_f0[i*30+23]*k35_ny_re) //S35 Im
382 + nz * (compressed_spectral_matrix_f0[i*30+14]*k24_nz_im //S24 Re
383 +compressed_spectral_matrix_f0[i*30+16]*k25_nz_im //S25 Re
384 +compressed_spectral_matrix_f0[i*30+20]*k34_nz_im //S34 Re
385 +compressed_spectral_matrix_f0[i*30+22]*k35_nz_im //S35 Re
386 -compressed_spectral_matrix_f0[i*30+15]*k24_nz_re //S24 Im
387 -compressed_spectral_matrix_f0[i*30+17]*k25_nz_re //S25 Im
388 -compressed_spectral_matrix_f0[i*30+21]*k34_nz_re //S34 Im
389 -compressed_spectral_matrix_f0[i*30+23]*k35_nz_re);//S35 Im
390
391 printf("n_cross_e_scal_b_re : %16.8e\n",n_cross_e_scal_b_re);
392 printf("n_cross_e_scal_b_im : %16.8e\n",n_cross_e_scal_b_im);
393 // vphi = n_cross_e_scal_b_re / bx_bx_star => sign(VPHI) = sign(n_cross_e_scal_b_re)
394 pt_u_char = (unsigned char*) &n_cross_e_scal_b_re; // Affect an unsigned char pointer with the adress of n_cross_e_scal_b_re
395 LFR_BP1_F0[i*9+7] = LFR_BP1_F0[i*9+7] | (pt_u_char[3] & 0x80); // Extract its sign bit (32-bit float, sign bit in the 4th octet)
396 // Record it at the 8th bit position (from the right to the left)
397 // of LFR_BP1_F0[i*9+7]
398 pt_u_char[3] = (pt_u_char[3] & 0x7f); // Make n_cross_e_scal_b_re be positive in any case: |n_cross_e_scal_b_re|
399 vphi = n_cross_e_scal_b_re / bx_bx_star; // Compute |VPHI|
400
401 significand = frexpf(vphi/2, &exponent); // 0.5 <= significand < 1
402 // vphi/2 = significand * 2^exponent
403 // The division by 2 is to ensure that max value <= 2^30 (rough estimate)
404 // Should be reconsidered by taking into account the k-coefficients ...
405
406 if (exponent < expmin) { // value should be >= 0.5 * 2^expmin
407 exponent = expmin;
408 significand = 0.5; // min value that can be recorded
409 }
410 if (exponent > expmax) { // value should be < 0.5 * 2^(expmax+1)
411 exponent = expmax;
412 significand = 1.0; // max value that can be recorded
413 }
414 if (significand == 0) {// in that case exponent == 0 too
415 exponent = expmin;
416 significand = 0.5; // min value that can be recorded
417 }
418 printf("|VPHI| / 2 : %16.8e\n",vphi/2);
419 printf("significand : %16.8e\n",significand);
420 printf("exponent : %d\n" ,exponent);
421
422 LFR_BP1_F0[i*9+0] = (unsigned char) ((significand*2-1)*7 + 0.5); // Shift and cast into a 8-bit unsigned char with rounding
423 // where just the first 3 bits are used (0, ..., 7)
424 tmp_u_char = (unsigned char) (exponent-expmin); // Shift and cast into a 8-bit unsigned char where
425 // just the first 5 bits are used (0, ..., 2^5-1)
426 printf("LFR_BP1_F0[i*9+0] for VPHI significand : %u\n",LFR_BP1_F0[i*9+0]);
427 printf("tmp_u_char for VPHI exponent : %d\n",tmp_u_char);
428 LFR_BP1_F0[i*9+0] = LFR_BP1_F0[i*9+0] | (tmp_u_char << 3); // shift these 5 bits to the left before logical addition
429 // with LFR_BP1_F0[i*9+0]
430 printf("LFR_BP1_F0[i*9+0] for VPHI exponent + significand : %u\n",LFR_BP1_F0[i*9+0]);
431 printf("LFR_BP1_F0[i*9+6] for VPHI sign + PSDE 'exponent' : %u\n",LFR_BP1_F0[i*9+6]);
432
433 pt_u_char = (unsigned char*) &n_cross_e_scal_b_im; // Affect an unsigned char pointer with the adress of n_cross_e_scal_b_im
434 pt_u_char[3] = pt_u_char[3] & 0x7f; // Make n_cross_e_scal_b_im be positive in any case: |ImaSX|
435 tmp_u_char = (n_cross_e_scal_b_im > n_cross_e_scal_b_re) ? 0x40 : 0x00; // Determine the sector argument of SX. If |Im| > |Re| affect
436 // an unsigned 8-bit char with 01000000; otherwise with null.
437 LFR_BP1_F0[i*9+6] = LFR_BP1_F0[i*9+6] | tmp_u_char; // Record it as a sign bit at the 7th bit position (from the right
438 // to the left) of LFR_BP1_F0[i*9+6], by simple logical addition.
439
440 printf("|n_cross_e_scal_b_im| : %16.8e\n",n_cross_e_scal_b_im);
441 printf("|n_cross_e_scal_b_im|/bx_bx_star/2: %16.8e\n",n_cross_e_scal_b_im/bx_bx_star/2);
442 printf("ArgNEBX sign : %u\n",tmp_u_char);
443 printf("LFR_BP1_F0[i*9+6] for VPHI & ArgNEBX signs + PSDE 'exponent' : %u\n",LFR_BP1_F0[i*9+6]);
444
445 }
446 }
447
448 void BP2_set(){
449 int i, exponent;
450 float aux, significand, cross_re, cross_im;
451 signed char nbitexp, nbitsig, expmin, expmax; // 8 bits
452 short int rangesig; // 16 bits
453 unsigned short int autocor, tmp_u_short_int; // 16 bits
454 unsigned short int *pt_u_short_int; // pointer on unsigned 16-bit words
455
456 printf("Number of bins: %d\n", NB_BINS_COMPRESSED_MATRIX_f0);
457 printf("BP2 : \n");
458
459 // For floating point data to be recorded on 16-bit words :
460 nbitexp = 6; // number of bits for the exponent
461 nbitsig = 16 - nbitexp; // number of bits for the significand
462 rangesig = (1 << nbitsig)-1; // == 2^nbitsig - 1
463 printf("nbitexp : %d, nbitsig : %d, rangesig : %d\n", nbitexp, nbitsig, rangesig);
464 expmax = 32;
465 expmin = expmax - (1 << nbitexp) + 1;
466 printf("expmin : %d, expmax : %d\n", expmin, expmax);
467
468 for(i = 0; i<1; i++){
469 //==============================================
470 // BP2 normalized cross correlations == PA_LFR_SC_BP2_CROSS_F0 == 10 * (8+8) bits
471 // == PA_LFR_SC_BP2_CROSS_RE_0_F0 == 8 bits
472 // == PA_LFR_SC_BP2_CROSS_IM_0_F0 == 8 bits
473 // == PA_LFR_SC_BP2_CROSS_RE_1_F0 == 8 bits
474 // == PA_LFR_SC_BP2_CROSS_IM_1_F0 == 8 bits
475 // == PA_LFR_SC_BP2_CROSS_RE_2_F0 == 8 bits
476 // == PA_LFR_SC_BP2_CROSS_IM_2_F0 == 8 bits
477 // == PA_LFR_SC_BP2_CROSS_RE_3_F0 == 8 bits
478 // == PA_LFR_SC_BP2_CROSS_IM_3_F0 == 8 bits
479 // == PA_LFR_SC_BP2_CROSS_RE_4_F0 == 8 bits
480 // == PA_LFR_SC_BP2_CROSS_IM_4_F0 == 8 bits
481 // == PA_LFR_SC_BP2_CROSS_RE_5_F0 == 8 bits
482 // == PA_LFR_SC_BP2_CROSS_IM_5_F0 == 8 bits
483 // == PA_LFR_SC_BP2_CROSS_RE_6_F0 == 8 bits
484 // == PA_LFR_SC_BP2_CROSS_IM_6_F0 == 8 bits
485 // == PA_LFR_SC_BP2_CROSS_RE_7_F0 == 8 bits
486 // == PA_LFR_SC_BP2_CROSS_IM_7_F0 == 8 bits
487 // == PA_LFR_SC_BP2_CROSS_RE_8_F0 == 8 bits
488 // == PA_LFR_SC_BP2_CROSS_IM_8_F0 == 8 bits
489 // == PA_LFR_SC_BP2_CROSS_RE_9_F0 == 8 bits
490 // == PA_LFR_SC_BP2_CROSS_IM_9_F0 == 8 bits
491 // S12
492 aux = sqrt(compressed_spectral_matrix_f0[i*30]*compressed_spectral_matrix_f0[i*30+10]);
493 cross_re = compressed_spectral_matrix_f0[i*30+2] / aux;
494 cross_im = compressed_spectral_matrix_f0[i*30+3] / aux;
495 LFR_BP2_F0[i*30+19] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
496 LFR_BP2_F0[i*30+9] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
497 printf("LFR_BP2_F0[i*30+19] for cross12_re (%16.8e) : %.3u\n",cross_re, LFR_BP2_F0[i*30+19]);
498 printf("LFR_BP2_F0[i*30+9] for cross12_im (%16.8e) : %.3u\n",cross_im, LFR_BP2_F0[i*30+9]);
499
500 // S13
501 aux = sqrt(compressed_spectral_matrix_f0[i*30]*compressed_spectral_matrix_f0[i*30+18]);
502 cross_re = compressed_spectral_matrix_f0[i*30+4] / aux;
503 cross_im = compressed_spectral_matrix_f0[i*30+5] / aux;
504 LFR_BP2_F0[i*30+18] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
505 LFR_BP2_F0[i*30+8] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
506 printf("LFR_BP2_F0[i*30+18] for cross13_re (%16.8e) : %.3u\n",cross_re, LFR_BP2_F0[i*30+18]);
507 printf("LFR_BP2_F0[i*30+8] for cross13_im (%16.8e) : %.3u\n",cross_im, LFR_BP2_F0[i*30+8]);
508
509 // S14
510 aux = sqrt(compressed_spectral_matrix_f0[i*30]*compressed_spectral_matrix_f0[i*30+24]);
511 cross_re = compressed_spectral_matrix_f0[i*30+6] / aux;
512 cross_im = compressed_spectral_matrix_f0[i*30+7] / aux;
513 LFR_BP2_F0[i*30+17] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
514 LFR_BP2_F0[i*30+7] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
515 printf("LFR_BP2_F0[i*30+17] for cross14_re (%16.8e) : %.3u\n",cross_re, LFR_BP2_F0[i*30+17]);
516 printf("LFR_BP2_F0[i*30+7] for cross14_im (%16.8e) : %.3u\n",cross_im, LFR_BP2_F0[i*30+7]);
517 // S15
518 aux = sqrt(compressed_spectral_matrix_f0[i*30]*compressed_spectral_matrix_f0[i*30+28]);
519 cross_re = compressed_spectral_matrix_f0[i*30+8] / aux;
520 cross_im = compressed_spectral_matrix_f0[i*30+9] / aux;
521 LFR_BP2_F0[i*30+16] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
522 LFR_BP2_F0[i*30+6] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
523 printf("LFR_BP2_F0[i*30+16] for cross15_re (%16.8e) : %.3u\n",cross_re, LFR_BP2_F0[i*30+16]);
524 printf("LFR_BP2_F0[i*30+6] for cross15_im (%16.8e) : %.3u\n",cross_im, LFR_BP2_F0[i*30+6]);
525 // S23
526 aux = sqrt(compressed_spectral_matrix_f0[i*30+10]*compressed_spectral_matrix_f0[i*30+18]);
527 cross_re = compressed_spectral_matrix_f0[i*30+12] / aux;
528 cross_im = compressed_spectral_matrix_f0[i*30+13] / aux;
529 LFR_BP2_F0[i*30+15] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
530 LFR_BP2_F0[i*30+5] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
531 printf("LFR_BP2_F0[i*30+15] for cross23_re (%16.8e) : %.3u\n",cross_re, LFR_BP2_F0[i*30+15]);
532 printf("LFR_BP2_F0[i*30+5] for cross23_im (%16.8e) : %.3u\n",cross_im, LFR_BP2_F0[i*30+5]);
533 // S24
534 aux = sqrt(compressed_spectral_matrix_f0[i*30+10]*compressed_spectral_matrix_f0[i*30+24]);
535 cross_re = compressed_spectral_matrix_f0[i*30+14] / aux;
536 cross_im = compressed_spectral_matrix_f0[i*30+15] / aux;
537 LFR_BP2_F0[i*30+14] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
538 LFR_BP2_F0[i*30+4] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
539 printf("LFR_BP2_F0[i*30+14] for cross24_re (%16.8e) : %.3u\n",cross_re, LFR_BP2_F0[i*30+14]);
540 printf("LFR_BP2_F0[i*30+4] for cross24_im (%16.8e) : %.3u\n",cross_im, LFR_BP2_F0[i*30+4]);
541 // S25
542 aux = sqrt(compressed_spectral_matrix_f0[i*30+10]*compressed_spectral_matrix_f0[i*30+28]);
543 cross_re = compressed_spectral_matrix_f0[i*30+16] / aux;
544 cross_im = compressed_spectral_matrix_f0[i*30+17] / aux;
545 LFR_BP2_F0[i*30+13] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
546 LFR_BP2_F0[i*30+3] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
547 printf("LFR_BP2_F0[i*30+13] for cross25_re (%16.8e) : %.3u\n",cross_re, LFR_BP2_F0[i*30+13]);
548 printf("LFR_BP2_F0[i*30+3] for cross25_im (%16.8e) : %.3u\n",cross_im, LFR_BP2_F0[i*30+3]);
549 // S34
550 aux = sqrt(compressed_spectral_matrix_f0[i*30+18]*compressed_spectral_matrix_f0[i*30+24]);
551 cross_re = compressed_spectral_matrix_f0[i*30+20] / aux;
552 cross_im = compressed_spectral_matrix_f0[i*30+21] / aux;
553 LFR_BP2_F0[i*30+12] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
554 LFR_BP2_F0[i*30+2] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
555 printf("LFR_BP2_F0[i*30+12] for cross34_re (%16.8e) : %.3u\n",cross_re, LFR_BP2_F0[i*30+12]);
556 printf("LFR_BP2_F0[i*30+2] for cross34_im (%16.8e) : %.3u\n",cross_im, LFR_BP2_F0[i*30+2]);
557 // S35
558 aux = sqrt(compressed_spectral_matrix_f0[i*30+18]*compressed_spectral_matrix_f0[i*30+28]);
559 cross_re = compressed_spectral_matrix_f0[i*30+22] / aux;
560 cross_im = compressed_spectral_matrix_f0[i*30+23] / aux;
561 LFR_BP2_F0[i*30+11] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
562 LFR_BP2_F0[i*30+1] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
563 printf("LFR_BP2_F0[i*30+11] for cross35_re (%16.8e) : %.3u\n",cross_re, LFR_BP2_F0[i*30+11]);
564 printf("LFR_BP2_F0[i*30+1] for cross35_im (%16.8e) : %.3u\n",cross_im, LFR_BP2_F0[i*30+1]);
565 // S45
566 aux = sqrt(compressed_spectral_matrix_f0[i*30+24]*compressed_spectral_matrix_f0[i*30+28]);
567 cross_re = compressed_spectral_matrix_f0[i*30+26] / aux;
568 cross_im = compressed_spectral_matrix_f0[i*30+27] / aux;
569 LFR_BP2_F0[i*30+10] = (unsigned char) (cross_re*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
570 LFR_BP2_F0[i*30+0] = (unsigned char) (cross_im*127.5 + 128); // shift and cast into a 8-bit unsigned char (0, ..., 255) with rounding
571 printf("LFR_BP2_F0[i*30+10] for cross45_re (%16.8e) : %.3u\n",cross_re, LFR_BP2_F0[i*30+10]);
572 printf("LFR_BP2_F0[i*30+0] for cross45_im (%16.8e) : %.3u\n",cross_im, LFR_BP2_F0[i*30+0]);
573
574 //==============================================
575 // BP2 auto correlations == PA_LFR_SC_BP2_AUTO_F0 == 5*16 bits = 5*[6 bits (exponent) + 10 bits (significand)]
576 // == PA_LFR_SC_BP2_AUTO_A0_F0 == 16 bits
577 // == PA_LFR_SC_BP2_AUTO_A1_F0 == 16 bits
578 // == PA_LFR_SC_BP2_AUTO_A2_F0 == 16 bits
579 // == PA_LFR_SC_BP2_AUTO_A3_F0 == 16 bits
580 // == PA_LFR_SC_BP2_AUTO_A4_F0 == 16 bits
581 // S11
582 significand = frexpf(compressed_spectral_matrix_f0[i*30], &exponent); // 0.5 <= significand < 1
583 // S11 = significand * 2^exponent
584 printf("S11 : %16.8e\n",compressed_spectral_matrix_f0[i*30]);
585 printf("significand : %16.8e\n",significand);
586 printf("exponent : %d\n" ,exponent);
587
588 if (exponent < expmin) { // value should be >= 0.5 * 2^expmin
589 exponent = expmin;
590 significand = 0.5; // min value that can be recorded
591 }
592 if (exponent > expmax) { // value should be < 0.5 * 2^(expmax+1)
593 exponent = expmax;
594 significand = 1.0; // max value that can be recorded
595 }
596 if (significand == 0) {// in that case exponent == 0 too
597 exponent = expmin;
598 significand = 0.5; // min value that can be recorded
599 }
600
601 autocor = (unsigned short int) ((significand*2-1)*rangesig + 0.5); // shift and cast into a 16-bit unsigned int with rounding
602 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
603 tmp_u_short_int = (unsigned short int) (exponent-expmin); // shift and cast into a 16-bit unsigned int
604 // where just the first nbitexp bits are used (0, ..., 2^nbitexp-1)
605 pt_u_short_int = (unsigned short int*) &LFR_BP2_F0[i*30+28]; // affect an unsigned short int pointer with the
606 // adress where the 16-bit word result will be stored
607 *pt_u_short_int = autocor | (tmp_u_short_int << nbitsig); // put the exponent bits (nbitexp) next to the
608 // left place of the significand bits (nbitsig), making
609 // the 16-bit word to be recorded, and record it using the pointer
610 //printf("size of autocor : %d\n",sizeof(autocor) );
611 //printf("size of tmp_u_short_int : %d\n",sizeof(tmp_u_short_int) );
612 printf("autocor for S11 significand : %u\n",autocor );
613 printf("tmp_u_char for S11 exponent : %u\n",tmp_u_short_int );
614 printf("*pt_u_short_int for S11 significand + exponent: %u or %x\n",*pt_u_short_int, *pt_u_short_int);
615 printf("LFR_BP2_F0[i*30+29] : %u or %x\n",LFR_BP2_F0[i*30+29], LFR_BP2_F0[i*30+29]);
616 printf("LFR_BP2_F0[i*30+28] : %u or %x\n",LFR_BP2_F0[i*30+28], LFR_BP2_F0[i*30+28]);
617 // S22
618 significand = frexpf(compressed_spectral_matrix_f0[i*30+10], &exponent); // 0.5 <= significand < 1
619 // S22 = significand * 2^exponent
620 printf("S22 : %16.8e\n",compressed_spectral_matrix_f0[i*30+10]);
621 printf("significand : %16.8e\n",significand);
622 printf("exponent : %d\n" ,exponent);
623
624 if (exponent < expmin) { // value should be >= 0.5 * 2^expmin
625 exponent = expmin;
626 significand = 0.5; // min value that can be recorded
627 }
628 if (exponent > expmax) { // value should be < 0.5 * 2^(expmax+1)
629 exponent = expmax;
630 significand = 1.0; // max value that can be recorded
631 }
632 if (significand == 0) {// in that case exponent == 0 too
633 exponent = expmin;
634 significand = 0.5; // min value that can be recorded
635 }
636
637 autocor = (unsigned short int) ((significand*2-1)*rangesig + 0.5); // shift and cast into a 16-bit unsigned int with rounding
638 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
639 tmp_u_short_int = (unsigned short int) (exponent-expmin); // shift and cast into a 16-bit unsigned int
640 // where just the first nbitexp bits are used (0, ..., 2^nbitexp-1)
641 pt_u_short_int = (unsigned short int*) &LFR_BP2_F0[i*30+26]; // affect an unsigned short int pointer with the
642 // adress where the 16-bit word result will be stored
643 *pt_u_short_int = autocor | (tmp_u_short_int << nbitsig); // put the exponent bits (nbitexp) next to the
644 // left place of the significand bits (nbitsig), making
645 // the 16-bit word to be recorded, and record it using the pointer
646 printf("autocor for S22 significand : %d\n",autocor );
647 printf("tmp_u_char for S22 exponent : %d\n",tmp_u_short_int );
648 printf("*pt_u_short_int for S22 significand + exponent: %.3d or %x\n",*pt_u_short_int, *pt_u_short_int);
649 printf("LFR_BP2_F0[i*30+27] : %.3d or %x\n",LFR_BP2_F0[i*30+27], LFR_BP2_F0[i*30+27]);
650 printf("LFR_BP2_F0[i*30+26] : %.3d or %x\n",LFR_BP2_F0[i*30+26], LFR_BP2_F0[i*30+26]);
651 // S33
652 significand = frexpf(compressed_spectral_matrix_f0[i*30+18], &exponent); // 0.5 <= significand < 1
653 // S33 = significand * 2^exponent
654 printf("S33 : %16.8e\n",compressed_spectral_matrix_f0[i*30+18]);
655 printf("significand : %16.8e\n",significand);
656 printf("exponent : %d\n" ,exponent);
657
658 if (exponent < expmin) { // value should be >= 0.5 * 2^expmin
659 exponent = expmin;
660 significand = 0.5; // min value that can be recorded
661 }
662 if (exponent > expmax) { // value should be < 0.5 * 2^(expmax+1)
663 exponent = expmax;
664 significand = 1.0; // max value that can be recorded
665 }
666 if (significand == 0) {// in that case exponent == 0 too
667 exponent = expmin;
668 significand = 0.5; // min value that can be recorded
669 }
670
671 autocor = (unsigned short int) ((significand*2-1)*rangesig + 0.5); // shift and cast into a 16-bit unsigned int with rounding
672 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
673 tmp_u_short_int = (unsigned short int) (exponent-expmin); // shift and cast into a 16-bit unsigned int
674 // where just the first nbitexp bits are used (0, ..., 2^nbitexp-1)
675 pt_u_short_int = (unsigned short int*) &LFR_BP2_F0[i*30+24]; // affect an unsigned short int pointer with the
676 // adress where the 16-bit word result will be stored
677 *pt_u_short_int = autocor | (tmp_u_short_int << nbitsig); // put the exponent bits (nbitexp) next to the
678 // left place of the significand bits (nbitsig), making
679 // the 16-bit word to be recorded, and record it using the pointer
680 printf("autocor for S33 significand : %d\n",autocor );
681 printf("tmp_u_char for S33 exponent : %d\n",tmp_u_short_int );
682 printf("*pt_u_short_int for S33 significand + exponent: %.3d or %x\n",*pt_u_short_int, *pt_u_short_int);
683 printf("LFR_BP2_F0[i*30+25] : %.3d or %x\n",LFR_BP2_F0[i*30+25], LFR_BP2_F0[i*30+25]);
684 printf("LFR_BP2_F0[i*30+24] : %.3d or %x\n",LFR_BP2_F0[i*30+24], LFR_BP2_F0[i*30+24]);
685 // S44
686 significand = frexpf(compressed_spectral_matrix_f0[i*30+24], &exponent); // 0.5 <= significand < 1
687 // S44 = significand * 2^exponent
688 printf("S44 : %16.8e\n",compressed_spectral_matrix_f0[i*30+24]);
689 printf("significand : %16.8e\n",significand);
690 printf("exponent : %d\n" ,exponent);
691
692 if (exponent < expmin) { // value should be >= 0.5 * 2^expmin
693 exponent = expmin;
694 significand = 0.5; // min value that can be recorded
695 }
696 if (exponent > expmax) { // value should be < 0.5 * 2^(expmax+1)
697 exponent = expmax;
698 significand = 1.0; // max value that can be recorded
699 }
700 if (significand == 0) {// in that case exponent == 0 too
701 exponent = expmin;
702 significand = 0.5; // min value that can be recorded
703 }
704
705 autocor = (unsigned short int) ((significand*2-1)*rangesig + 0.5); // shift and cast into a 16-bit unsigned int with rounding
706 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
707 tmp_u_short_int = (unsigned short int) (exponent-expmin); // shift and cast into a 16-bit unsigned int
708 // where just the first nbitexp bits are used (0, ..., 2^nbitexp-1)
709 pt_u_short_int = (unsigned short int*) &LFR_BP2_F0[i*30+22]; // affect an unsigned short int pointer with the
710 // adress where the 16-bit word result will be stored
711 *pt_u_short_int = autocor | (tmp_u_short_int << nbitsig); // put the exponent bits (nbitexp) next to the
712 // left place of the significand bits (nbitsig), making
713 // the 16-bit word to be recorded, and record it using the pointer
714 printf("autocor for S44 significand : %d\n",autocor );
715 printf("tmp_u_char for S44 exponent : %d\n",tmp_u_short_int );
716 printf("*pt_u_short_int for S44 significand + exponent: %.3d or %x\n",*pt_u_short_int, *pt_u_short_int);
717 printf("LFR_BP2_F0[i*30+23] : %.3d or %x\n",LFR_BP2_F0[i*30+23], LFR_BP2_F0[i*30+23]);
718 printf("LFR_BP2_F0[i*30+22] : %.3d or %x\n",LFR_BP2_F0[i*30+22], LFR_BP2_F0[i*30+22]);
719 // S55
720 significand = frexpf(compressed_spectral_matrix_f0[i*30+28], &exponent); // 0.5 <= significand < 1
721 // S55 = significand * 2^exponent
722 printf("S55 : %16.8e\n",compressed_spectral_matrix_f0[i*30+28]);
723 printf("significand : %16.8e\n",significand);
724 printf("exponent : %d\n" ,exponent);
725
726 if (exponent < expmin) { // value should be >= 0.5 * 2^expmin
727 exponent = expmin;
728 significand = 0.5; // min value that can be recorded
729 }
730 if (exponent > expmax) { // value should be < 0.5 * 2^(expmax+1)
731 exponent = expmax;
732 significand = 1.0; // max value that can be recorded
733 }
734 if (significand == 0) {// in that case exponent == 0 too
735 exponent = expmin;
736 significand = 0.5; // min value that can be recorded
737 }
738
739 autocor = (unsigned short int) ((significand*2-1)*rangesig + 0.5); // shift and cast into a 16-bit unsigned int with rounding
740 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
741 tmp_u_short_int = (unsigned short int) (exponent-expmin); // shift and cast into a 16-bit unsigned int
742 // where just the first nbitexp bits are used (0, ..., 2^nbitexp-1)
743 pt_u_short_int = (unsigned short int*) &LFR_BP2_F0[i*30+20]; // affect an unsigned short int pointer with the
744 // adress where the 16-bit word result will be stored
745 *pt_u_short_int = autocor | (tmp_u_short_int << nbitsig); // put the exponent bits (nbitexp) next to the
746 // left place of the significand bits (nbitsig), making
747 // the 16-bit word to be recorded, and record it using the pointer
748 printf("autocor for S55 significand : %d\n",autocor );
749 printf("tmp_u_char for S55 exponent : %d\n",tmp_u_short_int );
750 printf("*pt_u_short_int for S55 significand + exponent: %.3d or %x\n",*pt_u_short_int, *pt_u_short_int);
751 printf("LFR_BP2_F0[i*30+21] : %.3d or %x\n",LFR_BP2_F0[i*30+21], LFR_BP2_F0[i*30+21]);
752 printf("LFR_BP2_F0[i*30+20] : %.3d or %x\n",LFR_BP2_F0[i*30+20], LFR_BP2_F0[i*30+20]);
753
754 }
755 }
756
@@ -0,0 +1,29
1 #ifndef BASIC_PARAMETERS_H_INCLUDED
2 #define BASIC_PARAMETERS_H_INCLUDED
3
4 #define LPP_SPECTRAL_MATRIX_CTRL 0x80000700
5 #define LPP_SPECTRAL_MATRIX_1 0x80000704
6 #define LPP_SPECTRAL_MATRIX_2 0x80000708
7
8 #define NB_BINS_SPECTRAL_MATRIX 128
9 #define NB_VALUES_PER_SPECTRAL_MATRIX 30
10 #define TOTAL_SIZE_SPECTRAL_MATRIX NB_BINS_SPECTRAL_MATRIX * NB_VALUES_PER_SPECTRAL_MATRIX
11 #define NB_BINS_COMPRESSED_MATRIX_f0 2
12 #define SIZE_COMPRESSED_SPECTRAL_MATRIX_f1 13
13 #define SIZE_COMPRESSED_SPECTRAL_MATRIX_f2 12
14 #define TOTAL_SIZE_COMPRESSED_MATRIX_f0 NB_BINS_COMPRESSED_MATRIX_f0 * NB_VALUES_PER_SPECTRAL_MATRIX
15 #define NB_AVERAGE_NORMAL_f0 4
16
17 volatile int spectral_matrix_f0_a[TOTAL_SIZE_SPECTRAL_MATRIX];
18 volatile int spectral_matrix_f0_b[TOTAL_SIZE_SPECTRAL_MATRIX];
19 int averaged_spectral_matrix_f0[TOTAL_SIZE_SPECTRAL_MATRIX];
20
21 float compressed_spectral_matrix_f0[TOTAL_SIZE_COMPRESSED_MATRIX_f0];
22
23 unsigned char LFR_BP1_F0[NB_BINS_COMPRESSED_MATRIX_f0*9];
24 unsigned char LFR_BP2_F0[NB_BINS_COMPRESSED_MATRIX_f0*30];
25
26 void BP1_set();
27 void BP2_set();
28
29 #endif // BASIC_PARAMETERS_H_INCLUDED
@@ -0,0 +1,25
1 #include <file_utilities.h>
2
3 int lecture_file_sm()
4 {
5 unsigned int i;
6
7 FILE *infile;
8 infile = fopen("sm_test1.dat", "rb"); // open explicitely a binary file !!! ...
9 if(infile == NULL) {
10 printf("Hello I cannot open the file!\n");
11 return 0;
12 }
13 (void) fread(compressed_spectral_matrix_f0, sizeof(compressed_spectral_matrix_f0), 1, infile);
14 (void) fclose(infile);
15 //printf("size of compressed_spectral_matrix_f0 : %d\n", sizeof(compressed_spectral_matrix_f0));
16 printf("compressed_spectral_matrix_f0 : \n");
17 for (i = 0; i < 15; i++) {
18 printf("Element number %.2d (%.2d & %.2d) => Re:%16.8e Im:%16.8e\n", i+1, 2*i, 2*i+1,
19 compressed_spectral_matrix_f0[2*i],
20 compressed_spectral_matrix_f0[2*i+1]);
21 }
22
23 return 0;
24 }
25
@@ -0,0 +1,13
1 #ifndef FILE_UTILITIES_H
2 #define FILE_UTILITIES_H
3
4 #include <stdio.h>
5 #include <basic_parameters_1_ICD_issue1rev6.h>
6
7 extern float compressed_spectral_matrix_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ];
8 extern unsigned char LFR_BP1_F0[ ];
9 extern unsigned char LFR_BP2_F0[ ];
10
11 int lecture_file_sm();
12
13 #endif // FILE_UTILITIES_H
@@ -0,0 +1,40
1 #include <stdio.h>
2 #include <malloc.h>
3 #include <basic_parameters_1_ICD_issue1rev6.h>
4 #include <file_utilities.h>
5
6 float compressed_spectral_matrix_f0[TOTAL_SIZE_COMPRESSED_MATRIX_f0];
7
8 unsigned char LFR_BP1_F0[NB_BINS_COMPRESSED_MATRIX_f0*9];
9 unsigned char LFR_BP2_F0[NB_BINS_COMPRESSED_MATRIX_f0*30];
10
11 int main(void)
12 {
13 printf("Hello World!\n");
14
15 lecture_file_sm();
16
17 BP1_set();
18
19 BP2_set();
20
21 return 0;
22 }
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
@@ -0,0 +1,11
1 # --------------------------------------------------------
2 # MISSION NAME : LFR/RPW/SO
3 # DATA NAME : test matrix
4 # NB_TOTAL_VALUES : 60
5 # NB_COMPONENTS : 30
6 # FORMAT : (60(e16.8))
7 # UNIT : floating
8 # --------------------------------------------------------
9 # BEGIN DATA
10 1.00200234e+004 0.00000000e+000-8.89210144e+002 1.14001392e+003-5.19522591e+001 4.09957178e+003 5.89932617e+002-8.61112012e+003 8.60225684e+003-7.61522522e+002 3.59796326e+002 0.00000000e+000 4.94544861e+002-4.77043762e+002-1.08253699e+003 5.83120300e+002-8.45693970e+002-1.06855054e+003 1.77511353e+003 0.00000000e+000-3.44424780e+003-2.54208740e+002-2.31431686e+002-3.53662280e+003 7.53777246e+003 0.00000000e+000 1.27810120e+003 7.40368945e+003 7.60701318e+003 0.00000000e+000 1.00200234e+004 0.00000000e+000-8.89210144e+002 1.14001392e+003-5.19522591e+001 4.09957178e+003 5.89932617e+002-8.61112012e+003 8.60225684e+003-7.61522522e+002 3.59796326e+002 0.00000000e+000 4.94544861e+002-4.77043762e+002-1.08253699e+003 5.83120300e+002-8.45693970e+002-1.06855054e+003 1.77511353e+003 0.00000000e+000-3.44424780e+003-2.54208740e+002-2.31431686e+002-3.53662280e+003 7.53777246e+003 0.00000000e+000 1.27810120e+003 7.40368945e+003 7.60701318e+003 0.00000000e+000
11 # END DATA
@@ -0,0 +1,16
1 TEMPLATE = app
2 CONFIG += console
3 CONFIG -= app_bundle
4 CONFIG -= qt
5
6 DEFINES += DEBUG_TCH
7
8 SOURCES += main.c \
9 basic_parameters_1_ICD_issue1rev6.c \
10 file_utilities.c
11
12 HEADERS += \
13 file_utilities.h \
14 basic_parameters_1_ICD_issue1rev6.h
15
16
@@ -0,0 +1,17
1 TEMPLATE = app
2 CONFIG += console
3 CONFIG -= app_bundle
4 CONFIG -= qt
5
6 #
7 DEFINES += DEBUG_TCH
8
9 SOURCES += main.c \
10 basic_parameters_1_ICD_issue1rev6.c \
11 file_utilities.c
12
13 HEADERS += \
14 file_utilities.h \
15 basic_parameters_1_ICD_issue1rev6.h
16
17
@@ -0,0 +1,243
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 2.7.0, 2013-07-29T08:50:35. -->
4 <qtcreator>
5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
7 <value type="int">0</value>
8 </data>
9 <data>
10 <variable>ProjectExplorer.Project.EditorSettings</variable>
11 <valuemap type="QVariantMap">
12 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
13 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
14 <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
15 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
16 <value type="QByteArray" key="language">Cpp</value>
17 <valuemap type="QVariantMap" key="value">
18 <value type="QString" key="CurrentPreferences">CppGlobal</value>
19 </valuemap>
20 </valuemap>
21 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
22 <value type="QByteArray" key="language">QmlJS</value>
23 <valuemap type="QVariantMap" key="value">
24 <value type="QString" key="CurrentPreferences">QmlJSGlobal</value>
25 </valuemap>
26 </valuemap>
27 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
28 <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
29 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
30 <value type="int" key="EditorConfiguration.IndentSize">4</value>
31 <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
32 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
33 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
34 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
35 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
36 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
37 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
38 <value type="int" key="EditorConfiguration.TabSize">8</value>
39 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
40 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
41 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
42 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
43 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
44 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
45 </valuemap>
46 </data>
47 <data>
48 <variable>ProjectExplorer.Project.PluginSettings</variable>
49 <valuemap type="QVariantMap"/>
50 </data>
51 <data>
52 <variable>ProjectExplorer.Project.Target.0</variable>
53 <valuemap type="QVariantMap">
54 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
55 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
56 <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">{721f5504-08a0-4593-9998-142c3ead3c68}</value>
57 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
58 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
59 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
60 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
61 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
62 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
63 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
64 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
65 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
66 <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
67 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
68 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
69 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
70 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
71 </valuemap>
72 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
73 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
74 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
75 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
76 <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
77 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
78 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
79 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
80 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
81 </valuemap>
82 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
83 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Compiler</value>
84 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
85 <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
86 </valuemap>
87 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
88 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
89 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
90 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
91 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
92 <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
93 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
94 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
95 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
96 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
97 </valuemap>
98 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
99 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Nettoyer</value>
100 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
101 <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
102 </valuemap>
103 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
104 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
105 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
106 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
107 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
108 <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
109 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
110 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">C:/Documents and Settings/chust/DD CHUST/Missions/Solar Orbiter/LFR/Prog C/tests bp Paul/build-tests1-Desktop-Debug</value>
111 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
112 </valuemap>
113 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
114 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
115 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
116 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
117 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
118 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
119 <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
120 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
121 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
122 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
123 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
124 </valuemap>
125 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
126 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
127 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
128 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
129 <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
130 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
131 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
132 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
133 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
134 </valuemap>
135 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
136 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Compiler</value>
137 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
138 <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
139 </valuemap>
140 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
141 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
142 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
143 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
144 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
145 <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
146 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
147 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
148 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
149 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
150 </valuemap>
151 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
152 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Nettoyer</value>
153 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
154 <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
155 </valuemap>
156 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
157 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
158 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
159 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
160 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
161 <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
162 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
163 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">C:/Documents and Settings/chust/DD CHUST/Missions/Solar Orbiter/LFR/Prog C/tests bp Paul/build-tests1-Desktop-Release</value>
164 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
165 </valuemap>
166 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
167 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
168 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
169 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
170 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">DΓ©ploiement</value>
171 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
172 <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
173 </valuemap>
174 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
175 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">DΓ©ployer localement</value>
176 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
177 <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
178 </valuemap>
179 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
180 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
181 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
182 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
183 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
184 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
185 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
186 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
187 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
188 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
189 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
190 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
191 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
192 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
193 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
194 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
195 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
196 <value type="int">0</value>
197 <value type="int">1</value>
198 <value type="int">2</value>
199 <value type="int">3</value>
200 <value type="int">4</value>
201 <value type="int">5</value>
202 <value type="int">6</value>
203 <value type="int">7</value>
204 <value type="int">8</value>
205 <value type="int">9</value>
206 <value type="int">10</value>
207 <value type="int">11</value>
208 <value type="int">12</value>
209 <value type="int">13</value>
210 <value type="int">14</value>
211 </valuelist>
212 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">tests1</value>
213 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
214 <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Documents and Settings/chust/DD CHUST/Missions/Solar Orbiter/LFR/Prog C/tests bp Paul/tests1/tests1.pro</value>
215 <value type="int" key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase">2</value>
216 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
217 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">tests1.pro</value>
218 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
219 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
220 <valuelist type="QVariantList" key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges"/>
221 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory">C:/Documents and Settings/chust/DD CHUST/Missions/Solar Orbiter/LFR/Prog C/tests bp Paul/tests1</value>
222 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
223 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
224 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
225 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
226 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
227 </valuemap>
228 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
229 </valuemap>
230 </data>
231 <data>
232 <variable>ProjectExplorer.Project.TargetCount</variable>
233 <value type="int">1</value>
234 </data>
235 <data>
236 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
237 <value type="QString">{9bfc8a8c-2fd7-44ce-982a-ffe56dd5e5fa}</value>
238 </data>
239 <data>
240 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
241 <value type="int">12</value>
242 </data>
243 </qtcreator>
General Comments 0
You need to be logged in to leave comments. Login now