void conv_fft_cc_free(conv_fft_cc_t *state) { if (state->input_fft) { free(state->input_fft); } if (state->filter_fft) { free(state->filter_fft); } if (state->output_fft) { free(state->output_fft); } dft_plan_free(&state->input_plan); dft_plan_free(&state->filter_plan); dft_plan_free(&state->output_plan); }
int pss_synch_init_N_id_2(cf_t *pss_signal_freq, uint32_t N_id_2, uint32_t fft_size) { dft_plan_t plan; cf_t pss_signal_pad[2048]; cf_t pss_signal_time[PSS_LEN]; int ret = LIBLTE_ERROR_INVALID_INPUTS; if (lte_N_id_2_isvalid(N_id_2) && fft_size <= 2048) { pss_generate(pss_signal_time, N_id_2); bzero(pss_signal_pad, fft_size * sizeof(cf_t)); bzero(pss_signal_freq, fft_size * sizeof(cf_t)); memcpy(&pss_signal_pad[(fft_size-PSS_LEN)/2], pss_signal_time, PSS_LEN * sizeof(cf_t)); if (dft_plan(&plan, fft_size, BACKWARD, COMPLEX)) { return LIBLTE_ERROR; } dft_plan_set_mirror(&plan, true); dft_plan_set_dc(&plan, true); dft_plan_set_norm(&plan, true); dft_run_c(&plan, pss_signal_pad, pss_signal_freq); vec_conj_cc(pss_signal_freq, pss_signal_freq, fft_size); vec_sc_prod_cfc(pss_signal_freq, 1.0/62.0, pss_signal_freq, fft_size); dft_plan_free(&plan); ret = LIBLTE_SUCCESS; } return ret; }
int sss_synch_realloc(sss_synch_t *q, uint32_t fft_size) { if (q != NULL && fft_size < 2048) { dft_plan_free(&q->dftp_input); if (dft_plan(&q->dftp_input, fft_size, FORWARD, COMPLEX)) { sss_synch_free(q); return LIBLTE_ERROR; } dft_plan_set_mirror(&q->dftp_input, true); dft_plan_set_dc(&q->dftp_input, true); q->fft_size = fft_size; return LIBLTE_SUCCESS; } return LIBLTE_ERROR_INVALID_INPUTS; }
void sss_synch_free(sss_synch_t *q) { dft_plan_free(&q->dftp_input); bzero(q, sizeof(sss_synch_t)); }
void dft_plan_free_vector(dft_plan_t *plan, int nof_plans) { int i; for (i=0;i<nof_plans;i++) { dft_plan_free(&plan[i]); } }