2108 while (
in.readable() >= 1 &&
out.writable() >= 1 &&
2111 fecframe<SOFTBYTE> *pin =
in.rd();
2112 const modcod_info *mcinfo =
check_modcod(pin->pls.modcod);
2113 const fec_info *fi = &fec_infos[pin->pls.sf][mcinfo->rate];
2114 bool corrupted =
false;
2115 bool residual_errors;
2119 size_t cwbits = pin->pls.framebits();
2120 size_t msgbits = fi->kldpc;
2121 size_t chkbits = cwbits - msgbits;
2123 int ncorr = ldpc->decode_bitflip(fi->ldpc, pin->bytes, msgbits, cwbits,
bitflips);
2125 fprintf(stderr,
"LDPCCORR = %d\n", ncorr);
2131 size_t cwbytes = fi->kldpc / 8;
2132 size_t msgbytes = fi->Kbch / 8;
2133 size_t chkbytes = cwbytes - msgbytes;
2135 bch_interface *bch =
s2bch.
bchs[pin->pls.sf][mcinfo->rate];
2136 int ncorr = bch->
decode(hardbytes, cwbytes);
2138 fprintf(stderr,
"BCHCORR = %d\n", ncorr);
2139 corrupted = (ncorr < 0);
2140 residual_errors = (ncorr != 0);
2145 int bbsize = fi->Kbch / 8;
2149 fprintf(stderr,
"Passing bad frame\n");
2156 bbframe *pout =
out.wr();
2157 pout->pls = pin->pls;
2162 fprintf(stderr,
"%c", corrupted ?
':' : residual_errors ?
'.' :
'_');
virtual int decode(uint8_t *cw, size_t cwbytes)=0
uint8_t * softbytes_harden(hard_sb p[], int nbytes, uint8_t storage[])
pipewriter< int > * bitcount
bch_interface * bchs[2][FEC_COUNT]
s2_ldpc_engines< SOFTBIT, SOFTBYTE > s2ldpc
pipewriter< bbframe > out
void opt_write(pipewriter< T > *p, T val)
bool opt_writable(pipewriter< T > *p, int n=1)
pipewriter< int > * errcount
void transform(const uint8_t *in, int bbsize, uint8_t *out)
s2_bbscrambling bbscrambling
ldpc_engine< bool, hard_sb, 8, uint16_t > s2_ldpc_engine
const modcod_info * check_modcod(int m)
pipereader< fecframe< SOFTBYTE > > in