00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00037 #ifndef BLOCKDECODER_H
00038 #define BLOCKDECODER_H
00039 
00040 #include "decoder.h"
00041 
00042 
00043 namespace simthlib{
00044 
00045 
00051 class BlockDecoder : public Decoder
00052 {
00053 
00054   public :
00055     BlockDecoder(int deviceID, simth::DeviceSystemIntf* system,
00056          const simth::PropertyList& pl, 
00057          simth::SequenceType inType);
00058 };
00059 
00067 class RSHardDecoder
00068 {
00069   public:
00070     RSHardDecoder();
00071     virtual ~RSHardDecoder();
00072     int initialise(int*,int,int,int,int);
00073     int compute_out(int, int*, int*);
00074     int decoder(int* v,int n,int r,int q,int m0,int erasures,int* zp,int* err);
00075 
00076     static const int Q=256;
00077     static const int R=60;
00078 
00079   protected:
00080 
00081     int *gp,(*mlga)[RSHardDecoder::Q];
00082     int *g,*lgt,*lga,*qua,*inv;
00083     int* v;
00084     int n;
00085     int r,q,m0;
00086     int syndromes(int* v, int* s, int n, int r, int q, int m0);
00087     void erasure_pol(int* ze, int erasures, int r, int* gam);
00088     void syn_pol(int* s, int* gam, int r, int erasures, int* xi);
00089     int bma(int* s, int* xi, int erasures, int r, int* lam, int* errnum);
00090     void err_pol(int* lam, int* gam, int r, int* psi);
00091     int chien(int* lam, int errnum, int* x, int q, int n, int* zeta);
00092     void forney(int* xi, int* lam, int* psi, int* x, int* ze, int erasures, int errnum, int m0, int q, int r, int* zv, int* y);
00093 
00094 
00095 };
00096 
00097 
00100 class ReedSolomonDecoder : public BlockDecoder
00101 {
00102   public :
00103     ReedSolomonDecoder(int deviceID, simth::DeviceSystemIntf* system,
00104                const simth::PropertyList& pl, 
00105                int bitsPerSymbol, int numCheckSymbol ,
00106                int m0_, int output_Length,int numChase2bits );
00107     virtual ~ReedSolomonDecoder();
00108 
00109     virtual void decode(const simth::BitSeq &llr, simth::BitSeq& bsout);
00110     virtual void decode(const simth::LlrSeq &llr, simth::BitSeq& bsout);
00111     virtual void decode(const simth::LlvSeq &llr, simth::BitSeq& bsout);
00112 
00113     virtual void updateOutputLengths( );
00114     virtual void updateInputLengths();
00115 
00116     virtual int getDataLength(int codedLength) const;
00117     virtual int getCodeLength(int rawLength) const;
00118 
00119   private:
00120 
00121     static const int Q=RSHardDecoder::Q;
00122     static const int R=RSHardDecoder::R;
00123 
00124     inline void compare_results();
00125     inline void generate_pattern();
00126     RSHardDecoder rsd;
00127     int inp_length;
00128     int out_length;
00129     int q;
00130     int inf_code_length;
00131     int code_length;
00132     int ns;
00133     int bits_p_sym, r, m0;
00134     int num_chase2_bits;
00135     mutable int temp[ReedSolomonDecoder::Q];
00136     int * hard_inp;
00137     
00138     int* best_res;
00139     int * less_prob_pos;
00140     float * inp;
00141     int err;
00142     int zp[RSHardDecoder::R];
00143     int chase2;
00144     mutable int errstat;
00145     mutable float best_metric;
00146 
00147 
00148 };
00149 
00150 
00151 }
00152 
00153 #endif