kopia lustrzana https://github.com/rs1729/RS
add --softinv: inverted softbits input (fsk_demod)
rodzic
b0a28d7306
commit
ddaec3e788
|
@ -1715,7 +1715,7 @@ static float corr_softhdb(hdb_t *hdb) { // max score in window probably not need
|
|||
return sum;
|
||||
}
|
||||
|
||||
int f32soft_read(FILE *fp, float *s) {
|
||||
int f32soft_read(FILE *fp, float *s, int inv) {
|
||||
unsigned int word = 0;
|
||||
short *b = (short*)&word;
|
||||
float *f = (float*)&word;
|
||||
|
@ -1732,17 +1732,19 @@ int f32soft_read(FILE *fp, float *s) {
|
|||
if (bps == 16) { *s /= 256.0; }
|
||||
}
|
||||
|
||||
if (inv) *s = -*s;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int find_softbinhead(FILE *fp, hdb_t *hdb, float *score) {
|
||||
int find_softbinhead(FILE *fp, hdb_t *hdb, float *score, int inv) {
|
||||
int headlen = hdb->len;
|
||||
float sbit;
|
||||
float mv;
|
||||
|
||||
//*score = 0.0;
|
||||
|
||||
while ( f32soft_read(fp, &sbit) != EOF )
|
||||
while ( f32soft_read(fp, &sbit, inv) != EOF )
|
||||
{
|
||||
hdb->bufpos = (hdb->bufpos+1) % headlen;
|
||||
hdb->sbuf[hdb->bufpos] = sbit;
|
||||
|
|
|
@ -187,8 +187,8 @@ int free_buffers(dsp_t *);
|
|||
|
||||
int find_header(dsp_t *, float, int, int, int);
|
||||
|
||||
int f32soft_read(FILE *fp, float *s);
|
||||
int f32soft_read(FILE *fp, float *s, int inv);
|
||||
int find_binhead(FILE *fp, hdb_t *hdb, float *score);
|
||||
int find_softbinhead(FILE *fp, hdb_t *hdb, float *score);
|
||||
int find_softbinhead(FILE *fp, hdb_t *hdb, float *score, int inv);
|
||||
|
||||
|
||||
|
|
|
@ -1376,7 +1376,8 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
else if (strcmp(*argv, "--auto") == 0) { option_auto = 1; }
|
||||
else if (strcmp(*argv, "--bin") == 0) { option_bin = 1; } // bit/byte binary input
|
||||
else if (strcmp(*argv, "--softin") == 0) { option_softin = 1; } // float32 soft input
|
||||
else if (strcmp(*argv, "--softin") == 0) { option_softin = 1; } // float32 soft input
|
||||
else if (strcmp(*argv, "--softinv") == 0) { option_softin = 2; } // float32 inverted soft input
|
||||
else if (strcmp(*argv, "--dist") == 0) { option_dist = 1; option_ecc = 1; }
|
||||
else if (strcmp(*argv, "--json") == 0) { option_json = 1; option_ecc = 1; }
|
||||
else if (strcmp(*argv, "--jsn_cfq") == 0) {
|
||||
|
@ -1628,7 +1629,7 @@ int main(int argc, char **argv) {
|
|||
hdrcnt += nfrms;
|
||||
}
|
||||
else if (option_softin) {
|
||||
header_found = find_softbinhead(fp, &hdb, &_mv);
|
||||
header_found = find_softbinhead(fp, &hdb, &_mv, option_softin == 2);
|
||||
hdrcnt += nfrms;
|
||||
}
|
||||
else { //2 (false positive) // FM-audio:
|
||||
|
@ -1677,9 +1678,9 @@ int main(int argc, char **argv) {
|
|||
float s1 = 0.0;
|
||||
float s2 = 0.0;
|
||||
float s = 0.0;
|
||||
bitQ = f32soft_read(fp, &s1);
|
||||
bitQ = f32soft_read(fp, &s1, option_softin == 2);
|
||||
if (bitQ != EOF) {
|
||||
bitQ = f32soft_read(fp, &s2);
|
||||
bitQ = f32soft_read(fp, &s2, option_softin == 2);
|
||||
if (bitQ != EOF) {
|
||||
s = s2-s1; // integrate both symbols // only 2nd Manchester symbol: s2
|
||||
hsbit.sb = s;
|
||||
|
|
|
@ -752,7 +752,8 @@ int main(int argc, char *argv[]) {
|
|||
else if (strcmp(*argv, "--silent") == 0) { gpx.option.slt = 1; }
|
||||
else if (strcmp(*argv, "--ch2") == 0) { sel_wavch = 1; } // right channel (default: 0=left)
|
||||
else if (strcmp(*argv, "--auto") == 0) { gpx.option.aut = 1; }
|
||||
else if (strcmp(*argv, "--softin") == 0) { option_softin = 1; } // float32 soft input
|
||||
else if (strcmp(*argv, "--softin") == 0) { option_softin = 1; } // float32 soft input
|
||||
else if (strcmp(*argv, "--softinv") == 0) { option_softin = 2; } // float32 inverted soft input
|
||||
else if (strcmp(*argv, "--ths") == 0) {
|
||||
++argv;
|
||||
if (*argv) {
|
||||
|
@ -964,7 +965,7 @@ int main(int argc, char *argv[]) {
|
|||
while ( 1 )
|
||||
{
|
||||
if (option_softin) {
|
||||
header_found = find_softbinhead(fp, &hdb, &_mv);
|
||||
header_found = find_softbinhead(fp, &hdb, &_mv, option_softin == 2);
|
||||
}
|
||||
else { // FM-audio:
|
||||
header_found = find_header(&dsp, thres, 4, bitofs, dsp.opt_dc); // optional 2nd pass: dc=0
|
||||
|
@ -987,7 +988,7 @@ int main(int argc, char *argv[]) {
|
|||
{
|
||||
if (option_softin) {
|
||||
float s = 0.0;
|
||||
bitQ = f32soft_read(fp, &s);
|
||||
bitQ = f32soft_read(fp, &s, option_softin == 2);
|
||||
if (bitQ != EOF) {
|
||||
bit = (s>=0.0);
|
||||
hsbit.hb = bit;
|
||||
|
@ -1023,7 +1024,7 @@ int main(int argc, char *argv[]) {
|
|||
while ( 0 && bitpos < 4*BITFRAME_LEN/3 ) {
|
||||
if (option_softin) {
|
||||
float s = 0.0;
|
||||
bitQ = f32soft_read(fp, &s);
|
||||
bitQ = f32soft_read(fp, &s, option_softin == 2);
|
||||
}
|
||||
else {
|
||||
bitQ = read_slbit(&dsp, &bit, 0, bitofs, bitpos, -1, 0); // symlen=1
|
||||
|
|
|
@ -1103,7 +1103,8 @@ int main(int argc, char **argv) {
|
|||
option_inv = 1; // nicht noetig
|
||||
}
|
||||
else if (strcmp(*argv, "--ch2") == 0) { sel_wavch = 1; } // right channel (default: 0=left)
|
||||
else if (strcmp(*argv, "--softin") == 0) { option_softin = 1; } // float32 soft input
|
||||
else if (strcmp(*argv, "--softin") == 0) { option_softin = 1; } // float32 soft input
|
||||
else if (strcmp(*argv, "--softinv") == 0) { option_softin = 2; } // float32 inverted soft input
|
||||
else if (strcmp(*argv, "--ths") == 0) {
|
||||
++argv;
|
||||
if (*argv) {
|
||||
|
@ -1351,7 +1352,7 @@ int main(int argc, char **argv) {
|
|||
while ( 1 )
|
||||
{
|
||||
if (option_softin) {
|
||||
header_found = find_softbinhead(fp, &hdb, &_mv);
|
||||
header_found = find_softbinhead(fp, &hdb, &_mv, option_softin == 2);
|
||||
}
|
||||
else { // FM-audio:
|
||||
header_found = find_header(&dsp, thres, 10, bitofs, dsp.opt_dc); // optional 2nd pass: dc=0
|
||||
|
@ -1382,7 +1383,7 @@ int main(int argc, char **argv) {
|
|||
|
||||
if (option_softin) {
|
||||
float s = 0.0;
|
||||
bitQ = f32soft_read(fp, &s);
|
||||
bitQ = f32soft_read(fp, &s, option_softin == 2);
|
||||
if (bitQ != EOF) {
|
||||
rhsbit.sb = s;
|
||||
rhsbit.hb = (s>=0.0);
|
||||
|
|
|
@ -1232,7 +1232,8 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
else if (strcmp(*argv, "--chk3") == 0) { option_chk = 3; }
|
||||
else if (strcmp(*argv, "--ch2") == 0) { sel_wavch = 1; } // right channel (default: 0=left)
|
||||
else if (strcmp(*argv, "--softin") == 0) { option_softin = 1; } // float32 soft input
|
||||
else if (strcmp(*argv, "--softin") == 0) { option_softin = 1; } // float32 soft input
|
||||
else if (strcmp(*argv, "--softinv") == 0) { option_softin = 2; } // float32 inverted soft input
|
||||
else if (strcmp(*argv, "--silent") == 0) { gpx.option.slt = 1; }
|
||||
else if (strcmp(*argv, "--ths") == 0) {
|
||||
++argv;
|
||||
|
@ -1429,7 +1430,7 @@ int main(int argc, char **argv) {
|
|||
while ( 1 )
|
||||
{
|
||||
if (option_softin) {
|
||||
header_found = find_softbinhead(fp, &hdb, &_mv);
|
||||
header_found = find_softbinhead(fp, &hdb, &_mv, option_softin == 2);
|
||||
}
|
||||
else { // FM-audio:
|
||||
header_found = find_header(&dsp, thres, 2, bitofs, dsp.opt_dc); // optional 2nd pass: dc=0
|
||||
|
@ -1456,9 +1457,9 @@ int main(int argc, char **argv) {
|
|||
float s1 = 0.0;
|
||||
float s2 = 0.0;
|
||||
float s = 0.0;
|
||||
bitQ = f32soft_read(fp, &s1);
|
||||
bitQ = f32soft_read(fp, &s1, option_softin == 2);
|
||||
if (bitQ != EOF) {
|
||||
bitQ = f32soft_read(fp, &s2);
|
||||
bitQ = f32soft_read(fp, &s2, option_softin == 2);
|
||||
if (bitQ != EOF) {
|
||||
s = s2-s1; // integrate both symbols // only 2nd Manchester symbol: s2
|
||||
bit = (s>=0.0); // no soft decoding
|
||||
|
@ -1495,7 +1496,7 @@ int main(int argc, char **argv) {
|
|||
while ( bitpos < 5*BITFRAME_LEN ) {
|
||||
if (option_softin) {
|
||||
float s = 0.0;
|
||||
bitQ = f32soft_read(fp, &s);
|
||||
bitQ = f32soft_read(fp, &s, option_softin == 2);
|
||||
}
|
||||
else {
|
||||
bitQ = read_slbit(&dsp, &bit, 0, bitofs, bitpos, -1, 0); // symlen=2
|
||||
|
|
|
@ -1098,7 +1098,8 @@ int main(int argc, char **argv) {
|
|||
spike = 1;
|
||||
}
|
||||
else if (strcmp(*argv, "--ch2") == 0) { sel_wavch = 1; } // right channel (default: 0=left)
|
||||
else if (strcmp(*argv, "--softin") == 0) { option_softin = 1; } // float32 soft input
|
||||
else if (strcmp(*argv, "--softin") == 0) { option_softin = 1; } // float32 soft input
|
||||
else if (strcmp(*argv, "--softinv") == 0) { option_softin = 2; } // float32 inverted soft input
|
||||
else if (strcmp(*argv, "--silent") == 0) { gpx.option.slt = 1; }
|
||||
else if (strcmp(*argv, "--ths") == 0) {
|
||||
++argv;
|
||||
|
@ -1301,7 +1302,7 @@ int main(int argc, char **argv) {
|
|||
while ( 1 )
|
||||
{
|
||||
if (option_softin) {
|
||||
header_found = find_softbinhead(fp, &hdb, &_mv);
|
||||
header_found = find_softbinhead(fp, &hdb, &_mv, option_softin == 2);
|
||||
}
|
||||
else { // FM-audio:
|
||||
header_found = find_header(&dsp, thres, 2, bitofs, dsp.opt_dc); // optional 2nd pass: dc=0
|
||||
|
@ -1328,9 +1329,9 @@ int main(int argc, char **argv) {
|
|||
float s1 = 0.0;
|
||||
float s2 = 0.0;
|
||||
float s = 0.0;
|
||||
bitQ = f32soft_read(fp, &s1);
|
||||
bitQ = f32soft_read(fp, &s1, option_softin == 2);
|
||||
if (bitQ != EOF) {
|
||||
bitQ = f32soft_read(fp, &s2);
|
||||
bitQ = f32soft_read(fp, &s2, option_softin == 2);
|
||||
if (bitQ != EOF) {
|
||||
s = s2-s1; // integrate both symbols // only 2nd Manchester symbol: s2
|
||||
bit = (s>=0.0); // no soft decoding
|
||||
|
@ -1364,7 +1365,7 @@ int main(int argc, char **argv) {
|
|||
while ( bitpos < 5*BITFRAME_LEN ) {
|
||||
if (option_softin) {
|
||||
float s = 0.0;
|
||||
bitQ = f32soft_read(fp, &s);
|
||||
bitQ = f32soft_read(fp, &s, option_softin == 2);
|
||||
}
|
||||
else {
|
||||
bitQ = read_slbit(&dsp, &bit, 0, bitofs, bitpos, -1, 0); // symlen=2
|
||||
|
|
|
@ -468,7 +468,8 @@ int main(int argc, char **argv) {
|
|||
else return -1;
|
||||
}
|
||||
else if (strcmp(*argv, "--ch2") == 0) { sel_wavch = 1; } // right channel (default: 0=left)
|
||||
else if (strcmp(*argv, "--softin") == 0) { option_softin = 1; } // float32 soft input
|
||||
else if (strcmp(*argv, "--softin") == 0) { option_softin = 1; } // float32 soft input
|
||||
else if (strcmp(*argv, "--softinv") == 0) { option_softin = 2; } // float32 inverted soft input
|
||||
else if (strcmp(*argv, "--ths") == 0) {
|
||||
++argv;
|
||||
if (*argv) {
|
||||
|
@ -684,7 +685,7 @@ int main(int argc, char **argv) {
|
|||
while ( 1 )
|
||||
{
|
||||
if (option_softin) {
|
||||
header_found = find_softbinhead(fp, &hdb, &_mv);
|
||||
header_found = find_softbinhead(fp, &hdb, &_mv, option_softin == 2);
|
||||
}
|
||||
else { // FM-audio:
|
||||
header_found = find_header(&dsp, thres, 1, bitofs, dsp.opt_dc); // optional 2nd pass: dc=0
|
||||
|
@ -704,7 +705,7 @@ int main(int argc, char **argv) {
|
|||
while (bitpos < RAWBITFRAME_LEN/2-RAWHEADLEN) { // 2*600-48
|
||||
if (option_softin) {
|
||||
float s = 0.0;
|
||||
bitQ = f32soft_read(fp, &s);
|
||||
bitQ = f32soft_read(fp, &s, option_softin == 2);
|
||||
if (bitQ != EOF) bit = (s>=0.0); // no soft decoding
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -967,7 +967,8 @@ int main(int argc, char **argv) {
|
|||
gpx.option.ptu = 1;
|
||||
}
|
||||
else if (strcmp(*argv, "--ch2") == 0) { sel_wavch = 1; } // right channel (default: 0=left)
|
||||
else if (strcmp(*argv, "--softin") == 0) { option_softin = 1; } // float32 soft input
|
||||
else if (strcmp(*argv, "--softin") == 0) { option_softin = 1; } // float32 soft input
|
||||
else if (strcmp(*argv, "--softinv") == 0) { option_softin = 2; } // float32 inverted soft input
|
||||
else if (strcmp(*argv, "-d") == 0) {
|
||||
++argv;
|
||||
if (*argv) {
|
||||
|
@ -1174,7 +1175,7 @@ int main(int argc, char **argv) {
|
|||
while ( 1 )
|
||||
{
|
||||
if (option_softin) {
|
||||
header_found = find_softbinhead(fp, &hdb, &_mv);
|
||||
header_found = find_softbinhead(fp, &hdb, &_mv, option_softin == 2);
|
||||
}
|
||||
else { // FM-audio:
|
||||
header_found = find_header(&dsp, thres, 2, bitofs, dsp.opt_dc); // optional 2nd pass: dc=0
|
||||
|
@ -1200,9 +1201,9 @@ int main(int argc, char **argv) {
|
|||
float s1 = 0.0;
|
||||
float s2 = 0.0;
|
||||
float s = 0.0;
|
||||
bitQ = f32soft_read(fp, &s1);
|
||||
bitQ = f32soft_read(fp, &s1, option_softin == 2);
|
||||
if (bitQ != EOF) {
|
||||
bitQ = f32soft_read(fp, &s2);
|
||||
bitQ = f32soft_read(fp, &s2, option_softin == 2);
|
||||
if (bitQ != EOF) {
|
||||
s = s2-s1; // integrate both symbols // Manchester2=s2 (invert to Manchester1=s1 below)
|
||||
bit = (s>=0.0); // no soft decoding
|
||||
|
|
|
@ -371,7 +371,8 @@ int main(int argc, char **argv) {
|
|||
spike = 1;
|
||||
}
|
||||
else if (strcmp(*argv, "--ch2") == 0) { sel_wavch = 1; } // right channel (default: 0=left)
|
||||
else if (strcmp(*argv, "--softin") == 0) { option_softin = 1; } // float32 soft input
|
||||
else if (strcmp(*argv, "--softin") == 0) { option_softin = 1; } // float32 soft input
|
||||
else if (strcmp(*argv, "--softinv") == 0) { option_softin = 2; } // float32 inverted soft input
|
||||
else if (strcmp(*argv, "--ths") == 0) {
|
||||
++argv;
|
||||
if (*argv) {
|
||||
|
@ -565,7 +566,7 @@ int main(int argc, char **argv) {
|
|||
while ( 1 )
|
||||
{
|
||||
if (option_softin) {
|
||||
header_found = find_softbinhead(fp, &hdb, &_mv);
|
||||
header_found = find_softbinhead(fp, &hdb, &_mv, option_softin == 2);
|
||||
}
|
||||
else { // FM-audio:
|
||||
header_found = find_header(&dsp, thres, 2, bitofs, dsp.opt_dc); // optional 2nd pass: dc=0
|
||||
|
@ -588,7 +589,7 @@ int main(int argc, char **argv) {
|
|||
|
||||
if (option_softin) {
|
||||
float s = 0.0;
|
||||
bitQ = f32soft_read(fp, &s);
|
||||
bitQ = f32soft_read(fp, &s, option_softin == 2);
|
||||
if (bitQ != EOF) {
|
||||
bit = (s>=0.0);
|
||||
hsbit.hb = bit;
|
||||
|
|
|
@ -2439,7 +2439,8 @@ int main(int argc, char *argv[]) {
|
|||
else if (strcmp(*argv, "--ch2") == 0) { sel_wavch = 1; } // right channel (default: 0=left)
|
||||
else if (strcmp(*argv, "--auto") == 0) { gpx.option.aut = 1; }
|
||||
else if (strcmp(*argv, "--bin") == 0) { option_bin = 1; } // bit/byte binary input
|
||||
else if (strcmp(*argv, "--softin") == 0) { option_softin = 1; } // float32 soft input
|
||||
else if (strcmp(*argv, "--softin") == 0) { option_softin = 1; } // float32 soft input
|
||||
else if (strcmp(*argv, "--softinv") == 0) { option_softin = 2; } // float32 inverted soft input
|
||||
else if (strcmp(*argv, "--silent") == 0) { gpx.option.slt = 1; }
|
||||
else if (strcmp(*argv, "--ths") == 0) {
|
||||
++argv;
|
||||
|
@ -2662,7 +2663,7 @@ int main(int argc, char *argv[]) {
|
|||
header_found = find_binhead(fp, &hdb, &_mv);
|
||||
}
|
||||
else if (option_softin) {
|
||||
header_found = find_softbinhead(fp, &hdb, &_mv);
|
||||
header_found = find_softbinhead(fp, &hdb, &_mv, option_softin == 2);
|
||||
}
|
||||
else { // FM-audio:
|
||||
header_found = find_header(&dsp, thres, 4, bitofs, dsp.opt_dc); // optional 2nd pass: dc=0
|
||||
|
@ -2695,7 +2696,7 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
else if (option_softin) {
|
||||
float s = 0.0;
|
||||
bitQ = f32soft_read(fp, &s);
|
||||
bitQ = f32soft_read(fp, &s, option_softin == 2);
|
||||
if (bitQ != EOF) {
|
||||
bit = (s>=0.0);
|
||||
hsbit.hb = bit;
|
||||
|
|
|
@ -1753,7 +1753,8 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
else if (strcmp(*argv, "--spike") == 0) { spike = 1; }
|
||||
else if (strcmp(*argv, "--ch2") == 0) { sel_wavch = 1; } // right channel (default: 0=left)
|
||||
else if (strcmp(*argv, "--softin") == 0) { option_softin = 1; } // float32 soft input
|
||||
else if (strcmp(*argv, "--softin") == 0) { option_softin = 1; } // float32 soft input
|
||||
else if (strcmp(*argv, "--softinv") == 0) { option_softin = 2; } // float32 inverted soft input
|
||||
else if (strcmp(*argv, "--ths") == 0) {
|
||||
++argv;
|
||||
if (*argv) {
|
||||
|
@ -1985,7 +1986,7 @@ int main(int argc, char *argv[]) {
|
|||
{
|
||||
if (option_softin) {
|
||||
for (k = 0; k < hdb.len; k++) hdb.sbuf[k] = 0.0;
|
||||
header_found = find_softbinhead(fp, &hdb, &_mv);
|
||||
header_found = find_softbinhead(fp, &hdb, &_mv, option_softin == 2);
|
||||
}
|
||||
else {
|
||||
header_found = find_header(&dsp, thres, 3, bitofs, dsp.opt_dc);
|
||||
|
@ -2012,9 +2013,9 @@ int main(int argc, char *argv[]) {
|
|||
float s1 = 0.0;
|
||||
float s2 = 0.0;
|
||||
float s = 0.0;
|
||||
bitQ = f32soft_read(fp, &s1);
|
||||
bitQ = f32soft_read(fp, &s1, option_softin == 2);
|
||||
if (bitQ != EOF) {
|
||||
bitQ = f32soft_read(fp, &s2);
|
||||
bitQ = f32soft_read(fp, &s2, option_softin == 2);
|
||||
if (bitQ != EOF) {
|
||||
s = s2-s1; // integrate both symbols // only 2nd Manchester symbol: s2
|
||||
bit = (s>=0.0); // no soft decoding
|
||||
|
|
|
@ -1623,7 +1623,7 @@ static float corr_softhdb(hdb_t *hdb) { // max score in window probably not need
|
|||
}
|
||||
|
||||
static
|
||||
int f32soft_read(FILE *fp, float *s) {
|
||||
int f32soft_read(FILE *fp, float *s, int inv) {
|
||||
unsigned int word = 0;
|
||||
short *b = (short*)&word;
|
||||
float *f = (float*)&word;
|
||||
|
@ -1640,18 +1640,20 @@ int f32soft_read(FILE *fp, float *s) {
|
|||
if (bps == 16) { *s /= 256.0; }
|
||||
}
|
||||
|
||||
if (inv) *s = -*s;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
int find_softbinhead(FILE *fp, hdb_t *hdb, float *score) {
|
||||
int find_softbinhead(FILE *fp, hdb_t *hdb, float *score, int inv) {
|
||||
int headlen = hdb->len;
|
||||
float sbit;
|
||||
float mv;
|
||||
|
||||
//*score = 0.0;
|
||||
|
||||
while ( f32soft_read(fp, &sbit) != EOF )
|
||||
while ( f32soft_read(fp, &sbit, inv) != EOF )
|
||||
{
|
||||
hdb->bufpos = (hdb->bufpos+1) % headlen;
|
||||
hdb->sbuf[hdb->bufpos] = sbit;
|
||||
|
@ -2207,6 +2209,10 @@ int main(int argc, char **argv) {
|
|||
else if (strcmp(*argv, "--decFM1") == 0) { // FM decimation
|
||||
option_decFM = 1;
|
||||
}
|
||||
/*
|
||||
else if (strcmp(*argv, "--softin") == 0) { option_softin = 1; } // float32 soft input
|
||||
else if (strcmp(*argv, "--softinv") == 0) { option_softin = 2; } // float32 inverted soft input
|
||||
*/
|
||||
else if (strcmp(*argv, "--dc") == 0) { option_dc = 1; }
|
||||
else if (strcmp(*argv, "--noLUT") == 0) { option_noLUT = 1; }
|
||||
else if (strcmp(*argv, "--min") == 0) {
|
||||
|
@ -2380,7 +2386,7 @@ int main(int argc, char **argv) {
|
|||
while ( 1 )
|
||||
{
|
||||
if (option_softin) {
|
||||
header_found = find_softbinhead(fp, &hdb, &_mv);
|
||||
header_found = find_softbinhead(fp, &hdb, &_mv, option_softin == 2);
|
||||
}
|
||||
else { // FM-audio:
|
||||
header_found = find_header(&dsp, thres, 1, bitofs, dsp.opt_dc); // optional 2nd pass: dc=0
|
||||
|
@ -2405,7 +2411,7 @@ int main(int argc, char **argv) {
|
|||
{
|
||||
if (option_softin) {
|
||||
float s = 0.0;
|
||||
bitQ = f32soft_read(fp, &s);
|
||||
bitQ = f32soft_read(fp, &s, option_softin == 2);
|
||||
if (bitQ != EOF) {
|
||||
bit = (s>=0.0);
|
||||
}
|
||||
|
|
|
@ -226,7 +226,7 @@ int read_rawbit(FILE *fp, int *bit) {
|
|||
}
|
||||
|
||||
|
||||
int f32soft_read(FILE *fp, float *s) {
|
||||
int f32soft_read(FILE *fp, float *s, int inv) {
|
||||
unsigned int word = 0;
|
||||
short *b = (short*)&word;
|
||||
float *f = (float*)&word;
|
||||
|
@ -243,6 +243,8 @@ int f32soft_read(FILE *fp, float *s) {
|
|||
if (bps == 16) { *s /= 256.0; }
|
||||
}
|
||||
|
||||
if (inv) *s = -*s;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -555,7 +557,8 @@ int main(int argc, char **argv) {
|
|||
else if ( (strcmp(*argv, "-v") == 0) || (strcmp(*argv, "--verbose") == 0) ) {
|
||||
option_verbose = 1;
|
||||
}
|
||||
else if (strcmp(*argv, "--softin") == 0) { option_softin = 1; } // float32 soft input
|
||||
else if (strcmp(*argv, "--softin") == 0) { option_softin = 1; } // float32 soft input
|
||||
else if (strcmp(*argv, "--softinv") == 0) { option_softin = 2; } // float32 inverted soft input
|
||||
else if (strcmp(*argv, "-b" ) == 0) { option_b = 1; }
|
||||
else if (strcmp(*argv, "-t" ) == 0) { option_timestamp = 1; }
|
||||
else if ( (strcmp(*argv, "-r") == 0) || (strcmp(*argv, "--raw") == 0) ) {
|
||||
|
@ -611,7 +614,7 @@ int main(int argc, char **argv) {
|
|||
sample_rate = baudrate;
|
||||
sample_count = 0;
|
||||
|
||||
while (!f32soft_read(fp, &s)) {
|
||||
while (!f32soft_read(fp, &s, option_softin == 2)) {
|
||||
|
||||
bit = option_inv ? (s<=0.0f) : (s>=0.0f); // softbit s: bit=0 <=> s<0 , bit=1 <=> s>=0
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue