From: Soeren Apel Date: Sun, 28 May 2017 08:31:47 +0000 (+0200) Subject: AnalogSegment: Speed up processing of interleaved sample data X-Git-Tag: pulseview-0.4.0~67 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=adb2a97bb18d0db0c936fa90b4164c8aac18e6fe;p=pulseview.git AnalogSegment: Speed up processing of interleaved sample data --- diff --git a/pv/data/analogsegment.cpp b/pv/data/analogsegment.cpp index 1bd33876..5e42556c 100644 --- a/pv/data/analogsegment.cpp +++ b/pv/data/analogsegment.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include @@ -37,6 +38,7 @@ using std::max_element; using std::min; using std::min_element; using std::pair; +using std::unique_ptr; namespace pv { namespace data { @@ -72,11 +74,17 @@ void AnalogSegment::append_interleaved_samples(const float *data, uint64_t prev_sample_count = sample_count_; + // Deinterleave the samples and add them + unique_ptr deint_data(new float[sample_count]); + float *deint_data_ptr = deint_data.get(); for (uint32_t i = 0; i < sample_count; i++) { - append_single_sample((void*)data); + *deint_data_ptr = (float)(*data); + deint_data_ptr++; data += stride; } + append_samples(deint_data.get(), sample_count); + // Generate the first mip-map from the data append_payload_to_envelope_levels();