/* convolr_c subroutine * FIR computation * with FFT convolution * and overlap-ad method * IRCOM GROUP - Author : A.Layec * * Copyright (C) 2007 Alan Layec * Copyright Scilab (c)INRIA-ENPC * * This file is part of modnumlib. * * modnumlib is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * modnumlib is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with modnumlib; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ /* REVISION HISTORY : * $Log$ */ #include "modnum_lib.h" #include "machine.h" extern integer C2F(dset)(); /* convolr_c routine qui realise un filtre FIR * par multiplication dans le domaine frequentiel * avec mise mémoire . * * n : taille du mot original * nb_coef : longueur de la réponse impulsionnelle * m1 : taille de la fft * [z1_r;z1_i] : adresses de départ du vecteur complexe 1 * [z2_r;z2_i] : adresses de départ du vecteur complexe 2 * [y_r;y_i] : adresses de départ du vecteur complexe résultat * z_r : adresse de départ du mot mémoire * * utilise : dset (BLAS) * convolfft_c * overlapadr_c */ void convolr_c(int *n,int *nb_coef,int *m1,double *z1_r,double *z1_i,double *z2_r,double *z2_i,double *y_r,double *y_i,double *z_r) { /*déclaration*/ int i,l,k; /*ajoute les zéros au vecteur z1_r*/ C2F(dset)((k=(*m1)-(*n),&k),(l=0,&l),&z1_r[(*n)],(i=1,&i)); /*place valeur img z1_i a zero*/ C2F(dset)((k=(*m1),&k),(l=0,&l),&z1_i[0],(i=1,&i)); /*ajoute les zéros au vecteur z2_r*/ C2F(dset)((k=(*m1)-(*nb_coef),&k),(l=0,&l),&z2_r[(*nb_coef)],(i=1,&i)); /*place valeur img z2_i a zero*/ C2F(dset)((k=(*m1),&k),(l=0,&l),&z2_i[0],(i=1,&i)); /*Appel convolfft_c*/ convolfft_c(m1,&z1_r[0],&z1_i[0],&z2_r[0],&z2_i[0],&y_r[0],&y_i[0]); /*Appel overlapad_c*/ overlapadr_c(m1,n,nb_coef,&y_r[0],&z_r[0]); return; }