mirror of
https://github.com/aicodix/modem.git
synced 2026-04-27 22:35:41 +00:00
restored short and long codes
This commit is contained in:
parent
f1539aacdc
commit
3765da54ff
5 changed files with 25 additions and 1 deletions
|
|
@ -13,7 +13,7 @@ Copyright 2025 Ahmet Inan <inan@aicodix.de>
|
|||
struct Common
|
||||
{
|
||||
static const int mod_max = 8;
|
||||
static const int code_max = 15;
|
||||
static const int code_max = 16;
|
||||
static const int bits_max = 1 << code_max;
|
||||
static const int data_max = 2048;
|
||||
static const int symbols_max = 22 + 1;
|
||||
|
|
|
|||
10
decode.cc
10
decode.cc
|
|
@ -147,6 +147,11 @@ struct Decoder : Common
|
|||
dest[0] = src[0];
|
||||
for (int i = 1; i < 256; ++i)
|
||||
dest[seq()] = src[i];
|
||||
} else if (order == 11) {
|
||||
CODE::XorShiftMask<int, 11, 1, 3, 4, 1> seq;
|
||||
dest[0] = src[0];
|
||||
for (int i = 1; i < 2048; ++i)
|
||||
dest[seq()] = src[i];
|
||||
} else if (order == 12) {
|
||||
CODE::XorShiftMask<int, 12, 1, 1, 4, 1> seq;
|
||||
dest[0] = src[0];
|
||||
|
|
@ -167,6 +172,11 @@ struct Decoder : Common
|
|||
dest[0] = src[0];
|
||||
for (int i = 1; i < 32768; ++i)
|
||||
dest[seq()] = src[i];
|
||||
} else if (order == 16) {
|
||||
CODE::XorShiftMask<int, 16, 1, 1, 14, 1> seq;
|
||||
dest[0] = src[0];
|
||||
for (int i = 1; i < 65536; ++i)
|
||||
dest[seq()] = src[i];
|
||||
}
|
||||
}
|
||||
const cmplx *next_sample()
|
||||
|
|
|
|||
10
encode.cc
10
encode.cc
|
|
@ -226,6 +226,11 @@ struct Encoder : public Common
|
|||
dest[0] = src[0];
|
||||
for (int i = 1; i < 256; ++i)
|
||||
dest[i] = src[seq()];
|
||||
} else if (order == 11) {
|
||||
CODE::XorShiftMask<int, 11, 1, 3, 4, 1> seq;
|
||||
dest[0] = src[0];
|
||||
for (int i = 1; i < 2048; ++i)
|
||||
dest[i] = src[seq()];
|
||||
} else if (order == 12) {
|
||||
CODE::XorShiftMask<int, 12, 1, 1, 4, 1> seq;
|
||||
dest[0] = src[0];
|
||||
|
|
@ -246,6 +251,11 @@ struct Encoder : public Common
|
|||
dest[0] = src[0];
|
||||
for (int i = 1; i < 32768; ++i)
|
||||
dest[i] = src[seq()];
|
||||
} else if (order == 16) {
|
||||
CODE::XorShiftMask<int, 16, 1, 1, 14, 1> seq;
|
||||
dest[0] = src[0];
|
||||
for (int i = 1; i < 65536; ++i)
|
||||
dest[i] = src[seq()];
|
||||
}
|
||||
}
|
||||
void guard_interval_weights()
|
||||
|
|
|
|||
|
|
@ -27,10 +27,12 @@ void code(int N, int K, double P)
|
|||
|
||||
int main()
|
||||
{
|
||||
code<16>(65536, 32768+32, 0.42);
|
||||
code<15>(32768, 16384+32, 0.40);
|
||||
code<14>(16384, 8192+32, 0.39);
|
||||
code<13>(8192, 4096+32, 0.38);
|
||||
code<12>(4096, 2048+32, 0.37);
|
||||
code<11>(2048, 1024+32, 0.34);
|
||||
code<8>(256, 47+8+16, 0.5);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue