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.
Static Public Member Functions | List of all members
HBFilterChainConverter Class Reference

#include <hbfilterchainconverter.h>

Static Public Member Functions

static double convertToIndexes (unsigned int log2, unsigned int chainHash, std::vector< unsigned int > &chainIndexes)
 
static double convertToString (unsigned int log2, unsigned int chainHash, QString &chainString)
 
static double getShiftFactor (unsigned int log2, unsigned int chainHash)
 

Detailed Description

Definition at line 27 of file hbfilterchainconverter.h.

Member Function Documentation

◆ convertToIndexes()

double HBFilterChainConverter::convertToIndexes ( unsigned int  log2,
unsigned int  chainHash,
std::vector< unsigned int > &  chainIndexes 
)
static

Definition at line 22 of file hbfilterchainconverter.cpp.

References i.

Referenced by DownChannelizer::applySetting(), and UpChannelizer::applySetting().

23 {
24  chainIndexes.clear();
25 
26  if (log2 == 0) {
27  return 0.0;
28  }
29 
30  unsigned int s = 1;
31  unsigned int u = chainHash;
32 
33  for (unsigned int i = 0; i < log2; i++) {
34  s *= 3;
35  }
36 
37  u %= s; // scale
38  unsigned int ix = log2;
39  double shift = 0.0;
40  double shift_stage = 1.0 / (1<<(log2+1));
41 
42  // base3 conversion
43  do
44  {
45  int r = u % 3;
46  chainIndexes.push_back(r);
47  shift += (r-1)*shift_stage;
48  shift_stage *= 2;
49  u /= 3;
50  ix--;
51  } while (u);
52 
53  // continue shift with leading zeroes. ix has the number of leading zeroes.
54  for (unsigned int i = 0; i < ix; i++)
55  {
56  chainIndexes.push_back(0);
57  shift -= shift_stage;
58  shift_stage *= 2;
59  }
60 
61  return shift;
62 }
int32_t i
Definition: decimators.h:244
+ Here is the caller graph for this function:

◆ convertToString()

double HBFilterChainConverter::convertToString ( unsigned int  log2,
unsigned int  chainHash,
QString &  chainString 
)
static

Definition at line 64 of file hbfilterchainconverter.cpp.

References i.

Referenced by LocalSinkGUI::applyPosition(), LocalSourceGUI::applyPosition(), RemoteSinkGUI::applyPosition(), and FileSourceGUI::applyPosition().

65 {
66  if (log2 == 0)
67  {
68  chainString = "C";
69  return 0.0;
70  }
71 
72  unsigned int s = 1;
73  unsigned int u = chainHash;
74  chainString = "";
75 
76  for (unsigned int i = 0; i < log2; i++) {
77  s *= 3;
78  }
79 
80  u %= s; // scale
81  unsigned int ix = log2;
82  double shift = 0.0;
83  double shift_stage = 1.0 / (1<<(log2+1));
84 
85  // base3 conversion
86  do
87  {
88  int r = u % 3;
89 
90  if (r == 0) {
91  chainString = "L" + chainString;
92  } else if (r == 1) {
93  chainString = "C" + chainString;
94  } else if (r == 2) {
95  chainString = "H" + chainString;
96  }
97 
98  shift += (r-1)*shift_stage;
99  shift_stage *= 2;
100  u /= 3;
101  ix--;
102  } while (u);
103 
104  // continue shift with leading zeroes. ix has the number of leading zeroes.
105  for (unsigned int i = 0; i < ix; i++)
106  {
107  chainString = "L" + chainString;
108  shift -= shift_stage;
109  shift_stage *= 2;
110  }
111 
112  return shift;
113 }
int32_t i
Definition: decimators.h:244
+ Here is the caller graph for this function:

◆ getShiftFactor()

double HBFilterChainConverter::getShiftFactor ( unsigned int  log2,
unsigned int  chainHash 
)
static

Definition at line 115 of file hbfilterchainconverter.cpp.

References i.

Referenced by LocalSink::calculateFrequencyOffset(), LocalSource::calculateFrequencyOffset(), RemoteSink::calculateFrequencyOffset(), and FileSource::calculateFrequencyOffset().

116 {
117  if (log2 == 0)
118  {
119  return 0.0;
120  }
121 
122  unsigned int s = 1;
123  unsigned int u = chainHash;
124 
125  for (unsigned int i = 0; i < log2; i++) {
126  s *= 3;
127  }
128 
129  u %= s; // scale
130  unsigned int ix = log2;
131  double shift = 0.0;
132  double shift_stage = 1.0 / (1<<(log2+1));
133 
134  // base3 conversion
135  do
136  {
137  int r = u % 3;
138  shift += (r-1)*shift_stage;
139  shift_stage *= 2;
140  u /= 3;
141  ix--;
142  } while (u);
143 
144  // continue shift with leading zeroes. ix has the number of leading zeroes.
145  for (unsigned int i = 0; i < ix; i++)
146  {
147  shift -= shift_stage;
148  shift_stage *= 2;
149  }
150 
151  return shift;
152 }
int32_t i
Definition: decimators.h:244
+ Here is the caller graph for this function:

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