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

#include <fcdprothread.h>

Inherits QThread.

+ Collaboration diagram for FCDProThread:

Public Member Functions

 FCDProThread (SampleSinkFifo *sampleFifo, AudioFifo *fcdFIFO, QObject *parent=nullptr)
 
 ~FCDProThread ()
 
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< Pro >::convBufSize *2]
 
SampleVector m_convertBuffer
 
SampleSinkFifom_sampleFifo
 
Decimators< qint32, qint16, SDR_RX_SAMP_SZ, 16 > m_decimators
 

Detailed Description

Definition at line 31 of file fcdprothread.h.

Constructor & Destructor Documentation

◆ FCDProThread()

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

Definition at line 30 of file fcdprothread.cpp.

30  :
31  QThread(parent),
32  m_fcdFIFO(fcdFIFO),
33  m_running(false),
34  m_log2Decim(0),
35  m_fcPos(2),
37  m_sampleFifo(sampleFifo)
38 {
39  start();
40 }
SampleSinkFifo * m_sampleFifo
Definition: fcdprothread.h:54
unsigned int m_log2Decim
Definition: fcdprothread.h:49
SampleVector m_convertBuffer
Definition: fcdprothread.h:53
AudioFifo * m_fcdFIFO
Definition: fcdprothread.h:44

◆ ~FCDProThread()

FCDProThread::~FCDProThread ( )

Definition at line 42 of file fcdprothread.cpp.

43 {
44 }

Member Function Documentation

◆ run()

void FCDProThread::run ( )
private

Definition at line 76 of file fcdprothread.cpp.

References m_running, and work().

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

◆ setFcPos()

void FCDProThread::setFcPos ( int  fcPos)

Definition at line 71 of file fcdprothread.cpp.

References m_fcPos.

Referenced by FCDProInput::applySettings().

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

◆ setLog2Decimation()

void FCDProThread::setLog2Decimation ( unsigned int  log2_decim)

Definition at line 66 of file fcdprothread.cpp.

References m_log2Decim.

Referenced by FCDProInput::applySettings().

67 {
68  m_log2Decim = log2_decim;
69 }
unsigned int m_log2Decim
Definition: fcdprothread.h:49
+ Here is the caller graph for this function:

◆ startWork()

void FCDProThread::startWork ( )

Definition at line 46 of file fcdprothread.cpp.

References m_running, m_startWaiter, and m_startWaitMutex.

Referenced by FCDProInput::start().

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

◆ stopWork()

void FCDProThread::stopWork ( )

Definition at line 60 of file fcdprothread.cpp.

References m_running.

Referenced by FCDProInput::stop().

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

◆ work()

void FCDProThread::work ( unsigned int  n_items)
private

Definition at line 91 of file fcdprothread.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().

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

Member Data Documentation

◆ m_buf

qint16 FCDProThread::m_buf[fcd_traits< Pro >::convBufSize *2]
private

Definition at line 52 of file fcdprothread.h.

Referenced by work().

◆ m_convertBuffer

SampleVector FCDProThread::m_convertBuffer
private

Definition at line 53 of file fcdprothread.h.

Referenced by work().

◆ m_decimators

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

Definition at line 55 of file fcdprothread.h.

Referenced by work().

◆ m_fcdFIFO

AudioFifo* FCDProThread::m_fcdFIFO
private

Definition at line 44 of file fcdprothread.h.

Referenced by work().

◆ m_fcPos

int FCDProThread::m_fcPos
private

Definition at line 50 of file fcdprothread.h.

Referenced by setFcPos(), and work().

◆ m_log2Decim

unsigned int FCDProThread::m_log2Decim
private

Definition at line 49 of file fcdprothread.h.

Referenced by setLog2Decimation(), and work().

◆ m_running

bool FCDProThread::m_running
private

Definition at line 48 of file fcdprothread.h.

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

◆ m_sampleFifo

SampleSinkFifo* FCDProThread::m_sampleFifo
private

Definition at line 54 of file fcdprothread.h.

Referenced by work().

◆ m_startWaiter

QWaitCondition FCDProThread::m_startWaiter
private

Definition at line 47 of file fcdprothread.h.

Referenced by startWork().

◆ m_startWaitMutex

QMutex FCDProThread::m_startWaitMutex
private

Definition at line 46 of file fcdprothread.h.

Referenced by startWork().


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