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.
Classes | Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
leansdr::dvb_deconvol_sync< Tin > Struct Template Reference

#include <dvb.h>

+ Inheritance diagram for leansdr::dvb_deconvol_sync< Tin >:
+ Collaboration diagram for leansdr::dvb_deconvol_sync< Tin >:

Classes

struct  sync_t
 

Public Types

typedef u8 decoded_byte
 

Public Member Functions

 dvb_deconvol_sync (scheduler *sch, pipebuf< Tin > &_in, pipebuf< decoded_byte > &_out)
 
void run ()
 
- 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 ()
 

Public Attributes

int resync_period
 
- Public Attributes inherited from leansdr::runnable_common
const char * name
 

Static Public Attributes

static const int chunk_size = 64
 

Private Member Functions

void init_syncs ()
 

Private Attributes

pipereader< Tin > in
 
pipewriter< decoded_byteout
 
int resync_phase
 
struct leansdr::dvb_deconvol_sync::sync_t syncs [NSYNCS]
 
sync_tlocked
 

Static Private Attributes

static const int NSYNCS = 4
 

Additional Inherited Members

- Protected Attributes inherited from leansdr::runnable
schedulersch
 

Detailed Description

template<typename Tin>
struct leansdr::dvb_deconvol_sync< Tin >

Definition at line 719 of file dvb.h.

Member Typedef Documentation

◆ decoded_byte

template<typename Tin >
typedef u8 leansdr::dvb_deconvol_sync< Tin >::decoded_byte

Definition at line 721 of file dvb.h.

Constructor & Destructor Documentation

◆ dvb_deconvol_sync()

template<typename Tin >
leansdr::dvb_deconvol_sync< Tin >::dvb_deconvol_sync ( scheduler sch,
pipebuf< Tin > &  _in,
pipebuf< decoded_byte > &  _out 
)
inline

Definition at line 725 of file dvb.h.

References leansdr::deconvol_sync< Tbyte, BYTE_ERASED >::init_syncs(), leansdr::deconvol_sync< Tbyte, BYTE_ERASED >::locked, and leansdr::deconvol_sync< Tbyte, BYTE_ERASED >::syncs.

727  : runnable(sch, "deconvol_sync_multipoly"),
728  resync_period(32),
729  in(_in),
730  out(_out, chunk_size),
731  resync_phase(0)
732  {
733  init_syncs();
734  locked = &syncs[0];
735  }
struct leansdr::dvb_deconvol_sync::sync_t syncs[NSYNCS]
pipereader< Tin > in
Definition: dvb.h:778
static const int chunk_size
Definition: dvb.h:723
runnable(scheduler *_sch, const char *name)
Definition: framework.h:193
scheduler * sch
Definition: framework.h:199
pipewriter< decoded_byte > out
Definition: dvb.h:779
+ Here is the call graph for this function:

Member Function Documentation

◆ init_syncs()

template<typename Tin >
void leansdr::dvb_deconvol_sync< Tin >::init_syncs ( )
inlineprivate

Definition at line 792 of file dvb.h.

References leansdr::deconvol_sync< Tbyte, BYTE_ERASED >::sync_t::lut, leansdr::deconvol_sync< Tbyte, BYTE_ERASED >::NSYNCS, and leansdr::deconvol_sync< Tbyte, BYTE_ERASED >::syncs.

793  {
794  for (int s = 0; s < NSYNCS; ++s)
795  // EN 300 421, section 4.5, Figure 5 QPSK constellation
796  // Four rotations * two conjugations.
797  // 180° rotation is detected as polarity inversion in mpeg_sync.
798  // 2 | 0
799  // --+--
800  // 3 | 1
801  // 0°
802  syncs[0].lut[0] = 0;
803 
804  syncs[0].lut[1] = 1;
805  syncs[0].lut[2] = 2;
806  syncs[0].lut[3] = 3;
807  // 90°
808  syncs[1].lut[0] = 2;
809  syncs[1].lut[1] = 0;
810  syncs[1].lut[2] = 3;
811  syncs[1].lut[3] = 1;
812  // 0° conjugated
813  syncs[2].lut[0] = 1;
814  syncs[2].lut[1] = 0;
815  syncs[2].lut[2] = 3;
816  syncs[2].lut[3] = 2;
817  // 90° conjugated
818  syncs[3].lut[0] = 0;
819  syncs[3].lut[1] = 2;
820  syncs[3].lut[2] = 1;
821  syncs[3].lut[3] = 3;
822  }
struct leansdr::dvb_deconvol_sync::sync_t syncs[NSYNCS]
static const int NSYNCS
Definition: dvb.h:782

◆ run()

template<typename Tin >
void leansdr::dvb_deconvol_sync< Tin >::run ( )
inlinevirtual

Reimplemented from leansdr::runnable_common.

Definition at line 737 of file dvb.h.

References leansdr::scheduler::debug, leansdr::deconvol_sync< Tbyte, BYTE_ERASED >::sync_t::in, leansdr::deconvol_sync< Tbyte, BYTE_ERASED >::locked, leansdr::deconvol_sync< Tbyte, BYTE_ERASED >::NSYNCS, leansdr::deconvol_sync< Tbyte, BYTE_ERASED >::sync_t::out, leansdr::runnable::sch, and leansdr::deconvol_sync< Tbyte, BYTE_ERASED >::syncs.

738  {
739  while (in.readable() >= chunk_size * 8 && out.writable() >= chunk_size)
740  {
741  int errors_best = 1 << 30;
742  sync_t *best = NULL;
743 
744  for (sync_t *s = syncs; s < syncs + NSYNCS; ++s)
745  {
746  if (resync_phase != 0 && s != locked)
747  // Decode only the currently-locked alignment
748  continue;
749 
750  Tin *pin = in.rd();
751  static decoded_byte dummy[chunk_size];
752  decoded_byte *pout = (s == locked) ? out.wr() : dummy;
753  int nerrors = s->deconv.run(pin, s->lut, pout, chunk_size);
754 
755  if (nerrors < errors_best)
756  {
757  errors_best = nerrors;
758  best = s;
759  }
760  }
761 
762  in.read(chunk_size * 8);
764 
765  if (best != locked)
766  {
767  if (sch->debug)
768  fprintf(stderr, "%%%d", (int)(best - syncs));
769  locked = best;
770  }
771 
772  if (++resync_phase >= resync_period)
773  resync_phase = 0;
774  } // Work to do
775  } // run()
struct leansdr::dvb_deconvol_sync::sync_t syncs[NSYNCS]
pipereader< Tin > in
Definition: dvb.h:778
static const int chunk_size
Definition: dvb.h:723
void written(unsigned long n)
Definition: framework.h:308
scheduler * sch
Definition: framework.h:199
static const int NSYNCS
Definition: dvb.h:782
void read(unsigned long n)
Definition: framework.h:367
pipewriter< decoded_byte > out
Definition: dvb.h:779

Member Data Documentation

◆ chunk_size

template<typename Tin >
const int leansdr::dvb_deconvol_sync< Tin >::chunk_size = 64
static

Definition at line 723 of file dvb.h.

◆ in

template<typename Tin >
pipereader<Tin> leansdr::dvb_deconvol_sync< Tin >::in
private

Definition at line 778 of file dvb.h.

◆ locked

template<typename Tin >
sync_t* leansdr::dvb_deconvol_sync< Tin >::locked
private

Definition at line 790 of file dvb.h.

◆ NSYNCS

template<typename Tin >
const int leansdr::dvb_deconvol_sync< Tin >::NSYNCS = 4
staticprivate

Definition at line 782 of file dvb.h.

◆ out

template<typename Tin >
pipewriter<decoded_byte> leansdr::dvb_deconvol_sync< Tin >::out
private

Definition at line 779 of file dvb.h.

◆ resync_period

template<typename Tin >
int leansdr::dvb_deconvol_sync< Tin >::resync_period

Definition at line 722 of file dvb.h.

◆ resync_phase

template<typename Tin >
int leansdr::dvb_deconvol_sync< Tin >::resync_phase
private

Definition at line 780 of file dvb.h.

◆ syncs

template<typename Tin >
struct leansdr::dvb_deconvol_sync::sync_t leansdr::dvb_deconvol_sync< Tin >::syncs[NSYNCS]
private

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