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