##// END OF EJS Templates
version 2.5: mise en conformité LOGISCOPE + déclarations extern pour les utilities
chust -
r22:29f7f58cbebc TCH draft
parent child
Show More
@@ -0,0 +1,165
1 Hello World!
2
3 The multi-byte quantities are laid out in a LSB FIRST (little endian) fashion
4
5 Compressed_spectral_matrix_f0 :
6 Number of bins: 1
7 Number of values per spectral matrix: 25
8 Size of compressed_spectral_matrix_f0 : 100
9
10 Bin number: 0
11 Element 01 (S11) (00 & --) => Re: 4.00109575e+06 Im: 0.00000000e+00
12 Element 02 (S12) (01 & 02) => Re: -2.19891187e+03 Im: 1.73193325e+06
13 Element 03 (S13) (03 & 04) => Re: 1.88106079e+03 Im: -1.00001638e+06
14 Element 04 (S14) (05 & 06) => Re: 6.23724854e+02 Im: 2.00016860e+07
15 Element 05 (S15) (07 & 08) => Re: -3.46422920e+07 Im: -1.44333826e+03
16 Element 06 (S22) (09 & --) => Re: 7.54424812e+05 Im: 0.00000000e+00
17 Element 07 (S23) (10 & 11) => Re: -4.36785375e+05 Im: 2.34538879e+02
18 Element 08 (S24) (12 & 13) => Re: 8.65882200e+06 Im: -3.31611108e+03
19 Element 09 (S25) (14 & 15) => Re: 2.71719702e+03 Im: 1.50027590e+07
20 Element 10 (S33) (16 & --) => Re: 2.53229094e+05 Im: 0.00000000e+00
21 Element 11 (S34) (17 & 18) => Re: -4.99895450e+06 Im: 2.90329712e+03
22 Element 12 (S35) (19 & 20) => Re: -2.17048022e+03 Im: -8.66275100e+06
23 Element 13 (S44) (21 & --) => Re: 1.00002952e+08 Im: 0.00000000e+00
24 Element 14 (S45) (22 & 23) => Re: -2.94739111e+03 Im: 1.73206224e+08
25 Element 15 (S55) (24 & --) => Re: 3.00003392e+08 Im: 0.00000000e+00
26
27 F0 data: initialization of the intercalibration k-coefficients
28 F1 data: initialization of the intercalibration k-coefficients
29 F2 data: initialization of the intercalibration k-coefficients
30
31
32 BP1 :
33 Number of bins: 1
34 nbitexp : 6, expmax : 37, expmin : -26
35 nbitsig : 10, rangesig : 1023
36
37 Bin number: 0
38 PSDB : 5.00874950e+06
39 significand : 5.97089469e-01
40 exponent : 23
41 psd for PSDB significand : 199
42 exp for PSDB exponent : 49
43 pt_uint8[1] for PSDB exponent + significand: 196 or c4
44 pt_uint8[0] for PSDB significand: 199 or c7
45 lfr_bp1[i*NB_BYTES_BP1+2] : 196 or c4
46 lfr_bp1[i*NB_BYTES_BP1+3] : 199 or c7
47 PSDE : 2.26797168e+08
48 significand : 8.44885290e-01
49 exponent : 28
50 psd for PSDE significand : 706
51 exp for PSDE exponent : 54
52 pt_uint8[1] for PSDE exponent + significand: 218 or da
53 pt_uint8[0] for PSDE significand: 194 or c2
54 lfr_bp1[i*NB_BYTES_BP1+0] : 218 or da
55 lfr_bp1[i*NB_BYTES_BP1+1] : 194 or c2
56 NVEC_V0 : 1.17274933e-04
57 NVEC_V1 : 5.00031590e-01
58 NVEC_V2 : 8.66007149e-01
59 lfr_bp1[i*NB_BYTES_BP1+4] for NVEC_V0 : 128
60 lfr_bp1[i*NB_BYTES_BP1+5] for NVEC_V1 : 191
61 lfr_bp1[i*NB_BYTES_BP1+6] for NVEC_V2 : 0
62 ellipticity : 7.98565149e-01
63 tmp_uint8 for ellipticity : 12
64 lfr_bp1[i*NB_BYTES_BP1+6] for NVEC_V2 + ellipticity : 96
65 DOP : 9.96131897e-01
66 tmp_uint8 for DOP : 7
67 lfr_bp1[i*NB_BYTES_BP1+6] for NVEC_V2 + ellipticity + DOP : 103
68 ReaSX : -4.64141500e+06
69 |ReaSX| : 4.64141500e+06
70 significand : 5.53299785e-01
71 exponent : 23
72 tmp_uint8 for ReaSX exponent : 49
73 lfr_bp1[i*NB_BYTES_BP1+7] for ReaSX sign + RealSX exponent : 177
74 lfr_bp1[i*NB_BYTES_BP1+8] for ReaSX significand : 27
75 ImaSX : -5.73210880e+07
76 |ImaSX| : 5.73210880e+07
77 ArgSX sign : 64
78 lfr_bp1[i*NB_BYTES_BP1+7] for ReaSX & ArgSX signs + ReaSX exponent : 241
79 n_cross_e_scal_b_re : 9.66053400e+06
80 n_cross_e_scal_b_im : -2.58822900e+06
81 |VPHI| : 1.02704735e+01
82 significand : 6.41904593e-01
83 exponent : 4
84 tmp_uint8 for VPHI exponent : 30
85 lfr_bp1[i*NB_BYTES_BP1+9] for VPHI sign + VPHI exponent : 30
86 lfr_bp1[i*NB_BYTES_BP1+10] for VPHI significand : 72
87 |n_cross_e_scal_b_im| : 2.58822900e+06
88 |n_cross_e_scal_b_im|/bx_bx_star : 2.75164270e+00
89 ArgNEBX sign : 0
90 lfr_bp1[i*NB_BYTES_BP1+9] for VPHI & ArgNEBX signs + VPHI exponent : 30
91
92 BP2 :
93 Number of bins: 1
94 nbitexp : 6, expmax : 37, expmin : -26
95 nbitsig : 10, rangesig : 1023
96
97 Bin number: 0
98 lfr_bp2[i*NB_BYTES_BP2+10] for cross12_re ( -1.26564049e-03) : 127
99 lfr_bp2[i*NB_BYTES_BP2+20] for cross12_im ( 9.96858895e-01) : 255
100 lfr_bp2[i*NB_BYTES_BP2+11] for cross13_re ( 1.86877302e-03) : 128
101 lfr_bp2[i*NB_BYTES_BP2+21] for cross13_im ( -9.93483901e-01) : 001
102 lfr_bp2[i*NB_BYTES_BP2+12] for cross14_re ( 3.11815129e-05) : 128
103 lfr_bp2[i*NB_BYTES_BP2+22] for cross14_im ( 9.99932587e-01) : 255
104 lfr_bp2[i*NB_BYTES_BP2+13] for cross15_re ( -9.99894261e-01) : 000
105 lfr_bp2[i*NB_BYTES_BP2+23] for cross15_im ( -4.16596449e-05) : 127
106 lfr_bp2[i*NB_BYTES_BP2+14] for cross23_re ( -9.99317050e-01) : 000
107 lfr_bp2[i*NB_BYTES_BP2+24] for cross23_im ( 5.36599255e-04) : 128
108 lfr_bp2[i*NB_BYTES_BP2+15] for cross24_re ( 9.96883571e-01) : 255
109 lfr_bp2[i*NB_BYTES_BP2+25] for cross24_im ( -3.81781341e-04) : 127
110 lfr_bp2[i*NB_BYTES_BP2+16] for cross25_re ( 1.80613439e-04) : 128
111 lfr_bp2[i*NB_BYTES_BP2+26] for cross25_im ( 9.97240901e-01) : 255
112 lfr_bp2[i*NB_BYTES_BP2+17] for cross34_re ( -9.93381321e-01) : 001
113 lfr_bp2[i*NB_BYTES_BP2+27] for cross34_im ( 5.76936873e-04) : 128
114 lfr_bp2[i*NB_BYTES_BP2+18] for cross35_re ( -2.49020959e-04) : 127
115 lfr_bp2[i*NB_BYTES_BP2+28] for cross35_im ( -9.93884504e-01) : 001
116 lfr_bp2[i*NB_BYTES_BP2+19] for cross45_re ( -1.70164221e-05) : 127
117 lfr_bp2[i*NB_BYTES_BP2+29] for cross45_im ( 9.99986172e-01) : 255
118 S11 : 4.00109575e+06
119 significand : 9.53935564e-01
120 exponent : 22
121 autocor for S11 significand : 929
122 exp for S11 exponent : 48
123 pt_uint8[1] for S11 exponent + significand : 195 or c3
124 pt_uint8[0] for S11 significand : 161 or a1
125 lfr_bp2[i*NB_BYTES_BP2+0] : 195 or c3
126 lfr_bp2[i*NB_BYTES_BP2+1] : 161 or a1
127 S22 : 7.54424812e+05
128 significand : 7.19475567e-01
129 exponent : 20
130 autocor for S22 significand : 449
131 exp for S11 exponent : 46
132 pt_uint8[1] for S22 exponent + significand : 185 or b9
133 pt_uint8[0] for S22 significand : 193 or c1
134 lfr_bp2[i*NB_BYTES_BP2+2] : 185 or b9
135 lfr_bp2[i*NB_BYTES_BP2+3] : 193 or c1
136 S33 : 2.53229094e+05
137 significand : 9.65992332e-01
138 exponent : 18
139 autocor for S33 significand : 953
140 exp for S33 exponent : 44
141 pt_uint8[1] for S33 exponent + significand : 179 or b3
142 pt_uint8[0] for S33 significand : 185 or b9
143 lfr_bp2[i*NB_BYTES_BP2+4] : 179 or b3
144 lfr_bp2[i*NB_BYTES_BP2+5] : 185 or b9
145 S44 : 1.00002952e+08
146 significand : 7.45080054e-01
147 exponent : 27
148 autocor for S44 significand : 501
149 exp for S44 exponent : 53
150 pt_uint8[1] for S44 exponent + significand : 213 or d5
151 pt_uint8[0] for S44 significand : 245 or f5
152 lfr_bp2[i*NB_BYTES_BP2+6] : 213 or d5
153 lfr_bp2[i*NB_BYTES_BP2+7] : 245 or f5
154 S55 : 3.00003392e+08
155 significand : 5.58799863e-01
156 exponent : 29
157 autocor for S55 significand : 120
158 exp for S55 exponent : 55
159 pt_uint8[1] for S55 exponent + significand : 220 or dc
160 pt_uint8[0] for S55 significand : 120 or 78
161 lfr_bp2[i*NB_BYTES_BP2+8] : 220 or dc
162 lfr_bp2[i*NB_BYTES_BP2+9] : 120 or 78
163 Press <RETURN> to close this window...
164
165
@@ -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
@@ -13,6 +13,33
13 // version 2.1: 22/06/2015 (modifs de Paul)
13 // version 2.1: 22/06/2015 (modifs de Paul)
14 // version 2.2: 23/06/2015 (modifs de l'ordre de déclaration/définition de init_k_coefficients dans basic_parameters.c ... + maintien des declarations dans le .h)
14 // version 2.2: 23/06/2015 (modifs de l'ordre de déclaration/définition de init_k_coefficients dans basic_parameters.c ... + maintien des declarations dans le .h)
15 // version 2.3: 01/07/2015 (affectation initiale des octets 7 et 9 dans les BP1 corrigée ...)
15 // version 2.3: 01/07/2015 (affectation initiale des octets 7 et 9 dans les BP1 corrigée ...)
16 // version 2.4: 05/10/2018 (added GPL headers)
17 // version 2.5: 09/10/2018 (dans main.c #include "basic_parameters_utilities.h" est changé par les déclarations extern correspondantes ...!
18 // + delta mise en conformité LOGISCOPE)
19
20 /*------------------------------------------------------------------------------
21 -- Solar Orbiter's Low Frequency Receiver Flight Software (LFR FSW),
22 -- This file is a part of the LFR FSW
23 -- Copyright (C) 2012-2018, Plasma Physics Laboratory - CNRS
24 --
25 -- This program is free software; you can redistribute it and/or modify
26 -- it under the terms of the GNU General Public License as published by
27 -- the Free Software Foundation; either version 2 of the License, or
28 -- (at your option) any later version.
29 --
30 -- This program is distributed in the hope that it will be useful,
31 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
32 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 -- GNU General Public License for more details.
34 --
35 -- You should have received a copy of the GNU General Public License
36 -- along with this program; if not, write to the Free Software
37 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
38 -------------------------------------------------------------------------------*/
39 /*-- Author : Thomas Chust
40 -- Contact : Thomas Chust
41 -- Mail : thomas.chust@lpp.polytechnique.fr
42 ----------------------------------------------------------------------------*/
16
43
17 #include <stdio.h>
44 #include <stdio.h>
18 #include <stdint.h>
45 #include <stdint.h>
@@ -13,6 +13,33
13 // version 2.1: 22/06/2015 (modifs de Paul)
13 // version 2.1: 22/06/2015 (modifs de Paul)
14 // version 2.2: 23/06/2015 (modifs de l'ordre de déclaration/définition de init_k_coefficients dans basic_parameters.c ... + maintien des declarations dans le .h)
14 // version 2.2: 23/06/2015 (modifs de l'ordre de déclaration/définition de init_k_coefficients dans basic_parameters.c ... + maintien des declarations dans le .h)
15 // version 2.3: 01/07/2015 (affectation initiale des octets 7 et 9 dans les BP1 corrigée ...)
15 // version 2.3: 01/07/2015 (affectation initiale des octets 7 et 9 dans les BP1 corrigée ...)
16 // version 2.4: 05/10/2018 (mise en conformité LOGISCOPE)
17 // version 2.5: 09/10/2018 (dans main.c #include "basic_parameters_utilities.h" est changé par les déclarations extern correspondantes ...!
18 // + delta mise en conformité LOGISCOPE)
19
20 /*------------------------------------------------------------------------------
21 -- Solar Orbiter's Low Frequency Receiver Flight Software (LFR FSW),
22 -- This file is a part of the LFR FSW
23 -- Copyright (C) 2012-2018, Plasma Physics Laboratory - CNRS
24 --
25 -- This program is free software; you can redistribute it and/or modify
26 -- it under the terms of the GNU General Public License as published by
27 -- the Free Software Foundation; either version 2 of the License, or
28 -- (at your option) any later version.
29 --
30 -- This program is distributed in the hope that it will be useful,
31 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
32 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 -- GNU General Public License for more details.
34 --
35 -- You should have received a copy of the GNU General Public License
36 -- along with this program; if not, write to the Free Software
37 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
38 -------------------------------------------------------------------------------*/
39 /*-- Author : Thomas Chust
40 -- Contact : Thomas Chust
41 -- Mail : thomas.chust@lpp.polytechnique.fr
42 ----------------------------------------------------------------------------*/
16
43
17 #ifndef BASIC_PARAMETERS_H_INCLUDED
44 #ifndef BASIC_PARAMETERS_H_INCLUDED
18 #define BASIC_PARAMETERS_H_INCLUDED
45 #define BASIC_PARAMETERS_H_INCLUDED
@@ -78,7 +105,7 void BP1_set( float * compressed_spec_ma
78 // initialization for managing the exponents of the floating point data:
105 // initialization for managing the exponents of the floating point data:
79 nbitexp = 6; // number of bits for the exponent
106 nbitexp = 6; // number of bits for the exponent
80 expmax = 32+5; // maximum value of the exponent
107 expmax = 32+5; // maximum value of the exponent
81 expmin = expmax - (1 << nbitexp) + 1; // accordingly the minimum exponent value
108 expmin = (expmax - (1 << nbitexp)) + 1; // accordingly the minimum exponent value
82 // for floating point data to be recorded on 16-bit words:
109 // for floating point data to be recorded on 16-bit words:
83 nbitsig = 16 - nbitexp; // number of bits for the significand
110 nbitsig = 16 - nbitexp; // number of bits for the significand
84 rangesig = (1 << nbitsig)-1; // == 2^nbitsig - 1
111 rangesig = (1 << nbitsig)-1; // == 2^nbitsig - 1
@@ -92,8 +119,8 void BP1_set( float * compressed_spec_ma
92 //==============================================
119 //==============================================
93 // BP1 PSDB == PA_LFR_SC_BP1_PB_F0 == 16 bits = 6 bits (exponent) + 10 bits (significand)
120 // BP1 PSDB == PA_LFR_SC_BP1_PB_F0 == 16 bits = 6 bits (exponent) + 10 bits (significand)
94 PSDB = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX] // S11
121 PSDB = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX] // S11
95 + compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+9] // S22
122 + compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 9] // S22
96 + compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+16]; // S33
123 + compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 16]; // S33
97
124
98 significand = frexpf(PSDB, &exponent); // 0.5 <= significand < 1
125 significand = frexpf(PSDB, &exponent); // 0.5 <= significand < 1
99 // PSDB = significand * 2^exponent
126 // PSDB = significand * 2^exponent
@@ -111,7 +138,7 void BP1_set( float * compressed_spec_ma
111 significand = 0.5; // min value that can be recorded
138 significand = 0.5; // min value that can be recorded
112 }
139 }
113
140
114 psd = (uint16_t) ((significand*2-1)*rangesig + 0.5); // Shift and cast into a 16-bit unsigned int with rounding
141 psd = (uint16_t) ((((significand*2) - 1)*rangesig) + 0.5); // Shift and cast into a 16-bit unsigned int with rounding
115 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
142 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
116 exp = (uint16_t) (exponent-expmin); // Shift and cast into a 16-bit unsigned int where just
143 exp = (uint16_t) (exponent-expmin); // Shift and cast into a 16-bit unsigned int where just
117 // the first nbitexp bits are used (0, ..., 2^nbitexp-1)
144 // the first nbitexp bits are used (0, ..., 2^nbitexp-1)
@@ -120,12 +147,12 void BP1_set( float * compressed_spec_ma
120 // making the 16-bit word to be recorded
147 // making the 16-bit word to be recorded
121 pt_uint8 = (uint8_t*) &tmp_uint16; // Affect an uint8_t pointer with the adress of tmp_uint16
148 pt_uint8 = (uint8_t*) &tmp_uint16; // Affect an uint8_t pointer with the adress of tmp_uint16
122 #ifdef MSB_FIRST_TCH
149 #ifdef MSB_FIRST_TCH
123 lfr_bp1[i*NB_BYTES_BP1+2] = pt_uint8[0]; // Record MSB of tmp_uint16
150 lfr_bp1[(i*NB_BYTES_BP1)+2] = pt_uint8[0]; // Record MSB of tmp_uint16
124 lfr_bp1[i*NB_BYTES_BP1+3] = pt_uint8[1]; // Record LSB of tmp_uint16
151 lfr_bp1[(i*NB_BYTES_BP1)+3] = pt_uint8[1]; // Record LSB of tmp_uint16
125 #endif
152 #endif
126 #ifdef LSB_FIRST_TCH
153 #ifdef LSB_FIRST_TCH
127 lfr_bp1[i*NB_BYTES_BP1+2] = pt_uint8[1]; // Record MSB of tmp_uint16
154 lfr_bp1[(i*NB_BYTES_BP1)+2] = pt_uint8[1]; // Record MSB of tmp_uint16
128 lfr_bp1[i*NB_BYTES_BP1+3] = pt_uint8[0]; // Record LSB of tmp_uint16
155 lfr_bp1[(i*NB_BYTES_BP1)+3] = pt_uint8[0]; // Record LSB of tmp_uint16
129 #endif
156 #endif
130 #ifdef DEBUG_TCH
157 #ifdef DEBUG_TCH
131 printf("\nBin number: %d\n", i);
158 printf("\nBin number: %d\n", i);
@@ -141,10 +168,10 void BP1_set( float * compressed_spec_ma
141 #endif
168 #endif
142 //==============================================
169 //==============================================
143 // BP1 PSDE == PA_LFR_SC_BP1_PE_F0 == 16 bits = 6 bits (exponent) + 10 bits (significand)
170 // BP1 PSDE == PA_LFR_SC_BP1_PE_F0 == 16 bits = 6 bits (exponent) + 10 bits (significand)
144 PSDE = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+21] * k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K44_PE] // S44
171 PSDE = (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 21] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K44_PE]) // S44
145 + compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+24] * k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K55_PE] // S55
172 + (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 24] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K55_PE]) // S55
146 + compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+22] * k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K45_PE_RE] // S45 Re
173 + (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 22] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K45_PE_RE]) // S45 Re
147 - compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+23] * k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K45_PE_IM]; // S45 Im
174 - (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 23] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K45_PE_IM]); // S45 Im
148
175
149 significand = frexpf(PSDE, &exponent); // 0.5 <= significand < 1
176 significand = frexpf(PSDE, &exponent); // 0.5 <= significand < 1
150 // PSDE = significand * 2^exponent
177 // PSDE = significand * 2^exponent
@@ -162,7 +189,7 void BP1_set( float * compressed_spec_ma
162 significand = 0.5; // min value that can be recorded
189 significand = 0.5; // min value that can be recorded
163 }
190 }
164
191
165 psd = (uint16_t) ((significand*2-1)*rangesig + 0.5); // Shift and cast into a 16-bit unsigned int with rounding
192 psd = (uint16_t) ((((significand*2)-1)*rangesig) + 0.5); // Shift and cast into a 16-bit unsigned int with rounding
166 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
193 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
167 exp = (uint16_t) (exponent-expmin); // Shift and cast into a 16-bit unsigned int where just
194 exp = (uint16_t) (exponent-expmin); // Shift and cast into a 16-bit unsigned int where just
168 // the first nbitexp bits are used (0, ..., 2^nbitexp-1)
195 // the first nbitexp bits are used (0, ..., 2^nbitexp-1)
@@ -171,12 +198,12 void BP1_set( float * compressed_spec_ma
171 // making the 16-bit word to be recorded
198 // making the 16-bit word to be recorded
172 pt_uint8 = (uint8_t*) &tmp_uint16; // Affect an uint8_t pointer with the adress of tmp_uint16
199 pt_uint8 = (uint8_t*) &tmp_uint16; // Affect an uint8_t pointer with the adress of tmp_uint16
173 #ifdef MSB_FIRST_TCH
200 #ifdef MSB_FIRST_TCH
174 lfr_bp1[i*NB_BYTES_BP1+0] = pt_uint8[0]; // Record MSB of tmp_uint16
201 lfr_bp1[(i*NB_BYTES_BP1) + 0] = pt_uint8[0]; // Record MSB of tmp_uint16
175 lfr_bp1[i*NB_BYTES_BP1+1] = pt_uint8[1]; // Record LSB of tmp_uint16
202 lfr_bp1[(i*NB_BYTES_BP1) + 1] = pt_uint8[1]; // Record LSB of tmp_uint16
176 #endif
203 #endif
177 #ifdef LSB_FIRST_TCH
204 #ifdef LSB_FIRST_TCH
178 lfr_bp1[i*NB_BYTES_BP1+0] = pt_uint8[1]; // Record MSB of tmp_uint16
205 lfr_bp1[(i*NB_BYTES_BP1) + 0] = pt_uint8[1]; // Record MSB of tmp_uint16
179 lfr_bp1[i*NB_BYTES_BP1+1] = pt_uint8[0]; // Record LSB of tmp_uint16
206 lfr_bp1[(i*NB_BYTES_BP1) + 1] = pt_uint8[0]; // Record LSB of tmp_uint16
180 #endif
207 #endif
181 #ifdef DEBUG_TCH
208 #ifdef DEBUG_TCH
182 printf("PSDE : %16.8e\n",PSDE);
209 printf("PSDE : %16.8e\n",PSDE);
@@ -193,14 +220,14 void BP1_set( float * compressed_spec_ma
193 // BP1 normal wave vector == PA_LFR_SC_BP1_NVEC_V0_F0 == 8 bits
220 // BP1 normal wave vector == PA_LFR_SC_BP1_NVEC_V0_F0 == 8 bits
194 // == PA_LFR_SC_BP1_NVEC_V1_F0 == 8 bits
221 // == PA_LFR_SC_BP1_NVEC_V1_F0 == 8 bits
195 // == PA_LFR_SC_BP1_NVEC_V2_F0 == 1 sign bit
222 // == PA_LFR_SC_BP1_NVEC_V2_F0 == 1 sign bit
196 tmp = sqrt( compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+2] *compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+2] //Im S12
223 tmp = sqrt( (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 2] *compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 2]) //Im S12
197 +compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+4] *compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+4] //Im S13
224 + (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 4] *compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 4]) //Im S13
198 +compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+11]*compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+11] //Im S23
225 + (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 11]*compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 11]) //Im S23
199 );
226 );
200 if (tmp != 0.) { // no division by 0.
227 if (tmp != 0.) { // no division by 0.
201 NVEC_V0 = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+11]/ tmp; // S23 Im => n1
228 NVEC_V0 = compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 11] / tmp; // S23 Im => n1
202 NVEC_V1 = -compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+4] / tmp; // S13 Im => n2
229 NVEC_V1 = (-compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 4]) / tmp; // S13 Im => n2
203 NVEC_V2 = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+2] / tmp; // S12 Im => n3
230 NVEC_V2 = compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 2] / tmp; // S12 Im => n3
204 }
231 }
205 else
232 else
206 {
233 {
@@ -208,15 +235,15 void BP1_set( float * compressed_spec_ma
208 NVEC_V1 = 0.;
235 NVEC_V1 = 0.;
209 NVEC_V2 = 0.;
236 NVEC_V2 = 0.;
210 }
237 }
211 lfr_bp1[i*NB_BYTES_BP1+4] = (uint8_t) (NVEC_V0*127.5 + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
238 lfr_bp1[(i*NB_BYTES_BP1) + 4] = (uint8_t) ((NVEC_V0*127.5) + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
212 lfr_bp1[i*NB_BYTES_BP1+5] = (uint8_t) (NVEC_V1*127.5 + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
239 lfr_bp1[(i*NB_BYTES_BP1) + 5] = (uint8_t) ((NVEC_V1*127.5) + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
213 pt_uint8 = (uint8_t*) &NVEC_V2; // Affect an uint8_t pointer with the adress of NVEC_V2
240 pt_uint8 = (uint8_t*) &NVEC_V2; // Affect an uint8_t pointer with the adress of NVEC_V2
214 #ifdef LSB_FIRST_TCH
241 #ifdef LSB_FIRST_TCH
215 lfr_bp1[i*NB_BYTES_BP1+6] = pt_uint8[3] & 0x80; // Extract the sign bit of NVEC_V2 (32-bit float, sign bit in the 4th octet:PC convention)
242 lfr_bp1[(i*NB_BYTES_BP1) + 6] = pt_uint8[3] & 0x80; // Extract the sign bit of NVEC_V2 (32-bit float, sign bit in the 4th octet:PC convention)
216 // Record it at the 8th bit position (from the right to the left) of lfr_bp1[i*NB_BYTES_BP1+6]
243 // Record it at the 8th bit position (from the right to the left) of lfr_bp1[i*NB_BYTES_BP1+6]
217 #endif
244 #endif
218 #ifdef MSB_FIRST_TCH
245 #ifdef MSB_FIRST_TCH
219 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)
246 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)
220 // Record it at the 8th bit position (from the right to the left) of lfr_bp1[i*NB_BYTES_BP1+6]
247 // Record it at the 8th bit position (from the right to the left) of lfr_bp1[i*NB_BYTES_BP1+6]
221 #endif
248 #endif
222 #ifdef DEBUG_TCH
249 #ifdef DEBUG_TCH
@@ -236,9 +263,9 void BP1_set( float * compressed_spec_ma
236 {
263 {
237 aux = 0.;
264 aux = 0.;
238 }
265 }
239 tmp_uint8 = (uint8_t) (aux*15 + 0.5); // Shift and cast into a 8-bit uint8_t with rounding
266 tmp_uint8 = (uint8_t) ((aux*15) + 0.5); // Shift and cast into a 8-bit uint8_t with rounding
240 // where just the first 4 bits are used (0, ..., 15)
267 // where just the first 4 bits are used (0, ..., 15)
241 lfr_bp1[i*NB_BYTES_BP1+6] = lfr_bp1[i*NB_BYTES_BP1+6] | (tmp_uint8 << 3); // Put these 4 bits next to the right place
268 lfr_bp1[(i*NB_BYTES_BP1) + 6] = lfr_bp1[(i*NB_BYTES_BP1) + 6] | (tmp_uint8 << 3); // Put these 4 bits next to the right place
242 // of the sign bit of NVEC_V2 (recorded
269 // of the sign bit of NVEC_V2 (recorded
243 // previously in lfr_bp1[i*NB_BYTES_BP1+6])
270 // previously in lfr_bp1[i*NB_BYTES_BP1+6])
244 #ifdef DEBUG_TCH
271 #ifdef DEBUG_TCH
@@ -248,15 +275,15 void BP1_set( float * compressed_spec_ma
248 #endif
275 #endif
249 //==============================================================
276 //==============================================================
250 // BP1 degree of polarization == PA_LFR_SC_BP1_DOP_F0 == 3 bits
277 // BP1 degree of polarization == PA_LFR_SC_BP1_DOP_F0 == 3 bits
251 tr_SB_SB = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX] *compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX]
278 tr_SB_SB = (compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX] * compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX])
252 + compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+9] *compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+9]
279 + (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 9] * compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 9])
253 + compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+16] *compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+16]
280 + (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 16] * compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 16])
254 + 2 * compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+1] *compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+1]
281 + (2 * compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 1] * compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 1])
255 + 2 * compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+2] *compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+2]
282 + (2 * compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 2] * compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 2])
256 + 2 * compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+3] *compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+3]
283 + (2 * compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 3] * compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 3])
257 + 2 * compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+4] *compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+4]
284 + (2 * compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 4] * compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 4])
258 + 2 * compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+10]*compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+10]
285 + (2 * compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 10]* compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 10])
259 + 2 * compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+11]*compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+11];
286 + (2 * compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 11]* compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 11]);
260 aux = PSDB*PSDB;
287 aux = PSDB*PSDB;
261 if (aux != 0.) { // no division by 0.
288 if (aux != 0.) { // no division by 0.
262 tmp = ( 3*tr_SB_SB - aux ) / ( 2 * aux ); // Compute the degree of polarisation
289 tmp = ( 3*tr_SB_SB - aux ) / ( 2 * aux ); // Compute the degree of polarisation
@@ -265,9 +292,9 void BP1_set( float * compressed_spec_ma
265 {
292 {
266 tmp = 0.;
293 tmp = 0.;
267 }
294 }
268 tmp_uint8 = (uint8_t) (tmp*7 + 0.5); // Shift and cast into a 8-bit uint8_t with rounding
295 tmp_uint8 = (uint8_t) ((tmp*7) + 0.5); // Shift and cast into a 8-bit uint8_t with rounding
269 // where just the first 3 bits are used (0, ..., 7)
296 // where just the first 3 bits are used (0, ..., 7)
270 lfr_bp1[i*NB_BYTES_BP1+6] = lfr_bp1[i*NB_BYTES_BP1+6] | tmp_uint8; // Record these 3 bits at the 3 first bit positions
297 lfr_bp1[(i*NB_BYTES_BP1) + 6] = lfr_bp1[(i*NB_BYTES_BP1) + 6] | tmp_uint8; // Record these 3 bits at the 3 first bit positions
271 // (from the right to the left) of lfr_bp1[i*NB_BYTES_BP1+6]
298 // (from the right to the left) of lfr_bp1[i*NB_BYTES_BP1+6]
272 #ifdef DEBUG_TCH
299 #ifdef DEBUG_TCH
273 printf("DOP : %16.8e\n",tmp);
300 printf("DOP : %16.8e\n",tmp);
@@ -278,45 +305,45 void BP1_set( float * compressed_spec_ma
278 // BP1 X_SO-component of the Poynting flux == PA_LFR_SC_BP1_SX_F0 == 16 bits
305 // BP1 X_SO-component of the Poynting flux == PA_LFR_SC_BP1_SX_F0 == 16 bits
279 // = 1 sign bit + 1 argument bit (two sectors)
306 // = 1 sign bit + 1 argument bit (two sectors)
280 // + 6 bits (exponent) + 8 bits (significand)
307 // + 6 bits (exponent) + 8 bits (significand)
281 e_cross_b_re = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+17]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K34_SX_RE] //S34 Re
308 e_cross_b_re = (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 17] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K34_SX_RE]) //S34 Re
282 + compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+19]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K35_SX_RE] //S35 Re
309 + (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 19] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K35_SX_RE]) //S35 Re
283 + compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+5] *k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K14_SX_RE] //S14 Re
310 + (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 5] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K14_SX_RE]) //S14 Re
284 + compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+7] *k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K15_SX_RE] //S15 Re
311 + (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 7] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K15_SX_RE]) //S15 Re
285 + compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+12]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K24_SX_RE] //S24 Re
312 + (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 12] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K24_SX_RE]) //S24 Re
286 + compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+14]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K25_SX_RE] //S25 Re
313 + (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 14] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K25_SX_RE]) //S25 Re
287 + compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+18]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K34_SX_IM] //S34 Im
314 + (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 18] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K34_SX_IM]) //S34 Im
288 + compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+20]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K35_SX_IM] //S35 Im
315 + (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 20] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K35_SX_IM]) //S35 Im
289 + compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+6] *k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K14_SX_IM] //S14 Im
316 + (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 6] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K14_SX_IM]) //S14 Im
290 + compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+8] *k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K15_SX_IM] //S15 Im
317 + (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 8] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K15_SX_IM]) //S15 Im
291 + compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+13]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K24_SX_IM] //S24 Im
318 + (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 13] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K24_SX_IM]) //S24 Im
292 + compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+15]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K25_SX_IM]; //S25 Im
319 + (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 15] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K25_SX_IM]); //S25 Im
293 // Im(S_ji) = -Im(S_ij)
320 // Im(S_ji) = -Im(S_ij)
294 // k_ji = k_ij
321 // k_ji = k_ij
295 e_cross_b_im = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+17]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K34_SX_IM] //S34 Re
322 e_cross_b_im = (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 17]*k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K34_SX_IM]) //S34 Re
296 + compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+19]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K35_SX_IM] //S35 Re
323 + (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 19]*k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K35_SX_IM]) //S35 Re
297 + compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+5] *k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K14_SX_IM] //S14 Re
324 + (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 5] *k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K14_SX_IM]) //S14 Re
298 + compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+7] *k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K15_SX_IM] //S15 Re
325 + (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 7] *k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K15_SX_IM]) //S15 Re
299 + compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+12]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K24_SX_IM] //S24 Re
326 + (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 12]*k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K24_SX_IM]) //S24 Re
300 + compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+14]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K25_SX_IM] //S25 Re
327 + ((compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 14]*k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K25_SX_IM]) //S25 Re
301 - compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+18]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K34_SX_RE] //S34 Im
328 - (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 18]*k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K34_SX_RE]) //S34 Im
302 - compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+20]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K35_SX_RE] //S35 Im
329 - (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 20]*k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K35_SX_RE]) //S35 Im
303 - compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+6] *k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K14_SX_RE] //S14 Im
330 - (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 6] *k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K14_SX_RE]) //S14 Im
304 - compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+8] *k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K15_SX_RE] //S15 Im
331 - (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 8] *k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K15_SX_RE]) //S15 Im
305 - compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+13]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K24_SX_RE] //S24 Im
332 - (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 13]*k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K24_SX_RE]) //S24 Im
306 - compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+15]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K25_SX_RE]; //S25 Im
333 - (compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 15]*k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K25_SX_RE])); //S25 Im
307 #ifdef DEBUG_TCH
334 #ifdef DEBUG_TCH
308 printf("ReaSX : %16.8e\n",e_cross_b_re);
335 printf("ReaSX : %16.8e\n",e_cross_b_re);
309 #endif
336 #endif
310 pt_uint8 = (uint8_t*) &e_cross_b_re; // Affect an uint8_t pointer with the adress of e_cross_b_re
337 pt_uint8 = (uint8_t*) &e_cross_b_re; // Affect an uint8_t pointer with the adress of e_cross_b_re
311 #ifdef LSB_FIRST_TCH
338 #ifdef LSB_FIRST_TCH
312
339
313 lfr_bp1[i*NB_BYTES_BP1+7] = (uint8_t) (pt_uint8[3] & 0x80); // Extract its sign bit (32-bit float, sign bit in the 4th octet:PC convention)
340 lfr_bp1[(i*NB_BYTES_BP1) + 7] = (uint8_t) (pt_uint8[3] & 0x80); // Extract its sign bit (32-bit float, sign bit in the 4th octet:PC convention)
314 // Record it at the 8th bit position (from the right to the left)
341 // Record it at the 8th bit position (from the right to the left)
315 // of lfr_bp1[i*NB_BYTES_BP1+7]
342 // of lfr_bp1[i*NB_BYTES_BP1+7]
316 pt_uint8[3] = (pt_uint8[3] & 0x7f); // Make e_cross_b_re be positive in any case: |ReaSX|
343 pt_uint8[3] = (pt_uint8[3] & 0x7f); // Make e_cross_b_re be positive in any case: |ReaSX|
317 #endif
344 #endif
318 #ifdef MSB_FIRST_TCH
345 #ifdef MSB_FIRST_TCH
319 lfr_bp1[i*NB_BYTES_BP1+7] = (uint8_t) (pt_uint8[0] & 0x80); // Extract its sign bit (32-bit float, sign bit in the 1th octet:SPARC convention)
346 lfr_bp1[(i*NB_BYTES_BP1) + 7] = (uint8_t) (pt_uint8[0] & 0x80); // Extract its sign bit (32-bit float, sign bit in the 1th octet:SPARC convention)
320 // Record it at the 8th bit position (from the right to the left)
347 // Record it at the 8th bit position (from the right to the left)
321 // of lfr_bp1[i*NB_BYTES_BP1+7]
348 // of lfr_bp1[i*NB_BYTES_BP1+7]
322 pt_uint8[0] = (pt_uint8[0] & 0x7f); // Make e_cross_b_re be positive in any case: |ReaSX|
349 pt_uint8[0] = (pt_uint8[0] & 0x7f); // Make e_cross_b_re be positive in any case: |ReaSX|
@@ -336,7 +363,7 void BP1_set( float * compressed_spec_ma
336 significand = 0.5; // min value that can be recorded
363 significand = 0.5; // min value that can be recorded
337 }
364 }
338
365
339 lfr_bp1[i*NB_BYTES_BP1+8] = (uint8_t) ((significand*2-1)*255 + 0.5); // Shift and cast into a 8-bit uint8_t with rounding
366 lfr_bp1[(i*NB_BYTES_BP1) + 8] = (uint8_t) ((((significand*2)-1)*255) + 0.5); // Shift and cast into a 8-bit uint8_t with rounding
340 // where all bits are used (0, ..., 255)
367 // where all bits are used (0, ..., 255)
341 tmp_uint8 = (uint8_t) (exponent-expmin); // Shift and cast into a 8-bit uint8_t where
368 tmp_uint8 = (uint8_t) (exponent-expmin); // Shift and cast into a 8-bit uint8_t where
342 // just the first nbitexp bits are used (0, ..., 2^nbitexp-1)
369 // just the first nbitexp bits are used (0, ..., 2^nbitexp-1)
@@ -346,7 +373,7 void BP1_set( float * compressed_spec_ma
346 printf("exponent : %d\n" ,exponent);
373 printf("exponent : %d\n" ,exponent);
347 printf("tmp_uint8 for ReaSX exponent : %d\n",tmp_uint8);
374 printf("tmp_uint8 for ReaSX exponent : %d\n",tmp_uint8);
348 #endif
375 #endif
349 lfr_bp1[i*NB_BYTES_BP1+7] = lfr_bp1[i*NB_BYTES_BP1+7] | tmp_uint8; // Record these nbitexp bits in the nbitexp first bits
376 lfr_bp1[(i*NB_BYTES_BP1) + 7] = lfr_bp1[(i*NB_BYTES_BP1) + 7] | tmp_uint8; // Record these nbitexp bits in the nbitexp first bits
350 // (from the right to the left) of lfr_bp1[i*NB_BYTES_BP1+7]
377 // (from the right to the left) of lfr_bp1[i*NB_BYTES_BP1+7]
351 #ifdef DEBUG_TCH
378 #ifdef DEBUG_TCH
352 printf("lfr_bp1[i*NB_BYTES_BP1+7] for ReaSX sign + RealSX exponent : %u\n",lfr_bp1[i*NB_BYTES_BP1+7]);
379 printf("lfr_bp1[i*NB_BYTES_BP1+7] for ReaSX sign + RealSX exponent : %u\n",lfr_bp1[i*NB_BYTES_BP1+7]);
@@ -360,9 +387,16 void BP1_set( float * compressed_spec_ma
360 #ifdef MSB_FIRST_TCH
387 #ifdef MSB_FIRST_TCH
361 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)
388 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)
362 #endif
389 #endif
363 tmp_uint8 = (e_cross_b_im > e_cross_b_re) ? 0x40 : 0x00; // Determine the sector argument of SX. If |Im| > |Re| affect
390 // Determine the sector argument of SX. If |Im| > |Re| affect
364 // an unsigned 8-bit char with 01000000; otherwise with null.
391 // an unsigned 8-bit char with 01000000; otherwise with null.
365 lfr_bp1[i*NB_BYTES_BP1+7] = lfr_bp1[i*NB_BYTES_BP1+7] | tmp_uint8; // Record it as a sign bit at the 7th bit position (from the right
392 if (e_cross_b_im > e_cross_b_re) {
393 tmp_uint8 = 0x40;
394 }
395 else {
396 tmp_uint8 = 0x00;
397 }
398
399 lfr_bp1[(i*NB_BYTES_BP1) + 7] = lfr_bp1[(i*NB_BYTES_BP1) + 7] | tmp_uint8; // Record it as a sign bit at the 7th bit position (from the right
366 // to the left) of lfr_bp1[i*NB_BYTES_BP1+7], by simple logical addition.
400 // to the left) of lfr_bp1[i*NB_BYTES_BP1+7], by simple logical addition.
367 #ifdef DEBUG_TCH
401 #ifdef DEBUG_TCH
368 printf("|ImaSX| : %16.8e\n",e_cross_b_im);
402 printf("|ImaSX| : %16.8e\n",e_cross_b_im);
@@ -373,46 +407,46 void BP1_set( float * compressed_spec_ma
373 // BP1 phase velocity estimator == PA_LFR_SC_BP1_VPHI_F0 == 16 bits
407 // BP1 phase velocity estimator == PA_LFR_SC_BP1_VPHI_F0 == 16 bits
374 // = 1 sign bit + 1 argument bit (two sectors)
408 // = 1 sign bit + 1 argument bit (two sectors)
375 // + 6 bits (exponent) + 8 bits (significand)
409 // + 6 bits (exponent) + 8 bits (significand)
376 ny = sin(alpha_M)*NVEC_V1 + cos(alpha_M)*NVEC_V2;
410 ny = (sin(alpha_M)*NVEC_V1) + (cos(alpha_M)*NVEC_V2);
377 nz = NVEC_V0;
411 nz = NVEC_V0;
378 bx_bx_star = cos(alpha_M)*cos(alpha_M)*compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+9] // S22 Re
412 bx_bx_star = (cos(alpha_M)*cos(alpha_M)*compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 9]) // S22 Re
379 + sin(alpha_M)*sin(alpha_M)*compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+16] // S33 Re
413 + ((sin(alpha_M)*sin(alpha_M)*compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 16]) // S33 Re
380 - 2*sin(alpha_M)*cos(alpha_M)*compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+10]; // S23 Re
414 - (2*sin(alpha_M)*cos(alpha_M)*compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 10])); // S23 Re
381
415
382 n_cross_e_scal_b_re = ny * (compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+12]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K24_NY_RE] //S24 Re
416 n_cross_e_scal_b_re = (ny * ((compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 12] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K24_NY_RE]) //S24 Re
383 +compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+14]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K25_NY_RE] //S25 Re
417 +(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 14] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K25_NY_RE]) //S25 Re
384 +compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+17]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K34_NY_RE] //S34 Re
418 +(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 17] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K34_NY_RE]) //S34 Re
385 +compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+19]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K35_NY_RE] //S35 Re
419 +(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 19] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K35_NY_RE]) //S35 Re
386 +compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+13]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K24_NY_IM] //S24 Im
420 +(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 13] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K24_NY_IM]) //S24 Im
387 +compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+15]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K25_NY_IM] //S25 Im
421 +(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 15] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K25_NY_IM]) //S25 Im
388 +compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+18]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K34_NY_IM] //S34 Im
422 +(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 18] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K34_NY_IM]) //S34 Im
389 +compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+20]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K35_NY_IM]) //S35 Im
423 +(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 20] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K35_NY_IM]))) //S35 Im
390 + nz * (compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+12]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K24_NZ_RE] //S24 Re
424 + (nz * ((compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 12] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K24_NZ_RE]) //S24 Re
391 +compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+14]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K25_NZ_RE] //S25 Re
425 +(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 14] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K25_NZ_RE]) //S25 Re
392 +compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+17]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K34_NZ_RE] //S34 Re
426 +(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 17] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K34_NZ_RE]) //S34 Re
393 +compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+19]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K35_NZ_RE] //S35 Re
427 +(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 19] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K35_NZ_RE]) //S35 Re
394 +compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+13]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K24_NZ_IM] //S24 Im
428 +(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 13] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K24_NZ_IM]) //S24 Im
395 +compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+15]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K25_NZ_IM] //S25 Im
429 +(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 15] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K25_NZ_IM]) //S25 Im
396 +compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+18]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K34_NZ_IM] //S34 Im
430 +(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 18] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K34_NZ_IM]) //S34 Im
397 +compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+20]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K35_NZ_IM]);//S35 Im
431 +(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 20] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K35_NZ_IM])));//S35 Im
398 // Im(S_ji) = -Im(S_ij)
432 // Im(S_ji) = -Im(S_ij)
399 // k_ji = k_ij
433 // k_ji = k_ij
400 n_cross_e_scal_b_im = ny * (compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+12]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K24_NY_IM] //S24 Re
434 n_cross_e_scal_b_im = (ny * ((compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 12] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K24_NY_IM]) //S24 Re
401 +compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+14]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K25_NY_IM] //S25 Re
435 +(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 14] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K25_NY_IM]) //S25 Re
402 +compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+17]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K34_NY_IM] //S34 Re
436 +(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 17] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K34_NY_IM]) //S34 Re
403 +compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+19]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K35_NY_IM] //S35 Re
437 +((compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 19] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K35_NY_IM]) //S35 Re
404 -compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+13]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K24_NY_RE] //S24 Im
438 -(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 13] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K24_NY_RE]) //S24 Im
405 -compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+15]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K25_NY_RE] //S25 Im
439 -(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 15] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K25_NY_RE]) //S25 Im
406 -compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+18]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K34_NY_RE] //S34 Im
440 -(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 18] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K34_NY_RE]) //S34 Im
407 -compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+20]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K35_NY_RE]) //S35 Im
441 -(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 20] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K35_NY_RE])))) //S35 Im
408 + nz * (compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+12]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K24_NZ_IM] //S24 Re
442 + (nz * ((compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 12] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K24_NZ_IM]) //S24 Re
409 +compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+14]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K25_NZ_IM] //S25 Re
443 +(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 14] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K25_NZ_IM]) //S25 Re
410 +compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+17]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K34_NZ_IM] //S34 Re
444 +(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 17] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K34_NZ_IM] ) //S34 Re
411 +compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+19]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K35_NZ_IM] //S35 Re
445 +((compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 19] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K35_NZ_IM]) //S35 Re
412 -compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+13]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K24_NZ_RE] //S24 Im
446 -(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 13] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K24_NZ_RE]) //S24 Im
413 -compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+15]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K25_NZ_RE] //S25 Im
447 -(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 15] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K25_NZ_RE]) //S25 Im
414 -compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+18]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K34_NZ_RE] //S34 Im
448 -(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 18] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K34_NZ_RE]) //S34 Im
415 -compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+20]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K35_NZ_RE]);//S35 Im
449 -(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 20] * k_coeff_intercalib[(i*NB_K_COEFF_PER_BIN) + K35_NZ_RE]))));//S35 Im
416 #ifdef DEBUG_TCH
450 #ifdef DEBUG_TCH
417 printf("n_cross_e_scal_b_re : %16.8e\n",n_cross_e_scal_b_re);
451 printf("n_cross_e_scal_b_re : %16.8e\n",n_cross_e_scal_b_re);
418 printf("n_cross_e_scal_b_im : %16.8e\n",n_cross_e_scal_b_im);
452 printf("n_cross_e_scal_b_im : %16.8e\n",n_cross_e_scal_b_im);
@@ -420,13 +454,13 void BP1_set( float * compressed_spec_ma
420 // vphi = n_cross_e_scal_b_re / bx_bx_star => sign(VPHI) = sign(n_cross_e_scal_b_re)
454 // vphi = n_cross_e_scal_b_re / bx_bx_star => sign(VPHI) = sign(n_cross_e_scal_b_re)
421 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
455 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
422 #ifdef LSB_FIRST_TCH
456 #ifdef LSB_FIRST_TCH
423 lfr_bp1[i*NB_BYTES_BP1+9] = (uint8_t) (pt_uint8[3] & 0x80); // Extract its sign bit (32-bit float, sign bit in the 4th octet:PC convention)
457 lfr_bp1[(i*NB_BYTES_BP1) + 9] = (uint8_t) (pt_uint8[3] & 0x80); // Extract its sign bit (32-bit float, sign bit in the 4th octet:PC convention)
424 // Record it at the 8th bit position (from the right to the left)
458 // Record it at the 8th bit position (from the right to the left)
425 // of lfr_bp1[i*NB_BYTES_BP1+9]
459 // of lfr_bp1[i*NB_BYTES_BP1+9]
426 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|
460 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|
427 #endif
461 #endif
428 #ifdef MSB_FIRST_TCH
462 #ifdef MSB_FIRST_TCH
429 lfr_bp1[i*NB_BYTES_BP1+9] = (uint8_t) (pt_uint8[0] & 0x80); // Extract its sign bit (32-bit float, sign bit in the 1th octet:SPARC convention)
463 lfr_bp1[(i*NB_BYTES_BP1) + 9] = (uint8_t) (pt_uint8[0] & 0x80); // Extract its sign bit (32-bit float, sign bit in the 1th octet:SPARC convention)
430 // Record it at the 8th bit position (from the right to the left)
464 // Record it at the 8th bit position (from the right to the left)
431 // of lfr_bp1[i*NB_BYTES_BP1+9]
465 // of lfr_bp1[i*NB_BYTES_BP1+9]
432 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|
466 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|
@@ -453,7 +487,7 void BP1_set( float * compressed_spec_ma
453 significand = 0.5; // min value that can be recorded
487 significand = 0.5; // min value that can be recorded
454 }
488 }
455
489
456 lfr_bp1[i*NB_BYTES_BP1+10] = (uint8_t) ((significand*2-1)*255 + 0.5); // Shift and cast into a 8-bit uint8_t with rounding
490 lfr_bp1[(i*NB_BYTES_BP1) + 10] = (uint8_t) ((((significand*2)-1)*255) + 0.5); // Shift and cast into a 8-bit uint8_t with rounding
457 // where all the bits are used (0, ..., 255)
491 // where all the bits are used (0, ..., 255)
458 tmp_uint8 = (uint8_t) (exponent-expmin); // Shift and cast into a 8-bit uint8_t where
492 tmp_uint8 = (uint8_t) (exponent-expmin); // Shift and cast into a 8-bit uint8_t where
459 // just the first nbitexp bits are used (0, ..., 2^nbitexp-1)
493 // just the first nbitexp bits are used (0, ..., 2^nbitexp-1)
@@ -463,7 +497,7 void BP1_set( float * compressed_spec_ma
463 printf("exponent : %d\n" ,exponent);
497 printf("exponent : %d\n" ,exponent);
464 printf("tmp_uint8 for VPHI exponent : %d\n",tmp_uint8);
498 printf("tmp_uint8 for VPHI exponent : %d\n",tmp_uint8);
465 #endif
499 #endif
466 lfr_bp1[i*NB_BYTES_BP1+9] = lfr_bp1[i*NB_BYTES_BP1+9] | tmp_uint8; // Record these nbitexp bits in the nbitexp first bits
500 lfr_bp1[(i*NB_BYTES_BP1) + 9] = lfr_bp1[(i*NB_BYTES_BP1) + 9] | tmp_uint8; // Record these nbitexp bits in the nbitexp first bits
467 // (from the right to the left) of lfr_bp1[i*NB_BYTES_BP1+9]
501 // (from the right to the left) of lfr_bp1[i*NB_BYTES_BP1+9]
468 #ifdef DEBUG_TCH
502 #ifdef DEBUG_TCH
469 printf("lfr_bp1[i*NB_BYTES_BP1+9] for VPHI sign + VPHI exponent : %u\n",lfr_bp1[i*NB_BYTES_BP1+9]);
503 printf("lfr_bp1[i*NB_BYTES_BP1+9] for VPHI sign + VPHI exponent : %u\n",lfr_bp1[i*NB_BYTES_BP1+9]);
@@ -476,9 +510,17 void BP1_set( float * compressed_spec_ma
476 #ifdef MSB_FIRST_TCH
510 #ifdef MSB_FIRST_TCH
477 pt_uint8[0] = pt_uint8[0] & 0x7f; // Make n_cross_e_scal_b_im be positive in any case: |ImaNEBX| (32-bit float, sign bit in the 1th octet:SPARC convention)
511 pt_uint8[0] = pt_uint8[0] & 0x7f; // Make n_cross_e_scal_b_im be positive in any case: |ImaNEBX| (32-bit float, sign bit in the 1th octet:SPARC convention)
478 #endif
512 #endif
479 tmp_uint8 = (n_cross_e_scal_b_im > n_cross_e_scal_b_re) ? 0x40 : 0x00; // Determine the sector argument of NEBX. If |Im| > |Re| affect
513
480 // an unsigned 8-bit char with 01000000; otherwise with null.
514 // Determine the sector argument of NEBX. If |Im| > |Re| affect
481 lfr_bp1[i*NB_BYTES_BP1+9] = lfr_bp1[i*NB_BYTES_BP1+9] | tmp_uint8; // Record it as a sign bit at the 7th bit position (from the right
515 // an unsigned 8-bit char with 01000000; otherwise with null.
516 if (n_cross_e_scal_b_im > n_cross_e_scal_b_re) {
517 tmp_uint8 = 0x40;
518 }
519 else {
520 tmp_uint8 = 0x00;
521 }
522
523 lfr_bp1[(i*NB_BYTES_BP1) + 9] = lfr_bp1[(i*NB_BYTES_BP1) + 9] | tmp_uint8; // Record it as a sign bit at the 7th bit position (from the right
482 // to the left) of lfr_bp1[i*NB_BYTES_BP1+9], by simple logical addition.
524 // to the left) of lfr_bp1[i*NB_BYTES_BP1+9], by simple logical addition.
483 #ifdef DEBUG_TCH
525 #ifdef DEBUG_TCH
484 printf("|n_cross_e_scal_b_im| : %16.8e\n",n_cross_e_scal_b_im);
526 printf("|n_cross_e_scal_b_im| : %16.8e\n",n_cross_e_scal_b_im);
@@ -517,7 +559,7 void BP2_set( float * compressed_spec_ma
517 nbitsig = 16 - nbitexp; // number of bits for the significand
559 nbitsig = 16 - nbitexp; // number of bits for the significand
518 rangesig = (1 << nbitsig)-1; // == 2^nbitsig - 1
560 rangesig = (1 << nbitsig)-1; // == 2^nbitsig - 1
519 expmax = 32 + 5;
561 expmax = 32 + 5;
520 expmin = expmax - (1 << nbitexp) + 1;
562 expmin = (expmax - (1 << nbitexp)) + 1;
521
563
522 #ifdef DEBUG_TCH
564 #ifdef DEBUG_TCH
523
565
@@ -549,172 +591,172 void BP2_set( float * compressed_spec_ma
549 // == PA_LFR_SC_BP2_CROSS_RE_9_F0 == 8 bits
591 // == PA_LFR_SC_BP2_CROSS_RE_9_F0 == 8 bits
550 // == PA_LFR_SC_BP2_CROSS_IM_9_F0 == 8 bits
592 // == PA_LFR_SC_BP2_CROSS_IM_9_F0 == 8 bits
551 // S12
593 // S12
552 aux = sqrt(compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX]*compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+9]);
594 aux = sqrt(compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX] * compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 9]);
553 if (aux != 0.) { // no division by 0.
595 if (aux != 0.) { // no division by 0.
554 cross_re = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+1] / aux;
596 cross_re = compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 1] / aux;
555 cross_im = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+2] / aux;
597 cross_im = compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 2] / aux;
556 }
598 }
557 else
599 else
558 {
600 {
559 cross_re = 0.;
601 cross_re = 0.;
560 cross_im = 0.;
602 cross_im = 0.;
561 }
603 }
562 lfr_bp2[i*NB_BYTES_BP2+10] = (uint8_t) (cross_re*127.5 + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
604 lfr_bp2[(i*NB_BYTES_BP2) + 10] = (uint8_t) ((cross_re*127.5) + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
563 lfr_bp2[i*NB_BYTES_BP2+20] = (uint8_t) (cross_im*127.5 + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
605 lfr_bp2[(i*NB_BYTES_BP2) + 20] = (uint8_t) ((cross_im*127.5) + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
564 #ifdef DEBUG_TCH
606 #ifdef DEBUG_TCH
565 printf("\nBin number: %d\n", i);
607 printf("\nBin number: %d\n", i);
566 printf("lfr_bp2[i*NB_BYTES_BP2+10] for cross12_re (%16.8e) : %.3u\n",cross_re, lfr_bp2[i*NB_BYTES_BP2+10]);
608 printf("lfr_bp2[i*NB_BYTES_BP2+10] for cross12_re (%16.8e) : %.3u\n",cross_re, lfr_bp2[i*NB_BYTES_BP2+10]);
567 printf("lfr_bp2[i*NB_BYTES_BP2+20] for cross12_im (%16.8e) : %.3u\n",cross_im, lfr_bp2[i*NB_BYTES_BP2+20]);
609 printf("lfr_bp2[i*NB_BYTES_BP2+20] for cross12_im (%16.8e) : %.3u\n",cross_im, lfr_bp2[i*NB_BYTES_BP2+20]);
568 #endif
610 #endif
569 // S13
611 // S13
570 aux = sqrt(compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX]*compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+16]);
612 aux = sqrt(compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX] * compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 16]);
571 if (aux != 0.) { // no division by 0.
613 if (aux != 0.) { // no division by 0.
572 cross_re = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+3] / aux;
614 cross_re = compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 3] / aux;
573 cross_im = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+4] / aux;
615 cross_im = compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 4] / aux;
574 }
616 }
575 else
617 else
576 {
618 {
577 cross_re = 0.;
619 cross_re = 0.;
578 cross_im = 0.;
620 cross_im = 0.;
579 }
621 }
580 lfr_bp2[i*NB_BYTES_BP2+11] = (uint8_t) (cross_re*127.5 + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
622 lfr_bp2[(i*NB_BYTES_BP2) + 11] = (uint8_t) ((cross_re*127.5) + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
581 lfr_bp2[i*NB_BYTES_BP2+21] = (uint8_t) (cross_im*127.5 + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
623 lfr_bp2[(i*NB_BYTES_BP2) + 21] = (uint8_t) ((cross_im*127.5) + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
582 #ifdef DEBUG_TCH
624 #ifdef DEBUG_TCH
583 printf("lfr_bp2[i*NB_BYTES_BP2+11] for cross13_re (%16.8e) : %.3u\n",cross_re, lfr_bp2[i*NB_BYTES_BP2+11]);
625 printf("lfr_bp2[i*NB_BYTES_BP2+11] for cross13_re (%16.8e) : %.3u\n",cross_re, lfr_bp2[i*NB_BYTES_BP2+11]);
584 printf("lfr_bp2[i*NB_BYTES_BP2+21] for cross13_im (%16.8e) : %.3u\n",cross_im, lfr_bp2[i*NB_BYTES_BP2+21]);
626 printf("lfr_bp2[i*NB_BYTES_BP2+21] for cross13_im (%16.8e) : %.3u\n",cross_im, lfr_bp2[i*NB_BYTES_BP2+21]);
585 #endif
627 #endif
586 // S14
628 // S14
587 aux = sqrt(compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX]*compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+21]);
629 aux = sqrt(compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX] * compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 21]);
588 if (aux != 0.) { // no division by 0.
630 if (aux != 0.) { // no division by 0.
589 cross_re = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+5] / aux;
631 cross_re = compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 5] / aux;
590 cross_im = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+6] / aux;
632 cross_im = compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 6] / aux;
591 }
633 }
592 else
634 else
593 {
635 {
594 cross_re = 0.;
636 cross_re = 0.;
595 cross_im = 0.;
637 cross_im = 0.;
596 }
638 }
597 lfr_bp2[i*NB_BYTES_BP2+12] = (uint8_t) (cross_re*127.5 + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
639 lfr_bp2[(i*NB_BYTES_BP2) + 12] = (uint8_t) ((cross_re*127.5) + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
598 lfr_bp2[i*NB_BYTES_BP2+22] = (uint8_t) (cross_im*127.5 + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
640 lfr_bp2[(i*NB_BYTES_BP2) + 22] = (uint8_t) ((cross_im*127.5) + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
599 #ifdef DEBUG_TCH
641 #ifdef DEBUG_TCH
600 printf("lfr_bp2[i*NB_BYTES_BP2+12] for cross14_re (%16.8e) : %.3u\n",cross_re, lfr_bp2[i*NB_BYTES_BP2+12]);
642 printf("lfr_bp2[i*NB_BYTES_BP2+12] for cross14_re (%16.8e) : %.3u\n",cross_re, lfr_bp2[i*NB_BYTES_BP2+12]);
601 printf("lfr_bp2[i*NB_BYTES_BP2+22] for cross14_im (%16.8e) : %.3u\n",cross_im, lfr_bp2[i*NB_BYTES_BP2+22]);
643 printf("lfr_bp2[i*NB_BYTES_BP2+22] for cross14_im (%16.8e) : %.3u\n",cross_im, lfr_bp2[i*NB_BYTES_BP2+22]);
602 #endif
644 #endif
603 // S15
645 // S15
604 aux = sqrt(compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX]*compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+24]);
646 aux = sqrt(compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX] * compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 24]);
605 if (aux != 0.) { // no division by 0.
647 if (aux != 0.) { // no division by 0.
606 cross_re = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+7] / aux;
648 cross_re = compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 7] / aux;
607 cross_im = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+8] / aux;
649 cross_im = compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 8] / aux;
608 }
650 }
609 else
651 else
610 {
652 {
611 cross_re = 0.;
653 cross_re = 0.;
612 cross_im = 0.;
654 cross_im = 0.;
613 }
655 }
614 lfr_bp2[i*NB_BYTES_BP2+13] = (uint8_t) (cross_re*127.5 + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
656 lfr_bp2[(i*NB_BYTES_BP2) + 13] = (uint8_t) ((cross_re*127.5) + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
615 lfr_bp2[i*NB_BYTES_BP2+23] = (uint8_t) (cross_im*127.5 + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
657 lfr_bp2[(i*NB_BYTES_BP2) + 23] = (uint8_t) ((cross_im*127.5) + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
616 #ifdef DEBUG_TCH
658 #ifdef DEBUG_TCH
617 printf("lfr_bp2[i*NB_BYTES_BP2+13] for cross15_re (%16.8e) : %.3u\n",cross_re, lfr_bp2[i*NB_BYTES_BP2+13]);
659 printf("lfr_bp2[i*NB_BYTES_BP2+13] for cross15_re (%16.8e) : %.3u\n",cross_re, lfr_bp2[i*NB_BYTES_BP2+13]);
618 printf("lfr_bp2[i*NB_BYTES_BP2+23] for cross15_im (%16.8e) : %.3u\n",cross_im, lfr_bp2[i*NB_BYTES_BP2+23]);
660 printf("lfr_bp2[i*NB_BYTES_BP2+23] for cross15_im (%16.8e) : %.3u\n",cross_im, lfr_bp2[i*NB_BYTES_BP2+23]);
619 #endif
661 #endif
620 // S23
662 // S23
621 aux = sqrt(compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+9]*compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+16]);
663 aux = sqrt(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 9] * compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 16]);
622 if (aux != 0.) { // no division by 0.
664 if (aux != 0.) { // no division by 0.
623 cross_re = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+10] / aux;
665 cross_re = compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 10] / aux;
624 cross_im = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+11] / aux;
666 cross_im = compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 11] / aux;
625 }
667 }
626 else
668 else
627 {
669 {
628 cross_re = 0.;
670 cross_re = 0.;
629 cross_im = 0.;
671 cross_im = 0.;
630 }
672 }
631 lfr_bp2[i*NB_BYTES_BP2+14] = (uint8_t) (cross_re*127.5 + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
673 lfr_bp2[(i*NB_BYTES_BP2) + 14] = (uint8_t) ((cross_re*127.5) + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
632 lfr_bp2[i*NB_BYTES_BP2+24] = (uint8_t) (cross_im*127.5 + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
674 lfr_bp2[(i*NB_BYTES_BP2) + 24] = (uint8_t) ((cross_im*127.5) + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
633 #ifdef DEBUG_TCH
675 #ifdef DEBUG_TCH
634 printf("lfr_bp2[i*NB_BYTES_BP2+14] for cross23_re (%16.8e) : %.3u\n",cross_re, lfr_bp2[i*NB_BYTES_BP2+14]);
676 printf("lfr_bp2[i*NB_BYTES_BP2+14] for cross23_re (%16.8e) : %.3u\n",cross_re, lfr_bp2[i*NB_BYTES_BP2+14]);
635 printf("lfr_bp2[i*NB_BYTES_BP2+24] for cross23_im (%16.8e) : %.3u\n",cross_im, lfr_bp2[i*NB_BYTES_BP2+24]);
677 printf("lfr_bp2[i*NB_BYTES_BP2+24] for cross23_im (%16.8e) : %.3u\n",cross_im, lfr_bp2[i*NB_BYTES_BP2+24]);
636 #endif
678 #endif
637 // S24
679 // S24
638 aux = sqrt(compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+9]*compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+21]);
680 aux = sqrt(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 9] * compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 21]);
639 if (aux != 0.) { // no division by 0.
681 if (aux != 0.) { // no division by 0.
640 cross_re = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+12] / aux;
682 cross_re = compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 12] / aux;
641 cross_im = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+13] / aux;
683 cross_im = compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 13] / aux;
642 }
684 }
643 else
685 else
644 {
686 {
645 cross_re = 0.;
687 cross_re = 0.;
646 cross_im = 0.;
688 cross_im = 0.;
647 }
689 }
648 lfr_bp2[i*NB_BYTES_BP2+15] = (uint8_t) (cross_re*127.5 + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
690 lfr_bp2[(i*NB_BYTES_BP2) + 15] = (uint8_t) ((cross_re*127.5) + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
649 lfr_bp2[i*NB_BYTES_BP2+25] = (uint8_t) (cross_im*127.5 + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
691 lfr_bp2[(i*NB_BYTES_BP2) + 25] = (uint8_t) ((cross_im*127.5) + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
650 #ifdef DEBUG_TCH
692 #ifdef DEBUG_TCH
651 printf("lfr_bp2[i*NB_BYTES_BP2+15] for cross24_re (%16.8e) : %.3u\n",cross_re, lfr_bp2[i*NB_BYTES_BP2+15]);
693 printf("lfr_bp2[i*NB_BYTES_BP2+15] for cross24_re (%16.8e) : %.3u\n",cross_re, lfr_bp2[i*NB_BYTES_BP2+15]);
652 printf("lfr_bp2[i*NB_BYTES_BP2+25] for cross24_im (%16.8e) : %.3u\n",cross_im, lfr_bp2[i*NB_BYTES_BP2+25]);
694 printf("lfr_bp2[i*NB_BYTES_BP2+25] for cross24_im (%16.8e) : %.3u\n",cross_im, lfr_bp2[i*NB_BYTES_BP2+25]);
653 #endif
695 #endif
654 // S25
696 // S25
655 aux = sqrt(compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+9]*compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+24]);
697 aux = sqrt(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 9] * compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 24]);
656 if (aux != 0.) { // no division by 0.
698 if (aux != 0.) { // no division by 0.
657 cross_re = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+14] / aux;
699 cross_re = compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 14] / aux;
658 cross_im = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+15] / aux;
700 cross_im = compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 15] / aux;
659 }
701 }
660 else
702 else
661 {
703 {
662 cross_re = 0.;
704 cross_re = 0.;
663 cross_im = 0.;
705 cross_im = 0.;
664 }
706 }
665 lfr_bp2[i*NB_BYTES_BP2+16] = (uint8_t) (cross_re*127.5 + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
707 lfr_bp2[(i*NB_BYTES_BP2) + 16] = (uint8_t) ((cross_re*127.5) + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
666 lfr_bp2[i*NB_BYTES_BP2+26] = (uint8_t) (cross_im*127.5 + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
708 lfr_bp2[(i*NB_BYTES_BP2) + 26] = (uint8_t) ((cross_im*127.5) + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
667 #ifdef DEBUG_TCH
709 #ifdef DEBUG_TCH
668 printf("lfr_bp2[i*NB_BYTES_BP2+16] for cross25_re (%16.8e) : %.3u\n",cross_re, lfr_bp2[i*NB_BYTES_BP2+16]);
710 printf("lfr_bp2[i*NB_BYTES_BP2+16] for cross25_re (%16.8e) : %.3u\n",cross_re, lfr_bp2[i*NB_BYTES_BP2+16]);
669 printf("lfr_bp2[i*NB_BYTES_BP2+26] for cross25_im (%16.8e) : %.3u\n",cross_im, lfr_bp2[i*NB_BYTES_BP2+26]);
711 printf("lfr_bp2[i*NB_BYTES_BP2+26] for cross25_im (%16.8e) : %.3u\n",cross_im, lfr_bp2[i*NB_BYTES_BP2+26]);
670 #endif
712 #endif
671 // S34
713 // S34
672 aux = sqrt(compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+16]*compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+21]);
714 aux = sqrt(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 16] * compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 21]);
673 if (aux != 0.) { // no division by 0.
715 if (aux != 0.) { // no division by 0.
674 cross_re = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+17] / aux;
716 cross_re = compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 17] / aux;
675 cross_im = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+18] / aux;
717 cross_im = compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 18] / aux;
676 }
718 }
677 else
719 else
678 {
720 {
679 cross_re = 0.;
721 cross_re = 0.;
680 cross_im = 0.;
722 cross_im = 0.;
681 }
723 }
682 lfr_bp2[i*NB_BYTES_BP2+17] = (uint8_t) (cross_re*127.5 + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
724 lfr_bp2[(i*NB_BYTES_BP2) + 17] = (uint8_t) ((cross_re*127.5) + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
683 lfr_bp2[i*NB_BYTES_BP2+27] = (uint8_t) (cross_im*127.5 + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
725 lfr_bp2[(i*NB_BYTES_BP2) + 27] = (uint8_t) ((cross_im*127.5) + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
684 #ifdef DEBUG_TCH
726 #ifdef DEBUG_TCH
685 printf("lfr_bp2[i*NB_BYTES_BP2+17] for cross34_re (%16.8e) : %.3u\n",cross_re, lfr_bp2[i*NB_BYTES_BP2+17]);
727 printf("lfr_bp2[i*NB_BYTES_BP2+17] for cross34_re (%16.8e) : %.3u\n",cross_re, lfr_bp2[i*NB_BYTES_BP2+17]);
686 printf("lfr_bp2[i*NB_BYTES_BP2+27] for cross34_im (%16.8e) : %.3u\n",cross_im, lfr_bp2[i*NB_BYTES_BP2+27]);
728 printf("lfr_bp2[i*NB_BYTES_BP2+27] for cross34_im (%16.8e) : %.3u\n",cross_im, lfr_bp2[i*NB_BYTES_BP2+27]);
687 #endif
729 #endif
688 // S35
730 // S35
689 aux = sqrt(compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+16]*compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+24]);
731 aux = sqrt(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 16] * compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 24]);
690 if (aux != 0.) { // no division by 0.
732 if (aux != 0.) { // no division by 0.
691 cross_re = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+19] / aux;
733 cross_re = compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 19] / aux;
692 cross_im = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+20] / aux;
734 cross_im = compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 20] / aux;
693 }
735 }
694 else
736 else
695 {
737 {
696 cross_re = 0.;
738 cross_re = 0.;
697 cross_im = 0.;
739 cross_im = 0.;
698 }
740 }
699 lfr_bp2[i*NB_BYTES_BP2+18] = (uint8_t) (cross_re*127.5 + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
741 lfr_bp2[(i*NB_BYTES_BP2) + 18] = (uint8_t) ((cross_re*127.5) + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
700 lfr_bp2[i*NB_BYTES_BP2+28] = (uint8_t) (cross_im*127.5 + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
742 lfr_bp2[(i*NB_BYTES_BP2) + 28] = (uint8_t) ((cross_im*127.5) + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
701 #ifdef DEBUG_TCH
743 #ifdef DEBUG_TCH
702 printf("lfr_bp2[i*NB_BYTES_BP2+18] for cross35_re (%16.8e) : %.3u\n",cross_re, lfr_bp2[i*NB_BYTES_BP2+18]);
744 printf("lfr_bp2[i*NB_BYTES_BP2+18] for cross35_re (%16.8e) : %.3u\n",cross_re, lfr_bp2[i*NB_BYTES_BP2+18]);
703 printf("lfr_bp2[i*NB_BYTES_BP2+28] for cross35_im (%16.8e) : %.3u\n",cross_im, lfr_bp2[i*NB_BYTES_BP2+28]);
745 printf("lfr_bp2[i*NB_BYTES_BP2+28] for cross35_im (%16.8e) : %.3u\n",cross_im, lfr_bp2[i*NB_BYTES_BP2+28]);
704 #endif
746 #endif
705 // S45
747 // S45
706 aux = sqrt(compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+21]*compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+24]);
748 aux = sqrt(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 21]*compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 24]);
707 if (aux != 0.) { // no division by 0.
749 if (aux != 0.) { // no division by 0.
708 cross_re = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+22] / aux;
750 cross_re = compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 22] / aux;
709 cross_im = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+23] / aux;
751 cross_im = compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 23] / aux;
710 }
752 }
711 else
753 else
712 {
754 {
713 cross_re = 0.;
755 cross_re = 0.;
714 cross_im = 0.;
756 cross_im = 0.;
715 }
757 }
716 lfr_bp2[i*NB_BYTES_BP2+19] = (uint8_t) (cross_re*127.5 + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
758 lfr_bp2[(i*NB_BYTES_BP2) + 19] = (uint8_t) ((cross_re*127.5) + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
717 lfr_bp2[i*NB_BYTES_BP2+29] = (uint8_t) (cross_im*127.5 + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
759 lfr_bp2[(i*NB_BYTES_BP2) + 29] = (uint8_t) ((cross_im*127.5) + 128); // Shift and cast into a 8-bit uint8_t (0, ..., 255) with rounding
718 #ifdef DEBUG_TCH
760 #ifdef DEBUG_TCH
719 printf("lfr_bp2[i*NB_BYTES_BP2+19] for cross45_re (%16.8e) : %.3u\n",cross_re, lfr_bp2[i*NB_BYTES_BP2+19]);
761 printf("lfr_bp2[i*NB_BYTES_BP2+19] for cross45_re (%16.8e) : %.3u\n",cross_re, lfr_bp2[i*NB_BYTES_BP2+19]);
720 printf("lfr_bp2[i*NB_BYTES_BP2+29] for cross45_im (%16.8e) : %.3u\n",cross_im, lfr_bp2[i*NB_BYTES_BP2+29]);
762 printf("lfr_bp2[i*NB_BYTES_BP2+29] for cross45_im (%16.8e) : %.3u\n",cross_im, lfr_bp2[i*NB_BYTES_BP2+29]);
@@ -747,7 +789,7 void BP2_set( float * compressed_spec_ma
747 significand = 0.5; // min value that can be recorded
789 significand = 0.5; // min value that can be recorded
748 }
790 }
749
791
750 autocor = (uint16_t) ((significand*2-1)*rangesig + 0.5); // Shift and cast into a 16-bit unsigned int with rounding
792 autocor = (uint16_t) ((((significand*2)-1)*rangesig) + 0.5); // Shift and cast into a 16-bit unsigned int with rounding
751 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
793 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
752 exp = (uint16_t) (exponent-expmin); // Shift and cast into a 16-bit unsigned int where just
794 exp = (uint16_t) (exponent-expmin); // Shift and cast into a 16-bit unsigned int where just
753 // the first nbitexp bits are used (0, ..., 2^nbitexp-1)
795 // the first nbitexp bits are used (0, ..., 2^nbitexp-1)
@@ -756,12 +798,12 void BP2_set( float * compressed_spec_ma
756 // making the 16-bit word to be recorded
798 // making the 16-bit word to be recorded
757 pt_uint8 = (uint8_t*) &tmp_uint16; // Affect an uint8_t pointer with the adress of tmp_uint16
799 pt_uint8 = (uint8_t*) &tmp_uint16; // Affect an uint8_t pointer with the adress of tmp_uint16
758 #ifdef MSB_FIRST_TCH
800 #ifdef MSB_FIRST_TCH
759 lfr_bp2[i*NB_BYTES_BP2+0] = pt_uint8[0]; // Record MSB of tmp_uint16
801 lfr_bp2[(i*NB_BYTES_BP2) + 0] = pt_uint8[0]; // Record MSB of tmp_uint16
760 lfr_bp2[i*NB_BYTES_BP2+1] = pt_uint8[1]; // Record LSB of tmp_uint16
802 lfr_bp2[(i*NB_BYTES_BP2) + 1] = pt_uint8[1]; // Record LSB of tmp_uint16
761 #endif
803 #endif
762 #ifdef LSB_FIRST_TCH
804 #ifdef LSB_FIRST_TCH
763 lfr_bp2[i*NB_BYTES_BP2+0] = pt_uint8[1]; // Record MSB of tmp_uint16
805 lfr_bp2[(i*NB_BYTES_BP2) + 0] = pt_uint8[1]; // Record MSB of tmp_uint16
764 lfr_bp2[i*NB_BYTES_BP2+1] = pt_uint8[0]; // Record LSB of tmp_uint16
806 lfr_bp2[(i*NB_BYTES_BP2) + 1] = pt_uint8[0]; // Record LSB of tmp_uint16
765 #endif
807 #endif
766 #ifdef DEBUG_TCH
808 #ifdef DEBUG_TCH
767 printf("autocor for S11 significand : %u\n",autocor);
809 printf("autocor for S11 significand : %u\n",autocor);
@@ -772,7 +814,7 void BP2_set( float * compressed_spec_ma
772 printf("lfr_bp2[i*NB_BYTES_BP2+1] : %3u or %2x\n",lfr_bp2[i*NB_BYTES_BP2+1], lfr_bp2[i*NB_BYTES_BP2+1]);
814 printf("lfr_bp2[i*NB_BYTES_BP2+1] : %3u or %2x\n",lfr_bp2[i*NB_BYTES_BP2+1], lfr_bp2[i*NB_BYTES_BP2+1]);
773 #endif
815 #endif
774 // S22
816 // S22
775 significand = frexpf(compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+9], &exponent); // 0.5 <= significand < 1
817 significand = frexpf(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 9], &exponent); // 0.5 <= significand < 1
776 // S22 = significand * 2^exponent
818 // S22 = significand * 2^exponent
777 #ifdef DEBUG_TCH
819 #ifdef DEBUG_TCH
778 printf("S22 : %16.8e\n",compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+9]);
820 printf("S22 : %16.8e\n",compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+9]);
@@ -792,7 +834,7 void BP2_set( float * compressed_spec_ma
792 significand = 0.5; // min value that can be recorded
834 significand = 0.5; // min value that can be recorded
793 }
835 }
794
836
795 autocor = (uint16_t) ((significand*2-1)*rangesig + 0.5); // Shift and cast into a 16-bit unsigned int with rounding
837 autocor = (uint16_t) ((((significand*2)-1)*rangesig) + 0.5); // Shift and cast into a 16-bit unsigned int with rounding
796 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
838 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
797 exp = (uint16_t) (exponent-expmin); // Shift and cast into a 16-bit unsigned int where just
839 exp = (uint16_t) (exponent-expmin); // Shift and cast into a 16-bit unsigned int where just
798 // the first nbitexp bits are used (0, ..., 2^nbitexp-1)
840 // the first nbitexp bits are used (0, ..., 2^nbitexp-1)
@@ -801,12 +843,12 void BP2_set( float * compressed_spec_ma
801 // making the 16-bit word to be recorded
843 // making the 16-bit word to be recorded
802 pt_uint8 = (uint8_t*) &tmp_uint16; // Affect an uint8_t pointer with the adress of tmp_uint16
844 pt_uint8 = (uint8_t*) &tmp_uint16; // Affect an uint8_t pointer with the adress of tmp_uint16
803 #ifdef MSB_FIRST_TCH
845 #ifdef MSB_FIRST_TCH
804 lfr_bp2[i*NB_BYTES_BP2+2] = pt_uint8[0]; // Record MSB of tmp_uint16
846 lfr_bp2[(i*NB_BYTES_BP2) + 2] = pt_uint8[0]; // Record MSB of tmp_uint16
805 lfr_bp2[i*NB_BYTES_BP2+3] = pt_uint8[1]; // Record LSB of tmp_uint16
847 lfr_bp2[(i*NB_BYTES_BP2) + 3] = pt_uint8[1]; // Record LSB of tmp_uint16
806 #endif
848 #endif
807 #ifdef LSB_FIRST_TCH
849 #ifdef LSB_FIRST_TCH
808 lfr_bp2[i*NB_BYTES_BP2+2] = pt_uint8[1]; // Record MSB of tmp_uint16
850 lfr_bp2[(i*NB_BYTES_BP2) + 2] = pt_uint8[1]; // Record MSB of tmp_uint16
809 lfr_bp2[i*NB_BYTES_BP2+3] = pt_uint8[0]; // Record LSB of tmp_uint16
851 lfr_bp2[(i*NB_BYTES_BP2) + 3] = pt_uint8[0]; // Record LSB of tmp_uint16
810 #endif
852 #endif
811 #ifdef DEBUG_TCH
853 #ifdef DEBUG_TCH
812 printf("autocor for S22 significand : %u\n",autocor);
854 printf("autocor for S22 significand : %u\n",autocor);
@@ -817,7 +859,7 void BP2_set( float * compressed_spec_ma
817 printf("lfr_bp2[i*NB_BYTES_BP2+3] : %3u or %2x\n",lfr_bp2[i*NB_BYTES_BP2+3], lfr_bp2[i*NB_BYTES_BP2+3]);
859 printf("lfr_bp2[i*NB_BYTES_BP2+3] : %3u or %2x\n",lfr_bp2[i*NB_BYTES_BP2+3], lfr_bp2[i*NB_BYTES_BP2+3]);
818 #endif
860 #endif
819 // S33
861 // S33
820 significand = frexpf(compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+16], &exponent); // 0.5 <= significand < 1
862 significand = frexpf(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 16], &exponent); // 0.5 <= significand < 1
821 // S33 = significand * 2^exponent
863 // S33 = significand * 2^exponent
822 #ifdef DEBUG_TCH
864 #ifdef DEBUG_TCH
823 printf("S33 : %16.8e\n",compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+16]);
865 printf("S33 : %16.8e\n",compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+16]);
@@ -837,7 +879,7 void BP2_set( float * compressed_spec_ma
837 significand = 0.5; // min value that can be recorded
879 significand = 0.5; // min value that can be recorded
838 }
880 }
839
881
840 autocor = (uint16_t) ((significand*2-1)*rangesig + 0.5); // Shift and cast into a 16-bit unsigned int with rounding
882 autocor = (uint16_t) ((((significand*2)-1)*rangesig) + 0.5); // Shift and cast into a 16-bit unsigned int with rounding
841 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
883 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
842 exp = (uint16_t) (exponent-expmin); // Shift and cast into a 16-bit unsigned int where just
884 exp = (uint16_t) (exponent-expmin); // Shift and cast into a 16-bit unsigned int where just
843 // the first nbitexp bits are used (0, ..., 2^nbitexp-1)
885 // the first nbitexp bits are used (0, ..., 2^nbitexp-1)
@@ -846,12 +888,12 void BP2_set( float * compressed_spec_ma
846 // making the 16-bit word to be recorded
888 // making the 16-bit word to be recorded
847 pt_uint8 = (uint8_t*) &tmp_uint16; // Affect an uint8_t pointer with the adress of tmp_uint16
889 pt_uint8 = (uint8_t*) &tmp_uint16; // Affect an uint8_t pointer with the adress of tmp_uint16
848 #ifdef MSB_FIRST_TCH
890 #ifdef MSB_FIRST_TCH
849 lfr_bp2[i*NB_BYTES_BP2+4] = pt_uint8[0]; // Record MSB of tmp_uint16
891 lfr_bp2[(i*NB_BYTES_BP2) + 4] = pt_uint8[0]; // Record MSB of tmp_uint16
850 lfr_bp2[i*NB_BYTES_BP2+5] = pt_uint8[1]; // Record LSB of tmp_uint16
892 lfr_bp2[(i*NB_BYTES_BP2) + 5] = pt_uint8[1]; // Record LSB of tmp_uint16
851 #endif
893 #endif
852 #ifdef LSB_FIRST_TCH
894 #ifdef LSB_FIRST_TCH
853 lfr_bp2[i*NB_BYTES_BP2+4] = pt_uint8[1]; // Record MSB of tmp_uint16
895 lfr_bp2[(i*NB_BYTES_BP2) + 4] = pt_uint8[1]; // Record MSB of tmp_uint16
854 lfr_bp2[i*NB_BYTES_BP2+5] = pt_uint8[0]; // Record LSB of tmp_uint16
896 lfr_bp2[(i*NB_BYTES_BP2) + 5] = pt_uint8[0]; // Record LSB of tmp_uint16
855 #endif
897 #endif
856 #ifdef DEBUG_TCH
898 #ifdef DEBUG_TCH
857 printf("autocor for S33 significand : %u\n",autocor);
899 printf("autocor for S33 significand : %u\n",autocor);
@@ -862,7 +904,7 void BP2_set( float * compressed_spec_ma
862 printf("lfr_bp2[i*NB_BYTES_BP2+5] : %3u or %2x\n",lfr_bp2[i*NB_BYTES_BP2+5], lfr_bp2[i*NB_BYTES_BP2+5]);
904 printf("lfr_bp2[i*NB_BYTES_BP2+5] : %3u or %2x\n",lfr_bp2[i*NB_BYTES_BP2+5], lfr_bp2[i*NB_BYTES_BP2+5]);
863 #endif
905 #endif
864 // S44
906 // S44
865 significand = frexpf(compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+21], &exponent); // 0.5 <= significand < 1
907 significand = frexpf(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 21], &exponent); // 0.5 <= significand < 1
866 // S44 = significand * 2^exponent
908 // S44 = significand * 2^exponent
867 #ifdef DEBUG_TCH
909 #ifdef DEBUG_TCH
868 printf("S44 : %16.8e\n",compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+21]);
910 printf("S44 : %16.8e\n",compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+21]);
@@ -883,7 +925,7 void BP2_set( float * compressed_spec_ma
883 significand = 0.5; // min value that can be recorded
925 significand = 0.5; // min value that can be recorded
884 }
926 }
885
927
886 autocor = (uint16_t) ((significand*2-1)*rangesig + 0.5); // Shift and cast into a 16-bit unsigned int with rounding
928 autocor = (uint16_t) ((((significand*2)-1)*rangesig )+ 0.5); // Shift and cast into a 16-bit unsigned int with rounding
887 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
929 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
888 exp = (uint16_t) (exponent-expmin); // Shift and cast into a 16-bit unsigned int where just
930 exp = (uint16_t) (exponent-expmin); // Shift and cast into a 16-bit unsigned int where just
889 // the first nbitexp bits are used (0, ..., 2^nbitexp-1)
931 // the first nbitexp bits are used (0, ..., 2^nbitexp-1)
@@ -892,12 +934,12 void BP2_set( float * compressed_spec_ma
892 // making the 16-bit word to be recorded
934 // making the 16-bit word to be recorded
893 pt_uint8 = (uint8_t*) &tmp_uint16; // Affect an uint8_t pointer with the adress of tmp_uint16
935 pt_uint8 = (uint8_t*) &tmp_uint16; // Affect an uint8_t pointer with the adress of tmp_uint16
894 #ifdef MSB_FIRST_TCH
936 #ifdef MSB_FIRST_TCH
895 lfr_bp2[i*NB_BYTES_BP2+6] = pt_uint8[0]; // Record MSB of tmp_uint16
937 lfr_bp2[(i*NB_BYTES_BP2) + 6] = pt_uint8[0]; // Record MSB of tmp_uint16
896 lfr_bp2[i*NB_BYTES_BP2+7] = pt_uint8[1]; // Record LSB of tmp_uint16
938 lfr_bp2[(i*NB_BYTES_BP2) + 7] = pt_uint8[1]; // Record LSB of tmp_uint16
897 #endif
939 #endif
898 #ifdef LSB_FIRST_TCH
940 #ifdef LSB_FIRST_TCH
899 lfr_bp2[i*NB_BYTES_BP2+6] = pt_uint8[1]; // Record MSB of tmp_uint16
941 lfr_bp2[(i*NB_BYTES_BP2) + 6] = pt_uint8[1]; // Record MSB of tmp_uint16
900 lfr_bp2[i*NB_BYTES_BP2+7] = pt_uint8[0]; // Record LSB of tmp_uint16
942 lfr_bp2[(i*NB_BYTES_BP2) + 7] = pt_uint8[0]; // Record LSB of tmp_uint16
901 #endif
943 #endif
902 #ifdef DEBUG_TCH
944 #ifdef DEBUG_TCH
903 printf("autocor for S44 significand : %u\n",autocor);
945 printf("autocor for S44 significand : %u\n",autocor);
@@ -908,7 +950,7 void BP2_set( float * compressed_spec_ma
908 printf("lfr_bp2[i*NB_BYTES_BP2+7] : %3u or %2x\n",lfr_bp2[i*NB_BYTES_BP2+7], lfr_bp2[i*NB_BYTES_BP2+7]);
950 printf("lfr_bp2[i*NB_BYTES_BP2+7] : %3u or %2x\n",lfr_bp2[i*NB_BYTES_BP2+7], lfr_bp2[i*NB_BYTES_BP2+7]);
909 #endif
951 #endif
910 // S55
952 // S55
911 significand = frexpf(compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+24], &exponent); // 0.5 <= significand < 1
953 significand = frexpf(compressed_spec_mat[(i*NB_VALUES_PER_SPECTRAL_MATRIX) + 24], &exponent); // 0.5 <= significand < 1
912 // S55 = significand * 2^exponent
954 // S55 = significand * 2^exponent
913 #ifdef DEBUG_TCH
955 #ifdef DEBUG_TCH
914 printf("S55 : %16.8e\n",compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+24]);
956 printf("S55 : %16.8e\n",compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+24]);
@@ -928,7 +970,7 void BP2_set( float * compressed_spec_ma
928 significand = 0.5; // min value that can be recorded
970 significand = 0.5; // min value that can be recorded
929 }
971 }
930
972
931 autocor = (uint16_t) ((significand*2-1)*rangesig + 0.5); // Shift and cast into a 16-bit unsigned int with rounding
973 autocor = (uint16_t) ((((significand*2)-1)*rangesig) + 0.5); // Shift and cast into a 16-bit unsigned int with rounding
932 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
974 // where just the first nbitsig bits are used (0, ..., 2^nbitsig-1)
933 exp = (uint16_t) (exponent-expmin); // Shift and cast into a 16-bit unsigned int where just
975 exp = (uint16_t) (exponent-expmin); // Shift and cast into a 16-bit unsigned int where just
934 // the first nbitexp bits are used (0, ..., 2^nbitexp-1)
976 // the first nbitexp bits are used (0, ..., 2^nbitexp-1)
@@ -937,13 +979,13 void BP2_set( float * compressed_spec_ma
937 // making the 16-bit word to be recorded
979 // making the 16-bit word to be recorded
938 pt_uint8 = (uint8_t*) &tmp_uint16; // Affect an uint8_t pointer with the adress of tmp_uint16
980 pt_uint8 = (uint8_t*) &tmp_uint16; // Affect an uint8_t pointer with the adress of tmp_uint16
939 #ifdef MSB_FIRST_TCH
981 #ifdef MSB_FIRST_TCH
940 lfr_bp2[i*NB_BYTES_BP2+8] = pt_uint8[0]; // Record MSB of tmp_uint16
982 lfr_bp2[(i*NB_BYTES_BP2) + 8] = pt_uint8[0]; // Record MSB of tmp_uint16
941 lfr_bp2[i*NB_BYTES_BP2+9] = pt_uint8[1]; // Record LSB of tmp_uint16
983 lfr_bp2[(i*NB_BYTES_BP2) + 9] = pt_uint8[1]; // Record LSB of tmp_uint16
942 //printf("MSB:\n");
984 //printf("MSB:\n");
943 #endif
985 #endif
944 #ifdef LSB_FIRST_TCH
986 #ifdef LSB_FIRST_TCH
945 lfr_bp2[i*NB_BYTES_BP2+8] = pt_uint8[1]; // Record MSB of tmp_uint16
987 lfr_bp2[(i*NB_BYTES_BP2) + 8] = pt_uint8[1]; // Record MSB of tmp_uint16
946 lfr_bp2[i*NB_BYTES_BP2+9] = pt_uint8[0]; // Record LSB of tmp_uint16
988 lfr_bp2[(i*NB_BYTES_BP2) + 9] = pt_uint8[0]; // Record LSB of tmp_uint16
947 //printf("LSB:\n");
989 //printf("LSB:\n");
948 #endif
990 #endif
949 #ifdef DEBUG_TCH
991 #ifdef DEBUG_TCH
@@ -9,6 +9,33
9 // version 2.1: 22/06/2015 (modifs de Paul)
9 // version 2.1: 22/06/2015 (modifs de Paul)
10 // version 2.2: 23/06/2015 (modifs de l'ordre de déclaration/définition de init_k_coefficients dans basic_parameters.c ... + maintien des declarations dans le .h)
10 // version 2.2: 23/06/2015 (modifs de l'ordre de déclaration/définition de init_k_coefficients dans basic_parameters.c ... + maintien des declarations dans le .h)
11 // version 2.3: 01/07/2015 (affectation initiale des octets 7 et 9 dans les BP1 corrigée ...)
11 // version 2.3: 01/07/2015 (affectation initiale des octets 7 et 9 dans les BP1 corrigée ...)
12 // version 2.4: 05/10/2018 (added GPL headers)
13 // version 2.5: 09/10/2018 (dans main.c #include "basic_parameters_utilities.h" est changé par les déclarations extern correspondantes ...!
14 // + delta mise en conformité LOGISCOPE)
15
16 /*------------------------------------------------------------------------------
17 -- Solar Orbiter's Low Frequency Receiver Flight Software (LFR FSW),
18 -- This file is a part of the LFR FSW
19 -- Copyright (C) 2012-2018, Plasma Physics Laboratory - CNRS
20 --
21 -- This program is free software; you can redistribute it and/or modify
22 -- it under the terms of the GNU General Public License as published by
23 -- the Free Software Foundation; either version 2 of the License, or
24 -- (at your option) any later version.
25 --
26 -- This program is distributed in the hope that it will be useful,
27 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
28 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 -- GNU General Public License for more details.
30 --
31 -- You should have received a copy of the GNU General Public License
32 -- along with this program; if not, write to the Free Software
33 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
34 -------------------------------------------------------------------------------*/
35 /*-- Author : Thomas Chust
36 -- Contact : Thomas Chust
37 -- Mail : thomas.chust@lpp.polytechnique.fr
38 ----------------------------------------------------------------------------*/
12
39
13 #ifndef BASIC_PARAMETERS_PARAMS_H
40 #ifndef BASIC_PARAMETERS_PARAMS_H
14 #define BASIC_PARAMETERS_PARAMS_H
41 #define BASIC_PARAMETERS_PARAMS_H
@@ -7,6 +7,33
7 // version 2.1: 22/06/2015 (modifs de Paul)
7 // version 2.1: 22/06/2015 (modifs de Paul)
8 // version 2.2: 23/06/2015 (modifs de l'ordre de déclaration/définition de init_k_coefficients dans basic_parameters.c ... + maintien des declarations dans le .h)
8 // version 2.2: 23/06/2015 (modifs de l'ordre de déclaration/définition de init_k_coefficients dans basic_parameters.c ... + maintien des declarations dans le .h)
9 // version 2.3: 01/07/2015 (affectation initiale des octets 7 et 9 dans les BP1 corrigée ...)
9 // version 2.3: 01/07/2015 (affectation initiale des octets 7 et 9 dans les BP1 corrigée ...)
10 // version 2.4: 05/10/2018 (mise en conformité LOGISCOPE)
11 // version 2.5: 09/10/2018 (dans main.c #include "basic_parameters_utilities.h" est changé par les déclarations extern correspondantes ...!
12 // + delta mise en conformité LOGISCOPE)
13
14 /*------------------------------------------------------------------------------
15 -- Solar Orbiter's Low Frequency Receiver Flight Software (LFR FSW),
16 -- This file is a part of the LFR FSW
17 -- Copyright (C) 2012-2018, Plasma Physics Laboratory - CNRS
18 --
19 -- This program is free software; you can redistribute it and/or modify
20 -- it under the terms of the GNU General Public License as published by
21 -- the Free Software Foundation; either version 2 of the License, or
22 -- (at your option) any later version.
23 --
24 -- This program is distributed in the hope that it will be useful,
25 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
26 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 -- GNU General Public License for more details.
28 --
29 -- You should have received a copy of the GNU General Public License
30 -- along with this program; if not, write to the Free Software
31 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 -------------------------------------------------------------------------------*/
33 /*-- Author : Thomas Chust
34 -- Contact : Thomas Chust
35 -- Mail : thomas.chust@lpp.polytechnique.fr
36 ----------------------------------------------------------------------------*/
10
37
11 #ifndef BASIC_PARAMETERS_UTILITIES_H
38 #ifndef BASIC_PARAMETERS_UTILITIES_H
12 #define BASIC_PARAMETERS_UTILITIES_H
39 #define BASIC_PARAMETERS_UTILITIES_H
@@ -16,12 +43,12
16
43
17 #include "basic_parameters_params.h"
44 #include "basic_parameters_params.h"
18
45
19 float compressed_spectral_matrix_f0[NB_BINS_COMPRESSED_MATRIX_f0 * NB_VALUES_PER_SPECTRAL_MATRIX];
46 float compressed_spectral_matrix_f0[NB_BINS_COMPRESSED_MATRIX_f0 * NB_VALUES_PER_SPECTRAL_MATRIX] = {0.0};
20 float k_coefficients_f0[NB_BINS_COMPRESSED_MATRIX_f0 * NB_K_COEFF_PER_BIN];
47 float k_coefficients_f0[NB_BINS_COMPRESSED_MATRIX_f0 * NB_K_COEFF_PER_BIN] = {0.0};
21 float k_coefficients_f1[NB_BINS_COMPRESSED_MATRIX_f1 * NB_K_COEFF_PER_BIN];
48 float k_coefficients_f1[NB_BINS_COMPRESSED_MATRIX_f1 * NB_K_COEFF_PER_BIN] = {0.0};
22 float k_coefficients_f2[NB_BINS_COMPRESSED_MATRIX_f2 * NB_K_COEFF_PER_BIN];
49 float k_coefficients_f2[NB_BINS_COMPRESSED_MATRIX_f2 * NB_K_COEFF_PER_BIN] = {0.0};
23
50
24 unsigned char LFR_BP1_f0[NB_BINS_COMPRESSED_MATRIX_f0*NB_BYTES_BP1];
51 unsigned char LFR_BP1_f0[NB_BINS_COMPRESSED_MATRIX_f0*NB_BYTES_BP1] = {0};
25 unsigned char LFR_BP2_f0[NB_BINS_COMPRESSED_MATRIX_f0*NB_BYTES_BP2];
52 unsigned char LFR_BP2_f0[NB_BINS_COMPRESSED_MATRIX_f0*NB_BYTES_BP2] = {0};
26
53
27 #endif // BASIC_PARAMETERS_UTILITIES_H
54 #endif // BASIC_PARAMETERS_UTILITIES_H
@@ -13,6 +13,33
13 // version 2.1: 22/06/2015 (modifs de Paul)
13 // version 2.1: 22/06/2015 (modifs de Paul)
14 // version 2.2: 23/06/2015 (modifs de l'ordre de déclaration/définition de init_k_coefficients dans basic_parameters.c ... + maintien des declarations dans le .h)
14 // version 2.2: 23/06/2015 (modifs de l'ordre de déclaration/définition de init_k_coefficients dans basic_parameters.c ... + maintien des declarations dans le .h)
15 // version 2.3: 01/07/2015 (affectation initiale des octets 7 et 9 dans les BP1 corrigée ...)
15 // version 2.3: 01/07/2015 (affectation initiale des octets 7 et 9 dans les BP1 corrigée ...)
16 // version 2.4: 05/10/2018 (added GPL headers)
17 // version 2.5: 09/10/2018 (dans main.c #include "basic_parameters_utilities.h" est changé par les déclarations extern correspondantes ...!
18 // + delta mise en conformité LOGISCOPE)
19
20 /*------------------------------------------------------------------------------
21 -- Solar Orbiter's Low Frequency Receiver Flight Software (LFR FSW),
22 -- This file is a part of the LFR FSW
23 -- Copyright (C) 2012-2018, Plasma Physics Laboratory - CNRS
24 --
25 -- This program is free software; you can redistribute it and/or modify
26 -- it under the terms of the GNU General Public License as published by
27 -- the Free Software Foundation; either version 2 of the License, or
28 -- (at your option) any later version.
29 --
30 -- This program is distributed in the hope that it will be useful,
31 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
32 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 -- GNU General Public License for more details.
34 --
35 -- You should have received a copy of the GNU General Public License
36 -- along with this program; if not, write to the Free Software
37 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
38 -------------------------------------------------------------------------------*/
39 /*-- Author : Thomas Chust
40 -- Contact : Thomas Chust
41 -- Mail : thomas.chust@lpp.polytechnique.fr
42 ----------------------------------------------------------------------------*/
16
43
17 #include "basic_parameters_utilities.h"
44 #include "basic_parameters_utilities.h"
18
45
@@ -13,6 +13,34
13 // version 2.1: 22/06/2015 (modifs de Paul)
13 // version 2.1: 22/06/2015 (modifs de Paul)
14 // version 2.2: 23/06/2015 (modifs de l'ordre de déclaration/définition de init_k_coefficients dans basic_parameters.c ... + maintien des declarations dans le .h)
14 // version 2.2: 23/06/2015 (modifs de l'ordre de déclaration/définition de init_k_coefficients dans basic_parameters.c ... + maintien des declarations dans le .h)
15 // version 2.3: 01/07/2015 (affectation initiale des octets 7 et 9 dans les BP1 corrigée ...)
15 // version 2.3: 01/07/2015 (affectation initiale des octets 7 et 9 dans les BP1 corrigée ...)
16 // version 2.4: 05/10/2018 (added GPL headers)
17 // version 2.5: 09/10/2018 (dans main.c #include "basic_parameters_utilities.h" est changé par les déclarations extern correspondantes ...!
18 // + delta mise en conformité LOGISCOPE)
19
20 /*------------------------------------------------------------------------------
21 -- Solar Orbiter's Low Frequency Receiver Flight Software (LFR FSW),
22 -- This file is a part of the LFR FSW
23 -- Copyright (C) 2012-2018, Plasma Physics Laboratory - CNRS
24 --
25 -- This program is free software; you can redistribute it and/or modify
26 -- it under the terms of the GNU General Public License as published by
27 -- the Free Software Foundation; either version 2 of the License, or
28 -- (at your option) any later version.
29 --
30 -- This program is distributed in the hope that it will be useful,
31 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
32 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 -- GNU General Public License for more details.
34 --
35 -- You should have received a copy of the GNU General Public License
36 -- along with this program; if not, write to the Free Software
37 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
38 -------------------------------------------------------------------------------*/
39 /*-- Author : Thomas Chust
40 -- Contact : Thomas Chust
41 -- Mail : thomas.chust@lpp.polytechnique.fr
42 ----------------------------------------------------------------------------*/
43
16
44
17 #ifndef FILE_UTILITIES_H
45 #ifndef FILE_UTILITIES_H
18 #define FILE_UTILITIES_H
46 #define FILE_UTILITIES_H
@@ -13,13 +13,48
13 // version 2.1: 22/06/2015 (modifs de Paul)
13 // version 2.1: 22/06/2015 (modifs de Paul)
14 // version 2.2: 23/06/2015 (modifs de l'ordre de déclaration/définition de init_k_coefficients dans basic_parameters.c ... + maintien des declarations dans le .h)
14 // version 2.2: 23/06/2015 (modifs de l'ordre de déclaration/définition de init_k_coefficients dans basic_parameters.c ... + maintien des declarations dans le .h)
15 // version 2.3: 01/07/2015 (affectation initiale des octets 7 et 9 dans les BP1 corrigée ...)
15 // version 2.3: 01/07/2015 (affectation initiale des octets 7 et 9 dans les BP1 corrigée ...)
16 // version 2.4: 05/10/2018 (added GPL headers)
17 // version 2.5: 09/10/2018 (dans main.c #include "basic_parameters_utilities.h" est changé par les déclarations extern correspondantes ...!
18 // + delta mise en conformité LOGISCOPE)
19
20 /*------------------------------------------------------------------------------
21 -- Solar Orbiter's Low Frequency Receiver Flight Software (LFR FSW),
22 -- This file is a part of the LFR FSW
23 -- Copyright (C) 2012-2018, Plasma Physics Laboratory - CNRS
24 --
25 -- This program is free software; you can redistribute it and/or modify
26 -- it under the terms of the GNU General Public License as published by
27 -- the Free Software Foundation; either version 2 of the License, or
28 -- (at your option) any later version.
29 --
30 -- This program is distributed in the hope that it will be useful,
31 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
32 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 -- GNU General Public License for more details.
34 --
35 -- You should have received a copy of the GNU General Public License
36 -- along with this program; if not, write to the Free Software
37 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
38 -------------------------------------------------------------------------------*/
39 /*-- Author : Thomas Chust
40 -- Contact : Thomas Chust
41 -- Mail : thomas.chust@lpp.polytechnique.fr
42 ----------------------------------------------------------------------------*/
43
16
44
17 #include <stdio.h>
45 #include <stdio.h>
18
46
19 #include "file_utilities.h"
47 #include "file_utilities.h"
20 #include "basic_parameters_utilities.h"
21 #include "basic_parameters.h"
48 #include "basic_parameters.h"
22
49
50 extern float compressed_spectral_matrix_f0[NB_BINS_COMPRESSED_MATRIX_f0 * NB_VALUES_PER_SPECTRAL_MATRIX];
51 extern float k_coefficients_f0[NB_BINS_COMPRESSED_MATRIX_f0 * NB_K_COEFF_PER_BIN];
52 extern float k_coefficients_f1[NB_BINS_COMPRESSED_MATRIX_f1 * NB_K_COEFF_PER_BIN];
53 extern float k_coefficients_f2[NB_BINS_COMPRESSED_MATRIX_f2 * NB_K_COEFF_PER_BIN];
54
55 extern unsigned char LFR_BP1_f0[NB_BINS_COMPRESSED_MATRIX_f0*NB_BYTES_BP1];
56 extern unsigned char LFR_BP2_f0[NB_BINS_COMPRESSED_MATRIX_f0*NB_BYTES_BP2];
57
23 int main(void)
58 int main(void)
24 {
59 {
25 const char *filename;
60 const char *filename;
@@ -35,8 +70,8 int main(void)
35 printf("The multi-byte quantities are laid out in a MSB FIRST (big endian) fashion\n\n");
70 printf("The multi-byte quantities are laid out in a MSB FIRST (big endian) fashion\n\n");
36 #endif
71 #endif
37
72
38 filename="/WIN/Users/chust/DD CHUST/Missions/Solar Orbiter/LFR/Prog C/tests bp Paul/tests7/sm_test2_R3.dat";
73 //filename="/WIN/Users/chust/DD CHUST/Missions/Solar Orbiter/LFR/Prog C/tests bp Paul/tests7/sm_test2_R3.dat";
39 //filename="/home/chust/DD pc-p-chust/Missions/Solar Orbiter/LFR/Prog C/tests bp Paul/tests7/sm_test2_R3.dat";
74 filename="/home/chust/DD pc-p-chust/Missions/Solar Orbiter/LFR/Prog C/tests bp Paul/tests7/sm_test2_R3.dat";
40
75
41 lecture_file_sm(filename);
76 lecture_file_sm(filename);
42
77
General Comments 0
You need to be logged in to leave comments. Login now