From e57afffecf6e595f9039c8a1d66eb862cb984188 Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Fri, 10 Feb 2023 09:15:52 +0100 Subject: [PATCH] need to align the rotation --- decode.cc | 5 +++-- encode.cc | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/decode.cc b/decode.cc index ebdec08..3d5bd49 100644 --- a/decode.cc +++ b/decode.cc @@ -73,7 +73,7 @@ public: SchmidlCox(const cmplx *sequence) : threshold(value(0.2*match_len), value(0.3*match_len)) { -#if 0 +#if 1 fsh.omega(-1, symbol_len); #endif for (int i = 0; i < symbol_len; ++i) @@ -84,7 +84,8 @@ public: } bool operator()(const cmplx *samples) { - cmplx P = cor(fsh() * samples[search_pos] * conj(samples[search_pos+symbol_len+guard_len])); + 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])); value min_R = 0.0001 * symbol_len; R = std::max(R, min_R); diff --git a/encode.cc b/encode.cc index 39dbdf4..bef988e 100644 --- a/encode.cc +++ b/encode.cc @@ -68,7 +68,7 @@ struct Encoder CODE::MLS seq(0b1100111); for (int i = 0; i < symbol_len; ++i) fdom[i] = 0; -#if 0 +#if 1 fdom[first_subcarrier+1] = std::sqrt(value(2 * symbol_len) / value(subcarrier_count)); for (int i = first_subcarrier + 2; i < first_subcarrier + subcarrier_count + 1; ++i) fdom[i] = fdom[i-1] * cmplx(nrz(seq()));