/* demodqam_c subroutine * Quadrature Amplitude Modulation demodulator * 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" /* demodqam_c routine de calcul d'un démodulataur mQAM * * Entrées : * n :longueur des vecteurs d'entrées * m :longueurs des mots binaires en nombre de bits (scalaire) * i_c :adresse de départ du vecteur de la composante I * q_c :adresse de départ du vecteur de la composante Q * * Sortie : * y : adresse de départ du vecteur du symbole * * Dépendances: */ void demodqam_c(int *n,int *m,double *i_c,double *q_c,double *y) { /*déclaration des variables*/ int i; int ng,nd; int d,g; for(i=0;i<(*n);i++) { /*Calcul des sélecteurs binaires (c'est maladroit!!)*/ nd=(1<<(*m)/2)-1; ng=(1<<(*m))-1-nd; /*récupération des valeurs d'entrée*/ d=(int)i_c[i]; g=(int)q_c[i]; /*Calcul les nombres binaires droit et gauche*/ d=(d+nd)/2; g=((g+nd)/2)<<((*m)/2); /*Calcul du registre de sortie y[]*/ y[i]=d+g; } return; }