mirror of
https://github.com/aicodix/code.git
synced 2026-04-27 22:35:44 +00:00
do multi-round using a smaller list size
This commit is contained in:
parent
43508ce94e
commit
0c3b9111f1
3 changed files with 44 additions and 17 deletions
|
|
@ -22,7 +22,7 @@ class PACEncoder
|
||||||
bool b4 = (*state >> 4) & 1;
|
bool b4 = (*state >> 4) & 1;
|
||||||
bool b6 = (*state >> 6) & 1;
|
bool b6 = (*state >> 6) & 1;
|
||||||
bool output = input ^ b1 ^ b3 ^ b4 ^ b6;
|
bool output = input ^ b1 ^ b3 ^ b4 ^ b6;
|
||||||
*state = (*state & 8064) | ((*state & 62) << 1) | (input ? 2 : 0) | (output ? 1 : 0);
|
*state = ((*state & 62) << 1) | (input ? 2 : 0) | (output ? 1 : 0);
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ struct PACListTree<TYPE, 1>
|
||||||
bool b4 = (*state >> 4) & 1;
|
bool b4 = (*state >> 4) & 1;
|
||||||
bool b6 = (*state >> 6) & 1;
|
bool b6 = (*state >> 6) & 1;
|
||||||
bool output = input ^ b1 ^ b3 ^ b4 ^ b6;
|
bool output = input ^ b1 ^ b3 ^ b4 ^ b6;
|
||||||
*state = (*state & 8064) | ((*state & 62) << 1) | (input ? 2 : 0) | (output ? 1 : 0);
|
*state = ((*state & 62) << 1) | (input ? 2 : 0) | (output ? 1 : 0);
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
static MAP rate0(PATH *metric, int *count, int *state, TYPE *hard, TYPE *soft)
|
static MAP rate0(PATH *metric, int *count, int *state, TYPE *hard, TYPE *soft)
|
||||||
|
|
@ -123,7 +123,6 @@ template <typename TYPE, int MAX_M>
|
||||||
class PACListDecoder
|
class PACListDecoder
|
||||||
{
|
{
|
||||||
static_assert(MAX_M >= 5 && MAX_M <= 8);
|
static_assert(MAX_M >= 5 && MAX_M <= 8);
|
||||||
static_assert(TYPE::SIZE >= 64);
|
|
||||||
typedef PolarHelper<TYPE> PH;
|
typedef PolarHelper<TYPE> PH;
|
||||||
typedef typename TYPE::value_type VALUE;
|
typedef typename TYPE::value_type VALUE;
|
||||||
typedef typename PH::PATH PATH;
|
typedef typename PH::PATH PATH;
|
||||||
|
|
@ -137,20 +136,49 @@ public:
|
||||||
{
|
{
|
||||||
assert(level <= MAX_M);
|
assert(level <= MAX_M);
|
||||||
PATH metric[TYPE::SIZE];
|
PATH metric[TYPE::SIZE];
|
||||||
int count = 0;
|
int state[TYPE::SIZE];
|
||||||
for (int k = 0; k < 64; ++k)
|
int count;
|
||||||
metric[k] = 0;
|
|
||||||
for (int k = 64; k < TYPE::SIZE; ++k)
|
|
||||||
metric[k] = 1000000;
|
|
||||||
int length = 1 << level;
|
int length = 1 << level;
|
||||||
|
int frozen = length - mesg_bits;
|
||||||
|
int best_metric = 1000000;
|
||||||
|
int best_round = 0;
|
||||||
|
|
||||||
|
for (int round = 0; round < 64; ++round) {
|
||||||
|
count = 0;
|
||||||
|
metric[0] = 0;
|
||||||
|
for (int k = 1; k < TYPE::SIZE; ++k)
|
||||||
|
metric[k] = 1000000;
|
||||||
|
for (int i = 0; i < length; ++i)
|
||||||
|
soft[length+i] = vdup<TYPE>(codeword[i]);
|
||||||
|
state[0] = round << 1;
|
||||||
|
for (int i = 1; i < TYPE::SIZE; ++i)
|
||||||
|
state[i] = 0;
|
||||||
|
|
||||||
|
switch (level) {
|
||||||
|
case 5: PACListTree<TYPE, 5>::decode(metric, message, maps, &count, state, hard, soft, rank_map, frozen); break;
|
||||||
|
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;
|
||||||
|
default: assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < TYPE::SIZE; ++i) {
|
||||||
|
if (round == ((state[i] & 126) >> 1) && metric[i] < best_metric) {
|
||||||
|
best_metric = metric[i];
|
||||||
|
best_round = round;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
count = 0;
|
||||||
|
metric[0] = 0;
|
||||||
|
for (int k = 1; k < TYPE::SIZE; ++k)
|
||||||
|
metric[k] = 1000000;
|
||||||
for (int i = 0; i < length; ++i)
|
for (int i = 0; i < length; ++i)
|
||||||
soft[length+i] = vdup<TYPE>(codeword[i]);
|
soft[length+i] = vdup<TYPE>(codeword[i]);
|
||||||
int state[TYPE::SIZE];
|
state[0] = best_round << 1;
|
||||||
for (int i = 0; i < 64; ++i)
|
for (int i = 1; i < TYPE::SIZE; ++i)
|
||||||
state[i] = (i << 7) | (i << 1);
|
|
||||||
for (int i = 64; i < TYPE::SIZE; ++i)
|
|
||||||
state[i] = 0;
|
state[i] = 0;
|
||||||
int frozen = length - mesg_bits;
|
|
||||||
|
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case 5: PACListTree<TYPE, 5>::decode(metric, message, maps, &count, state, hard, soft, rank_map, frozen); break;
|
case 5: PACListTree<TYPE, 5>::decode(metric, message, maps, &count, state, hard, soft, rank_map, frozen); break;
|
||||||
|
|
@ -159,9 +187,8 @@ public:
|
||||||
case 8: PACListTree<TYPE, 8>::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;
|
||||||
default: assert(false);
|
default: assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < TYPE::SIZE; ++i)
|
for (int i = 0; i < TYPE::SIZE; ++i)
|
||||||
if (((state[i] & 8064) >> 7) != ((state[i] & 126) >> 1))
|
if (best_round != ((state[i] & 126) >> 1))
|
||||||
metric[i] = 1000000;
|
metric[i] = 1000000;
|
||||||
int perm[TYPE::SIZE];
|
int perm[TYPE::SIZE];
|
||||||
CODE::insertion_sort(perm, metric, TYPE::SIZE);
|
CODE::insertion_sort(perm, metric, TYPE::SIZE);
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,10 @@ int main()
|
||||||
const int C = 16;
|
const int C = 16;
|
||||||
int K = R * N + crc_aided * C;
|
int K = R * N + crc_aided * C;
|
||||||
#if 1
|
#if 1
|
||||||
const int L = 64;
|
const int L = 16;
|
||||||
typedef int8_t code_type;
|
typedef int8_t code_type;
|
||||||
#else
|
#else
|
||||||
const int L = 16;
|
const int L = 4;
|
||||||
typedef float code_type;
|
typedef float code_type;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue