Cleanup scope of some S2 constants.

work
pabr 2020-04-29 22:17:56 +02:00
rodzic 30c6b1068f
commit 1c77c0e0b6
1 zmienionych plików z 12 dodań i 10 usunięć

Wyświetl plik

@ -197,10 +197,13 @@ namespace leansdr {
// EN 302 307-1 section 6 Error performance
const struct modcod_info {
static const int MIN_SLOTS_PER_FRAME = 144;
static const int MIN_SYMBOLS_PER_FRAME =
(1+MIN_SLOTS_PER_FRAME) * PLSLOT_LENGTH;
static const int MAX_SLOTS_PER_FRAME = 360;
static const int MAX_SYMBOLS_PER_FRAME =
(1+MAX_SLOTS_PER_FRAME)*plslot<uint8_t>::LENGTH +
((MAX_SLOTS_PER_FRAME-1)/16)*PILOT_LENGTH;
(1+MAX_SLOTS_PER_FRAME) * PLSLOT_LENGTH +
((MAX_SLOTS_PER_FRAME-1)/16) * PILOT_LENGTH;
int nslots_nf; // Number of 90-symbol slots per normal frame
int nsymbols; // Symbols in the constellation
cstln_base::predef c;
@ -382,9 +385,6 @@ namespace leansdr {
bool fastdrift; // Carrier drift faster than pilots
float freq_tol; // Tolerance on carrier frequency
float sr_tol; // Tolerance on symbol rate
static const int MAX_SYMBOLS_PER_FRAME =
(1+modcod_info::MAX_SLOTS_PER_FRAME)*PLSLOT_LENGTH +
((modcod_info::MAX_SLOTS_PER_FRAME-1)/16)*PILOT_LENGTH;
s2_frame_receiver(scheduler *sch,
sampler_interface<T> *_sampler,
pipebuf< complex<T> > &_in,
@ -416,7 +416,8 @@ namespace leansdr {
mer_out(opt_writer(_mer_out)),
cstln_out(opt_writer(_cstln_out,1024)),
cstln_pls_out(opt_writer(_cstln_pls_out,1024)),
symbols_out(opt_writer(_symbols_out,MAX_SYMBOLS_PER_FRAME)),
symbols_out(opt_writer(_symbols_out,
modcod_info::MAX_SYMBOLS_PER_FRAME)),
state_out(opt_writer(_state_out)),
first_run(true),
scrambling(0),
@ -481,14 +482,14 @@ namespace leansdr {
if ( strongpls ) fail("--strongpls is broken.");
// Require enough samples to detect one plheader,
// TBD margin ?
int min_samples = (1 + MAX_SYMBOLS_PER_FRAME +
int min_samples = (1 + modcod_info::MAX_SYMBOLS_PER_FRAME +
sof.LENGTH+plscodes.LENGTH)*omega0 * 2;
while ( in.readable() >= min_samples + sampler->readahead() &&
out.writable() >= 1+modcod_info::MAX_SLOTS_PER_FRAME &&
opt_writable(freq_out, 1) &&
opt_writable(ss_out, 1) &&
opt_writable(mer_out, 1) &&
opt_writable(symbols_out, MAX_SYMBOLS_PER_FRAME) &&
opt_writable(symbols_out, modcod_info::MAX_SYMBOLS_PER_FRAME) &&
opt_writable(state_out, 1) ) {
if ( first_run ) {
enter_frame_detect();
@ -531,7 +532,8 @@ namespace leansdr {
// is at same level as during steady-state demodulation.
// This has no effect if the first detection is successful.
float duty_factor = 5;
discard = MAX_SYMBOLS_PER_FRAME * omega0 * (duty_factor+drand48()-0.5);
discard = ( modcod_info::MAX_SYMBOLS_PER_FRAME * omega0 *
(duty_factor+drand48()-0.5) );
}
}
@ -547,7 +549,7 @@ namespace leansdr {
sampler->update_freq(ss_cache.fw16/omega0);
const int search_range = MAX_SYMBOLS_PER_FRAME;
const int search_range = modcod_info::MIN_SYMBOLS_PER_FRAME;
ss_cache.p = in.rd();
float q = find_plheader(&ss_cache, search_range);