Add lots of value constructors.

This commit is contained in:
Jared Boone
2016-11-26 16:50:44 -08:00
parent cd31ae86d7
commit 4eb0facacb
54 changed files with 194 additions and 217 deletions

View File

@@ -55,13 +55,13 @@ private:
BlockDecimator<float, 32> block_buffer { 1 };
IIRBiquadFilter hpf;
IIRBiquadFilter deemph;
FMSquelch squelch;
IIRBiquadFilter hpf { };
IIRBiquadFilter deemph { };
FMSquelch squelch { };
std::unique_ptr<StreamInput> stream;
std::unique_ptr<StreamInput> stream { };
AudioStatsCollector audio_stats;
AudioStatsCollector audio_stats { };
uint64_t audio_present_history = 0;

View File

@@ -50,7 +50,7 @@ private:
float max_squared { 0 };
size_t count { 0 };
AudioStatistics statistics;
AudioStatistics statistics { };
void consume_audio_buffer(const buffer_f32_t& src);

View File

@@ -40,7 +40,7 @@ protected:
void feed_channel_stats(const buffer_c16_t& channel);
private:
ChannelStatsCollector channel_stats;
ChannelStatsCollector channel_stats { };
};
#endif/*__BASEBAND_PROCESSOR_H__*/

View File

@@ -48,8 +48,8 @@ private:
static Thread* thread;
BasebandProcessor* baseband_processor { nullptr };
baseband::Direction _direction;
uint32_t sampling_rate;
baseband::Direction _direction { baseband::Direction::Receive };
uint32_t sampling_rate { 0 };
void run() override;
};

View File

@@ -85,7 +85,7 @@ public:
}
private:
std::array<T, N> buffer;
std::array<T, N> buffer { };
uint32_t input_sampling_rate_ { 0 };
size_t factor_ { 1 };
size_t src_i { 0 };

View File

@@ -38,12 +38,6 @@ public:
By16,
By32,
};
constexpr ChannelDecimator(
) : decimation_factor { DecimationFactor::By32 },
fs_over_4_downconvert { true }
{
}
constexpr ChannelDecimator(
const DecimationFactor decimation_factor,
@@ -64,17 +58,17 @@ public:
}
private:
std::array<complex16_t, 1024> work_baseband;
std::array<complex16_t, 1024> work_baseband { };
dsp::decimate::TranslateByFSOver4AndDecimateBy2CIC3 translate;
dsp::decimate::Complex8DecimateBy2CIC3 cic_0;
dsp::decimate::DecimateBy2CIC3 cic_1;
dsp::decimate::DecimateBy2CIC3 cic_2;
dsp::decimate::DecimateBy2CIC3 cic_3;
dsp::decimate::DecimateBy2CIC3 cic_4;
dsp::decimate::TranslateByFSOver4AndDecimateBy2CIC3 translate { };
dsp::decimate::Complex8DecimateBy2CIC3 cic_0 { };
dsp::decimate::DecimateBy2CIC3 cic_1 { };
dsp::decimate::DecimateBy2CIC3 cic_2 { };
dsp::decimate::DecimateBy2CIC3 cic_3 { };
dsp::decimate::DecimateBy2CIC3 cic_4 { };
DecimationFactor decimation_factor;
const bool fs_over_4_downconvert;
DecimationFactor decimation_factor { DecimationFactor::By32 };
const bool fs_over_4_downconvert { true };
buffer_c16_t execute_decimation(const buffer_c8_t& buffer);

View File

@@ -60,7 +60,7 @@ public:
}
private:
std::array<float, 3> t { { 0.0f, 0.0f, 0.0f } };
std::array<float, 3> t { };
size_t symbol_phase { 0 };
};
@@ -154,9 +154,9 @@ public:
}
private:
dsp::interpolation::LinearResampler resampler;
GardnerTimingErrorDetector timing_error_detector;
ErrorFilter error_filter;
dsp::interpolation::LinearResampler resampler { };
GardnerTimingErrorDetector timing_error_detector { };
ErrorFilter error_filter { };
const SymbolHandler symbol_handler;
void resampler_callback(const float interpolated_sample) {

View File

@@ -86,8 +86,8 @@ public:
);
private:
std::array<int16_t, taps_count + 2> z;
std::array<int16_t, taps_count> taps;
std::array<int16_t, taps_count + 2> z { };
std::array<int16_t, taps_count> taps { };
};
class FIRC8xR16x24FS4Decim4 {
@@ -115,8 +115,8 @@ public:
);
private:
std::array<vec2_s16, taps_count - decimation_factor> z_;
std::array<tap_t, taps_count> taps_;
std::array<vec2_s16, taps_count - decimation_factor> z_ { };
std::array<tap_t, taps_count> taps_ { };
int32_t output_scale = 0;
};
@@ -145,8 +145,8 @@ public:
);
private:
std::array<vec2_s16, taps_count - decimation_factor> z_;
std::array<tap_t, taps_count> taps_;
std::array<vec2_s16, taps_count - decimation_factor> z_ { };
std::array<tap_t, taps_count> taps_ { };
int32_t output_scale = 0;
};
@@ -169,8 +169,8 @@ public:
);
private:
std::array<vec2_s16, taps_count - decimation_factor> z_;
std::array<tap_t, taps_count> taps_;
std::array<vec2_s16, taps_count - decimation_factor> z_ { };
std::array<tap_t, taps_count> taps_ { };
int32_t output_scale = 0;
};
@@ -193,8 +193,8 @@ public:
);
private:
std::array<vec2_s16, taps_count - decimation_factor> z_;
std::array<tap_t, taps_count> taps_;
std::array<vec2_s16, taps_count - decimation_factor> z_ { };
std::array<tap_t, taps_count> taps_ { };
int32_t output_scale = 0;
};
@@ -208,11 +208,6 @@ public:
/* NOTE! Current code makes an assumption that block of samples to be
* processed will be a multiple of the taps_count.
*/
FIRAndDecimateComplex(
) : taps_count_ { 0 },
decimation_factor_ { 1 }
{
}
template<typename T>
void configure(
@@ -230,10 +225,10 @@ public:
private:
using samples_t = sample_t[];
std::unique_ptr<samples_t> samples_;
std::unique_ptr<taps_t> taps_reversed_;
size_t taps_count_;
size_t decimation_factor_;
std::unique_ptr<samples_t> samples_ { };
std::unique_ptr<taps_t> taps_reversed_ { };
size_t taps_count_ { 0 };
size_t decimation_factor_ { 1 };
template<typename T>
void configure(
@@ -259,7 +254,7 @@ public:
);
private:
int16_t z[5];
int16_t z[5] { };
};
} /* namespace decimate */

View File

@@ -66,8 +66,8 @@ public:
private:
using samples_t = sample_t[];
std::unique_ptr<samples_t> samples_;
std::unique_ptr<taps_t> taps_reversed_;
std::unique_ptr<samples_t> samples_ { };
std::unique_ptr<taps_t> taps_reversed_ { };
size_t taps_count_ { 0 };
size_t decimation_factor_ { 1 };
size_t decimation_phase { 0 };

View File

@@ -122,13 +122,13 @@ private:
const PayloadHandlerFunc payload_handler;
BitHistory bit_history;
PreambleMatcher preamble;
UnstuffMatcher unstuff;
EndMatcher end;
BitHistory bit_history { };
PreambleMatcher preamble { };
UnstuffMatcher unstuff { };
EndMatcher end { };
State state { State::Preamble };
baseband::Packet packet;
baseband::Packet packet { };
void reset_state() {
packet.clear();

View File

@@ -54,21 +54,21 @@ private:
BasebandThread baseband_thread { baseband_fs, this, NORMALPRIO + 20 };
RSSIThread rssi_thread { NORMALPRIO + 10 };
std::array<complex16_t, 512> dst;
std::array<complex16_t, 512> dst { };
const buffer_c16_t dst_buffer {
dst.data(),
dst.size()
};
dsp::decimate::FIRC8xR16x24FS4Decim8 decim_0;
dsp::decimate::FIRC16xR16x32Decim8 decim_1;
dsp::decimate::FIRC8xR16x24FS4Decim8 decim_0 { };
dsp::decimate::FIRC16xR16x32Decim8 decim_1 { };
dsp::matched_filter::MatchedFilter mf { baseband::ais::square_taps_38k4_1t_p, 2 };
clock_recovery::ClockRecovery<clock_recovery::FixedErrorFilter> clock_recovery {
19200, 9600, { 0.0555f },
[this](const float symbol) { this->consume_symbol(symbol); }
};
symbol_coding::NRZIDecoder nrzi_decode;
symbol_coding::NRZIDecoder nrzi_decode { };
PacketBuilder<BitPattern, BitPattern, BitPattern> packet_builder {
{ 0b0101010101111110, 16, 1 },
{ 0b111110, 6 },

View File

@@ -49,31 +49,31 @@ private:
BasebandThread baseband_thread { baseband_fs, this, NORMALPRIO + 20 };
RSSIThread rssi_thread { NORMALPRIO + 10 };
std::array<complex16_t, 512> dst;
std::array<complex16_t, 512> dst { };
const buffer_c16_t dst_buffer {
dst.data(),
dst.size()
};
std::array<float, 32> audio;
std::array<float, 32> audio { };
const buffer_f32_t audio_buffer {
audio.data(),
audio.size()
};
dsp::decimate::FIRC8xR16x24FS4Decim8 decim_0;
dsp::decimate::FIRC16xR16x32Decim8 decim_1;
dsp::decimate::FIRAndDecimateComplex decim_2;
dsp::decimate::FIRAndDecimateComplex channel_filter;
dsp::decimate::FIRC8xR16x24FS4Decim8 decim_0 { };
dsp::decimate::FIRC16xR16x32Decim8 decim_1 { };
dsp::decimate::FIRAndDecimateComplex decim_2 { };
dsp::decimate::FIRAndDecimateComplex channel_filter { };
uint32_t channel_filter_pass_f = 0;
uint32_t channel_filter_stop_f = 0;
bool modulation_ssb = false;
dsp::demodulate::AM demod_am;
dsp::demodulate::SSB demod_ssb;
FeedForwardCompressor audio_compressor;
AudioOutput audio_output;
dsp::demodulate::AM demod_am { };
dsp::demodulate::SSB demod_ssb { };
FeedForwardCompressor audio_compressor { };
AudioOutput audio_output { };
SpectrumCollector channel_spectrum;
SpectrumCollector channel_spectrum { };
bool configured { false };
void configure(const AMConfigureMessage& message);

View File

@@ -51,20 +51,20 @@ private:
BasebandThread baseband_thread { baseband_fs, this, NORMALPRIO + 20 };
RSSIThread rssi_thread { NORMALPRIO + 10 };
std::array<complex16_t, 512> dst;
std::array<complex16_t, 512> dst { };
const buffer_c16_t dst_buffer {
dst.data(),
dst.size()
};
dsp::decimate::FIRC8xR16x24FS4Decim4 decim_0;
dsp::decimate::FIRC16xR16x16Decim2 decim_1;
dsp::decimate::FIRC8xR16x24FS4Decim4 decim_0 { };
dsp::decimate::FIRC16xR16x16Decim2 decim_1 { };
uint32_t channel_filter_pass_f = 0;
uint32_t channel_filter_stop_f = 0;
std::unique_ptr<StreamInput> stream;
std::unique_ptr<StreamInput> stream { };
SpectrumCollector channel_spectrum;
SpectrumCollector channel_spectrum { };
size_t spectrum_interval_samples = 0;
size_t spectrum_samples = 0;

View File

@@ -46,28 +46,28 @@ private:
BasebandThread baseband_thread { baseband_fs, this, NORMALPRIO + 20 };
RSSIThread rssi_thread { NORMALPRIO + 10 };
std::array<complex16_t, 512> dst;
std::array<complex16_t, 512> dst { };
const buffer_c16_t dst_buffer {
dst.data(),
dst.size()
};
std::array<float, 32> audio;
std::array<float, 32> audio { };
const buffer_f32_t audio_buffer {
audio.data(),
audio.size()
};
dsp::decimate::FIRC8xR16x24FS4Decim8 decim_0;
dsp::decimate::FIRC16xR16x32Decim8 decim_1;
dsp::decimate::FIRAndDecimateComplex channel_filter;
dsp::decimate::FIRC8xR16x24FS4Decim8 decim_0 { };
dsp::decimate::FIRC16xR16x32Decim8 decim_1 { };
dsp::decimate::FIRAndDecimateComplex channel_filter { };
uint32_t channel_filter_pass_f = 0;
uint32_t channel_filter_stop_f = 0;
dsp::demodulate::FM demod;
dsp::demodulate::FM demod { };
AudioOutput audio_output;
AudioOutput audio_output { };
SpectrumCollector channel_spectrum;
SpectrumCollector channel_spectrum { };
bool configured { false };
void configure(const NBFMConfigureMessage& message);

View File

@@ -69,14 +69,14 @@ private:
BasebandThread baseband_thread { baseband_fs, this, NORMALPRIO + 20 };
RSSIThread rssi_thread { NORMALPRIO + 10 };
std::array<complex16_t, 512> dst;
std::array<complex16_t, 512> dst { };
const buffer_c16_t dst_buffer {
dst.data(),
dst.size()
};
dsp::decimate::FIRC8xR16x24FS4Decim4 decim_0;
dsp::decimate::FIRC16xR16x16Decim2 decim_1;
dsp::decimate::FIRC8xR16x24FS4Decim4 decim_0 { };
dsp::decimate::FIRC16xR16x16Decim2 decim_1 { };
dsp::matched_filter::MatchedFilter mf_38k4_1t_19k2 { rect_taps_307k2_38k4_1t_19k2_p, 8 };

View File

@@ -45,7 +45,7 @@ private:
BasebandThread baseband_thread { baseband_fs, this, NORMALPRIO + 20 };
RSSIThread rssi_thread { NORMALPRIO + 10 };
std::array<complex16_t, 512> dst;
std::array<complex16_t, 512> dst { };
const buffer_c16_t dst_buffer {
dst.data(),
dst.size()
@@ -55,19 +55,19 @@ private:
sizeof(dst) / sizeof(int16_t)
};
dsp::decimate::FIRC8xR16x24FS4Decim4 decim_0;
dsp::decimate::FIRC16xR16x16Decim2 decim_1;
dsp::decimate::FIRC8xR16x24FS4Decim4 decim_0 { };
dsp::decimate::FIRC16xR16x16Decim2 decim_1 { };
uint32_t channel_filter_pass_f = 0;
uint32_t channel_filter_stop_f = 0;
dsp::demodulate::FM demod;
dsp::decimate::DecimateBy2CIC4Real audio_dec_1;
dsp::decimate::DecimateBy2CIC4Real audio_dec_2;
dsp::decimate::FIR64AndDecimateBy2Real audio_filter;
dsp::demodulate::FM demod { };
dsp::decimate::DecimateBy2CIC4Real audio_dec_1 { };
dsp::decimate::DecimateBy2CIC4Real audio_dec_2 { };
dsp::decimate::FIR64AndDecimateBy2Real audio_filter { };
AudioOutput audio_output;
AudioOutput audio_output { };
SpectrumCollector channel_spectrum;
SpectrumCollector channel_spectrum { };
size_t spectrum_interval_samples = 0;
size_t spectrum_samples = 0;

View File

@@ -46,9 +46,9 @@ private:
BasebandThread baseband_thread { baseband_fs, this, NORMALPRIO + 20 };
RSSIThread rssi_thread { NORMALPRIO + 10 };
SpectrumCollector channel_spectrum;
SpectrumCollector channel_spectrum { };
std::array<complex16_t, 256> spectrum;
std::array<complex16_t, 256> spectrum { };
size_t phase = 0;
};

View File

@@ -69,7 +69,7 @@ public:
private:
static constexpr float update_interval { 0.1f };
RSSIStatistics statistics;
RSSIStatistics statistics { };
};
#endif/*__RSSI_STATS_COLLECTOR_H__*/

View File

@@ -34,12 +34,6 @@
class SpectrumCollector {
public:
constexpr SpectrumCollector(
) : channel_spectrum_decimator { 1 },
fifo { fifo_data, ChannelSpectrumConfigMessage::fifo_k }
{
}
void on_message(const Message* const message);
void set_decimation_factor(const size_t decimation_factor);
@@ -51,13 +45,13 @@ public:
);
private:
BlockDecimator<complex16_t, 256> channel_spectrum_decimator;
ChannelSpectrumFIFO fifo;
ChannelSpectrum fifo_data[1 << ChannelSpectrumConfigMessage::fifo_k];
BlockDecimator<complex16_t, 256> channel_spectrum_decimator { 1 };
ChannelSpectrum fifo_data[1 << ChannelSpectrumConfigMessage::fifo_k] { };
ChannelSpectrumFIFO fifo { fifo_data, ChannelSpectrumConfigMessage::fifo_k };
volatile bool channel_spectrum_request_update { false };
bool streaming { false };
std::array<std::complex<float>, 256> channel_spectrum;
std::array<std::complex<float>, 256> channel_spectrum { };
uint32_t channel_spectrum_sampling_rate { 0 };
uint32_t channel_filter_pass_frequency { 0 };
uint32_t channel_filter_stop_frequency { 0 };

View File

@@ -42,12 +42,12 @@ private:
FIFO<StreamBuffer*> fifo_buffers_empty;
FIFO<StreamBuffer*> fifo_buffers_full;
std::array<StreamBuffer, buffer_count_max> buffers;
std::array<StreamBuffer*, buffer_count_max> buffers_empty;
std::array<StreamBuffer*, buffer_count_max> buffers_full;
std::array<StreamBuffer, buffer_count_max> buffers { };
std::array<StreamBuffer*, buffer_count_max> buffers_empty { };
std::array<StreamBuffer*, buffer_count_max> buffers_full { };
StreamBuffer* active_buffer { nullptr };
CaptureConfig* const config { nullptr };
std::unique_ptr<uint8_t[]> data;
std::unique_ptr<uint8_t[]> data { };
};
#endif/*__STREAM_INPUT_H__*/