Browse Source

Use constexpr to fix compilation with clang.

chirpmodem-v8.0.0
Jon Beniston 1 month ago
parent
commit
d348ec3829
  1. 10
      modemdvb/cwcanceller.h
  2. 12
      modemdvb/dvbs2.h
  3. 36
      modemdvb/dvbs2pl.h
  4. 18
      modemdvb/dvbs2receiver.h
  5. 2
      modemdvb/dvbsfec.h
  6. 4
      modemdvb/dvbsfrontend.h
  7. 2
      modemdvb/dvbsmodulator.h
  8. 4
      modemdvb/dvbsreceiver.h
  9. 2
      modemdvb/dvbt.h
  10. 20
      modemdvb/dvbt2fec.h
  11. 2
      modemdvb/dvbtfec.h
  12. 16
      modemdvb/dvbtofdm.h
  13. 12
      modemdvb/dvbtouter.h
  14. 12
      modemdvb/dvbtreceiver.h
  15. 2
      modemdvb/ldpcpool.h
  16. 2
      modemdvb/resampler.h
  17. 6
      modemdvb/viterbi27.h

10
modemdvb/cwcanceller.h

@ -62,14 +62,14 @@ public: @@ -62,14 +62,14 @@ public:
private:
friend class NotchedCarriers; //!< For m_twoPi and m_poleRadius
static const int m_fftSize = 4096;
static const int m_blocks = 8; //!< Averaged in each measurement
static const int m_maxNotches = 4;
static constexpr int m_fftSize = 4096;
static constexpr int m_blocks = 8; //!< Averaged in each measurement
static constexpr int m_maxNotches = 4;
static const double m_twoPi;
static const double m_thresholdDb; //!< Above the signal's median level in a bin, to notch (a CW at -23 dBc)
static const double m_poleRadius; //!< Notch about 0.0003 of the sample rate wide (3 kHz at 9.14 MS/s)
static const int m_matchBins = 3; //!< A peak this close to a notch, or a candidate, is the same one
static const int m_missesToRemove = 3; //!< Measurements without the interferer
static constexpr int m_matchBins = 3; //!< A peak this close to a notch, or a candidate, is the same one
static constexpr int m_missesToRemove = 3; //!< Measurements without the interferer
void measure(const Cf *block);
void decide();

12
modemdvb/dvbs2.h

@ -188,7 +188,7 @@ public: @@ -188,7 +188,7 @@ public:
//! R_n(i), for i from 0 at the first symbol after the PLHEADER
const std::vector<uint8_t>& sequence() const { return m_sequence; }
static const int m_length = 66420; //!< As the standard defines it
static constexpr int m_length = 66420; //!< As the standard defines it
private:
int m_n;
@ -244,11 +244,11 @@ public: @@ -244,11 +244,11 @@ public:
return nearest;
}
static const int m_grid = 256; //!< Cells a side
static constexpr int m_grid = 256; //!< Cells a side
static constexpr float m_range = 2.0f; //!< It covers +/- this, at unit energy (beyond, the nearest edge cell's)
static constexpr float m_cellsPerUnit = m_grid / (2.0f * m_range);
static const int m_slots = 4; //!< Points a cell can list
static const uint16_t m_unused = 0xffff;
static constexpr int m_slots = 4; //!< Points a cell can list
static constexpr uint16_t m_unused = 0xffff;
private:
std::vector<uint16_t> m_table;
@ -271,8 +271,8 @@ public: @@ -271,8 +271,8 @@ public:
return &m_candidates[m_offsets[point]];
}
static const int m_minPoints = 128; //!< Constellations this size or more have one
static const int m_perBit = 4; //!< Nearest a point with each bit the other way
static constexpr int m_minPoints = 128; //!< Constellations this size or more have one
static constexpr int m_perBit = 4; //!< Nearest a point with each bit the other way
private:
NearestTable m_nearest;

36
modemdvb/dvbs2pl.h

@ -241,9 +241,9 @@ private: @@ -241,9 +241,9 @@ private:
static void turnValues(const Cf *in, Cf *out, int n, Cf rot, const Cf& step, const uint8_t *scrambling = nullptr);
static constexpr double m_pi = 3.141592653589793;
static const int m_maxMisses = 3; //!< Headers missing in a row before searching again
static constexpr int m_maxMisses = 3; //!< Headers missing in a row before searching again
static constexpr double m_candidateSigmas = 3.5; //!< Of the metric over its mean, for a header in the search
static const size_t m_maxCandidates = 64; //!< Waiting to be confirmed
static constexpr size_t m_maxCandidates = 64; //!< Waiting to be confirmed
static constexpr double m_verifySigmas = 3.0; //!< At the candidate's next header
static constexpr double m_confirmSigmas = 2.0; //!< At a header's expected place, locked
static constexpr double m_minMetricSigma = 0.02; //!< The metric's spread is never taken as less (noise's is about 0.06)
@ -255,22 +255,22 @@ private: @@ -255,22 +255,22 @@ private:
//!< repeat (a still picture, padding), data can look like a header in each
static constexpr double m_minLockEsN0 = -6.5; //!< dB: a new lock's frames' known symbols below this, it's false (the
//!< lowest MODCOD's threshold is -2.35, the estimate's spread well within)
static const uint64_t m_trustedFrames = 4; //!< Locked this long, the lock's real (a false one doesn't last)
static constexpr uint64_t m_trustedFrames = 4; //!< Locked this long, the lock's real (a false one doesn't last)
static constexpr double m_searchStep = 0.0025; //!< Cycles a symbol, of the frequencies a header's decoded at in the search
static const int m_searchSteps = 20; //!< Either side: +/- 0.05
static const int m_lrLags = 24; //!< Of Luise and Reggiannini's estimator: range +/- 1/25 cycles a symbol
static constexpr int m_searchSteps = 20; //!< Either side: +/- 0.05
static constexpr int m_lrLags = 24; //!< Of Luise and Reggiannini's estimator: range +/- 1/25 cycles a symbol
static constexpr double m_coarseLimit = 2.5e-3; //!< Cycles a symbol: settled, a frame's estimate used only beyond this (it's
//!< too noisy at low SNR for the pilots' phase steps, which wrap at 3.4e-4)
static constexpr double m_pilotPeriod = 1476.0; //!< Symbols from pilot block to pilot block: their steps alias at 1 / this
static constexpr double m_vlsnrPilotPeriod = 738.0; //!< VL-SNR frames' (737 and 739 apart in set 1, 736 and 740 in set 2)
static const uint64_t m_settledFrames = 1; //!< Locked this long, the frequency's tracked from the pilots
static constexpr uint64_t m_settledFrames = 1; //!< Locked this long, the frequency's tracked from the pilots
static constexpr double m_maxFrequency = 0.05; //!< Cycles a symbol, beyond which the front end's NCO takes it
static constexpr double m_invertedFrequency = 0.25; //!< Cycles a symbol: a valid header this far out's of an inverted spectrum
static constexpr double m_timeSlicingTest = 0.75; //!< An S2 PLS code correlating under this times the SOF, time slicing's tried
static constexpr double m_timeSlicingNoise = 0.55; //!< Time slicing's code correlating under this times its symbols' rms: noise
static constexpr double m_timeSlicingPairs = 0.3; //!< Its repeated bits' agreement under this (of half their power): not tried
static const int m_sameTsnFrames = 8; //!< Frames in a row of one TSN, after which a frame without its header's of it
static const int64_t m_modeSymbols = 4 * 33372; //!< Searching this long without a lock, the other kind of header's metric
static constexpr int m_sameTsnFrames = 8; //!< Frames in a row of one TSN, after which a frame without its header's of it
static constexpr int64_t m_modeSymbols = 4 * 33372; //!< Searching this long without a lock, the other kind of header's metric
//!< (S2's or time slicing's): four of the longest frames (with two, S2's
//!< longest, near threshold, were cut off before a header was confirmed)
static constexpr int m_ddBlockSymbols = 8; //!< Without pilots, the decision directed loop's update interval
@ -282,27 +282,27 @@ private: @@ -282,27 +282,27 @@ private:
static constexpr double m_ddDriftGain = 0.15; //!< Of it, for its drift a frame
static constexpr double m_ddTrustedEnd = 1.0; //!< Radians: the loop's end from the next header's phase, within which the
//!< loop's advance is taken (else the headers', within half a turn)
static const uint64_t m_aliasSearchFrames = 2; //!< Without pilots, a new lock's frames whose frequency alias is searched
static constexpr uint64_t m_aliasSearchFrames = 2; //!< Without pilots, a new lock's frames whose frequency alias is searched
static constexpr double m_aliasSearchUncertainty = 0.75 * m_searchStep; //!< Cycles a symbol either side tried at lock
static const int m_aliasConfirmTurns = 4; //!< Turns a frame either side tried next
static constexpr int m_aliasConfirmTurns = 4; //!< Turns a frame either side tried next
static constexpr double m_aliasErrorWeight = 0.1; //!< Of each frame, in the average of the loop's end from the next header's
static const uint64_t m_aliasErrorFrames = 10; //!< After the search, before the average's taken as the lock's health
static constexpr uint64_t m_aliasErrorFrames = 10; //!< After the search, before the average's taken as the lock's health
static constexpr double m_aliasLostError = 1.0; //!< Radians: the average over which the lock's dropped
static const uint64_t m_coarseAliasFrames = 16; //!< Without pilots, frames of the headers' estimates averaged, at least
static constexpr uint64_t m_coarseAliasFrames = 16; //!< Without pilots, frames of the headers' estimates averaged, at least
static constexpr double m_coarseAliasTurns = 0.9; //!< Turns a frame their average must be out
static constexpr double m_coarseAliasSigmas = 5.0; //!< And standard errors
static constexpr double m_smoothedPhaseNoise = 0.004; //!< Radians a symbol: more, the phase is tracked symbol by symbol, less
//!< (cheaper), slot by slot
static constexpr double m_vlsnrPresentScore = 6.0; //!< Standard deviations: a VL-SNR frame's headers there, locked (noise's
//!< best of the 32 hypotheses is rarely over 3; at -10 dB, a header's ~10)
static const int m_maxSlip = 2; //!< Symbols either side a VL-SNR frame's next header's looked for
static const int m_slipCorrection = 2; //!< Slips one way, for the clock to be corrected
static const int m_maxSlipFrames = 64; //!< Frames, after which slips fewer are forgotten
static const int64_t m_vlsnrSearchDelay = 2 * 33282; //!< Searching this long without a lock, VL-SNR's search too: S2's
static constexpr int m_maxSlip = 2; //!< Symbols either side a VL-SNR frame's next header's looked for
static constexpr int m_slipCorrection = 2; //!< Slips one way, for the clock to be corrected
static constexpr int m_maxSlipFrames = 64; //!< Frames, after which slips fewer are forgotten
static constexpr int64_t m_vlsnrSearchDelay = 2 * 33282; //!< Searching this long without a lock, VL-SNR's search too: S2's
//!< finds VL-SNR frames above about -3 dB, and at 27.5 MS/s
//!< VL-SNR's would take much of the search's CPU
static const int m_vlsnrSearchFFT = 4096; //!< VL-SNR's search's FFT: its headers' 990 symbols' differences, and
static const int m_vlsnrSearchBlock = 3072; //!< the positions searched with each (at most its size less theirs)
static constexpr int m_vlsnrSearchFFT = 4096; //!< VL-SNR's search's FFT: its headers' 990 symbols' differences, and
static constexpr int m_vlsnrSearchBlock = 3072; //!< the positions searched with each (at most its size less theirs)
static constexpr double m_vlsnrSearchSigmas = 3.5; //!< Of the search's correlation, for a peak to verify: noise's over it
//!< e^-12 of the time (a few a second at 1 MS/s, each 10 FFTs to verify);
//!< a header's about 6 at -6 dB, 4 at -8 dB

18
modemdvb/dvbs2receiver.h

@ -200,13 +200,13 @@ private: @@ -200,13 +200,13 @@ private:
static double now();
static double rollOffValue(int ro);
static const int m_defaultMaxIterations = 50;
static constexpr int m_defaultMaxIterations = 50;
static constexpr int m_vlsnrIterations = 75;
static constexpr float m_outlierThreshold = 16.0f; //!< As DVB-T2's
static constexpr double m_timingAcquire = 2e-3;
static constexpr double m_timingTrack = 5e-4;
static constexpr double m_minRelockSeconds = 3.0; //!< Without frames, before the spectrum's measured again (at least)
static const int m_maxFailedFrames = 32; //!< Locked, but frames failing in a row: perhaps a false lock, if
static constexpr int m_maxFailedFrames = 32; //!< Locked, but frames failing in a row: perhaps a false lock, if
static constexpr double m_searchBudget = 0.4; //!< Of a core, at most, for the physical layer's search (symbols skipped)
static constexpr double m_threadBudget = 0.6; //!< Of a core, for the thread as a whole: the search has what's left,
//!< after the front end (and in Auto, the DVB-S receiver)
@ -214,16 +214,16 @@ private: @@ -214,16 +214,16 @@ private:
static constexpr double m_steadyLockSeconds = 2.0; //!< Locked this long, the search's budget starts again from nothing
static constexpr double m_maxSkipSeconds = 0.25; //!< Of symbols the budget skips after a window, at most: one that cost
//!< far too much (a fault) mustn't stop the search for long
static const int64_t m_searchWindow = 131072; //!< Symbols searched at a time: a few of the longest frames, so a header
static constexpr int64_t m_searchWindow = 131072; //!< Symbols searched at a time: a few of the longest frames, so a header
//!< and the next are found in it
static const int m_lowRollOffFrames = 16; //!< Trusted frames without an RO of 11, after which S2X's low roll-offs have ended
static constexpr int m_lowRollOffFrames = 16; //!< Trusted frames without an RO of 11, after which S2X's low roll-offs have ended
static constexpr double m_failingSeconds = 1.0; //!< Failing for this long too
static const uint64_t m_nullOnlyPackets = 1000; //!< Of an input stream chosen automatically, all null: another's chosen
static const uint64_t m_missingStreamFrames = 2000; //!< Of other streams, without the one chosen automatically: it's
static constexpr uint64_t m_nullOnlyPackets = 1000; //!< Of an input stream chosen automatically, all null: another's chosen
static constexpr uint64_t m_missingStreamFrames = 2000; //!< Of other streams, without the one chosen automatically: it's
//!< gone (the transmitter's changed its streams), another's chosen
static const size_t m_minTakeBatches = 4; //!< The FEC thread takes at most whole rounds of its decoders' batches,
static constexpr size_t m_minTakeBatches = 4; //!< The FEC thread takes at most whole rounds of its decoders' batches,
//!< at least this many: more, and the last round leaves decoders idle
static const size_t m_maxLanes = 32; //!< The LDPC decoder's widest batch (AVX2's), for the slots made at first
static constexpr size_t m_maxLanes = 32; //!< The LDPC decoder's widest batch (AVX2's), for the slots made at first
bool m_threaded;
double m_inputRate;
@ -308,7 +308,7 @@ private: @@ -308,7 +308,7 @@ private:
Status m_fecStatus;
uint64_t m_queueWaits;
static const size_t m_maxQueued = 160; //!< 5 batches of 32 lanes: across the decoder threads and this one when the frames are coming faster than they're decoded (3 left a laptop's fourth decoder thread idle, and DVB-S2 waiting a quarter of its time)
static constexpr size_t m_maxQueued = 160; //!< 5 batches of 32 lanes: across the decoder threads and this one when the frames are coming faster than they're decoded (3 left a laptop's fourth decoder thread idle, and DVB-S2 waiting a quarter of its time)
size_t m_takeBatches = 1; //!< The most the FEC thread takes from the queue at once, in batches
static constexpr int m_batchWaitMs = 100; //!< The longest a frame waits for a batch to fill
};

2
modemdvb/dvbsfec.h

@ -90,7 +90,7 @@ public: @@ -90,7 +90,7 @@ public:
void decode(const int8_t *iq, int nbSymbols);
const Status& getStatus() const { return m_status; }
static const int m_searchSymbols = 8192; //!< Tried at a time
static constexpr int m_searchSymbols = 8192; //!< Tried at a time
private:
struct Hypothesis

4
modemdvb/dvbsfrontend.h

@ -108,7 +108,7 @@ public: @@ -108,7 +108,7 @@ public:
//! any thread
void getSpectrum(std::vector<float>& db, int points) const;
static const int m_fftSize = 1024;
static constexpr int m_fftSize = 1024;
private:
static constexpr double m_pi = 3.141592653589793;
@ -147,7 +147,7 @@ private: @@ -147,7 +147,7 @@ private:
double m_samplesPerSymbol; //!< Input samples
int m_taps;
std::vector<float> m_pairs; //!< The matched filter's phases
static const int m_phases = 256;
static constexpr int m_phases = 256;
// NCO
double m_ncoFrequency; //!< Hz taken out

2
modemdvb/dvbsmodulator.h

@ -42,7 +42,7 @@ private: @@ -42,7 +42,7 @@ private:
double m_sampleRate;
double m_symbolRate;
int m_span;
static const int m_resolution = 256; //!< Table points a symbol
static constexpr int m_resolution = 256; //!< Table points a symbol
std::vector<float> m_table;
std::vector<Cf> m_history; //!< The symbols the next outputs need
double m_time; //!< Of the next output, in symbols from m_history[0]

4
modemdvb/dvbsreceiver.h

@ -69,7 +69,7 @@ public: @@ -69,7 +69,7 @@ public:
double snr() const;
uint64_t acquisitions() const { return m_acquisitions; }
static const int m_acquireSymbols = 4096;
static constexpr int m_acquireSymbols = 4096;
private:
static constexpr double m_pi = 3.141592653589793;
@ -252,7 +252,7 @@ private: @@ -252,7 +252,7 @@ private:
uint64_t m_queueWaits;
std::atomic<double> m_fecSeconds; //!< Written in the error correction thread
static const size_t m_maxQueued = 64;
static constexpr size_t m_maxQueued = 64;
};
} // namespace dvbs

2
modemdvb/dvbt.h

@ -79,7 +79,7 @@ struct MODEMDVB_API TPS @@ -79,7 +79,7 @@ struct MODEMDVB_API TPS
//! Encode into a 68-bit TPS block (s0 is set to 0)
void encode(uint8_t bits[symbolsPerFrame]) const;
static const uint16_t m_syncWord = 0x35ee; //!< 0011010111101110, frames 1 and 3
static constexpr uint16_t m_syncWord = 0x35ee; //!< 0011010111101110, frames 1 and 3
static bool checkBCH(const uint8_t bits[symbolsPerFrame]);
static void addBCH(uint8_t bits[symbolsPerFrame]);

20
modemdvb/dvbt2fec.h

@ -51,8 +51,8 @@ private: @@ -51,8 +51,8 @@ private:
int mul(int a, int b) const { return (a && b) ? m_exp[m_log[a] + m_log[b]] : 0; }
static inline uint64_t loadBigEndian64(const uint8_t *p);
static const int m_remWords = 3; //!< The remainder's 64-bit words: up to 192 parity bits (t = 12 of 16 bits)
static const int m_maxT = 12;
static constexpr int m_remWords = 3; //!< The remainder's 64-bit words: up to 192 parity bits (t = 12 of 16 bits)
static constexpr int m_maxT = 12;
//! Generator polynomial factors of each frame size (table 7), as the powers of x with non-zero coefficients
static const std::vector<std::vector<int>> m_bchNormalPolys;
static const std::vector<std::vector<int>> m_bchMediumPolys;
@ -191,7 +191,7 @@ public: @@ -191,7 +191,7 @@ public:
private:
int nextShift(int& k) const;
static const int m_maxBlocks = 1024; //!< A TI-block's FEC blocks: PLP_NUM_BLOCKS_MAX's 10 bits
static constexpr int m_maxBlocks = 1024; //!< A TI-block's FEC blocks: PLP_NUM_BLOCKS_MAX's 10 bits
int m_ncells;
int m_nd;
std::vector<int> m_l0;
@ -242,13 +242,13 @@ private: @@ -242,13 +242,13 @@ private:
static void postCellBitMap(L1Constellation constellation, int npost, std::vector<int>& map);
// L1 signalling (7.3)
static const int m_preKbch = 3072;
static const int m_preKldpc = 3240;
static const int m_preKsig = 200;
static const int m_preNpunc = 11488;
static const int m_postKbch = 7032;
static const int m_postKldpc = 7200;
static const int m_l1BchParity = 168;
static constexpr int m_preKbch = 3072;
static constexpr int m_preKldpc = 3240;
static constexpr int m_preKsig = 200;
static constexpr int m_preNpunc = 11488;
static constexpr int m_postKbch = 7032;
static constexpr int m_postKldpc = 7200;
static constexpr int m_l1BchParity = 168;
static const int m_preGroups[9];
static const int m_preParity[36];
static const int m_postGroups[3][20];

2
modemdvb/dvbtfec.h

@ -161,7 +161,7 @@ private: @@ -161,7 +161,7 @@ private:
uint64_t m_berErrors;
uint64_t m_berTotal;
unsigned int m_berCalls;
static const uint64_t m_berWindow = 2000000; //!< Bits compared
static constexpr uint64_t m_berWindow = 2000000; //!< Bits compared
static const unsigned int m_berInterval = 8; //!< Calls, of which one is measured, to save time
// Post-Viterbi BER

16
modemdvb/dvbtofdm.h

@ -118,31 +118,31 @@ private: @@ -118,31 +118,31 @@ private:
bool m_valid = false; //!< False if lost or misaligned, as when the timing jumps
};
static const int m_ringSize = 7; //!< Channel estimation interpolates over +/-3 symbols
static constexpr int m_ringSize = 7; //!< Channel estimation interpolates over +/-3 symbols
//! m_seq is kept below twice this, so it doesn't overflow. A multiple of the ring size and the scattered pilot
//! period, so subtracting it leaves the ring positions and pilot phases as they were
static const int m_seqPeriod = 4 * m_ringSize * (1 << 20);
static constexpr int m_seqPeriod = 4 * m_ringSize * (1 << 20);
static const double m_giLossFraction; //!< Of the usual guard interval correlation, below which the timing is lost
static const double m_giAveraging; //!< Of the guard interval correlation, per symbol
static const double m_twoPi;
static const int m_acquireSymbols = 12; //!< Symbols of the longest mode analysed per acquisition attempt
static constexpr int m_acquireSymbols = 12; //!< Symbols of the longest mode analysed per acquisition attempt
static const double m_acquireThreshold; //!< Minimum normalised guard interval correlation
static const double m_intCFOThreshold; //!< Minimum normalised continual pilot correlation
static const double m_frequencyLoopGain;
static const double m_delaySmoothing;
//! Symbols whose significant paths all spread over more than the guard interval (net of those that didn't) before
//! the least spread is taken, rather than the last measurement kept, so bursts of noise don't count
static const int m_cirRejectSymbols = 8;
static constexpr int m_cirRejectSymbols = 8;
static const float m_pilotBoost; //!< Scattered and continual pilot amplitude (4.5.3)
static const float m_noiseAlpha; //!< Per symbol, for the noise on each carrier
static const int m_noiseSettleSymbols = 64; //!< Before the per-carrier noise is used
static constexpr int m_noiseSettleSymbols = 64; //!< Before the per-carrier noise is used
static const float m_noiseFloor; //!< Least noise assumed on a carrier, relative to the mean
//! The carriers near notches are worked out again when the frequency offset has moved this far, as the frequency
//! loop moves it a little every symbol. Their compensation's phase changes by at most 0.03 degrees a Hz
static const double m_notchOffsetTolerance; //!< Hz
//! Samples used are discarded from the buffer once there are this many, keeping it small enough to stay in cache
static const int64_t m_bufferDiscard = 1 << 16;
static constexpr int64_t m_bufferDiscard = 1 << 16;
static inline Cf complexMultiply(Cf a, Cf b);
static void rotate(const Cf *x, Cf *y, int n, double phase, double step);
@ -252,9 +252,9 @@ private: @@ -252,9 +252,9 @@ private:
std::vector<Cf> m_hi[2]; //!< Interpolated 1 and 2 carriers after each pilot
std::vector<float> m_smoothingTaps; //!< Low pass filter matched to the delay spread, empty for none
double m_smoothingCutoff; //!< Cycles per pilot
static const int m_smoothingHalfLength = 40;
static constexpr int m_smoothingHalfLength = 40;
std::vector<float> m_interpolationTaps[3]; //!< Interpolate from every third carrier, per carrier index mod 3
static const int m_interpolationHalfLength = 8; //!< Pilots each side
static constexpr int m_interpolationHalfLength = 8; //!< Pilots each side
std::vector<Cf> m_h; //!< Channel estimate of the symbol being output
std::vector<Cf> m_equalised; //!< Every carrier of the symbol being output
std::vector<float> m_power; //!< |m_h|^2

12
modemdvb/dvbtouter.h

@ -81,12 +81,12 @@ private: @@ -81,12 +81,12 @@ private:
void processByte(uint8_t byte);
void processPacket(uint8_t *packet);
static const int m_syncPackets = 4; //!< Sync bytes required to sync
static const int m_maxSyncMisses = 8; //!< Consecutive packets without a sync byte before losing sync
static const int m_interleaverI = 12;
static const int m_interleaverM = 17;
static const uint8_t m_syncByte = 0x47;
static const uint8_t m_invertedSyncByte = 0xb8;
static constexpr int m_syncPackets = 4; //!< Sync bytes required to sync
static constexpr int m_maxSyncMisses = 8; //!< Consecutive packets without a sync byte before losing sync
static constexpr int m_interleaverI = 12;
static constexpr int m_interleaverM = 17;
static constexpr uint8_t m_syncByte = 0x47;
static constexpr uint8_t m_invertedSyncByte = 0xb8;
static const ReedSolomon::RS<255, 239> m_rs;
static const SyndromeTables m_syndromeTables;

12
modemdvb/dvbtreceiver.h

@ -123,19 +123,19 @@ private: @@ -123,19 +123,19 @@ private:
void deliverPackets();
void correctClock();
static const size_t m_maxQueuedSymbols = 512;
static const size_t m_maxFreeSymbols = 16; //!< Kept for reuse once the queue empties (about 72 kB each)
static const size_t m_maxQueuedDemapped = 32; //!< About 48 kB each
static constexpr size_t m_maxQueuedSymbols = 512;
static constexpr size_t m_maxFreeSymbols = 16; //!< Kept for reuse once the queue empties (about 72 kB each)
static constexpr size_t m_maxQueuedDemapped = 32; //!< About 48 kB each
// Clock offsets beyond this are corrected by resampling, rather than just by moving the FFT window,
// as they reduce the MER (by a few dB at 20 ppm in 8K mode)
static const double m_clockCorrectionThreshold; //!< ppm
static const uint64_t m_clockCorrectionPeriod = 256; //!< Symbols
static const int m_clockFirstMeasurements = 20; //!< Symbols the clock offset is averaged over, to correct it first
static constexpr uint64_t m_clockCorrectionPeriod = 256; //!< Symbols
static constexpr int m_clockFirstMeasurements = 20; //!< Symbols the clock offset is averaged over, to correct it first
// Viterbi threads are added while the error correction thread is busy over this fraction of the time, with symbols
// waiting for it, and removed when it would have been under the lower fraction with one fewer, for a few windows
static const double m_viterbiAddLoad;
static const double m_viterbiRemoveLoad;
static const int m_viterbiRemoveWindows = 3; //!< Of 2 s
static constexpr int m_viterbiRemoveWindows = 3; //!< Of 2 s
static double now();

2
modemdvb/ldpcpool.h

@ -67,7 +67,7 @@ public: @@ -67,7 +67,7 @@ public:
//! messages are each thread's, for any code), a dozen normal frames' (more short ones), so VCM and ACM's
//! MODCODs don't each make their decoder again and again (with two kept, three MODCODs in turn did, the
//! demapping and LDPC taking five times as long), while threads that have seen many codes don't hold them all
static const size_t m_maxBytes = 16u << 20;
static constexpr size_t m_maxBytes = 16u << 20;
};
struct Job

2
modemdvb/resampler.h

@ -50,7 +50,7 @@ public: @@ -50,7 +50,7 @@ public:
int process(const Cf *in, int nbIn, Cf *out, int maxOut);
private:
static const int m_phases = 512;
static constexpr int m_phases = 512;
static const double m_pi;
static const double m_attenuation; //!< dB
static const double m_kaiserBeta;

6
modemdvb/viterbi27.h

@ -45,7 +45,7 @@ public: @@ -45,7 +45,7 @@ public:
//! Encode bits (one per byte) into X, Y pairs (one bit per byte). Used for testing
static void encode(const uint8_t *bits, int nbBits, uint8_t& state, std::vector<uint8_t>& out);
static const int m_tracebackLength = 192;
static constexpr int m_tracebackLength = 192;
private:
friend struct EncoderOutputs;
@ -57,8 +57,8 @@ private: @@ -57,8 +57,8 @@ private:
// State s holds the previous six input bits, the most recent in bit 0. Input u moves state s to
// ((s << 1) | u) & 63, so new states 2j and 2j+1 both have predecessors j and j+32 (a butterfly)
// X = u ^ s0 ^ s1 ^ s2 ^ s5 (171 octal), Y = u ^ s1 ^ s2 ^ s4 ^ s5 (133 octal)
static const int m_maskX = 0x27;
static const int m_maskY = 0x36;
static constexpr int m_maskX = 0x27;
static constexpr int m_maskY = 0x36;
static const EncoderOutputs m_encoderOutputs;
static const BranchCosts m_branchCosts;

Loading…
Cancel
Save