kopia lustrzana https://github.com/projecthorus/radiosonde_auto_rx
match: minor fix
rodzic
15d47960cf
commit
f3b8555230
|
|
@ -196,8 +196,8 @@ int f32buf_sample(FILE *fp, int inv, int cm) {
|
|||
for (i = 0; i < M; i++) corrbuf[i] = 0.0; // -1.0
|
||||
}
|
||||
norm = 0.0;
|
||||
// for (i = 0; i < N; i++) {
|
||||
for (i = 1; i < N-1; i++) {
|
||||
//for (i = 0; i < N; i++) {
|
||||
for (i = 1; i < N-1; i++) {
|
||||
x = bufs[(sample_in+M -(N-1) + i) % M];
|
||||
corr += match[i]*x;
|
||||
norm += x*x;
|
||||
|
|
@ -357,7 +357,7 @@ int init_buffers(char hdr[], int hLen, int shape) {
|
|||
|
||||
N = hLen * samples_per_bit;
|
||||
M = 2*N; // >= N
|
||||
Nvar = 32 * samples_per_bit;
|
||||
Nvar = N/2;
|
||||
|
||||
bufs = (float *)calloc( M+1, sizeof(float)); if (bufs == NULL) return -100;
|
||||
match = (float *)calloc( N+1, sizeof(float)); if (match == NULL) return -100;
|
||||
|
|
|
|||
|
|
@ -604,6 +604,7 @@ int main(int argc, char **argv) {
|
|||
float thres = 0.6;
|
||||
|
||||
int bitofs = 0, dif = 0;
|
||||
int symlen = 2;
|
||||
|
||||
|
||||
#ifdef CYGWIN
|
||||
|
|
@ -670,6 +671,7 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
|
||||
|
||||
symlen = 2;
|
||||
headerlen = strlen(rawheader);
|
||||
bitofs = 2; // +1 .. +2
|
||||
if (init_buffers(rawheader, headerlen, 0) < 0) { // shape=0 (alt. shape=1)
|
||||
|
|
@ -689,10 +691,10 @@ int main(int argc, char **argv) {
|
|||
if (mv_pos > mv0_pos) {
|
||||
|
||||
header_found = 0;
|
||||
herrs = headcmp(2, rawheader, headerlen, mv_pos); // symlen=2
|
||||
herrs = headcmp(symlen, rawheader, headerlen, mv_pos); // symlen=2
|
||||
herr1 = 0;
|
||||
if (herrs <= 3 && herrs > 0) {
|
||||
herr1 = headcmp(2, rawheader, headerlen, mv_pos+1);
|
||||
herr1 = headcmp(symlen, rawheader, headerlen, mv_pos+1);
|
||||
if (herr1 < herrs) {
|
||||
herrs = herr1;
|
||||
herr1 = 1;
|
||||
|
|
@ -710,7 +712,7 @@ int main(int argc, char **argv) {
|
|||
while ( frm < nfrms ) { // nfrms=1,2,4,8
|
||||
while ( pos < BITFRAME_LEN ) {
|
||||
header_found = !(frm==nfrms-1 && pos>=BITFRAME_LEN-10);
|
||||
bitQ = read_sbit(fp, 2, &bit, option_inv, dif+bitofs, bitpos==0, !header_found); // symlen=2, return: zeroX/bit
|
||||
bitQ = read_sbit(fp, symlen, &bit, option_inv, dif+bitofs, bitpos==0, !header_found); // symlen=2, return: zeroX/bit
|
||||
//bitQ = read_sbit(fp, 2, &bit, option_inv, dif+bitofs, bitpos==0, 0); // symlen=2, return: zeroX/bit
|
||||
if (bitQ == EOF) { frm = nfrms; break; }
|
||||
frame_bits[pos] = 0x30 + bit;
|
||||
|
|
|
|||
|
|
@ -1074,6 +1074,7 @@ int main(int argc, char *argv[]) {
|
|||
float thres = 0.7;
|
||||
|
||||
int bitofs = 0, dif = 0;
|
||||
int symlen = 1;
|
||||
|
||||
|
||||
#ifdef CYGWIN
|
||||
|
|
@ -1150,6 +1151,8 @@ int main(int argc, char *argv[]) {
|
|||
rs_init_RS255();
|
||||
}
|
||||
|
||||
|
||||
symlen = 1;
|
||||
headerlen = strlen(header);
|
||||
bitofs = 2; // +1 .. +2
|
||||
if (init_buffers(header, headerlen, 2) < 0) { // shape=2
|
||||
|
|
@ -1169,10 +1172,10 @@ int main(int argc, char *argv[]) {
|
|||
if (mv_pos > mv0_pos) {
|
||||
|
||||
header_found = 0;
|
||||
herrs = headcmp(1, header, headerlen, mv_pos); // symlen=1
|
||||
herrs = headcmp(symlen, header, headerlen, mv_pos); // symlen=1
|
||||
herr1 = 0;
|
||||
if (herrs <= 3 && herrs > 0) {
|
||||
herr1 = headcmp(2, header, headerlen, mv_pos+1);
|
||||
herr1 = headcmp(symlen, header, headerlen, mv_pos+1);
|
||||
if (herr1 < herrs) {
|
||||
herrs = herr1;
|
||||
herr1 = 1;
|
||||
|
|
@ -1189,7 +1192,7 @@ int main(int argc, char *argv[]) {
|
|||
Qerror_count = 0;
|
||||
|
||||
while ( byte_count < frmlen ) {
|
||||
bitQ = read_sbit(fp, 1, &bit, option_inv, dif+bitofs, bit_count==0, 0); // symlen=1, return: zeroX/bit
|
||||
bitQ = read_sbit(fp, symlen, &bit, option_inv, dif+bitofs, bit_count==0, 0); // symlen=1, return: zeroX/bit
|
||||
if ( bitQ == EOF) break;
|
||||
bit_count += 1;
|
||||
bitbuf[bitpos] = bit;
|
||||
|
|
@ -1220,7 +1223,7 @@ int main(int argc, char *argv[]) {
|
|||
print_frame(byte_count);
|
||||
|
||||
while ( bit_count < BITS*FRAME_LEN ) {
|
||||
bitQ = read_sbit(fp, 1, &bit, option_inv, dif+bitofs, bit_count==0, 0); // symlen=1, return: zeroX/bit
|
||||
bitQ = read_sbit(fp, symlen, &bit, option_inv, dif+bitofs, bit_count==0, 0); // symlen=1, return: zeroX/bit
|
||||
if ( bitQ == EOF) break;
|
||||
bit_count++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1224,6 +1224,7 @@ int main(int argc, char *argv[]) {
|
|||
float thres = 0.7;
|
||||
|
||||
int bitofs = 0, dif = 0;
|
||||
int symlen = 2;
|
||||
|
||||
|
||||
#ifdef CYGWIN
|
||||
|
|
@ -1383,6 +1384,7 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
|
||||
symlen = 2;
|
||||
headerlen = strlen(rawheader);
|
||||
bitofs = 2; // +1 .. +2
|
||||
if (init_buffers(rawheader, headerlen, 2) < 0) { // shape=2
|
||||
|
|
@ -1401,10 +1403,10 @@ int main(int argc, char *argv[]) {
|
|||
if (mv_pos > mv0_pos) {
|
||||
|
||||
header_found = 0;
|
||||
herrs = headcmp(2, rawheader, headerlen, mv_pos); // symlen=2
|
||||
herrs = headcmp(symlen, rawheader, headerlen, mv_pos); // symlen=2
|
||||
herr1 = 0;
|
||||
if (herrs <= 3 && herrs > 0) {
|
||||
herr1 = headcmp(2, rawheader, headerlen, mv_pos+1);
|
||||
herr1 = headcmp(symlen, rawheader, headerlen, mv_pos+1);
|
||||
if (herr1 < herrs) {
|
||||
herrs = herr1;
|
||||
herr1 = 1;
|
||||
|
|
@ -1420,7 +1422,7 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
while ( byte_count < FRAME_LEN ) {
|
||||
header_found = !(byte_count>=FRAME_LEN-2);
|
||||
bitQ = read_sbit(fp, 2, &bit, option_inv, dif+bitofs, bit_count==0, !header_found); // symlen=2, return: zeroX/bit
|
||||
bitQ = read_sbit(fp, symlen, &bit, option_inv, dif+bitofs, bit_count==0, !header_found); // symlen=2, return: zeroX/bit
|
||||
if ( bitQ == EOF) break;
|
||||
bit_count += 1;
|
||||
bitbuf[bitpos] = bit;
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue