diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2017-08-23 08:35:26 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2017-09-28 13:36:48 +0200 |
commit | 16c4bcb085457514438d35bbbe11ef979e36bb85 (patch) | |
tree | d6a7d1b89dc1d398d7db8a3328f29fd073c3f02f | |
parent | 63ae20781af39e9cb6673e910e99e28f86c6adb0 (diff) | |
download | dabmod-16c4bcb085457514438d35bbbe11ef979e36bb85.tar.gz dabmod-16c4bcb085457514438d35bbbe11ef979e36bb85.tar.bz2 dabmod-16c4bcb085457514438d35bbbe11ef979e36bb85.zip |
Show CFR error min and max
-rw-r--r-- | src/OfdmGenerator.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
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<float> 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<complexf*>(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 } |