mirror of
https://github.com/aicodix/code.git
synced 2026-04-27 14:30:36 +00:00
limit code length to 256
This commit is contained in:
parent
0642259333
commit
520382a396
3 changed files with 7 additions and 15 deletions
|
|
@ -26,7 +26,7 @@ class PACEncoder
|
|||
return output;
|
||||
}
|
||||
public:
|
||||
void operator()(TYPE *codeword, const TYPE *message, const int *rank_map, int mesg_bits, int level)
|
||||
void operator()(TYPE *codeword, const TYPE *message, const uint8_t *rank_map, int mesg_bits, int level)
|
||||
{
|
||||
int length = 1 << level;
|
||||
int state = 0;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ struct PACListTree
|
|||
typedef typename PH::PATH PATH;
|
||||
typedef typename PH::MAP MAP;
|
||||
static const int N = 1 << M;
|
||||
static MAP decode(PATH *metric, TYPE *message, MAP *maps, int *count, int *state, TYPE *hard, TYPE *soft, const int *rank, int frozen)
|
||||
static MAP decode(PATH *metric, TYPE *message, MAP *maps, int *count, int *state, TYPE *hard, TYPE *soft, const uint8_t *rank, int frozen)
|
||||
{
|
||||
for (int i = 0; i < N/2; ++i)
|
||||
soft[i+N/2] = PH::prod(soft[i+N], soft[i+N/2+N]);
|
||||
|
|
@ -97,7 +97,7 @@ struct PACListTree<TYPE, 1>
|
|||
*hard = hrd;
|
||||
return map;
|
||||
}
|
||||
static MAP decode(PATH *metric, TYPE *message, MAP *maps, int *count, int *state, TYPE *hard, TYPE *soft, const int *rank, int frozen)
|
||||
static MAP decode(PATH *metric, TYPE *message, MAP *maps, int *count, int *state, TYPE *hard, TYPE *soft, const uint8_t *rank, int frozen)
|
||||
{
|
||||
soft[1] = PH::prod(soft[2], soft[3]);
|
||||
MAP lmap, rmap;
|
||||
|
|
@ -118,7 +118,7 @@ struct PACListTree<TYPE, 1>
|
|||
template <typename TYPE, int MAX_M>
|
||||
class PACListDecoder
|
||||
{
|
||||
static_assert(MAX_M >= 5 && MAX_M <= 16);
|
||||
static_assert(MAX_M >= 5 && MAX_M <= 8);
|
||||
typedef PolarHelper<TYPE> PH;
|
||||
typedef typename TYPE::value_type VALUE;
|
||||
typedef typename PH::PATH PATH;
|
||||
|
|
@ -128,7 +128,7 @@ class PACListDecoder
|
|||
TYPE hard[MAX_N];
|
||||
MAP maps[MAX_N];
|
||||
public:
|
||||
void operator()(int *rank, TYPE *message, const VALUE *codeword, const int *rank_map, int mesg_bits, int level)
|
||||
void operator()(int *rank, TYPE *message, const VALUE *codeword, const uint8_t *rank_map, int mesg_bits, int level)
|
||||
{
|
||||
assert(level <= MAX_M);
|
||||
PATH metric[TYPE::SIZE];
|
||||
|
|
@ -149,14 +149,6 @@ public:
|
|||
case 6: PACListTree<TYPE, 6>::decode(metric, message, maps, &count, state, hard, soft, rank_map, frozen); break;
|
||||
case 7: PACListTree<TYPE, 7>::decode(metric, message, maps, &count, state, hard, soft, rank_map, frozen); break;
|
||||
case 8: PACListTree<TYPE, 8>::decode(metric, message, maps, &count, state, hard, soft, rank_map, frozen); break;
|
||||
case 9: PACListTree<TYPE, 9>::decode(metric, message, maps, &count, state, hard, soft, rank_map, frozen); break;
|
||||
case 10: PACListTree<TYPE, 10>::decode(metric, message, maps, &count, state, hard, soft, rank_map, frozen); break;
|
||||
case 11: PACListTree<TYPE, 11>::decode(metric, message, maps, &count, state, hard, soft, rank_map, frozen); break;
|
||||
case 12: PACListTree<TYPE, 12>::decode(metric, message, maps, &count, state, hard, soft, rank_map, frozen); break;
|
||||
case 13: PACListTree<TYPE, 13>::decode(metric, message, maps, &count, state, hard, soft, rank_map, frozen); break;
|
||||
case 14: PACListTree<TYPE, 14>::decode(metric, message, maps, &count, state, hard, soft, rank_map, frozen); break;
|
||||
case 15: PACListTree<TYPE, 15>::decode(metric, message, maps, &count, state, hard, soft, rank_map, frozen); break;
|
||||
case 16: PACListTree<TYPE, 16>::decode(metric, message, maps, &count, state, hard, soft, rank_map, frozen); break;
|
||||
default: assert(false);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ Copyright 2025 Ahmet Inan <inan@aicodix.de>
|
|||
|
||||
int main()
|
||||
{
|
||||
const int MAX_M = 10;
|
||||
const int MAX_M = 8;
|
||||
const int MAX_N = 1 << MAX_M;
|
||||
const int M = 7;
|
||||
const int N = 1 << M;
|
||||
|
|
@ -52,7 +52,7 @@ int main()
|
|||
auto rel_seq = new int[MAX_N];
|
||||
(*construct)(rel_seq, MAX_M);
|
||||
delete construct;
|
||||
auto rank_map = new int[N];
|
||||
auto rank_map = new uint8_t[N];
|
||||
for (int i = 0, j = 0; i < MAX_N && j < N; ++i) {
|
||||
int index = rel_seq[i];
|
||||
if (index < N)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue