|
@@
-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
|