SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Public Member Functions | Private Member Functions | Private Attributes | List of all members
leansdr::s2_frame_transmitter< T > Struct Template Reference

#include <dvbs2.h>

+ Inheritance diagram for leansdr::s2_frame_transmitter< T >:
+ Collaboration diagram for leansdr::s2_frame_transmitter< T >:

Public Member Functions

 s2_frame_transmitter (scheduler *sch, pipebuf< plslot< hard_ss >> &_in, pipebuf< complex< T >> &_out)
 
void run ()
 
int run_frame (s2_pls *pls, const modcod_info *mcinfo, const plslot< hard_ss > *pin, int nslots, complex< T > *pout)
 
void scramble (const complex< T > *src, uint8_t r, complex< T > *dst)
 
- Public Member Functions inherited from leansdr::runnable
 runnable (scheduler *_sch, const char *name)
 
- Public Member Functions inherited from leansdr::runnable_common
 runnable_common (const char *_name)
 
virtual ~runnable_common ()
 
virtual void shutdown ()
 

Private Member Functions

void update_cstln (const modcod_info *mcinfo)
 

Private Attributes

pipereader< plslot< hard_ss > > in
 
pipewriter< complex< T > > out
 
cstln_lut< hard_ss, 256 > * cstln
 
complex< T > * csymbols
 
complex< T > qsymbols [4]
 
s2_sof< T > sof
 
s2_plscodes< T > plscodes
 
s2_scrambling scrambling
 

Additional Inherited Members

- Public Attributes inherited from leansdr::runnable_common
const char * name
 
- Protected Attributes inherited from leansdr::runnable
schedulersch
 

Detailed Description

template<typename T>
struct leansdr::s2_frame_transmitter< T >

Definition at line 298 of file dvbs2.h.

Constructor & Destructor Documentation

◆ s2_frame_transmitter()

template<typename T >
leansdr::s2_frame_transmitter< T >::s2_frame_transmitter ( scheduler sch,
pipebuf< plslot< hard_ss >> &  _in,
pipebuf< complex< T >> &  _out 
)
inline

Definition at line 300 of file dvbs2.h.

References leansdr::cstln_amp.

303  : runnable(sch, "S2 frame transmitter"),
305  {
306  float amp = cstln_amp / sqrtf(2);
307  qsymbols[0].re = +amp;
308  qsymbols[0].im = +amp;
309  qsymbols[1].re = +amp;
310  qsymbols[1].im = -amp;
311  qsymbols[2].re = -amp;
312  qsymbols[2].im = +amp;
313  qsymbols[3].re = -amp;
314  qsymbols[3].im = -amp;
315  }
complex< T > qsymbols[4]
Definition: dvbs2.h:423
pipereader< plslot< hard_ss > > in
Definition: dvbs2.h:396
runnable(scheduler *_sch, const char *name)
Definition: framework.h:193
pipewriter< complex< T > > out
Definition: dvbs2.h:397
scheduler * sch
Definition: framework.h:199
const float cstln_amp
Definition: sdr.h:404
static const int MAX_SYMBOLS_PER_FRAME
Definition: dvbs2.h:223

Member Function Documentation

◆ run()

template<typename T >
void leansdr::s2_frame_transmitter< T >::run ( )
inlinevirtual

Reimplemented from leansdr::runnable_common.

Definition at line 316 of file dvbs2.h.

References leansdr::check_modcod(), leansdr::fail(), leansdr::plslot< SOFTSYMB >::is_pls, leansdr::s2_pls::modcod, leansdr::modcod_info::nslots_nf, leansdr::s2_pls::pilots, leansdr::plslot< SOFTSYMB >::pls, and leansdr::s2_pls::sf.

317  {
318  while (in.readable() >= 1)
319  {
320  plslot<hard_ss> *pin = in.rd();
321  if (!pin->is_pls)
322  fail("Expected PLS pseudo-slot");
323  s2_pls *pls = &pin->pls;
324  const modcod_info *mcinfo = check_modcod(pls->modcod);
325  int nslots = (pls->sf ? mcinfo->nslots_nf / 4 : mcinfo->nslots_nf);
326  if (in.readable() < 1 + nslots)
327  break;
328  // Require room for BBHEADER + slots + optional pilots.
329  int nsymbols = ((1 + nslots) * plslot<hard_ss>::LENGTH +
330  (pls->pilots ? ((nslots - 1) / 16) * pilot_length : 0));
331  if (out.writable() < nsymbols)
332  break;
333  update_cstln(mcinfo);
334  int nw = run_frame(pls, mcinfo, pin + 1, nslots, out.wr());
335  if (nw != nsymbols)
336  fail("Bug: s2_frame_transmitter overflow");
337  in.read(1 + nslots);
338  out.written(nsymbols);
339  }
340  }
pipereader< plslot< hard_ss > > in
Definition: dvbs2.h:396
void fail(const char *s)
Definition: framework.cpp:11
pipewriter< complex< T > > out
Definition: dvbs2.h:397
static const int LENGTH
Definition: dvbs2.h:209
const modcod_info * check_modcod(int m)
Definition: dvbs2.h:285
int run_frame(s2_pls *pls, const modcod_info *mcinfo, const plslot< hard_ss > *pin, int nslots, complex< T > *pout)
Definition: dvbs2.h:341
void update_cstln(const modcod_info *mcinfo)
Definition: dvbs2.h:400
+ Here is the call graph for this function:

◆ run_frame()

template<typename T >
int leansdr::s2_frame_transmitter< T >::run_frame ( s2_pls pls,
const modcod_info mcinfo,
const plslot< hard_ss > *  pin,
int  nslots,
complex< T > *  pout 
)
inline

Definition at line 341 of file dvbs2.h.

References leansdr::fail(), leansdr::s2_pls::modcod, leansdr::s2_pls::pilots, and leansdr::s2_pls::sf.

344  {
345  complex<T> *pout0 = pout; // For sanity check
346  // PLHEADER: SOF AND PLSCODE
347  // EN 302 307-1 section 5.5.2 PL signalling
348  memcpy(pout, sof.symbols, sof.LENGTH * sizeof(*pout));
349  pout += sof.LENGTH;
350  int pls_index = (pls->modcod << 2) | (pls->sf << 1) | pls->pilots;
351  memcpy(pout, plscodes.symbols[pls_index], plscodes.LENGTH * sizeof(*pout));
352  pout += plscodes.LENGTH;
353  // Slots and pilots
354  int till_next_pilot = pls->pilots ? 16 : nslots;
355  uint8_t *scr = &scrambling.Rn[0];
356  for (int S = 0; S < nslots; ++S, ++pin, --till_next_pilot)
357  {
358  if (till_next_pilot == 0)
359  {
360  // Send pilot
361  for (int s = 0; s < pilot_length; ++s, ++scr, ++pout)
362  scramble(&qsymbols[0], *scr, pout);
363  till_next_pilot = 16;
364  }
365  // Send slot
366  if (pin->is_pls)
367  fail("s2_frame_transmitter: bad input sequence");
368  const hard_ss *ps = pin->symbols;
369  for (int s = 0; s < pin->LENGTH; ++s, ++ps, ++scr, ++pout)
370  scramble(&csymbols[*ps], *scr, pout);
371  }
372  return pout - pout0;
373  }
complex< T > * csymbols
Definition: dvbs2.h:399
complex< T > qsymbols[4]
Definition: dvbs2.h:423
void scramble(const complex< T > *src, uint8_t r, complex< T > *dst)
Definition: dvbs2.h:374
uint8_t Rn[131072]
Definition: dvbs2.h:129
s2_plscodes< T > plscodes
Definition: dvbs2.h:425
unsigned char uint8_t
Definition: rtptypes_win.h:42
void fail(const char *s)
Definition: framework.cpp:11
s2_scrambling scrambling
Definition: dvbs2.h:426
uint8_t hard_ss
Definition: sdr.h:423
+ Here is the call graph for this function:

◆ scramble()

template<typename T >
void leansdr::s2_frame_transmitter< T >::scramble ( const complex< T > *  src,
uint8_t  r,
complex< T > *  dst 
)
inline

Definition at line 374 of file dvbs2.h.

References leansdr::complex< T >::im, and leansdr::complex< T >::re.

375  {
376  switch (r)
377  {
378  case 3:
379  dst->re = src->im;
380  dst->im = -src->re;
381  break;
382  case 2:
383  dst->re = -src->re;
384  dst->im = -src->im;
385  break;
386  case 1:
387  dst->re = -src->im;
388  dst->im = src->re;
389  break;
390  default:
391  *dst = *src;
392  }
393  }

◆ update_cstln()

template<typename T >
void leansdr::s2_frame_transmitter< T >::update_cstln ( const modcod_info mcinfo)
inlineprivate

Definition at line 400 of file dvbs2.h.

References leansdr::modcod_info::c, leansdr::modcod_info::esn0_nf, leansdr::modcod_info::g1, leansdr::modcod_info::g2, leansdr::modcod_info::g3, leansdr::complex< T >::im, leansdr::modcod_info::nsymbols, leansdr::cstln_base::nsymbols, leansdr::complex< T >::re, and leansdr::cstln_base::symbols.

401  {
402  if (!cstln || cstln->nsymbols != mcinfo->nsymbols)
403  {
404  if (cstln)
405  {
406  fprintf(stderr, "Warning: Variable MODCOD is inefficient\n");
407  delete cstln;
408  delete csymbols;
409  }
410  if (sch->debug)
411  fprintf(stderr, "Building constellation %d\n", mcinfo->nsymbols);
412  // TBD Different Es/N0 for short frames ?
413  cstln = new cstln_lut<hard_ss, 256>(mcinfo->c, mcinfo->esn0_nf,
414  mcinfo->g1, mcinfo->g2, mcinfo->g3);
415  csymbols = new complex<T>[cstln->nsymbols];
416  for (int s = 0; s < cstln->nsymbols; ++s)
417  {
418  csymbols[s].re = cstln->symbols[s].re;
419  csymbols[s].im = cstln->symbols[s].im;
420  }
421  }
422  }
complex< T > * csymbols
Definition: dvbs2.h:399
cstln_lut< hard_ss, 256 > * cstln
Definition: dvbs2.h:398
scheduler * sch
Definition: framework.h:199
complex< int8_t > * symbols
Definition: sdr.h:478

Member Data Documentation

◆ cstln

template<typename T >
cstln_lut<hard_ss, 256>* leansdr::s2_frame_transmitter< T >::cstln
private

Definition at line 398 of file dvbs2.h.

◆ csymbols

template<typename T >
complex<T>* leansdr::s2_frame_transmitter< T >::csymbols
private

Definition at line 399 of file dvbs2.h.

◆ in

template<typename T >
pipereader<plslot<hard_ss> > leansdr::s2_frame_transmitter< T >::in
private

Definition at line 396 of file dvbs2.h.

◆ out

template<typename T >
pipewriter<complex<T> > leansdr::s2_frame_transmitter< T >::out
private

Definition at line 397 of file dvbs2.h.

◆ plscodes

template<typename T >
s2_plscodes<T> leansdr::s2_frame_transmitter< T >::plscodes
private

Definition at line 425 of file dvbs2.h.

◆ qsymbols

template<typename T >
complex<T> leansdr::s2_frame_transmitter< T >::qsymbols[4]
private

Definition at line 423 of file dvbs2.h.

◆ scrambling

template<typename T >
s2_scrambling leansdr::s2_frame_transmitter< T >::scrambling
private

Definition at line 426 of file dvbs2.h.

◆ sof

template<typename T >
s2_sof<T> leansdr::s2_frame_transmitter< T >::sof
private

Definition at line 424 of file dvbs2.h.


The documentation for this struct was generated from the following file: