Low level routine
fr - eng


convolr_c - finite impulse response filter by fft and overlap-add method computational routine

Module

Parameters

File content


/* convolr_c subroutine
 * FIR computation
 * with FFT convolution
 * and overlap-ad method
 *
 * Copyright (C) 2007-2011 Alan Layec
 *
 * 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"

/* 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 : 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, \
               fft_pr_struct *fft_pr)
{
 /*déclaration*/
 int i;

 /*ajoute les zéros au vecteur z1_r*/
 for(i=0;i<((*m1)-(*n));i++) {
   z1_r[(*n)+i]=0.;
 }

 /*place valeur img z1_i a zero*/
 for(i=0;i<(*m1);i++) {
   z1_i[i]=0.;
 }

 /*ajoute les zéros au vecteur z2_r*/
 for(i=0;i<((*m1)-(*nb_coef));i++) {
   z2_r[(*nb_coef)+i]=0.;
 }

 /*place valeur img z2_i a zero*/
 for(i=0;i<(*m1);i++) {
   z2_i[i]=0.;
 }

 /*Appel convolfft_c*/
 convolfft_c(m1,&z1_r[0],&z1_i[0],&z2_r[0],&z2_i[0],&y_r[0],&y_i[0],fft_pr);

 /*Appel overlapad_c*/
 overlapadr_c(m1,n,nb_coef,&y_r[0],&z_r[0]);

}

Authors

A. Layec