From 4a9009109512688d86a705b7b5c921c670c55701 Mon Sep 17 00:00:00 2001
From: Thomas Schlichter <thomas.schlichter@iis.fraunhofer.de>
Date: Sat, 13 Nov 2021 15:53:27 +0100
Subject: [PATCH] fix init_timeshift_rotation()

---
 openair1/PHY/MODULATION/nr_modulation.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c
index c81a88ff307..fd3c1d394d3 100644
--- a/openair1/PHY/MODULATION/nr_modulation.c
+++ b/openair1/PHY/MODULATION/nr_modulation.c
@@ -747,8 +747,9 @@ void init_symbol_rotation(NR_DL_FRAME_PARMS *fp) {
 
 void init_timeshift_rotation(NR_DL_FRAME_PARMS *fp)
 {
+  const int sample_offset = fp->nb_prefix_samples / fp->ofdm_offset_divisor;
   for (int i = 0; i < fp->ofdm_symbol_size; i++) {
-    double poff = -i * 2.0 * M_PI * 144.0 / 2048.0 / fp->ofdm_offset_divisor;
+    double poff = -i * 2.0 * M_PI * sample_offset / fp->ofdm_symbol_size;
     double exp_re = cos(poff);
     double exp_im = sin(-poff);
     fp->timeshift_symbol_rotation[i*2] = (int16_t)round(exp_re * 32767);
-- 
GitLab