Esempio n. 1
0
cf_t corr_sz(cf_t *z, cf_t *s) {
	cf_t sum;
	cf_t zsprod[32];
	vec_prod_ccc(z, s, zsprod, N_SSS - 1);
	sum = vec_acc_cc(zsprod, N_SSS - 1);

	return sum;
}
Esempio n. 2
0
void cfo_correct(cfo_t *h, cf_t *input, cf_t *output, float freq) {
  if (fabs(h->last_freq - freq) > h->tol) {
    h->last_freq = freq;
    cexptab_gen(&h->tab, h->cur_cexp, h->last_freq, h->nsamples);
    DEBUG("CFO generating new table for frequency %.4f\n", freq);
  }
  vec_prod_ccc(h->cur_cexp, input, output, h->nsamples);
}
Esempio n. 3
0
/* Assumes input points to the beginning of the SSS symbol. The SSS symbol start is
 * given by SSS_SYMBOL_ST() macro in sss.h.
 * Estimates the m0 and m1 values and saves in m0_value and m1_value
 * the resulted correlation (higher is more likely)
 *
 *
 * Source: "SSS Detection Method for Initial Cell Search in 3GPP LTE FDD/TDD Dual Mode Receiver"
 * 			Jung-In Kim, Jung-Su Han, Hee-Jin Roh and Hyung-Jin Choi

 *
 */
void sss_synch_m0m1(sss_synch_t *q, cf_t *input, int *m0, float *m0_value,
		int *m1, float *m1_value) {

	/* This is aprox 3-4 kbytes of stack. Consider moving to sss_synch_t?? */
	cf_t zdelay[N_SSS+1],zconj[N_SSS+1],zprod[N_SSS+1];
	cf_t y[2][N_SSS+1], z[N_SSS+1], tmp[N_SSS+1];
	float tmp_real[N_SSS+1];
	cf_t input_fft[SSS_DFT_LEN];

	int i;

	dft_run_c2c(&q->dftp_input, input, input_fft);

	for (i = 0; i < N_SSS; i++) {
		y[0][i] = input_fft[SSS_POS_SYMBOL + 2 * i];
		y[1][i] = input_fft[SSS_POS_SYMBOL + 2 * i + 1];
	}

	vec_prod_ccc(y[0], q->fc_tables.c[0], z, N_SSS);
	memcpy(zdelay, &z[1], (N_SSS - 1) * sizeof(cf_t));
	vec_conj_cc(z, zconj, N_SSS - 1);
	vec_prod_ccc(zdelay, zconj, zprod, N_SSS - 1);

	corr_all_zs(zprod, q->fc_tables.s, tmp);
	vec_abs_cf(tmp, tmp_real, N_SSS);
	*m0 = vec_max_fi(tmp_real, N_SSS);
	if (m0_value) {
		*m0_value = tmp_real[*m0];
	}

	vec_prod_ccc(y[1], q->fc_tables.c[1], tmp, N_SSS);
	vec_prod_ccc(tmp, q->fc_tables.z1[*m0], z, N_SSS);
	memcpy(zdelay, &z[1], (N_SSS - 1) * sizeof(cf_t));
	vec_conj_cc(z, zconj, N_SSS - 1);
	vec_prod_ccc(zdelay, zconj, zprod, N_SSS - 1);

	corr_all_zs(zprod, q->fc_tables.s, tmp);
	vec_abs_cf(tmp, tmp_real, N_SSS);
	*m1 = vec_max_fi(tmp_real, N_SSS);
	if (m1_value) {
		*m1_value = tmp_real[*m1];
	}

}