From 16c4bcb085457514438d35bbbe11ef979e36bb85 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Wed, 23 Aug 2017 08:35:26 +0200 Subject: Show CFR error min and max --- src/OfdmGenerator.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/OfdmGenerator.cpp b/src/OfdmGenerator.cpp index 8d1a560..8f5d8a0 100644 --- a/src/OfdmGenerator.cpp +++ b/src/OfdmGenerator.cpp @@ -242,6 +242,8 @@ void OfdmGenerator::cfr_one_iteration(complexf *symbol, const complexf *referenc // extent. const float err_clip_squared = myCfrErrorClip * myCfrErrorClip; + std::vector error_norm(mySpacing); + for (size_t i = 0; i < mySpacing; i++) { // FFTW computes an unnormalised trasform, i.e. a FFT-IFFT pair // or vice-versa give back the original vector scaled by a factor @@ -254,17 +256,23 @@ void OfdmGenerator::cfr_one_iteration(complexf *symbol, const complexf *referenc complexf error = reference[i] - constellation_point; const float mag_squared = std::norm(error); + error_norm[i] = mag_squared; + if (mag_squared > err_clip_squared) { error *= std::sqrt(err_clip_squared / mag_squared); myNumErrorClip++; } - // Update the input to the FFT directl to avoid another copy for the + // Update the input to the FFT directly to avoid another copy for the // subsequence IFFT complexf *fft_in = reinterpret_cast(myFftIn); fft_in[i] = constellation_point + error; } + auto minmax = std::minmax_element(error_norm.begin(), error_norm.end()); + etiLog.level(debug) << "err min: " << std::sqrt(*minmax.first) + << " max: " << std::sqrt(*minmax.second); + // Run our error-compensated symbol through the IFFT again fftwf_execute(myFftPlan); // IFFT from myFftIn to myFftOut } -- cgit v1.2.3