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