Increased sync threshold. Fixed some memory issues

master
ismagom 10 years ago
parent 9290336502
commit 9b3a890d6a

@ -273,7 +273,7 @@ int main(int argc, char **argv) {
if ((sf_cnt%10)==0) { if ((sf_cnt%10)==0) {
printf("CFO: %+6.2f KHz, SFO: %+6.2f Khz, SNR: %5.1f dB, NOI: %.2f, " printf("CFO: %+6.2f KHz, SFO: %+6.2f Khz, SNR: %5.1f dB, NOI: %.2f, "
"PDCCH-Miss: %d/%d, PDSCH-BLER: %5.2f%% (%d blocks)\n", "PDCCH-Miss: %d/%d, PDSCH-BLER: %5.2f%% (%d blocks)\r",
ue_sync_get_cfo(&ue_sync)/1000, ue_sync_get_sfo(&ue_sync)/1000, ue_sync_get_cfo(&ue_sync)/1000, ue_sync_get_sfo(&ue_sync)/1000,
10*log10f(snr), pdsch_average_noi(&ue_dl.pdsch), 10*log10f(snr), pdsch_average_noi(&ue_dl.pdsch),
nof_trials-ue_dl.nof_pdcch_detected, nof_trials, nof_trials-ue_dl.nof_pdcch_detected, nof_trials,

@ -255,17 +255,10 @@ int pss_synch_find_pss(pss_synch_t *q, cf_t *input, float *corr_peak_value)
/* Find maximum of the absolute value of the correlation */ /* Find maximum of the absolute value of the correlation */
corr_peak_pos = vec_max_abs_ci(q->conv_output, conv_output_len-1); corr_peak_pos = vec_max_abs_ci(q->conv_output, conv_output_len-1);
if (corr_peak_pos <= q->frame_size) { if (corr_peak_value) {
if (corr_peak_value) { *corr_peak_value = cabsf(q->conv_output[corr_peak_pos]);
*corr_peak_value = cabsf(q->conv_output[corr_peak_pos]);
}
ret = (int) corr_peak_pos;
} else {
ret = q->frame_size;
if (corr_peak_value) {
*corr_peak_value = 0.0;
}
} }
ret = (int) corr_peak_pos;
} }
return ret; return ret;
} }

@ -195,7 +195,12 @@ int sync_sss(sync_t *q, cf_t *input, uint32_t peak_pos) {
sss_synch_set_N_id_2(&q->sss, q->N_id_2); sss_synch_set_N_id_2(&q->sss, q->N_id_2);
if (q->detect_cp) { if (q->detect_cp) {
q->cp = detect_cp(q, input, peak_pos); if (peak_pos - q->fft_size - CP_EXT(q->fft_size)) {
q->cp = detect_cp(q, input, peak_pos);
} else {
INFO("Not enough room to detect CP length. Peak position: %d\n", peak_pos);
return LIBLTE_ERROR;
}
} }
/* Make sure we have enough room to find SSS sequence */ /* Make sure we have enough room to find SSS sequence */
@ -255,8 +260,9 @@ int sync_find(sync_t *q, cf_t *input, uint32_t find_offset, uint32_t *peak_posit
fprintf(stderr, "Error calling finding PSS sequence\n"); fprintf(stderr, "Error calling finding PSS sequence\n");
return LIBLTE_ERROR; return LIBLTE_ERROR;
} }
if (q->normalize_en && if (q->normalize_en &&
peak_pos + find_offset >= q->fft_size) peak_pos < q->frame_size &&
peak_pos + find_offset >= q->fft_size )
{ {
/* Compute the energy of the received PSS sequence to normalize */ /* Compute the energy of the received PSS sequence to normalize */
energy = sqrtf(vec_avg_power_cf(&input[find_offset+peak_pos-q->fft_size], q->fft_size)); energy = sqrtf(vec_avg_power_cf(&input[find_offset+peak_pos-q->fft_size], q->fft_size));
@ -290,7 +296,9 @@ int sync_find(sync_t *q, cf_t *input, uint32_t find_offset, uint32_t *peak_posit
} }
} }
// Make sure we have enough space to estimate CFO // Make sure we have enough space to estimate CFO
if (find_offset + peak_pos >= q->fft_size + CP_EXT(q->fft_size)) { if (peak_pos < q->frame_size &&
peak_pos + find_offset >= q->fft_size)
{
q->cfo = pss_synch_cfo_compute(&q->pss, &input[find_offset+peak_pos-q->fft_size]); q->cfo = pss_synch_cfo_compute(&q->pss, &input[find_offset+peak_pos-q->fft_size]);
} else { } else {
INFO("No space for CFO computation. Frame starts at \n",peak_pos); INFO("No space for CFO computation. Frame starts at \n",peak_pos);
@ -301,7 +309,7 @@ int sync_find(sync_t *q, cf_t *input, uint32_t find_offset, uint32_t *peak_posit
ret = 0; ret = 0;
} }
printf("SYNC ret=%d N_id_2=%d pos=%d peak=%.2f/%.2f=%.2f threshold=%.2f sf_idx=%d offset=%d\n", INFO("SYNC ret=%d N_id_2=%d pos=%d peak=%.2f/%.2f=%.2f threshold=%.2f sf_idx=%d offset=%d\n",
ret, q->N_id_2, peak_pos, peak_unnormalized,energy,q->peak_value, q->threshold, q->sf_idx, find_offset); ret, q->N_id_2, peak_pos, peak_unnormalized,energy,q->peak_value, q->threshold, q->sf_idx, find_offset);
} else if (lte_N_id_2_isvalid(q->N_id_2)) { } else if (lte_N_id_2_isvalid(q->N_id_2)) {

@ -46,9 +46,9 @@ cf_t dummy[MAX_TIME_OFFSET];
#define CURRENT_SLOTLEN_RE SLOT_LEN_RE(q->cell.nof_prb, q->cell.cp) #define CURRENT_SLOTLEN_RE SLOT_LEN_RE(q->cell.nof_prb, q->cell.cp)
#define CURRENT_SFLEN_RE SF_LEN_RE(q->cell.nof_prb, q->cell.cp) #define CURRENT_SFLEN_RE SF_LEN_RE(q->cell.nof_prb, q->cell.cp)
#define FIND_THRESHOLD 1.0 #define FIND_THRESHOLD 1.4
#define TRACK_THRESHOLD 0.4 #define TRACK_THRESHOLD 0.7
#define TRACK_MAX_LOST 5 #define TRACK_MAX_LOST 10
int ue_sync_init(ue_sync_t *q, int ue_sync_init(ue_sync_t *q,
@ -190,7 +190,10 @@ int track_peak_ok(ue_sync_t *q, uint32_t track_idx) {
q->sf_idx, sync_get_sf_idx(&q->strack), q->sf_idx, sync_get_sf_idx(&q->strack),
q->strack.m0, q->strack.m0_value, q->strack.m1, q->strack.m1_value); q->strack.m0, q->strack.m0_value, q->strack.m1, q->strack.m1_value);
/* FIXME: What should we do in this case? */ /* FIXME: What should we do in this case?
* If the threshold is high enough, an OK peak means it is likely to be true
* Otherwise, maybe we should not trust the new sf_idx.
*/
q->sf_idx = sync_get_sf_idx(&q->strack); q->sf_idx = sync_get_sf_idx(&q->strack);
//q->state = SF_FIND; //q->state = SF_FIND;
} else { } else {
@ -223,7 +226,7 @@ int track_peak_no(ue_sync_t *q) {
/* if we missed too many PSS go back to FIND */ /* if we missed too many PSS go back to FIND */
q->frame_no_cnt++; q->frame_no_cnt++;
if (q->frame_no_cnt >= TRACK_MAX_LOST) { if (q->frame_no_cnt >= TRACK_MAX_LOST) {
INFO("\n%d frames lost. Going back to FIND\n", (int) q->frame_no_cnt); printf("\n%d frames lost. Going back to FIND\n", (int) q->frame_no_cnt);
q->state = SF_FIND; q->state = SF_FIND;
} else { } else {
INFO("Tracking peak not found. Peak %.3f, %d lost\n", INFO("Tracking peak not found. Peak %.3f, %d lost\n",

Loading…
Cancel
Save