mirror of
https://github.com/aicodix/modem.git
synced 2026-04-27 14:30:34 +00:00
use 16 bit LLRs
This commit is contained in:
parent
25d9f2218b
commit
b71926062d
3 changed files with 16 additions and 9 deletions
11
decode.cc
11
decode.cc
|
|
@ -34,12 +34,8 @@ namespace DSP { using std::abs; using std::min; using std::cos; using std::sin;
|
||||||
template <typename value, typename cmplx, int rate>
|
template <typename value, typename cmplx, int rate>
|
||||||
struct Decoder
|
struct Decoder
|
||||||
{
|
{
|
||||||
typedef int8_t code_type;
|
typedef int16_t code_type;
|
||||||
#ifdef __AVX2__
|
typedef SIMD<code_type, 16> mesg_type;
|
||||||
typedef SIMD<code_type, 32 / sizeof(code_type)> mesg_type;
|
|
||||||
#else
|
|
||||||
typedef SIMD<code_type, 16 / sizeof(code_type)> mesg_type;
|
|
||||||
#endif
|
|
||||||
typedef DSP::Const<value> Const;
|
typedef DSP::Const<value> Const;
|
||||||
static const int guard_len = rate / 100;
|
static const int guard_len = rate / 100;
|
||||||
static const int symbol_len = guard_len * 16;
|
static const int symbol_len = guard_len * 16;
|
||||||
|
|
@ -387,11 +383,8 @@ struct Decoder
|
||||||
np += norm(error);
|
np += norm(error);
|
||||||
}
|
}
|
||||||
value precision = sp / np;
|
value precision = sp / np;
|
||||||
// precision = 8;
|
|
||||||
value snr = DSP::decibel(precision);
|
value snr = DSP::decibel(precision);
|
||||||
std::cerr << " " << snr;
|
std::cerr << " " << snr;
|
||||||
if (std::is_same<code_type, int8_t>::value && precision > 32)
|
|
||||||
precision = 32;
|
|
||||||
for (int i = 0; i < tone_count; ++i) {
|
for (int i = 0; i < tone_count; ++i) {
|
||||||
if (i % block_length == poff)
|
if (i % block_length == poff)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
6
psk.hh
6
psk.hh
|
|
@ -27,6 +27,8 @@ struct PhaseShiftKeying<2, TYPE, CODE>
|
||||||
value = std::nearbyint(value);
|
value = std::nearbyint(value);
|
||||||
if (std::is_same<code_type, int8_t>::value)
|
if (std::is_same<code_type, int8_t>::value)
|
||||||
value = std::min<value_type>(std::max<value_type>(value, -127), 127);
|
value = std::min<value_type>(std::max<value_type>(value, -127), 127);
|
||||||
|
if (std::is_same<code_type, int16_t>::value)
|
||||||
|
value = std::min<value_type>(std::max<value_type>(value, -32767), 32767);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -66,6 +68,8 @@ struct PhaseShiftKeying<4, TYPE, CODE>
|
||||||
value = std::nearbyint(value);
|
value = std::nearbyint(value);
|
||||||
if (std::is_same<code_type, int8_t>::value)
|
if (std::is_same<code_type, int8_t>::value)
|
||||||
value = std::min<value_type>(std::max<value_type>(value, -127), 127);
|
value = std::min<value_type>(std::max<value_type>(value, -127), 127);
|
||||||
|
if (std::is_same<code_type, int16_t>::value)
|
||||||
|
value = std::min<value_type>(std::max<value_type>(value, -32767), 32767);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -112,6 +116,8 @@ struct PhaseShiftKeying<8, TYPE, CODE>
|
||||||
value = std::nearbyint(value);
|
value = std::nearbyint(value);
|
||||||
if (std::is_same<code_type, int8_t>::value)
|
if (std::is_same<code_type, int8_t>::value)
|
||||||
value = std::min<value_type>(std::max<value_type>(value, -127), 127);
|
value = std::min<value_type>(std::max<value_type>(value, -127), 127);
|
||||||
|
if (std::is_same<code_type, int16_t>::value)
|
||||||
|
value = std::min<value_type>(std::max<value_type>(value, -32767), 32767);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
8
qam.hh
8
qam.hh
|
|
@ -36,6 +36,8 @@ struct QuadratureAmplitudeModulation<16, TYPE, CODE>
|
||||||
value = std::nearbyint(value);
|
value = std::nearbyint(value);
|
||||||
if (std::is_same<code_type, int8_t>::value)
|
if (std::is_same<code_type, int8_t>::value)
|
||||||
value = std::min<value_type>(std::max<value_type>(value, -127), 127);
|
value = std::min<value_type>(std::max<value_type>(value, -127), 127);
|
||||||
|
if (std::is_same<code_type, int16_t>::value)
|
||||||
|
value = std::min<value_type>(std::max<value_type>(value, -32767), 32767);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -90,6 +92,8 @@ struct QuadratureAmplitudeModulation<64, TYPE, CODE>
|
||||||
value = std::nearbyint(value);
|
value = std::nearbyint(value);
|
||||||
if (std::is_same<code_type, int8_t>::value)
|
if (std::is_same<code_type, int8_t>::value)
|
||||||
value = std::min<value_type>(std::max<value_type>(value, -127), 127);
|
value = std::min<value_type>(std::max<value_type>(value, -127), 127);
|
||||||
|
if (std::is_same<code_type, int16_t>::value)
|
||||||
|
value = std::min<value_type>(std::max<value_type>(value, -32767), 32767);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -148,6 +152,8 @@ struct QuadratureAmplitudeModulation<256, TYPE, CODE>
|
||||||
value = std::nearbyint(value);
|
value = std::nearbyint(value);
|
||||||
if (std::is_same<code_type, int8_t>::value)
|
if (std::is_same<code_type, int8_t>::value)
|
||||||
value = std::min<value_type>(std::max<value_type>(value, -127), 127);
|
value = std::min<value_type>(std::max<value_type>(value, -127), 127);
|
||||||
|
if (std::is_same<code_type, int16_t>::value)
|
||||||
|
value = std::min<value_type>(std::max<value_type>(value, -32767), 32767);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -210,6 +216,8 @@ struct QuadratureAmplitudeModulation<1024, TYPE, CODE>
|
||||||
value = std::nearbyint(value);
|
value = std::nearbyint(value);
|
||||||
if (std::is_same<code_type, int8_t>::value)
|
if (std::is_same<code_type, int8_t>::value)
|
||||||
value = std::min<value_type>(std::max<value_type>(value, -127), 127);
|
value = std::min<value_type>(std::max<value_type>(value, -127), 127);
|
||||||
|
if (std::is_same<code_type, int16_t>::value)
|
||||||
|
value = std::min<value_type>(std::max<value_type>(value, -32767), 32767);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue