From 049dfdb3fa7d436b92449d1aa5b263590349d606 Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Fri, 18 Jul 2025 07:19:13 +0200 Subject: [PATCH] accommodate preamble symbol in PAPR computations --- common.hh | 2 +- decode.cc | 4 ++-- encode.cc | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common.hh b/common.hh index 84817c6..9200362 100644 --- a/common.hh +++ b/common.hh @@ -16,7 +16,7 @@ struct Common static const int code_max = 15; static const int bits_max = 1 << code_max; static const int data_max = 2048; - static const int symbols_max = 23; + static const int symbols_max = 22 + 1; static const int mls0_poly = 0x331; static const int mls0_seed = 214; static const int mls1_poly = 0x43; diff --git a/decode.cc b/decode.cc index 3cb2450..03ef872 100644 --- a/decode.cc +++ b/decode.cc @@ -385,8 +385,8 @@ struct Decoder : Common } if (oper_mode < 1) continue; - DSP::quick_sort(snr, symbol_count); - std::cerr << "Es/N0 (dB): " << DSP::decibel(snr[0]) << " .. " << DSP::decibel(snr[symbol_count/2]) << " .. " << DSP::decibel(snr[symbol_count-1]) << std::endl; + DSP::quick_sort(snr, symbol_count + 1); + std::cerr << "Es/N0 (dB): " << DSP::decibel(snr[0]) << " .. " << DSP::decibel(snr[symbol_count/2]) << " .. " << DSP::decibel(snr[symbol_count]) << std::endl; crc_bits = data_bits + 32; shuffle(code, perm, code_order); polar_decoder(nullptr, mesg, code, frozen_bits, code_order); diff --git a/encode.cc b/encode.cc index 9d91318..932a09b 100644 --- a/encode.cc +++ b/encode.cc @@ -312,8 +312,8 @@ struct Encoder : public Common } symbol(j); } - DSP::quick_sort(papr, symbol_count); - std::cerr << "PAPR (dB): " << DSP::decibel(papr[0]) << " .. " << DSP::decibel(papr[symbol_count/2]) << " .. " << DSP::decibel(papr[symbol_count-1]) << std::endl; + DSP::quick_sort(papr, symbol_count + 1); + std::cerr << "PAPR (dB): " << DSP::decibel(papr[0]) << " .. " << DSP::decibel(papr[symbol_count/2]) << " .. " << DSP::decibel(papr[symbol_count]) << std::endl; } finish(); }