mirror of https://github.com/f4exb/sdrangel.git
FT8: implement Gray decoding when decoding from magnitudes
This commit is contained in:
parent
1691a3dfb3
commit
cd7f0c16c4
29
ft8/ft8.cpp
29
ft8/ft8.cpp
|
@ -1233,6 +1233,32 @@ std::vector<std::vector<float>> FT8::un_gray_code_r(const std::vector<std::vecto
|
||||||
return m79a;
|
return m79a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Generic Gray decoding for magnitudes (floats)
|
||||||
|
//
|
||||||
|
std::vector<std::vector<float>> FT8::un_gray_code_r_gen(const std::vector<std::vector<float>> &mags)
|
||||||
|
{
|
||||||
|
if (mags.size() == 0) {
|
||||||
|
return mags;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::vector<float>> magsa(mags.size());
|
||||||
|
int nsyms = mags.front().size();
|
||||||
|
|
||||||
|
for (unsigned int si = 0; si < mags.size(); si++)
|
||||||
|
{
|
||||||
|
magsa[si].resize(nsyms);
|
||||||
|
|
||||||
|
for (int bini = 0; bini < nsyms; bini++)
|
||||||
|
{
|
||||||
|
int grayi = bini ^ (bini >> 1);
|
||||||
|
magsa[si][bini] = mags[si][grayi];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return magsa;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// normalize levels by windowed median.
|
// normalize levels by windowed median.
|
||||||
// this helps, but why?
|
// this helps, but why?
|
||||||
|
@ -1919,6 +1945,7 @@ void FT8::soft_decode_mags(FT8Params& params, const std::vector<std::vector<floa
|
||||||
Stats bests(params.problt_how_sig, params.log_tail, params.log_rate);
|
Stats bests(params.problt_how_sig, params.log_tail, params.log_rate);
|
||||||
Stats all(params.problt_how_noise, params.log_tail, params.log_rate);
|
Stats all(params.problt_how_noise, params.log_tail, params.log_rate);
|
||||||
make_stats_gen(mags, nbSymbolBits, bests, all);
|
make_stats_gen(mags, nbSymbolBits, bests, all);
|
||||||
|
mags = un_gray_code_r_gen(mags);
|
||||||
int lli = 0;
|
int lli = 0;
|
||||||
int zoX = 1<<(nbSymbolBits-1);
|
int zoX = 1<<(nbSymbolBits-1);
|
||||||
int zoY = nbSymbolBits;
|
int zoY = nbSymbolBits;
|
||||||
|
@ -3188,7 +3215,7 @@ int FT8::one_iter1(
|
||||||
hz1_for_cb,
|
hz1_for_cb,
|
||||||
params.use_osd,
|
params.use_osd,
|
||||||
"",
|
"",
|
||||||
m79
|
m79
|
||||||
);
|
);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
|
|
@ -286,6 +286,11 @@ public:
|
||||||
//
|
//
|
||||||
static void soft_decode_mags(FT8Params& params, const std::vector<std::vector<float>>& mags, int nbSymbolBits, float ll174[]);
|
static void soft_decode_mags(FT8Params& params, const std::vector<std::vector<float>>& mags, int nbSymbolBits, float ll174[]);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Generic Gray decoding for magnitudes (floats)
|
||||||
|
//
|
||||||
|
static std::vector<std::vector<float>> un_gray_code_r_gen(const std::vector<std::vector<float>> &mags);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//
|
//
|
||||||
// reduce the sample rate from arate to brate.
|
// reduce the sample rate from arate to brate.
|
||||||
|
|
|
@ -322,7 +322,8 @@ void TestFT8Protocols::testSoftDecode(const QStringList& argElements)
|
||||||
}
|
}
|
||||||
|
|
||||||
symbol = symbol % symbolSize;
|
symbol = symbol % symbolSize;
|
||||||
magSymbols[symbol] += 0.01;
|
symbol = symbol ^(symbol >> 1); // Gray code
|
||||||
|
magSymbols[symbol] += 0.015;
|
||||||
mags.push_back(magSymbols);
|
mags.push_back(magSymbols);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue