Routine bas-niveau
fr - eng


surecht_c - routine de calcul élévateur de cadence

Paramètres

Contenu du fichier


/* surecht_c subroutine
 * Up-Sampling Computation
 * IRCOM GROUP - Author : A.Layec
 *
 * Copyright (C) 2007 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"

/* surecht_c routine de calcul de sur-échantillonnage en temporel
 *
 * Entrées :
 * opt    : option 0: sur-échantillonnage classique
 *                 1: sur-échantillonnage avec insertion de zéros(Dirac)
 * n      : taille du vecteur original
 * nech   : facteur de sur-échantillonnage
 * init_c : adresse du compteur
 * u      : adresse du vecteur d'entrée (de taille n)
 * Sorties :
 * y      : adresse du vecteur de sortie (de taille n*nech)
 *
 */

void surecht_c(int *opt,int *n,int *nech,int *init_c,double *u,double *y)
{
 /*déclaration des variables compteur*/
 int i,j;
 int counter;

 switch(*opt)
 {
  /*Suréchantillonnage classique*/
  case 0 : {
            for(j=0;j<(*n);j++)
            {
             for(i=0;i<(*nech);i++) y[j*(*nech)+i]=u[j];
            }
            break;
           }

  /*Suréchantillonnage avec insertion zéro*/
  case 1 : {
            counter=(*init_c);
            i=0;
            for(j=0;j<(*n)*(*nech);j++)
            {
             y[j]=0;
             if(j==counter)
             {
              counter=counter+(*nech);
              y[j]=u[i];
              i++;
             }
            }
            break;
           }
  /*other case*/
  break;
 }
 return;
}

Auteurs

IRCOM Group Alan Layec