Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

GrWeaverModHead.h

Go to the documentation of this file.
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2002 Free Software Foundation, Inc. 00004 * 00005 * This file is part of GNU Radio 00006 * 00007 * GNU Radio is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2, or (at your option) 00010 * any later version. 00011 * 00012 * GNU Radio is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with GNU Radio; see the file COPYING. If not, write to 00019 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00020 * Boston, MA 02111-1307, USA. 00021 */ 00022 #ifndef _GRWEAVERMODHEAD_H_ 00023 #define _GRWEAVERMODHEAD_H_ 00024 00025 #include <VrInterpolatingSigProc.h> 00026 00038 template<class iType, class oType> 00039 class GrWeaverModHead : public VrInterpolatingSigProc<iType,oType> { 00040 public: 00041 GrWeaverModHead (int interp_factor) : 00042 VrInterpolatingSigProc<iType,oType>(2, interp_factor){} 00043 00044 virtual const char *name () { return "GrWeaverModHead"; } 00045 00046 virtual int work (VrSampleRange output, void *o[], 00047 VrSampleRange inputs[], void *i[]); 00048 00049 void initialize () { setOutputSize (interp * 4); } 00050 }; 00051 00052 00053 template<class iType, class oType> int 00054 GrWeaverModHead<iType,oType>::work (VrSampleRange output, void *ao[], 00055 VrSampleRange inputs[], void *ai[]) 00056 { 00057 iType *i = ((iType **) ai)[0]; 00058 oType *oI = ((oType **) ao)[0]; 00059 oType *oQ = ((oType **) ao)[1]; 00060 int size = output.size; 00061 iType input_symbol; 00062 00063 static const iType nco[4][2] = { 00064 // cos sin 00065 { 1, 0 }, 00066 { 0, 1 }, 00067 { -1, 0 }, 00068 { 0, -1 } 00069 }; 00070 00071 assert ((inputs[0].index & 0x3) == 0); 00072 00073 for (int insamp = 0; insamp < size/interp; insamp++){ 00074 input_symbol = i[insamp]; 00075 *oI++ = input_symbol * nco[insamp & 0x3][0]; 00076 *oQ++ = input_symbol * nco[insamp & 0x3][1]; 00077 for (int outsamp = 1; outsamp < interp; outsamp++){ 00078 *oI++ = 0; 00079 *oQ++ = 0; 00080 } 00081 } 00082 return output.size; 00083 } 00084 00085 #endif /* _GRWEAVERMODHEAD_H_ */

Generated on Wed Aug 4 02:22:04 2004 for GNU Radio by doxygen 1.3.8