Exemplo n.º 1
0
dft_plan_t* generate_new_plan(int dft_size) {
	int i;

	modinfo_msg("Warning, no plan was precomputed for size %d. Generating.\n",dft_size);
	for (i=0;i<MAX_EXTRA_PLANS;i++) {
		if (!extra_plans[i].size) {
			if (is_complex) {
				if (dft_plan_c2r(dft_size, FORWARD, &extra_plans[i])) {
					return NULL;
				}
			} else {
				if (dft_plan_r2r(dft_size, FORWARD, &extra_plans[i])) {
					return NULL;
				}
			}
			extra_plans[i].options = DFT_PSD | DFT_OUT_DB | DFT_NORMALIZE;
			return &extra_plans[i];
		}
	}
	return NULL;
	}
Exemplo n.º 2
0
int dft_plan(const int dft_points, dft_mode_t mode, dft_dir_t dir, dft_plan_t *plan) {

	switch(mode) {
	case COMPLEX_2_COMPLEX:
		if (dft_plan_c2c(dft_points,dir,plan)) {
			return -1;
		}
		break;
	case REAL_2_REAL:
		if (dft_plan_r2r(dft_points,dir,plan)) {
			return -1;
		}
		break;
	case COMPLEX_2_REAL:
		if (dft_plan_c2r(dft_points,dir,plan)) {
			return -1;
		}
		break;
	}
	return 0;
}