Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

blockencoder.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           blockencoder.h  -  description
00003                              -------------------
00004     begin                : Sun Sep 14 2003
00005     copyright            : (C) 2003 by Peter Haase
00006     email                : mail@p-haase.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This library is free software; you can redistribute it and/or         *
00012  *   modify it under the terms of the GNU Lesser General Public            *
00013  *   License as published by the Free Software Foundation; either          *
00014  *   version 2.1 of the License, or (at your option) any later version.    *
00015  *                                                                         *
00016  *   This library is distributed in the hope that it will be useful,       *
00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00019  *   Lesser General Public License for more details.                       *
00020  *                                                                         *
00021  *   You should have received a copy of the GNU Lesser General Public      *
00022  *   License along with this library; if not, write to the Free Software   *
00023  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,                 *
00024  *   MA  02111-1307  USA                                                   *
00025  *                                                                         *
00026  ***************************************************************************/
00027 
00028 
00039 #ifndef BLOCKENCODER_H
00040 #define BLOCKENCODER_H
00041 
00042 #include "encoder.h"
00043 
00044 
00045 namespace simthlib{
00046 
00050 class BlockEncoder : public Encoder
00051 {
00052 
00053   public:
00054     BlockEncoder(int deviceID, simth::DeviceSystemIntf* system,
00055          const simth::PropertyList& pl);
00056     virtual ~BlockEncoder() = 0;
00057 
00058 };
00059 
00060   
00061 
00064 class ReedSol_init
00065 {
00066   private:
00067   public:
00068     ReedSol_init();
00069     virtual ~ReedSol_init();
00070 
00071     static const int Q=256;
00072     static const int R=60;
00073 
00074     int *gp,(*mlga)[Q],(*mgp)[ReedSol_init::Q];
00075     int *g,*lgt,*lga,*qua,*inv;
00076     void init(int ,int ,int );
00077     int mult(int, int);
00078   private:
00079     void gf(int);
00080     void mcf(int,int,int  (*mgp)[ReedSol_init::Q]);
00081     void genpol(int, int, int);
00082 
00083 
00084 };
00085 
00088 class ReedSolomonEncoder : public BlockEncoder
00089 {
00090 
00091 
00092   public:
00093     ReedSolomonEncoder(int deviceID, simth::DeviceSystemIntf* system,
00094                const simth::PropertyList& pl,
00095                int bitsPerSymbol, int numCheckSymbol ,int m0_, int input_Length);
00096     virtual ~ReedSolomonEncoder();
00097     virtual void Encode(const simth::BitSeq &bsin, simth::BitSeq* bsout) const;
00098     virtual void updateOutputLengths( );
00099     virtual void updateInputLengths();
00100 
00101     virtual int getDataLength(int codedLength) const;
00102     virtual int getCodeLength(int rawLength) const;
00103 
00104   private:
00105     void invariante() const;
00106     void coder(int*, int, int) const;
00107     size_t inp_length;
00108     size_t out_length;
00109     int q;
00110     int inf_code_length;
00111     int code_length;
00112     int *gp,(*mgp)[ReedSol_init::Q];
00113     int ns;
00114     mutable int temp[ReedSol_init::Q];
00115     int bits_p_sym, r, m0;
00116 };
00117 
00118 inline void ReedSolomonEncoder::invariante() const
00119 {
00120   if(DEBUG) {
00121     if(outputLength(0) != out_length) {
00122       throw std::runtime_error("inline ReedSolomonEncoder:invariante() : error 1");
00123     }
00124   }
00125 }
00126 
00127 
00128 }
00129 
00130 #endif

Generated on Tue Aug 9 14:35:10 2005 for simtheticlib by  doxygen 1.4.1