template<typename SOFTBIT, typename SOFTBYTE>
struct leansdr::s2_fecdec_helper< SOFTBIT, SOFTBYTE >
Definition at line 2208 of file dvbs2.h.
template<typename SOFTBIT , typename SOFTBYTE >
Definition at line 2373 of file dvbs2.h.
References leansdr::s2_fecdec_helper< SOFTBIT, SOFTBYTE >::helper_instance::b_out, leansdr::bbframe::bytes, leansdr::check_modcod(), leansdr::bch_interface::decode(), leansdr::fatal(), leansdr::s2_fecdec_helper< SOFTBIT, SOFTBYTE >::helper_instance::fd_rx, leansdr::s2_pls::framebits(), leansdr::s2_fecdec_helper< SOFTBIT, SOFTBYTE >::helper_job::h, leansdr::s2_pls::modcod, leansdr::opt_write(), leansdr::bbframe::pls, leansdr::s2_fecdec_helper< SOFTBIT, SOFTBYTE >::helper_job::pls, leansdr::modcod_info::rate, leansdr::s2_pls::sf, leansdr::softbytes_harden(), leansdr::pipewriter< T >::wr(), and leansdr::pipewriter< T >::written().
2376 const s2_pls *pls = &job->pls;
2377 size_t iosize = (pls->framebits() / 8) *
sizeof(
ldpc_buf[0]);
2378 int nr = read(job->h->fd_rx,
ldpc_buf, iosize);
2380 fatal(
"read(LDPC helper)");
2382 fatal(
"partial read(LDPC helper)");
2385 const modcod_info *mcinfo =
check_modcod(job->pls.modcod);
2386 const fec_info *fi = &fec_infos[job->pls.sf][mcinfo->rate];
2388 size_t cwbytes = fi->kldpc / 8;
2389 size_t msgbytes = fi->Kbch / 8;
2390 size_t chkbytes = cwbytes - msgbytes;
2391 bch_interface *bch =
s2bch.
bchs[job->pls.sf][mcinfo->rate];
2392 int ncorr = bch->
decode(hardbytes, cwbytes);
2394 fprintf(stderr,
"BCHCORR = %d\n", ncorr);
2395 bool corrupted = (ncorr < 0);
2402 fprintf(stderr,
"Passing bad frame\n");
2409 bbframe *pout =
out.wr();
2410 pout->pls = job->pls;
2415 fprintf(stderr,
"%c", corrupted ?
'!' : ncorr ?
'.' :
'_');
virtual int decode(uint8_t *cw, size_t cwbytes)=0
uint8_t * softbytes_harden(hard_sb p[], int nbytes, uint8_t storage[])
s2_bbscrambling bbscrambling
bch_interface * bchs[2][FEC_COUNT]
pipewriter< bbframe > out
void opt_write(pipewriter< T > *p, T val)
pipewriter< int > * errcount
pipewriter< int > * bitcount
void transform(const uint8_t *in, int bbsize, uint8_t *out)
void fatal(const char *s)
const modcod_info * check_modcod(int m)
SOFTBYTE ldpc_buf[64800/8]
template<typename SOFTBIT , typename SOFTBYTE >
Definition at line 2280 of file dvbs2.h.
References leansdr::s2_fecdec_helper< SOFTBIT, SOFTBYTE >::helper_instance::b_in, leansdr::s2_fecdec_helper< SOFTBIT, SOFTBYTE >::helper_instance::b_out, leansdr::s2_fecdec_helper< SOFTBIT, SOFTBYTE >::helper_instance::batch_size, leansdr::fecframe< SOFTBYTE >::bytes, leansdr::fatal(), leansdr::s2_fecdec_helper< SOFTBIT, SOFTBYTE >::helper_instance::fd_tx, leansdr::s2_fecdec_helper< SOFTBIT, SOFTBYTE >::helper_job::h, i, leansdr::s2_fecdec_helper< SOFTBIT, SOFTBYTE >::pool::nprocs, leansdr::fecframe< SOFTBYTE >::pls, leansdr::s2_fecdec_helper< SOFTBIT, SOFTBYTE >::helper_job::pls, leansdr::s2_fecdec_helper< SOFTBIT, SOFTBYTE >::pool::procs, and leansdr::simplequeue< T, _SIZE >::put().
2283 for (
int i = 0;
i < p->nprocs; ++
i)
2285 helper_instance *h = &p->procs[
i];
2286 size_t iosize = (pin->pls.framebits() / 8) *
sizeof(SOFTBYTE);
2288 int nw = write(h->fd_tx, pin->bytes, iosize);
2289 if (nw < 0 && errno == EWOULDBLOCK)
2292 fatal(
"write(LDPC helper");
2294 fatal(
"partial write(LDPC helper)");
2295 helper_job *job =
jobs.put();
2296 job->pls = pin->pls;
2299 if (h->b_in >= h->batch_size)
2301 h->b_in -= h->batch_size;
2302 h->b_out += h->batch_size;
void fatal(const char *s)
simplequeue< helper_job, 1024 > jobs
pool * get_pool(const s2_pls *pls)
template<typename SOFTBIT , typename SOFTBYTE >
Definition at line 2322 of file dvbs2.h.
References leansdr::s2_fecdec_helper< SOFTBIT, SOFTBYTE >::helper_instance::b_in, leansdr::s2_fecdec_helper< SOFTBIT, SOFTBYTE >::helper_instance::b_out, leansdr::s2_fecdec_helper< SOFTBIT, SOFTBYTE >::helper_instance::batch_size, leansdr::fatal(), leansdr::s2_fecdec_helper< SOFTBIT, SOFTBYTE >::helper_instance::fd_rx, leansdr::s2_fecdec_helper< SOFTBIT, SOFTBYTE >::helper_instance::fd_tx, leansdr::s2_pls::modcod, and leansdr::s2_pls::sf.
2325 fprintf(stderr,
"Spawning LDPC helper: modcod=%d sf=%d\n",
2326 pls->modcod, pls->sf);
2328 if (pipe(tx) || pipe(rx))
2332 if (fcntl(tx[0], F_SETPIPE_SZ, pipesize) < 0 ||
2333 fcntl(rx[0], F_SETPIPE_SZ, pipesize) < 0 ||
2334 fcntl(tx[1], F_SETPIPE_SZ, pipesize) < 0 ||
2335 fcntl(rx[1], F_SETPIPE_SZ, pipesize) < 0)
2338 "*** Failed to increase pipe size.\n" 2339 "*** Try echo %d > /proc/sys/fs/pipe-max-size\n",
2342 fatal(
"F_SETPIPE_SZ");
2344 fprintf(stderr,
"*** Throughput will be suboptimal.\n");
2346 int child = vfork();
2355 sprintf(mc_arg,
"%d", pls->modcod);
2356 const char *sf_arg = pls->sf ?
"--shortframes" : NULL;
2357 const char *argv[] = {
command,
"--modcod", mc_arg, sf_arg, NULL};
2358 execve(
command, (
char *
const *)argv, NULL);
2366 h->b_in = h->b_out = 0;
2367 int flags = fcntl(h->fd_tx, F_GETFL);
2368 if (fcntl(h->fd_tx, F_SETFL, flags | O_NONBLOCK))
2369 fatal(
"fcntl(helper)");
void fatal(const char *s)