From 18500674df2b9694f3d1e3b47046378b35124aad Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Fri, 12 Aug 2022 16:46:08 +0200 Subject: [PATCH] improve nr_dlsch_decoding --- .../PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 33 ++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index e6833c4cb4..4f22712335 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -259,7 +259,6 @@ void nr_processDLSegment(void* arg) { int length_dec; int no_iteration_ldpc; int Kr; - int Kr_bytes; int K_bits_F; uint8_t crc_type; int i; @@ -282,8 +281,7 @@ void nr_processDLSegment(void* arg) { __m128i *pv = (__m128i*)&z; __m128i *pl = (__m128i*)&l; - Kr = harq_process->K; // [hna] overwrites this line "Kr = p_decParams->Z*kb" - Kr_bytes = Kr>>3; + Kr = harq_process->K; K_bits_F = Kr-harq_process->F; t_nrLDPC_time_stats procTime = {0}; @@ -293,8 +291,7 @@ void nr_processDLSegment(void* arg) { start_meas(&rdata->ts_deinterleave); //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_IN); - int16_t w[E]; - memset(w, 0, sizeof(w)); + int16_t w[E]; nr_deinterleaving_ldpc(E, Qm, w, // [hna] w is e @@ -321,7 +318,7 @@ void nr_processDLSegment(void* arg) { w, harq_process->C, harq_process->rvidx, - (harq_process->first_rx==1)?1:0, + harq_process->first_rx, E, harq_process->F, Kr-harq_process->F-2*(p_decoderParms->Z))==-1) { @@ -333,8 +330,6 @@ void nr_processDLSegment(void* arg) { } stop_meas(&rdata->ts_rate_unmatch); - r_offset += E; - if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD)) { LOG_D(PHY,"decoder input(segment %u) :",r); @@ -344,8 +339,6 @@ void nr_processDLSegment(void* arg) { LOG_D(PHY,"\n"); } - memset(harq_process->c[r],0,Kr_bytes); - if (harq_process->C == 1) { if (A > NR_MAX_PDSCH_TBS) crc_type = CRC24_A; @@ -383,21 +376,23 @@ void nr_processDLSegment(void* arg) { &procTime); //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_LDPC, VCD_FUNCTION_OUT); + LOG_D(PHY,"no_iteration_ldpc = %d\n", no_iteration_ldpc); // Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int if (check_crc((uint8_t *)llrProcBuf,length_dec,harq_process->F,crc_type)) { LOG_D(PHY,"Segment %u CRC OK\n",r); - - if (r==0) { - for (int i=0; i<10; i++) LOG_D(PHY,"byte %d : %x\n",i,((uint8_t *)llrProcBuf)[i]); - } - - //Temporary hack - no_iteration_ldpc = dlsch->max_ldpc_iterations; - rdata->decodeIterations = no_iteration_ldpc; + if (no_iteration_ldpc > dlsch->max_ldpc_iterations) + no_iteration_ldpc = dlsch->max_ldpc_iterations; } else { LOG_D(PHY,"CRC NOT OK\n"); + no_iteration_ldpc = dlsch->max_ldpc_iterations + 1; } + if (r==0) { + for (int i=0; i<10; i++) LOG_D(PHY,"byte %d : %x\n",i,((uint8_t *)llrProcBuf)[i]); + } + + rdata->decodeIterations = no_iteration_ldpc; + nb_total_decod++; if (no_iteration_ldpc > dlsch->max_ldpc_iterations) { @@ -547,7 +542,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, } if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD) && (!frame%100)) - LOG_I(PHY,"K %d C %d Z %d nl %d \n", harq_process->K, harq_process->C, p_decParams->Z, harq_process->Nl); + LOG_I(PHY,"K %d C %d Z %d nl %d \n", harq_process->K, harq_process->C, harq_process->Z, harq_process->Nl); } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_SEGMENTATION, VCD_FUNCTION_OUT);