"Fossies" - the Fresh Open Source Software Archive

Member "unrar/rs16.hpp" (4 May 2022, 1507 Bytes) of package /linux/misc/unrarsrc-6.1.7.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "rs16.hpp" see the Fossies "Dox" file reference documentation.

    1 #ifndef _RAR_RS16_
    2 #define _RAR_RS16_
    3 
    4 class RSCoder16
    5 {
    6   private:
    7     static const uint gfSize=65535;   // Galois field size.
    8     void gfInit();                    // Galois field inititalization.
    9     inline uint gfAdd(uint a,uint b); // Addition in Galois field. 
   10     inline uint gfMul(uint a,uint b); // Multiplication in Galois field. 
   11     inline uint gfInv(uint a);        // Inverse element in Galois field.
   12     uint *gfExp;                      // Galois field exponents.
   13     uint *gfLog;                      // Galois field logarithms.
   14 
   15     void MakeEncoderMatrix();
   16     void MakeDecoderMatrix();
   17     void InvertDecoderMatrix();
   18 
   19 #ifdef USE_SSE
   20     bool SSE_UpdateECC(uint DataNum, uint ECCNum, const byte *Data, byte *ECC, size_t BlockSize);
   21 #endif
   22 
   23     bool Decoding;    // If we are decoding or encoding data.
   24     uint ND;          // Number of data units.
   25     uint NR;          // Number of Reed-Solomon code units.
   26     uint NE;          // Number of erasures.
   27     bool *ValidFlags; // Validity flags for data and ECC units.
   28     uint *MX;         // Cauchy based coding or decoding matrix.
   29 
   30     uint *DataLog; // Buffer to store data logarithms for UpdateECC.
   31     size_t DataLogSize;
   32 
   33   public:
   34     RSCoder16();
   35     ~RSCoder16();
   36 
   37     bool Init(uint DataCount, uint RecCount, bool *ValidityFlags);
   38 #if 0 // We use only UpdateECC now.
   39     void Process(const uint *Data, uint *Out);
   40 #endif
   41     void UpdateECC(uint DataNum, uint ECCNum, const byte *Data, byte *ECC, size_t BlockSize);
   42 };
   43 
   44 #endif