kopia lustrzana https://github.com/M17-Project/M17_Implementations
added soft bit (de)randomizer too
rodzic
f657d03527
commit
47dae3c230
|
@ -103,6 +103,7 @@ void soft_XOR(uint16_t* out, const uint16_t* a, const uint16_t* b, const uint8_t
|
||||||
extern const uint8_t rand_seq[46];
|
extern const uint8_t rand_seq[46];
|
||||||
|
|
||||||
void randomize_bits(uint8_t inp[SYM_PER_PLD*2]);
|
void randomize_bits(uint8_t inp[SYM_PER_PLD*2]);
|
||||||
|
void randomize_soft_bits(uint16_t inp[SYM_PER_PLD*2]);
|
||||||
|
|
||||||
// M17 C library - lib/phy/slice.c
|
// M17 C library - lib/phy/slice.c
|
||||||
void slice_symbols(uint16_t out[2*SYM_PER_PLD], const float inp[SYM_PER_PLD]);
|
void slice_symbols(uint16_t out[2*SYM_PER_PLD], const float inp[SYM_PER_PLD]);
|
||||||
|
|
|
@ -31,3 +31,19 @@ void randomize_bits(uint8_t inp[SYM_PER_PLD*2])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Randomize type-4 unpacked bits.
|
||||||
|
*
|
||||||
|
* @param inp Input 368 soft type-4 bits.
|
||||||
|
*/
|
||||||
|
void randomize_soft_bits(uint16_t inp[SYM_PER_PLD*2])
|
||||||
|
{
|
||||||
|
for(uint16_t i=0; i<SYM_PER_PLD*2; i++)
|
||||||
|
{
|
||||||
|
if((rand_seq[i/8]>>(7-(i%8)))&1) //flip bit if '1'
|
||||||
|
{
|
||||||
|
inp[i]=soft_bit_NOT(inp[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -82,11 +82,7 @@ int main(void)
|
||||||
slice_symbols(soft_bit, pld);
|
slice_symbols(soft_bit, pld);
|
||||||
|
|
||||||
//derandomize
|
//derandomize
|
||||||
for(uint16_t i=0; i<SYM_PER_PLD*2; i++)
|
randomize_soft_bits(soft_bit);
|
||||||
{
|
|
||||||
if((rand_seq[i/8]>>(7-(i%8)))&1) //soft NOT. flip soft bit if "1"
|
|
||||||
soft_bit[i]=soft_bit_NOT(soft_bit[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
//deinterleave
|
//deinterleave
|
||||||
reorder_soft_bits(d_soft_bit, soft_bit);
|
reorder_soft_bits(d_soft_bit, soft_bit);
|
||||||
|
|
Ładowanie…
Reference in New Issue