RS41: Reed-Solomon ECC

dump
Zilog80 2016-09-29 18:56:42 +02:00
rodzic a7bb088c04
commit 1e7f76c790
1 zmienionych plików z 10 dodań i 11 usunięć

Wyświetl plik

@ -84,7 +84,7 @@ int option_verbose = 0, // ausfuehrliche Anzeige
#define HEADLEN 32 // HEADOFS+HEADLEN mod 8 = 0
#define FRAMESTART ((HEADOFS+HEADLEN)/8)
/* 10 B6 CA 11 22 96 12 F8 */
/* 10 B6 CA 11 22 96 12 F8 */
char header[] = "0000100001101101010100111000100001000100011010010100100000011111";
char buf[HEADLEN+1] = "x";
int bufpos = -1;
@ -97,7 +97,7 @@ ui8_t //xframe[FRAME_LEN] = { 0x10, 0xB6, 0xCA, 0x11, 0x22, 0x96, 0x12, 0xF8},
#define MASK_LEN 64
ui8_t mask[MASK_LEN] = { 0x96, 0x83, 0x3E, 0x51, 0xB1, 0x49, 0x08, 0x98,
ui8_t mask[MASK_LEN] = { 0x96, 0x83, 0x3E, 0x51, 0xB1, 0x49, 0x08, 0x98,
0x32, 0x05, 0x59, 0x0E, 0xF9, 0x44, 0xC6, 0x26,
0x21, 0x60, 0xC2, 0xEA, 0x79, 0x5D, 0x6D, 0xA1,
0x54, 0x69, 0x47, 0x0C, 0xDC, 0xE8, 0x5C, 0xF1,
@ -201,7 +201,7 @@ int read_signed_sample(FILE *fp) { // int = i32_t
byte = fgetc(fp);
if (byte == EOF) return EOF_INT;
if (i == 0) sample = byte;
if (bits_sample == 16) {
byte = fgetc(fp);
if (byte == EOF) return EOF_INT;
@ -298,7 +298,6 @@ int read_rawbit(FILE *fp, int *bit) {
if (option_inv) *bit ^= 1;
return pars;
}
@ -313,7 +312,7 @@ int bits2byte(char bits[]) {
if (bits[i] == 1) byteval += d;
else if (bits[i] == 0) byteval += 0;
else return 0x100;
d <<= 1;
d <<= 1;
}
return byteval;
}
@ -375,9 +374,9 @@ void Gps2Date(long GpsWeek, long GpsSeconds, int *Year, int *Month, int *Day) {
Pos: SubHeader, 1+1 byte (ID+LEN)
0x039: 7928 FrameNumber+SondeID
+(0x050: 0732 CalFrames 0x00..0x32)
0x065: 7A2A
0x065: 7A2A
0x093: 7C1E GPS Week + TOW
0x0B5: 7D59
0x0B5: 7D59
0x112: 7B15 ECEF (X,Y,Z) Coordinates
0x12B: 7611 00
0x12B: 7Exx AUX-xdata
@ -580,13 +579,13 @@ void ecef2elli(double X[], double *lat, double *lon, double *h) {
p = sqrt( X[0]*X[0] + X[1]*X[1] );
t = atan2( X[2]*a , p*b );
phi = atan2( X[2] + ee2 * b * sin(t)*sin(t)*sin(t) ,
p - e2 * a * cos(t)*cos(t)*cos(t) );
R = a / sqrt( 1 - e2*sin(phi)*sin(phi) );
*h = p / cos(phi) - R;
*lat = phi*180/M_PI;
*lon = lam*180/M_PI;
}
@ -824,7 +823,7 @@ int print_position() {
fprintf(stdout, "[%5d] ", gpx.frnr);
fprintf(stdout, "(%s) ", gpx.id);
fprintf(stdout, "%s ", weekday[gpx.wday]);
fprintf(stdout, "%04d-%02d-%02d %02d:%02d:%02d",
fprintf(stdout, "%04d-%02d-%02d %02d:%02d:%02d",
gpx.jahr, gpx.monat, gpx.tag, gpx.std, gpx.min, gpx.sek);
if (option_verbose == 3) fprintf(stdout, " (W %d)", gpx.week);
fprintf(stdout, " ");
@ -977,7 +976,7 @@ int main(int argc, char *argv[]) {
else {
bitbuf[bit_count] = bit;
bit_count++;
if (bit_count == 8) {
bit_count = 0;
byte = bits2byte(bitbuf);