1 #ifndef _RAR_RS_ 2 #define _RAR_RS_ 3 4 #define MAXPAR 255 // Maximum parity data size. 5 #define MAXPOL 512 // Maximum polynomial degree. 6 7 class RSCoder 8 { 9 private: 10 void gfInit(); 11 int gfMult(int a,int b); 12 void pnInit(); 13 void pnMult(int *p1,int *p2,int *r); 14 15 int gfExp[MAXPOL]; // Galois field exponents. 16 int gfLog[MAXPAR+1]; // Galois field logarithms. 17 18 int GXPol[MAXPOL*2]; // Generator polynomial g(x). 19 20 int ErrorLocs[MAXPAR+1],ErrCount; 21 int Dnm[MAXPAR+1]; 22 23 int ParSize; // Parity bytes size and so the number of recovery volumes. 24 int ELPol[MAXPOL]; // Error locator polynomial. 25 bool FirstBlockDone; 26 public: 27 void Init(int ParSize); 28 void Encode(byte *Data,int DataSize,byte *DestData); 29 bool Decode(byte *Data,int DataSize,int *EraLoc,int EraSize); 30 }; 31 32 #endif 33