@@ -0,0 +1,20 | |||
|
1 | TEMPLATE = app | |
|
2 | CONFIG += console | |
|
3 | CONFIG -= app_bundle | |
|
4 | CONFIG -= qt | |
|
5 | ||
|
6 | DEFINES += DEBUG_TCH | |
|
7 | DEFINES += LSB_FIRST_TCH # PC convention | |
|
8 | #DEFINES += MSB_FIRST_TCH # SPARC convention | |
|
9 | ||
|
10 | SOURCES += main.c \ | |
|
11 | basic_parameters.c \ | |
|
12 | file_utilities.c | |
|
13 | ||
|
14 | HEADERS += \ | |
|
15 | basic_parameters.h \ | |
|
16 | basic_parameters_params.h \ | |
|
17 | basic_parameters_utilities.h \ | |
|
18 | file_utilities.h | |
|
19 | ||
|
20 |
@@ -6,52 +6,48 | |||
|
6 | 6 | // version 1.4: 16/05/2014 |
|
7 | 7 | // version 1.5: 20/05/2014 |
|
8 | 8 | // version 1.6: 19/12/2014 |
|
9 | // version 1.7: 15/01/2015 (modifs de Paul + correction erreurs qui se compensaient (LSB <=> MSB + indices [0,2] <=> [1,3]) | |
|
10 | ||
|
9 | 11 | |
|
10 | 12 | #include <stdint.h> |
|
11 | ||
|
12 | 13 | #include "basic_parameters_params.h" |
|
13 | 14 | |
|
14 |
void init_k_coefficients( |
|
|
15 | float *k_coefficients_f1, \ | |
|
16 | float *k_coefficients_f2 ) | |
|
15 | void init_k_coefficients(float *k_coefficients, | |
|
16 | unsigned char nb_binscompressed_matrix ) | |
|
17 | 17 | { |
|
18 |
uint16_t i; |
|
|
19 | ||
|
20 | for(i=0; i<NB_BINS_COMPRESSED_MATRIX_f0; i++){ | |
|
21 |
k_coefficients |
|
|
22 |
k_coefficients |
|
|
23 |
k_coefficients |
|
|
24 |
k_coefficients |
|
|
25 | ||
|
26 |
k_coefficients |
|
|
27 |
k_coefficients |
|
|
28 |
k_coefficients |
|
|
29 |
k_coefficients |
|
|
30 |
k_coefficients |
|
|
31 |
k_coefficients |
|
|
32 |
k_coefficients |
|
|
33 |
k_coefficients |
|
|
34 |
k_coefficients |
|
|
35 |
k_coefficients |
|
|
36 |
k_coefficients |
|
|
37 |
k_coefficients |
|
|
38 | ||
|
39 |
k_coefficients |
|
|
40 |
k_coefficients |
|
|
41 |
k_coefficients |
|
|
42 |
k_coefficients |
|
|
43 |
k_coefficients |
|
|
44 |
k_coefficients |
|
|
45 |
k_coefficients |
|
|
46 |
k_coefficients |
|
|
47 | ||
|
48 |
k_coefficients |
|
|
49 |
k_coefficients |
|
|
50 |
k_coefficients |
|
|
51 |
k_coefficients |
|
|
52 | k_coefficients_f0[i*NB_K_COEFF_PER_BIN+K34_NZ_RE] = 1; | |
|
53 | k_coefficients_f0[i*NB_K_COEFF_PER_BIN+K34_NZ_IM] = 1; | |
|
54 | k_coefficients_f0[i*NB_K_COEFF_PER_BIN+K35_NZ_RE] = 1; | |
|
55 | k_coefficients_f0[i*NB_K_COEFF_PER_BIN+K35_NZ_IM] = 1; | |
|
18 | uint16_t i; // 16 bits unsigned | |
|
19 | for(i=0; i<nb_binscompressed_matrix; i++){ | |
|
20 | k_coefficients[i*NB_K_COEFF_PER_BIN+K44_PE] = 1; | |
|
21 | k_coefficients[i*NB_K_COEFF_PER_BIN+K55_PE] = 1; | |
|
22 | k_coefficients[i*NB_K_COEFF_PER_BIN+K45_PE_RE] = 1; | |
|
23 | k_coefficients[i*NB_K_COEFF_PER_BIN+K45_PE_IM] = 1; | |
|
24 | k_coefficients[i*NB_K_COEFF_PER_BIN+K14_SX_RE] = 1; | |
|
25 | k_coefficients[i*NB_K_COEFF_PER_BIN+K14_SX_IM] = 1; | |
|
26 | k_coefficients[i*NB_K_COEFF_PER_BIN+K15_SX_RE] = 1; | |
|
27 | k_coefficients[i*NB_K_COEFF_PER_BIN+K15_SX_IM] = 1; | |
|
28 | k_coefficients[i*NB_K_COEFF_PER_BIN+K24_SX_RE] = 1; | |
|
29 | k_coefficients[i*NB_K_COEFF_PER_BIN+K24_SX_IM] = 1; | |
|
30 | k_coefficients[i*NB_K_COEFF_PER_BIN+K25_SX_RE] = 1; | |
|
31 | k_coefficients[i*NB_K_COEFF_PER_BIN+K25_SX_IM] = 1; | |
|
32 | k_coefficients[i*NB_K_COEFF_PER_BIN+K34_SX_RE] = 1; | |
|
33 | k_coefficients[i*NB_K_COEFF_PER_BIN+K34_SX_IM] = 1; | |
|
34 | k_coefficients[i*NB_K_COEFF_PER_BIN+K35_SX_RE] = 1; | |
|
35 | k_coefficients[i*NB_K_COEFF_PER_BIN+K35_SX_IM] = 1; | |
|
36 | k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NY_RE] = 1; | |
|
37 | k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NY_IM] = 1; | |
|
38 | k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NY_RE] = 1; | |
|
39 | k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NY_IM] = 1; | |
|
40 | k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NY_RE] = 1; | |
|
41 | k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NY_IM] = 1; | |
|
42 | k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NY_RE] = 1; | |
|
43 | k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NY_IM] = 1; | |
|
44 | k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NZ_RE] = 1; | |
|
45 | k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NZ_IM] = 1; | |
|
46 | k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NZ_RE] = 1; | |
|
47 | k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NZ_IM] = 1; | |
|
48 | k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NZ_RE] = 1; | |
|
49 | k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NZ_IM] = 1; | |
|
50 | k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NZ_RE] = 1; | |
|
51 | k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NZ_IM] = 1; | |
|
56 | 52 | } |
|
57 | 53 | } |
@@ -6,6 +6,7 | |||
|
6 | 6 | // version 1.4: 16/05/2014 |
|
7 | 7 | // version 1.5: 20/05/2014 |
|
8 | 8 | // version 1.6: 19/12/2014 |
|
9 | // version 1.7: 15/01/2015 (modifs de Paul + correction erreurs qui se compensaient (LSB <=> MSB + indices [0,2] <=> [1,3]) | |
|
9 | 10 | |
|
10 | 11 | #ifndef BASIC_PARAMETERS_H_INCLUDED |
|
11 | 12 | #define BASIC_PARAMETERS_H_INCLUDED |
@@ -19,7 +20,7 | |||
|
19 | 20 | static inline void BP1_set(float * compressed_spec_mat, float * k_coeff_intercalib, unsigned char nb_bins_compressed_spec_mat, unsigned char * lfr_bp1); |
|
20 | 21 | static inline void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * lfr_bp2); |
|
21 | 22 | |
|
22 | void init_k_coefficients( float *k_coefficients_f0, float *k_coefficients_f1, float *k_coefficients_f2 ); | |
|
23 | void init_k_coefficients( float *k_coefficients_f0, unsigned char nb_binscompressed_matrix ); | |
|
23 | 24 | |
|
24 | 25 | //*********************************** |
|
25 | 26 | // STATIC INLINE FUNCTION DEFINITIONS |
@@ -109,13 +110,13 void BP1_set( float * compressed_spec_ma | |||
|
109 | 110 | // left place of the significand bits (nbitsig), |
|
110 | 111 | // making the 16-bit word to be recorded |
|
111 | 112 | pt_uint8 = (uint8_t*) &tmp_uint16; // Affect an uint8_t pointer with the adress of tmp_uint16 |
|
112 |
#ifdef |
|
|
113 |
lfr_bp1[i*NB_BYTES_BP1+2] = pt_uint8[0]; // Record |
|
|
114 |
lfr_bp1[i*NB_BYTES_BP1+3] = pt_uint8[1]; // Record |
|
|
113 | #ifdef MSB_FIRST_TCH | |
|
114 | lfr_bp1[i*NB_BYTES_BP1+2] = pt_uint8[0]; // Record MSB of tmp_uint16 | |
|
115 | lfr_bp1[i*NB_BYTES_BP1+3] = pt_uint8[1]; // Record LSB of tmp_uint16 | |
|
115 | 116 | #endif |
|
116 |
#ifdef |
|
|
117 |
lfr_bp1[i*NB_BYTES_BP1+2] = pt_uint8[1]; // Record |
|
|
118 |
lfr_bp1[i*NB_BYTES_BP1+3] = pt_uint8[0]; // Record |
|
|
117 | #ifdef LSB_FIRST_TCH | |
|
118 | lfr_bp1[i*NB_BYTES_BP1+2] = pt_uint8[1]; // Record MSB of tmp_uint16 | |
|
119 | lfr_bp1[i*NB_BYTES_BP1+3] = pt_uint8[0]; // Record LSB of tmp_uint16 | |
|
119 | 120 | #endif |
|
120 | 121 | #ifdef DEBUG_TCH |
|
121 | 122 | printf("\nBin number: %d\n", i); |
@@ -162,13 +163,13 void BP1_set( float * compressed_spec_ma | |||
|
162 | 163 | // left place of the significand bits (nbitsig), |
|
163 | 164 | // making the 16-bit word to be recorded |
|
164 | 165 | pt_uint8 = (uint8_t*) &tmp_uint16; // Affect an uint8_t pointer with the adress of tmp_uint16 |
|
165 |
#ifdef |
|
|
166 |
lfr_bp1[i*NB_BYTES_BP1+0] = pt_uint8[0]; // Record |
|
|
167 |
lfr_bp1[i*NB_BYTES_BP1+1] = pt_uint8[1]; // Record |
|
|
166 | #ifdef MSB_FIRST_TCH | |
|
167 | lfr_bp1[i*NB_BYTES_BP1+0] = pt_uint8[0]; // Record MSB of tmp_uint16 | |
|
168 | lfr_bp1[i*NB_BYTES_BP1+1] = pt_uint8[1]; // Record LSB of tmp_uint16 | |
|
168 | 169 | #endif |
|
169 |
#ifdef |
|
|
170 |
lfr_bp1[i*NB_BYTES_BP1+0] = pt_uint8[1]; // Record |
|
|
171 |
lfr_bp1[i*NB_BYTES_BP1+1] = pt_uint8[0]; // Record |
|
|
170 | #ifdef LSB_FIRST_TCH | |
|
171 | lfr_bp1[i*NB_BYTES_BP1+0] = pt_uint8[1]; // Record MSB of tmp_uint16 | |
|
172 | lfr_bp1[i*NB_BYTES_BP1+1] = pt_uint8[0]; // Record LSB of tmp_uint16 | |
|
172 | 173 | #endif |
|
173 | 174 | #ifdef DEBUG_TCH |
|
174 | 175 | printf("Bin number: %d\n", i); |
@@ -202,7 +203,7 void BP1_set( float * compressed_spec_ma | |||
|
202 | 203 | // Record it at the 8th bit position (from the right to the left) of lfr_bp1[i*NB_BYTES_BP1+6] |
|
203 | 204 | #endif |
|
204 | 205 | #ifdef MSB_FIRST_TCH |
|
205 |
lfr_bp1[i*NB_BYTES_BP1+6] = pt_uint8[0] & 0x80; // Extract the sign bit of NVEC_V2 (32-bit float, sign bit in the |
|
|
206 | lfr_bp1[i*NB_BYTES_BP1+6] = pt_uint8[0] & 0x80; // Extract the sign bit of NVEC_V2 (32-bit float, sign bit in the 1th octet:SPARC convention) | |
|
206 | 207 | // Record it at the 8th bit position (from the right to the left) of lfr_bp1[i*NB_BYTES_BP1+6] |
|
207 | 208 | #endif |
|
208 | 209 | #ifdef DEBUG_TCH |
@@ -285,15 +286,15 void BP1_set( float * compressed_spec_ma | |||
|
285 | 286 | #endif |
|
286 | 287 | pt_uint8 = (uint8_t*) &e_cross_b_re; // Affect an uint8_t pointer with the adress of e_cross_b_re |
|
287 | 288 | #ifdef LSB_FIRST_TCH |
|
288 |
lfr_bp1[i*NB_BYTES_BP1+ |
|
|
289 | lfr_bp1[i*NB_BYTES_BP1+0] = lfr_bp1[i*NB_BYTES_BP1+0] | (pt_uint8[3] & 0x80); // Extract its sign bit (32-bit float, sign bit in the 4th octet:PC convention) | |
|
289 | 290 | // Record it at the 8th bit position (from the right to the left) |
|
290 |
// of lfr_bp1[i*NB_BYTES_BP1+ |
|
|
291 | // of lfr_bp1[i*NB_BYTES_BP1+0] | |
|
291 | 292 | pt_uint8[3] = (pt_uint8[3] & 0x7f); // Make e_cross_b_re be positive in any case: |ReaSX| |
|
292 | 293 | #endif |
|
293 | 294 | #ifdef MSB_FIRST_TCH |
|
294 |
lfr_bp1[i*NB_BYTES_BP1+ |
|
|
295 | lfr_bp1[i*NB_BYTES_BP1+0] = lfr_bp1[i*NB_BYTES_BP1+0] | (pt_uint8[0] & 0x80); // Extract its sign bit (32-bit float, sign bit in the 1th octet:SPARC convention) | |
|
295 | 296 | // Record it at the 8th bit position (from the right to the left) |
|
296 |
// of lfr_bp1[i*NB_BYTES_BP1+ |
|
|
297 | // of lfr_bp1[i*NB_BYTES_BP1+0] | |
|
297 | 298 | pt_uint8[0] = (pt_uint8[0] & 0x7f); // Make e_cross_b_re be positive in any case: |ReaSX| |
|
298 | 299 | #endif |
|
299 | 300 | significand = frexpf(e_cross_b_re/2, &exponent); // 0.5 <= significand < 1 |
@@ -329,24 +330,24 void BP1_set( float * compressed_spec_ma | |||
|
329 | 330 | // with lfr_bp1[i*NB_BYTES_BP1+7] |
|
330 | 331 | #ifdef DEBUG_TCH |
|
331 | 332 | printf("lfr_bp1[i*NB_BYTES_BP1+7] for ReaSX exponent + significand : %u\n",lfr_bp1[i*NB_BYTES_BP1+7]); |
|
332 |
printf("lfr_bp1[i*NB_BYTES_BP1+ |
|
|
333 | printf("lfr_bp1[i*NB_BYTES_BP1+0] for ReaSX sign + PSDE 'exponent' : %u\n",lfr_bp1[i*NB_BYTES_BP1+0]); | |
|
333 | 334 | printf("ImaSX / 2 : %16.8e\n",e_cross_b_im/2); |
|
334 | 335 | #endif |
|
335 | 336 | pt_uint8 = (uint8_t*) &e_cross_b_im; // Affect an uint8_t pointer with the adress of e_cross_b_im |
|
336 | 337 | #ifdef LSB_FIRST_TCH |
|
337 | pt_uint8[3] = pt_uint8[3] & 0x7f; // Make e_cross_b_im be positive in any case: |ImaSX| | |
|
338 | pt_uint8[3] = pt_uint8[3] & 0x7f; // Make e_cross_b_im be positive in any case: |ImaSX| (32-bit float, sign bit in the 4th octet:PC convention) | |
|
338 | 339 | #endif |
|
339 | 340 | #ifdef MSB_FIRST_TCH |
|
340 | pt_uint8[0] = pt_uint8[0] & 0x7f; // Make e_cross_b_im be positive in any case: |ImaSX| | |
|
341 | pt_uint8[0] = pt_uint8[0] & 0x7f; // Make e_cross_b_im be positive in any case: |ImaSX| (32-bit float, sign bit in the 1th octet:SPARC convention) | |
|
341 | 342 | #endif |
|
342 | 343 | tmp_uint8 = (e_cross_b_im > e_cross_b_re) ? 0x40 : 0x00; // Determine the sector argument of SX. If |Im| > |Re| affect |
|
343 | 344 | // an unsigned 8-bit char with 01000000; otherwise with null. |
|
344 |
lfr_bp1[i*NB_BYTES_BP1+ |
|
|
345 |
// to the left) of lfr_bp1[i*NB_BYTES_BP1+ |
|
|
345 | lfr_bp1[i*NB_BYTES_BP1+0] = lfr_bp1[i*NB_BYTES_BP1+0] | tmp_uint8; // Record it as a sign bit at the 7th bit position (from the right | |
|
346 | // to the left) of lfr_bp1[i*NB_BYTES_BP1+0], by simple logical addition. | |
|
346 | 347 | #ifdef DEBUG_TCH |
|
347 | 348 | printf("|ImaSX| / 2 : %16.8e\n",e_cross_b_im/2); |
|
348 | 349 | printf("ArgSX sign : %u\n",tmp_uint8); |
|
349 |
printf("lfr_bp1[i*NB_BYTES_BP1+ |
|
|
350 | printf("lfr_bp1[i*NB_BYTES_BP1+0] for ReaSX & ArgSX signs + PSDE 'exponent' : %u\n",lfr_bp1[i*NB_BYTES_BP1+0]); | |
|
350 | 351 | #endif |
|
351 | 352 | //====================================================================== |
|
352 | 353 | // BP1 phase velocity estimator == PA_LFR_SC_BP1_VPHI_F0 == 8 (+ 2) bits |
@@ -399,15 +400,15 void BP1_set( float * compressed_spec_ma | |||
|
399 | 400 | // vphi = n_cross_e_scal_b_re / bx_bx_star => sign(VPHI) = sign(n_cross_e_scal_b_re) |
|
400 | 401 | pt_uint8 = (uint8_t*) &n_cross_e_scal_b_re; // Affect an uint8_t pointer with the adress of n_cross_e_scal_b_re |
|
401 | 402 | #ifdef LSB_FIRST_TCH |
|
402 |
lfr_bp1[i*NB_BYTES_BP1+ |
|
|
403 | lfr_bp1[i*NB_BYTES_BP1+2] = lfr_bp1[i*NB_BYTES_BP1+2] | (pt_uint8[3] & 0x80); // Extract its sign bit (32-bit float, sign bit in the 4th octet:PC convention) | |
|
403 | 404 | // Record it at the 8th bit position (from the right to the left) |
|
404 |
// of lfr_bp1[i*NB_BYTES_BP1+ |
|
|
405 | // of lfr_bp1[i*NB_BYTES_BP1+2] | |
|
405 | 406 | pt_uint8[3] = (pt_uint8[3] & 0x7f); // Make n_cross_e_scal_b_re be positive in any case: |n_cross_e_scal_b_re| |
|
406 | 407 | #endif |
|
407 | 408 | #ifdef MSB_FIRST_TCH |
|
408 |
lfr_bp1[i*NB_BYTES_BP1+ |
|
|
409 | lfr_bp1[i*NB_BYTES_BP1+2] = lfr_bp1[i*NB_BYTES_BP1+2] | (pt_uint8[0] & 0x80); // Extract its sign bit (32-bit float, sign bit in the 1th octet:SPARC convention) | |
|
409 | 410 | // Record it at the 8th bit position (from the right to the left) |
|
410 |
// of lfr_bp1[i*NB_BYTES_BP1+ |
|
|
411 | // of lfr_bp1[i*NB_BYTES_BP1+2] | |
|
411 | 412 | pt_uint8[0] = (pt_uint8[0] & 0x7f); // Make n_cross_e_scal_b_re be positive in any case: |n_cross_e_scal_b_re| |
|
412 | 413 | #endif |
|
413 | 414 | vphi = n_cross_e_scal_b_re / bx_bx_star; // Compute |VPHI| |
@@ -446,24 +447,24 void BP1_set( float * compressed_spec_ma | |||
|
446 | 447 | // with lfr_bp1[i*NB_BYTES_BP1+8] |
|
447 | 448 | #ifdef DEBUG_TCH |
|
448 | 449 | printf("lfr_bp1[i*NB_BYTES_BP1+8] for VPHI exponent + significand : %u\n",lfr_bp1[i*NB_BYTES_BP1+8]); |
|
449 |
printf("lfr_bp1[i*NB_BYTES_BP1+ |
|
|
450 | printf("lfr_bp1[i*NB_BYTES_BP1+2] for VPHI sign + PSDB 'exponent' : %u\n",lfr_bp1[i*NB_BYTES_BP1+2]); | |
|
450 | 451 | #endif |
|
451 | 452 | pt_uint8 = (uint8_t*) &n_cross_e_scal_b_im; // Affect an uint8_t pointer with the adress of n_cross_e_scal_b_im |
|
452 | 453 | #ifdef LSB_FIRST_TCH |
|
453 | pt_uint8[3] = pt_uint8[3] & 0x7f; // Make n_cross_e_scal_b_im be positive in any case: |ImaSX| | |
|
454 | pt_uint8[3] = pt_uint8[3] & 0x7f; // Make n_cross_e_scal_b_im be positive in any case: |ImaSX| (32-bit float, sign bit in the 4th octet:PC convention) | |
|
454 | 455 | #endif |
|
455 | 456 | #ifdef MSB_FIRST_TCH |
|
456 | pt_uint8[0] = pt_uint8[0] & 0x7f; // Make n_cross_e_scal_b_im be positive in any case: |ImaSX| | |
|
457 | pt_uint8[0] = pt_uint8[0] & 0x7f; // Make n_cross_e_scal_b_im be positive in any case: |ImaSX| (32-bit float, sign bit in the 1th octet:SPARC convention) | |
|
457 | 458 | #endif |
|
458 | 459 | tmp_uint8 = (n_cross_e_scal_b_im > n_cross_e_scal_b_re) ? 0x40 : 0x00; // Determine the sector argument of SX. If |Im| > |Re| affect |
|
459 | 460 | // an unsigned 8-bit char with 01000000; otherwise with null. |
|
460 |
lfr_bp1[i*NB_BYTES_BP1+ |
|
|
461 | lfr_bp1[i*NB_BYTES_BP1+2] = lfr_bp1[i*NB_BYTES_BP1+2] | tmp_uint8; // Record it as a sign bit at the 7th bit position (from the right | |
|
461 | 462 | // to the left) of lfr_bp1[i*NB_BYTES_BP1+3], by simple logical addition. |
|
462 | 463 | #ifdef DEBUG_TCH |
|
463 | 464 | printf("|n_cross_e_scal_b_im| : %16.8e\n",n_cross_e_scal_b_im); |
|
464 | 465 | printf("|n_cross_e_scal_b_im|/bx_bx_star/2: %16.8e\n",n_cross_e_scal_b_im/bx_bx_star/2); |
|
465 | 466 | printf("ArgNEBX sign : %u\n",tmp_uint8); |
|
466 |
printf("lfr_bp1[i*NB_BYTES_BP1+ |
|
|
467 | printf("lfr_bp1[i*NB_BYTES_BP1+2] for VPHI & ArgNEBX signs + PSDB 'exponent' : %u\n",lfr_bp1[i*NB_BYTES_BP1+2]); | |
|
467 | 468 | #endif |
|
468 | 469 | } |
|
469 | 470 | } |
@@ -663,13 +664,13 void BP2_set( float * compressed_spec_ma | |||
|
663 | 664 | // left place of the significand bits (nbitsig), |
|
664 | 665 | // making the 16-bit word to be recorded |
|
665 | 666 | pt_uint8 = (uint8_t*) &tmp_uint16; // Affect an uint8_t pointer with the adress of tmp_uint16 |
|
666 |
#ifdef |
|
|
667 |
lfr_bp2[i*NB_BYTES_BP2+0] = pt_uint8[0]; // Record |
|
|
668 |
lfr_bp2[i*NB_BYTES_BP2+1] = pt_uint8[1]; // Record |
|
|
667 | #ifdef MSB_FIRST_TCH | |
|
668 | lfr_bp2[i*NB_BYTES_BP2+0] = pt_uint8[0]; // Record MSB of tmp_uint16 | |
|
669 | lfr_bp2[i*NB_BYTES_BP2+1] = pt_uint8[1]; // Record LSB of tmp_uint16 | |
|
669 | 670 | #endif |
|
670 |
#ifdef |
|
|
671 |
lfr_bp2[i*NB_BYTES_BP2+0] = pt_uint8[1]; // Record |
|
|
672 |
lfr_bp2[i*NB_BYTES_BP2+1] = pt_uint8[0]; // Record |
|
|
671 | #ifdef LSB_FIRST_TCH | |
|
672 | lfr_bp2[i*NB_BYTES_BP2+0] = pt_uint8[1]; // Record MSB of tmp_uint16 | |
|
673 | lfr_bp2[i*NB_BYTES_BP2+1] = pt_uint8[0]; // Record LSB of tmp_uint16 | |
|
673 | 674 | #endif |
|
674 | 675 | #ifdef DEBUG_TCH |
|
675 | 676 | printf("autocor for S11 significand : %u\n",autocor); |
@@ -708,13 +709,13 void BP2_set( float * compressed_spec_ma | |||
|
708 | 709 | // left place of the significand bits (nbitsig), |
|
709 | 710 | // making the 16-bit word to be recorded |
|
710 | 711 | pt_uint8 = (uint8_t*) &tmp_uint16; // Affect an uint8_t pointer with the adress of tmp_uint16 |
|
711 |
#ifdef |
|
|
712 |
lfr_bp2[i*NB_BYTES_BP2+2] = pt_uint8[0]; // Record |
|
|
713 |
lfr_bp2[i*NB_BYTES_BP2+3] = pt_uint8[1]; // Record |
|
|
712 | #ifdef MSB_FIRST_TCH | |
|
713 | lfr_bp2[i*NB_BYTES_BP2+2] = pt_uint8[0]; // Record MSB of tmp_uint16 | |
|
714 | lfr_bp2[i*NB_BYTES_BP2+3] = pt_uint8[1]; // Record LSB of tmp_uint16 | |
|
714 | 715 | #endif |
|
715 |
#ifdef |
|
|
716 |
lfr_bp2[i*NB_BYTES_BP2+2] = pt_uint8[1]; // Record |
|
|
717 |
lfr_bp2[i*NB_BYTES_BP2+3] = pt_uint8[0]; // Record |
|
|
716 | #ifdef LSB_FIRST_TCH | |
|
717 | lfr_bp2[i*NB_BYTES_BP2+2] = pt_uint8[1]; // Record MSB of tmp_uint16 | |
|
718 | lfr_bp2[i*NB_BYTES_BP2+3] = pt_uint8[0]; // Record LSB of tmp_uint16 | |
|
718 | 719 | #endif |
|
719 | 720 | #ifdef DEBUG_TCH |
|
720 | 721 | printf("autocor for S22 significand : %u\n",autocor); |
@@ -753,13 +754,13 void BP2_set( float * compressed_spec_ma | |||
|
753 | 754 | // left place of the significand bits (nbitsig), |
|
754 | 755 | // making the 16-bit word to be recorded |
|
755 | 756 | pt_uint8 = (uint8_t*) &tmp_uint16; // Affect an uint8_t pointer with the adress of tmp_uint16 |
|
756 |
#ifdef |
|
|
757 |
lfr_bp2[i*NB_BYTES_BP2+4] = pt_uint8[0]; // Record |
|
|
758 |
lfr_bp2[i*NB_BYTES_BP2+5] = pt_uint8[1]; // Record |
|
|
757 | #ifdef MSB_FIRST_TCH | |
|
758 | lfr_bp2[i*NB_BYTES_BP2+4] = pt_uint8[0]; // Record MSB of tmp_uint16 | |
|
759 | lfr_bp2[i*NB_BYTES_BP2+5] = pt_uint8[1]; // Record LSB of tmp_uint16 | |
|
759 | 760 | #endif |
|
760 |
#ifdef |
|
|
761 |
lfr_bp2[i*NB_BYTES_BP2+4] = pt_uint8[1]; // Record |
|
|
762 |
lfr_bp2[i*NB_BYTES_BP2+5] = pt_uint8[0]; // Record |
|
|
761 | #ifdef LSB_FIRST_TCH | |
|
762 | lfr_bp2[i*NB_BYTES_BP2+4] = pt_uint8[1]; // Record MSB of tmp_uint16 | |
|
763 | lfr_bp2[i*NB_BYTES_BP2+5] = pt_uint8[0]; // Record LSB of tmp_uint16 | |
|
763 | 764 | #endif |
|
764 | 765 | #ifdef DEBUG_TCH |
|
765 | 766 | printf("autocor for S33 significand : %u\n",autocor); |
@@ -799,13 +800,13 void BP2_set( float * compressed_spec_ma | |||
|
799 | 800 | // left place of the significand bits (nbitsig), |
|
800 | 801 | // making the 16-bit word to be recorded |
|
801 | 802 | pt_uint8 = (uint8_t*) &tmp_uint16; // Affect an uint8_t pointer with the adress of tmp_uint16 |
|
802 |
#ifdef |
|
|
803 |
lfr_bp2[i*NB_BYTES_BP2+6] = pt_uint8[0]; // Record |
|
|
804 |
lfr_bp2[i*NB_BYTES_BP2+7] = pt_uint8[1]; // Record |
|
|
803 | #ifdef MSB_FIRST_TCH | |
|
804 | lfr_bp2[i*NB_BYTES_BP2+6] = pt_uint8[0]; // Record MSB of tmp_uint16 | |
|
805 | lfr_bp2[i*NB_BYTES_BP2+7] = pt_uint8[1]; // Record LSB of tmp_uint16 | |
|
805 | 806 | #endif |
|
806 |
#ifdef |
|
|
807 |
lfr_bp2[i*NB_BYTES_BP2+6] = pt_uint8[1]; // Record |
|
|
808 |
lfr_bp2[i*NB_BYTES_BP2+7] = pt_uint8[0]; // Record |
|
|
807 | #ifdef LSB_FIRST_TCH | |
|
808 | lfr_bp2[i*NB_BYTES_BP2+6] = pt_uint8[1]; // Record MSB of tmp_uint16 | |
|
809 | lfr_bp2[i*NB_BYTES_BP2+7] = pt_uint8[0]; // Record LSB of tmp_uint16 | |
|
809 | 810 | #endif |
|
810 | 811 | #ifdef DEBUG_TCH |
|
811 | 812 | printf("autocor for S44 significand : %u\n",autocor); |
@@ -844,13 +845,15 void BP2_set( float * compressed_spec_ma | |||
|
844 | 845 | // left place of the significand bits (nbitsig), |
|
845 | 846 | // making the 16-bit word to be recorded |
|
846 | 847 | pt_uint8 = (uint8_t*) &tmp_uint16; // Affect an uint8_t pointer with the adress of tmp_uint16 |
|
847 |
#ifdef |
|
|
848 |
lfr_bp2[i*NB_BYTES_BP2+8] = pt_uint8[0]; // Record |
|
|
849 |
lfr_bp2[i*NB_BYTES_BP2+9] = pt_uint8[1]; // Record |
|
|
848 | #ifdef MSB_FIRST_TCH | |
|
849 | lfr_bp2[i*NB_BYTES_BP2+8] = pt_uint8[0]; // Record MSB of tmp_uint16 | |
|
850 | lfr_bp2[i*NB_BYTES_BP2+9] = pt_uint8[1]; // Record LSB of tmp_uint16 | |
|
851 | //printf("MSB:\n"); | |
|
850 | 852 | #endif |
|
851 |
#ifdef |
|
|
852 |
lfr_bp2[i*NB_BYTES_BP2+8] = pt_uint8[1]; // Record |
|
|
853 |
lfr_bp2[i*NB_BYTES_BP2+9] = pt_uint8[0]; // Record |
|
|
853 | #ifdef LSB_FIRST_TCH | |
|
854 | lfr_bp2[i*NB_BYTES_BP2+8] = pt_uint8[1]; // Record MSB of tmp_uint16 | |
|
855 | lfr_bp2[i*NB_BYTES_BP2+9] = pt_uint8[0]; // Record LSB of tmp_uint16 | |
|
856 | //printf("LSB:\n"); | |
|
854 | 857 | #endif |
|
855 | 858 | #ifdef DEBUG_TCH |
|
856 | 859 | printf("autocor for S55 significand : %u\n",autocor); |
@@ -1,14 +1,14 | |||
|
1 | // In the frame of RPW LFR Sofware ICD Issue1 Rev8 (05/07/2013) | |
|
1 | 2 | // version 1.4: 16/05/2014 |
|
2 | 3 | // version 1.5: 20/05/2014 |
|
3 | 4 | // version 1.6: 19/12/2014 |
|
5 | // version 1.7: 15/01/2015 (modifs de Paul + correction erreurs qui se compensaient (LSB <=> MSB + indices [0,2] <=> [1,3]) | |
|
6 | ||
|
4 | 7 | |
|
5 | 8 | #ifndef BASIC_PARAMETERS_PARAMS_H |
|
6 | 9 | #define BASIC_PARAMETERS_PARAMS_H |
|
7 | 10 | |
|
8 | 11 | #define NB_VALUES_PER_SPECTRAL_MATRIX 25 |
|
9 | #define NB_BINS_COMPRESSED_MATRIX_f0 1 | |
|
10 | #define NB_BINS_COMPRESSED_MATRIX_f1 13 | |
|
11 | #define NB_BINS_COMPRESSED_MATRIX_f2 12 | |
|
12 | 12 | |
|
13 | 13 | #define NB_BYTES_BP1 9 |
|
14 | 14 | #define NB_BYTES_BP2 30 |
@@ -1,4 +1,7 | |||
|
1 | // In the frame of RPW LFR Sofware ICD Issue1 Rev8 (05/07/2013) | |
|
1 | 2 | // version 1.6: 19/12/2014 |
|
3 | // version 1.7: 15/01/2015 (modifs de Paul + correction erreurs qui se compensaient (LSB <=> MSB + indices [0,2] <=> [1,3]) | |
|
4 | ||
|
2 | 5 | |
|
3 | 6 | #ifndef BASIC_PARAMETERS_UTILITIES_H |
|
4 | 7 | #define BASIC_PARAMETERS_UTILITIES_H |
@@ -8,6 +11,10 | |||
|
8 | 11 | |
|
9 | 12 | #include "basic_parameters_params.h" |
|
10 | 13 | |
|
14 | #define NB_BINS_COMPRESSED_MATRIX_f0 1 | |
|
15 | #define NB_BINS_COMPRESSED_MATRIX_f1 13 | |
|
16 | #define NB_BINS_COMPRESSED_MATRIX_f2 12 | |
|
17 | ||
|
11 | 18 | float compressed_spectral_matrix_f0[NB_BINS_COMPRESSED_MATRIX_f0 * NB_VALUES_PER_SPECTRAL_MATRIX]; |
|
12 | 19 | float k_coefficients_f0[NB_BINS_COMPRESSED_MATRIX_f0 * NB_K_COEFF_PER_BIN]; |
|
13 | 20 | float k_coefficients_f1[NB_BINS_COMPRESSED_MATRIX_f1 * NB_K_COEFF_PER_BIN]; |
@@ -6,6 +6,8 | |||
|
6 | 6 | // version 1.4: 16/05/2014 |
|
7 | 7 | // version 1.5: 20/05/2014 |
|
8 | 8 | // version 1.6: 19/12/2014 |
|
9 | // version 1.7: 15/01/2015 (modifs de Paul + correction erreurs qui se compensaient (LSB <=> MSB + indices [0,2] <=> [1,3]) | |
|
10 | ||
|
9 | 11 | |
|
10 | 12 | #include "basic_parameters_utilities.h" |
|
11 | 13 |
@@ -6,6 +6,8 | |||
|
6 | 6 | // version 1.4: 16/05/2014 |
|
7 | 7 | // version 1.5: 20/05/2014 |
|
8 | 8 | // version 1.6: 19/12/2014 |
|
9 | // version 1.7: 15/01/2015 (modifs de Paul + correction erreurs qui se compensaient (LSB <=> MSB + indices [0,2] <=> [1,3]) | |
|
10 | ||
|
9 | 11 | |
|
10 | 12 | #ifndef FILE_UTILITIES_H |
|
11 | 13 | #define FILE_UTILITIES_H |
@@ -6,6 +6,8 | |||
|
6 | 6 | // version 1.4: 16/05/2014 |
|
7 | 7 | // version 1.5: 20/05/2014 |
|
8 | 8 | // version 1.6: 19/12/2014 |
|
9 | // version 1.7: 15/01/2015 (modifs de Paul + correction erreurs qui se compensaient (LSB <=> MSB + indices [0,2] <=> [1,3]) | |
|
10 | ||
|
9 | 11 | |
|
10 | 12 | #include <stdio.h> |
|
11 | 13 | |
@@ -28,11 +30,12 int main(void) | |||
|
28 | 30 | printf("The multi-byte quantities are laid out in a MSB FIRST (big endian) fashion\n\n"); |
|
29 | 31 | #endif |
|
30 | 32 | |
|
31 |
|
|
|
32 | filename="sm_test2.dat"; | |
|
33 | filename="/WIN/Users/chust/DD CHUST/Missions/Solar Orbiter/LFR/Prog C/tests bp Paul/tests2/sm_test2.dat"; | |
|
33 | 34 | lecture_file_sm(filename); |
|
34 | 35 | |
|
35 |
init_k_coefficients(k_coefficients_f0, |
|
|
36 | init_k_coefficients(k_coefficients_f0, NB_BINS_COMPRESSED_MATRIX_f0); | |
|
37 | init_k_coefficients(k_coefficients_f1, NB_BINS_COMPRESSED_MATRIX_f1); | |
|
38 | init_k_coefficients(k_coefficients_f2, NB_BINS_COMPRESSED_MATRIX_f2); | |
|
36 | 39 | |
|
37 | 40 | printf("\n"); |
|
38 | 41 |
General Comments 0
You need to be logged in to leave comments.
Login now