Porównaj commity

...

4 Commity

Autor SHA1 Wiadomość Data
pabr 84c59e1c7a S2: Avoid deadlock. 2022-12-01 10:03:12 +01:00
pabr 9dd4060f06 S2: Optionally output BBFrames (including BBHeader). 2022-12-01 10:01:40 +01:00
pabr fe17e97b97 Implement --linger for DVB-S2. 2022-12-01 09:47:32 +01:00
pabr 06d80520bd Implement --s32 for sdriq files. 2022-12-01 09:46:48 +01:00
3 zmienionych plików z 44 dodań i 3 usunięć

Wyświetl plik

@ -47,7 +47,7 @@ struct config {
bool highspeed; // Demodulate raw u8 I/Q without preprocessing
enum {
INPUT_U8, INPUT_S8,
INPUT_S12, INPUT_S16,
INPUT_S12, INPUT_S16, INPUT_S32,
INPUT_F32, INPUT_F64
} input_format;
float float_scale; // Scaling factor for float data.
@ -61,6 +61,8 @@ struct config {
bool cnr; // Measure CNR
unsigned int decim; // Decimation, 0=auto
int fd_pp; // FD for preprocessed data, or -1
int fd_bbf; // FD for DVB-S2 bbframes, or -1
bool bbf_l3sync; // Output l3sync headers to fd_bbf
int fd_gse; // FD for DVB-S2 Generic streams, or -1
int fd_iqsymbols; // FD for sampled symbols, or -1
float awgn; // Standard deviation of noise
@ -120,7 +122,7 @@ struct config {
cnr(false),
decim(0),
fd_pp(-1),
fd_gse(-1),
fd_bbf(-1), bbf_l3sync(false), fd_gse(-1),
fd_iqsymbols(-1),
awgn(0),
Fm(2e6),
@ -320,6 +322,17 @@ struct runtime_common {
amp = (cfg.input_format==config::INPUT_S12 ? 2048 : 32768);
break;
}
case config::INPUT_S32: {
pipebuf<cs32> *p_stdin =
new pipebuf<cs32>(sch, "stdin", BUF_BASEBAND+cfg.input_buffer);
file_reader<cs32> *r_stdin =
new file_reader<cs32>(sch, 0, *p_stdin);
r_stdin->loop = cfg.loop_input;
cconverter<int32_t,0, f32,0, 1,1> *r_convert =
new cconverter<int32_t,0, f32,0, 1,1>(sch, *p_stdin, *p_rawiq);
amp = 5000000; // sdriq TBD
break;
}
case config::INPUT_F32: {
pipebuf<cf32> *p_stdin =
new pipebuf<cf32>(sch, "stdin", BUF_BASEBAND+cfg.input_buffer);
@ -763,6 +776,8 @@ int run_dvbs2(config &cfg) {
// Deframe BB frames to TS packets
s2_deframer deframer(run.sch, p_bbframes, *run.p_tspackets,
run.p_lock, run.p_locktime);
if ( cfg.fd_bbf >= 0 ) deframer.fd_bbf = cfg.fd_bbf;
deframer.bbf_l3sync = cfg.bbf_l3sync;
if ( cfg.fd_gse >= 0 ) deframer.fd_gse = cfg.fd_gse;
if ( cfg.debug )
@ -778,6 +793,8 @@ int run_dvbs2(config &cfg) {
run.sch->shutdown();
if ( cfg.debug ) run.sch->dump();
if ( cfg.gui && cfg.linger ) while ( 1 ) { run.sch->run(); usleep(10000); }
return 0;
} // run_dvbs2
#endif // LEANSDR_EXTENSIONS
@ -1378,6 +1395,7 @@ void usage(const char *name, FILE *f, int c, const char *info=NULL) {
" --u8 Input format is 8-bit unsigned (rtl_sdr, default)\n"
" --s12 Input format is 12/16-bit signed (PlutoSDR, LimeSDR)\n"
" --s16 Input format is 16-bit signed\n"
" --s32 Input format is 32-bit signed\n"
" --f32 Input format is 32-bit float (gqrx)\n"
" --f64 Input format is 64-bit float\n"
" -f HZ Input sample rate (Hz, default: 2.4e6)\n"
@ -1468,6 +1486,8 @@ void usage(const char *name, FILE *f, int c, const char *info=NULL) {
(f, "\nTesting options:\n"
" --fd-pp FDNUM Dump preprocessed IQ data to file descriptor\n"
" --fd-iqsymbols FDNUM Dump sampled IQ symbols to file descriptor\n"
" --fd-bbf FDNUM Dump raw DVB-S2 bbframes to this FD\n"
" --bbf-l3sync Output 0xb8 headers (with --fd-bbf)\n"
" --fd-gse FDNUM Dump DVB-S2 generic streams to this FD\n"
" --awgn FLOAT Add white gaussian noise stddev (slow)\n"
);
@ -1608,6 +1628,8 @@ int main(int argc, const char *argv[]) {
cfg.input_format = config::INPUT_S12;
else if ( ! strcmp(argv[i], "--s16") )
cfg.input_format = config::INPUT_S16;
else if ( ! strcmp(argv[i], "--s32") )
cfg.input_format = config::INPUT_S32;
else if ( ! strcmp(argv[i], "--f32") )
cfg.input_format = config::INPUT_F32;
else if ( ! strcmp(argv[i], "--f64") )
@ -1626,6 +1648,10 @@ int main(int argc, const char *argv[]) {
cfg.Fderot = atof(argv[++i]);
else if ( ! strcmp(argv[i], "--fd-pp") && i+1<argc )
cfg.fd_pp = atoi(argv[++i]);
else if ( ! strcmp(argv[i], "--fd-bbf") && i+1<argc )
cfg.fd_bbf = atoi(argv[++i]);
else if ( ! strcmp(argv[i], "--bbf-l3sync") )
cfg.bbf_l3sync = true;
else if ( ! strcmp(argv[i], "--fd-gse") && i+1<argc )
cfg.fd_gse = atoi(argv[++i]);
else if ( ! strcmp(argv[i], "--awgn") && i+1<argc )

Wyświetl plik

@ -940,6 +940,7 @@ namespace leansdr {
if ( ss.fw16<min_freqw16 || ss.fw16>max_freqw16 ) {
if ( sch->debug ) fprintf(stderr, "Carrier out of bounds\n");
in.read(ss.p-in.rd());
enter_frame_detect();
return;
}
@ -2482,12 +2483,14 @@ namespace leansdr {
// EN 302 307-1 section 5.1 Mode adaptation
struct s2_deframer : runnable {
int fd_bbf; // FD for raw BB frames, or -1
bool bbf_l3sync; // Output 0xb8 headers to fd_bbf
int fd_gse; // FD for generic streams, or -1
s2_deframer(scheduler *sch, pipebuf<bbframe> &_in, pipebuf<tspacket> &_out,
pipebuf<int> *_state_out=NULL,
pipebuf<unsigned long> *_locktime_out=NULL)
: runnable(sch, "S2 deframer"),
fd_gse(-1),
fd_bbf(-1), bbf_l3sync(false), fd_gse(-1),
nleftover(-1),
in(_in), out(_out,MAX_TS_PER_BBFRAME),
current_state(false),
@ -2552,6 +2555,17 @@ namespace leansdr {
info_unlocked();
return; // Max one state_out per loop
}
if ( fd_bbf >= 0 ) {
if ( bbf_l3sync ) {
uint8_t l3sync = 0xb8;
ssize_t nw = write(fd_bbf, &l3sync, 1);
if ( nw != 1 ) fatal("write(l3sync)");
}
size_t n = 10 + dfl/8;
ssize_t nw = write(fd_bbf, bbh, n);
if ( nw < 0 ) fatal("write(bbf)");
if ( nw != n ) fail("partial write(bbf)");
}
if ( streamtype==3 && upl==188*8 && sync==0x47 && syncd<=dfl)
handle_ts(data, dfl, syncd, sync);
else if ( streamtype == 1 ) {

Wyświetl plik

@ -31,6 +31,7 @@ namespace leansdr {
typedef complex<s8> cs8;
typedef complex<u16> cu16;
typedef complex<s16> cs16;
typedef complex<int32_t> cs32;
typedef complex<f32> cf32;
typedef complex<float> cf64;