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
FCDProPlusThread Class Reference

#include <fcdproplusthread.h>

Inherits QThread.

+ Collaboration diagram for FCDProPlusThread:

Public Member Functions

 FCDProPlusThread (SampleSinkFifo *sampleFifo, AudioFifo *fcdFIFO, QObject *parent=nullptr)
 
 ~FCDProPlusThread ()
 
void startWork ()
 
void stopWork ()
 
void setLog2Decimation (unsigned int log2_decim)
 
void setFcPos (int fcPos)
 

Private Member Functions

void run ()
 
void work (unsigned int n_items)
 

Private Attributes

AudioFifom_fcdFIFO
 
QMutex m_startWaitMutex
 
QWaitCondition m_startWaiter
 
bool m_running
 
unsigned int m_log2Decim
 
int m_fcPos
 
qint16 m_buf [fcd_traits< ProPlus >::convBufSize *2]
 
SampleVector m_convertBuffer
 
SampleSinkFifom_sampleFifo
 
Decimators< qint32, qint16, SDR_RX_SAMP_SZ, 16 > m_decimators
 

Detailed Description

Definition at line 32 of file fcdproplusthread.h.

Constructor & Destructor Documentation

◆ FCDProPlusThread()

FCDProPlusThread::FCDProPlusThread ( SampleSinkFifo sampleFifo,
AudioFifo fcdFIFO,
QObject *  parent = nullptr 
)

Definition at line 29 of file fcdproplusthread.cpp.

29  :
30  QThread(parent),
31  m_fcdFIFO(fcdFIFO),
32  m_running(false),
33  m_log2Decim(0),
34  m_fcPos(2),
36  m_sampleFifo(sampleFifo)
37 {
38  start();
39 }
SampleVector m_convertBuffer
AudioFifo * m_fcdFIFO
unsigned int m_log2Decim
SampleSinkFifo * m_sampleFifo

◆ ~FCDProPlusThread()

FCDProPlusThread::~FCDProPlusThread ( )

Definition at line 41 of file fcdproplusthread.cpp.

42 {
43 }

Member Function Documentation

◆ run()

void FCDProPlusThread::run ( )
private

Definition at line 75 of file fcdproplusthread.cpp.

References m_running, and work().

76 {
77  m_running = true;
78  qDebug("FCDThread::run: start running loop");
79 
80  while (m_running)
81  {
83  std::this_thread::sleep_for(std::chrono::microseconds(100));
84  }
85 
86  qDebug("FCDThread::run: running loop stopped");
87  m_running = false;
88 }
void work(unsigned int n_items)
+ Here is the call graph for this function:

◆ setFcPos()

void FCDProPlusThread::setFcPos ( int  fcPos)

Definition at line 70 of file fcdproplusthread.cpp.

References m_fcPos.

Referenced by FCDProPlusInput::applySettings().

71 {
72  m_fcPos = fcPos;
73 }
+ Here is the caller graph for this function:

◆ setLog2Decimation()

void FCDProPlusThread::setLog2Decimation ( unsigned int  log2_decim)

Definition at line 65 of file fcdproplusthread.cpp.

References m_log2Decim.

Referenced by FCDProPlusInput::applySettings().

66 {
67  m_log2Decim = log2_decim;
68 }
unsigned int m_log2Decim
+ Here is the caller graph for this function:

◆ startWork()

void FCDProPlusThread::startWork ( )

Definition at line 45 of file fcdproplusthread.cpp.

References m_running, m_startWaiter, and m_startWaitMutex.

Referenced by FCDProPlusInput::start().

46 {
47  m_startWaitMutex.lock();
48 
49  start();
50 
51  while(!m_running)
52  {
53  m_startWaiter.wait(&m_startWaitMutex, 100);
54  }
55 
56  m_startWaitMutex.unlock();
57 }
QWaitCondition m_startWaiter
+ Here is the caller graph for this function:

◆ stopWork()

void FCDProPlusThread::stopWork ( )

Definition at line 59 of file fcdproplusthread.cpp.

References m_running.

Referenced by FCDProPlusInput::stop().

60 {
61  m_running = false;
62  wait();
63 }
+ Here is the caller graph for this function:

◆ work()

void FCDProPlusThread::work ( unsigned int  n_items)
private

Definition at line 90 of file fcdproplusthread.cpp.

References Decimators< StorageType, T, SdrBits, InputBits >::decimate1(), Decimators< StorageType, T, SdrBits, InputBits >::decimate16_cen(), Decimators< StorageType, T, SdrBits, InputBits >::decimate16_inf(), Decimators< StorageType, T, SdrBits, InputBits >::decimate16_sup(), Decimators< StorageType, T, SdrBits, InputBits >::decimate2_cen(), Decimators< StorageType, T, SdrBits, InputBits >::decimate2_inf(), Decimators< StorageType, T, SdrBits, InputBits >::decimate2_sup(), Decimators< StorageType, T, SdrBits, InputBits >::decimate32_cen(), Decimators< StorageType, T, SdrBits, InputBits >::decimate32_inf(), Decimators< StorageType, T, SdrBits, InputBits >::decimate32_sup(), Decimators< StorageType, T, SdrBits, InputBits >::decimate4_cen(), Decimators< StorageType, T, SdrBits, InputBits >::decimate4_inf(), Decimators< StorageType, T, SdrBits, InputBits >::decimate4_sup(), Decimators< StorageType, T, SdrBits, InputBits >::decimate64_cen(), Decimators< StorageType, T, SdrBits, InputBits >::decimate64_inf(), Decimators< StorageType, T, SdrBits, InputBits >::decimate64_sup(), Decimators< StorageType, T, SdrBits, InputBits >::decimate8_cen(), Decimators< StorageType, T, SdrBits, InputBits >::decimate8_inf(), Decimators< StorageType, T, SdrBits, InputBits >::decimate8_sup(), m_buf, m_convertBuffer, m_decimators, m_fcdFIFO, m_fcPos, m_log2Decim, m_sampleFifo, AudioFifo::read(), and SampleSinkFifo::write().

Referenced by run().

91 {
92  uint32_t nbRead = m_fcdFIFO->read((unsigned char *) m_buf, n_items); // number of samples
93  SampleVector::iterator it = m_convertBuffer.begin();
94 
95  if (m_log2Decim == 0)
96  {
97  m_decimators.decimate1(&it, m_buf, 2*nbRead);
98  }
99  else
100  {
101  if (m_fcPos == 0) // Infradyne
102  {
103  switch (m_log2Decim)
104  {
105  case 1:
106  m_decimators.decimate2_inf(&it, m_buf, 2*nbRead);
107  break;
108  case 2:
109  m_decimators.decimate4_inf(&it, m_buf, 2*nbRead);
110  break;
111  case 3:
112  m_decimators.decimate8_inf(&it, m_buf, 2*nbRead);
113  break;
114  case 4:
115  m_decimators.decimate16_inf(&it, m_buf, 2*nbRead);
116  break;
117  case 5:
118  m_decimators.decimate32_inf(&it, m_buf, 2*nbRead);
119  break;
120  case 6:
121  m_decimators.decimate64_inf(&it, m_buf, 2*nbRead);
122  break;
123  default:
124  break;
125  }
126  }
127  else if (m_fcPos == 1) // Supradyne
128  {
129  switch (m_log2Decim)
130  {
131  case 1:
132  m_decimators.decimate2_sup(&it, m_buf, 2*nbRead);
133  break;
134  case 2:
135  m_decimators.decimate4_sup(&it, m_buf, 2*nbRead);
136  break;
137  case 3:
138  m_decimators.decimate8_sup(&it, m_buf, 2*nbRead);
139  break;
140  case 4:
141  m_decimators.decimate16_sup(&it, m_buf, 2*nbRead);
142  break;
143  case 5:
144  m_decimators.decimate32_sup(&it, m_buf, 2*nbRead);
145  break;
146  case 6:
147  m_decimators.decimate64_sup(&it, m_buf, 2*nbRead);
148  break;
149  default:
150  break;
151  }
152  }
153  else // Centered
154  {
155  switch (m_log2Decim)
156  {
157  case 1:
158  m_decimators.decimate2_cen(&it, m_buf, 2*nbRead);
159  break;
160  case 2:
161  m_decimators.decimate4_cen(&it, m_buf, 2*nbRead);
162  break;
163  case 3:
164  m_decimators.decimate8_cen(&it, m_buf, 2*nbRead);
165  break;
166  case 4:
167  m_decimators.decimate16_cen(&it, m_buf, 2*nbRead);
168  break;
169  case 5:
170  m_decimators.decimate32_cen(&it, m_buf, 2*nbRead);
171  break;
172  case 6:
173  m_decimators.decimate64_cen(&it, m_buf, 2*nbRead);
174  break;
175  default:
176  break;
177  }
178  }
179  }
180 
181  m_sampleFifo->write(m_convertBuffer.begin(), it);
182 }
Decimators< qint32, qint16, SDR_RX_SAMP_SZ, 16 > m_decimators
void decimate2_inf(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:498
void decimate64_sup(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:2975
SampleVector m_convertBuffer
void decimate64_cen(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:3040
void decimate2_sup(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:526
void decimate2_cen(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:554
uint write(const quint8 *data, uint count)
void decimate8_sup(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:941
void decimate64_inf(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:2418
void decimate32_inf(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:1592
void decimate32_sup(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:1902
unsigned int uint32_t
Definition: rtptypes_win.h:46
void decimate4_sup(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:682
AudioFifo * m_fcdFIFO
void decimate8_cen(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:1057
void decimate8_inf(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:825
void decimate16_sup(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:1300
qint16 m_buf[fcd_traits< ProPlus >::convBufSize *2]
void decimate4_cen(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:782
uint32_t read(quint8 *data, uint32_t numSamples)
Definition: audiofifo.cpp:103
void decimate4_inf(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:582
void decimate16_inf(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:1117
unsigned int m_log2Decim
void decimate16_cen(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:1483
void decimate32_cen(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:2212
void decimate1(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:462
SampleSinkFifo * m_sampleFifo
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_buf

qint16 FCDProPlusThread::m_buf[fcd_traits< ProPlus >::convBufSize *2]
private

Definition at line 53 of file fcdproplusthread.h.

Referenced by work().

◆ m_convertBuffer

SampleVector FCDProPlusThread::m_convertBuffer
private

Definition at line 54 of file fcdproplusthread.h.

Referenced by work().

◆ m_decimators

Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 16> FCDProPlusThread::m_decimators
private

Definition at line 56 of file fcdproplusthread.h.

Referenced by work().

◆ m_fcdFIFO

AudioFifo* FCDProPlusThread::m_fcdFIFO
private

Definition at line 45 of file fcdproplusthread.h.

Referenced by work().

◆ m_fcPos

int FCDProPlusThread::m_fcPos
private

Definition at line 51 of file fcdproplusthread.h.

Referenced by setFcPos(), and work().

◆ m_log2Decim

unsigned int FCDProPlusThread::m_log2Decim
private

Definition at line 50 of file fcdproplusthread.h.

Referenced by setLog2Decimation(), and work().

◆ m_running

bool FCDProPlusThread::m_running
private

Definition at line 49 of file fcdproplusthread.h.

Referenced by run(), startWork(), and stopWork().

◆ m_sampleFifo

SampleSinkFifo* FCDProPlusThread::m_sampleFifo
private

Definition at line 55 of file fcdproplusthread.h.

Referenced by work().

◆ m_startWaiter

QWaitCondition FCDProPlusThread::m_startWaiter
private

Definition at line 48 of file fcdproplusthread.h.

Referenced by startWork().

◆ m_startWaitMutex

QMutex FCDProPlusThread::m_startWaitMutex
private

Definition at line 47 of file fcdproplusthread.h.

Referenced by startWork().


The documentation for this class was generated from the following files: