mirror of
https://github.com/aicodix/code.git
synced 2026-04-27 14:30:36 +00:00
align parity bits accordingly
if we want to use a crc aid at the end, we should move the start of the first parity bit as far as possible to the front, otherwise we want the last bit to be a parity bit
This commit is contained in:
parent
e83dbce91f
commit
f3d3afbe01
2 changed files with 9 additions and 6 deletions
|
|
@ -84,6 +84,9 @@ int main()
|
|||
for (int i = 0; i < N - K; ++i)
|
||||
frozen[reliability_sequence[i]/32] |= 1 << (reliability_sequence[i]%32);
|
||||
int P = K / (S + 1);
|
||||
int F = K % (S + 1);
|
||||
if (!crc_aided)
|
||||
F += S;
|
||||
if (par_aided)
|
||||
K -= P;
|
||||
std::cerr << "Polar(" << N << ", " << K << ")" << std::endl;
|
||||
|
|
@ -142,7 +145,7 @@ int main()
|
|||
assert(codeword[i] == message[j++]);
|
||||
} else if (par_aided) {
|
||||
CODE::PolarParityEncoder<code_type> encode;
|
||||
encode(codeword, message, frozen, M, S);
|
||||
encode(codeword, message, frozen, M, S, F);
|
||||
} else {
|
||||
CODE::PolarEncoder<code_type> encode;
|
||||
encode(codeword, message, frozen, M);
|
||||
|
|
@ -169,7 +172,7 @@ int main()
|
|||
|
||||
auto start = std::chrono::system_clock::now();
|
||||
if (par_aided)
|
||||
(*par_dec)(metric, decoded, codeword, frozen, M, S);
|
||||
(*par_dec)(metric, decoded, codeword, frozen, M, S, F);
|
||||
else
|
||||
(*decode)(metric, decoded, codeword, frozen, M);
|
||||
auto end = std::chrono::system_clock::now();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue