mirror of
https://github.com/aicodix/code.git
synced 2026-04-27 14:30:36 +00:00
init conv state with last 6 bits
This commit is contained in:
parent
cb8dcd0ffb
commit
67355dbdb3
2 changed files with 13 additions and 6 deletions
|
|
@ -22,7 +22,7 @@ class PACEncoder
|
|||
bool b4 = (*state >> 4) & 1;
|
||||
bool b6 = (*state >> 6) & 1;
|
||||
bool output = input ^ b1 ^ b3 ^ b4 ^ b6;
|
||||
*state = ((*state & 62) << 1) | (input ? 2 : 0) | (output ? 1 : 0);
|
||||
*state = (*state & 8064) | ((*state & 62) << 1) | (input ? 2 : 0) | (output ? 1 : 0);
|
||||
return output;
|
||||
}
|
||||
public:
|
||||
|
|
@ -31,6 +31,13 @@ public:
|
|||
int length = 1 << level;
|
||||
int state = 0;
|
||||
int frozen = length - mesg_bits;
|
||||
for (int i = 0, j = 0; i < length; i += 2) {
|
||||
TYPE msg0 = rank_map[i] < frozen ? PH::one() : message[j++];
|
||||
TYPE msg1 = rank_map[i+1] < frozen ? PH::one() : message[j++];
|
||||
conv(&state, msg0 < 0);
|
||||
conv(&state, msg1 < 0);
|
||||
}
|
||||
state |= (state & 126) << 7;
|
||||
for (int i = 0; i < length; i += 2) {
|
||||
TYPE msg0 = rank_map[i] < frozen ? PH::one() : *message++;
|
||||
TYPE msg1 = rank_map[i+1] < frozen ? PH::one() : *message++;
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ struct PACListTree<TYPE, 1>
|
|||
bool b4 = (*state >> 4) & 1;
|
||||
bool b6 = (*state >> 6) & 1;
|
||||
bool output = input ^ b1 ^ b3 ^ b4 ^ b6;
|
||||
*state = ((*state & 62) << 1) | (input ? 2 : 0) | (output ? 1 : 0);
|
||||
*state = (*state & 8064) | ((*state & 62) << 1) | (input ? 2 : 0) | (output ? 1 : 0);
|
||||
return output;
|
||||
}
|
||||
static MAP rate0(PATH *metric, int *state, TYPE *hard, TYPE *soft)
|
||||
|
|
@ -119,6 +119,7 @@ template <typename TYPE, int MAX_M>
|
|||
class PACListDecoder
|
||||
{
|
||||
static_assert(MAX_M >= 5 && MAX_M <= 8);
|
||||
static_assert(TYPE::SIZE == 64);
|
||||
typedef PolarHelper<TYPE> PH;
|
||||
typedef typename TYPE::value_type VALUE;
|
||||
typedef typename PH::PATH PATH;
|
||||
|
|
@ -133,15 +134,14 @@ public:
|
|||
assert(level <= MAX_M);
|
||||
PATH metric[TYPE::SIZE];
|
||||
int count = 0;
|
||||
metric[0] = 0;
|
||||
for (int k = 1; k < TYPE::SIZE; ++k)
|
||||
metric[k] = 1000000;
|
||||
for (int k = 0; k < TYPE::SIZE; ++k)
|
||||
metric[k] = 0;
|
||||
int length = 1 << level;
|
||||
for (int i = 0; i < length; ++i)
|
||||
soft[length+i] = vdup<TYPE>(codeword[i]);
|
||||
int state[TYPE::SIZE];
|
||||
for (int i = 0; i < TYPE::SIZE; ++i)
|
||||
state[i] = 0;
|
||||
state[i] = (i << 7) | (i << 1);
|
||||
int frozen = length - mesg_bits;
|
||||
|
||||
switch (level) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue