omit guard between synchronization symbols

This commit is contained in:
Ahmet Inan 2023-02-10 11:24:18 +01:00
commit cca0199d63
2 changed files with 9 additions and 8 deletions

View file

@ -85,8 +85,8 @@ public:
bool operator()(const cmplx *samples)
{
cmplx S = fsh();
cmplx P = conj(S) * cor(S * samples[search_pos] * conj(samples[search_pos+symbol_len+guard_len]));
value R = value(0.5) * pwr(norm(samples[search_pos]) + norm(samples[search_pos+symbol_len+guard_len]));
cmplx P = conj(S) * cor(S * samples[search_pos] * conj(samples[search_pos+symbol_len]));
value R = value(0.5) * pwr(norm(samples[search_pos]) + norm(samples[search_pos+symbol_len]));
value min_R = 0.0001 * symbol_len;
R = std::max(R, min_R);
value timing = match(norm(P) / (R * R));
@ -115,11 +115,11 @@ public:
if (!process)
return false;
frac_cfo = phase_max / value(symbol_len+guard_len);
frac_cfo = phase_max / value(symbol_len);
DSP::Phasor<cmplx> osc;
osc.omega(frac_cfo);
symbol_pos = search_pos - index_max + guard_len;
symbol_pos = search_pos - index_max;
index_max = 0;
timing_max = 0;
for (int i = 0; i < symbol_len; ++i)

View file

@ -48,7 +48,7 @@ struct Encoder
{
return 1 - 2 * bit;
}
void symbol()
void symbol(bool output_guard = true)
{
bwd(tdom, fdom);
for (int i = 0; i < symbol_len; ++i)
@ -58,7 +58,8 @@ struct Encoder
x = value(0.5) * (value(1) - std::cos(DSP::Const<value>::Pi() * x));
guard[i] = DSP::lerp(guard[i], tdom[i+symbol_len-guard_len], x);
}
pcm->write(reinterpret_cast<value *>(guard), guard_len, 2);
if (output_guard)
pcm->write(reinterpret_cast<value *>(guard), guard_len, 2);
pcm->write(reinterpret_cast<value *>(tdom), symbol_len, 2);
for (int i = 0; i < guard_len; ++i)
guard[i] = tdom[i];
@ -76,13 +77,13 @@ struct Encoder
for (int i = first_subcarrier; i < first_subcarrier + subcarrier_count; ++i)
fdom[i] = fdom[i+1];
fdom[first_subcarrier+subcarrier_count] = 0;
symbol();
symbol(false);
#else
fdom[first_subcarrier] = std::sqrt(value(2 * symbol_len) / value(subcarrier_count));
for (int i = first_subcarrier + 1; i < first_subcarrier + subcarrier_count; ++i)
fdom[i] = fdom[i-1] * cmplx(nrz(seq()));
symbol();
symbol();
symbol(false);
#endif
}
cmplx mod_map(code_type *b)