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

VrFixOffset.h

Go to the documentation of this file.
00001 /* -*- Mode: c++ -*-
00002 *******************************************************************************
00003 *
00004 * File:         VrFixOffset.h
00005 * Description:  subtract offset from ADC data
00006 *
00007 *******************************************************************************
00008 */
00009 
00010 /*
00011  * Copyright 2001 Free Software Foundation, Inc.
00012  * 
00013  * This file is part of GNU Radio
00014  * 
00015  * GNU Radio is free software; you can redistribute it and/or modify
00016  * it under the terms of the GNU General Public License as published by
00017  * the Free Software Foundation; either version 2, or (at your option)
00018  * any later version.
00019  * 
00020  * GNU Radio is distributed in the hope that it will be useful,
00021  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00022  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023  * GNU General Public License for more details.
00024  * 
00025  * You should have received a copy of the GNU General Public License
00026  * along with GNU Radio; see the file COPYING.  If not, write to
00027  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00028  * Boston, MA 02111-1307, USA.
00029  */
00030 
00031 #ifndef _VRFIXOFFSET_H_
00032 #define _VRFIXOFFSET_H_
00033 
00034 #include <VrSigProc.h>
00035 
00036 template<class iType, class oType>
00037 class VrFixOffset : public VrSigProc {
00038 
00039 public: 
00040   virtual const char *name() { return "VrFixOffset"; }
00041   virtual int work(VrSampleRange output, void *o[],
00042                    VrSampleRange inputs[], void *i[]);
00043   VrFixOffset();
00044 };
00045 
00046 template<class iType,class oType> int
00047 VrFixOffset<iType,oType>::work(VrSampleRange output, void *ao[],
00048                               VrSampleRange inputs[], void *ai[])
00049 {
00050   iType **i = (iType **)ai;
00051   oType **o = (oType **)ao;
00052   iType *ip = i[0];
00053   oType *op = o[0];
00054   
00055   int size = output.size;
00056 
00057   while(size > 0) {
00058     *op++ = *ip++ - 0x800;
00059     *op++ = *ip++ - 0x800;
00060     *op++ = *ip++ - 0x800;
00061     *op++ = *ip++ - 0x800;
00062     *op++ = *ip++ - 0x800;
00063     *op++ = *ip++ - 0x800;
00064     *op++ = *ip++ - 0x800;
00065     *op++ = *ip++ - 0x800;
00066     size -= 8;
00067   }
00068   return output.size;
00069 }
00070 
00071 template<class iType,class oType> 
00072 VrFixOffset<iType,oType>::VrFixOffset()
00073   : VrSigProc(1, sizeof(iType), sizeof(oType))
00074 {
00075   setOutputSize (1024);
00076 }
00077 
00078 #endif /* _VRFIXOFFSET_H_ */

Generated on Wed Mar 23 12:30:26 2005 for GNU Radio by  doxygen 1.4.0