File: rs.hpp

package info (click to toggle)
unrar-nonfree 1%3A7.1.8-1
  • links: PTS, VCS
  • area: non-free
  • in suites: trixie
  • size: 1,952 kB
  • sloc: cpp: 26,394; makefile: 712; sh: 11
file content (32 lines) | stat: -rw-r--r-- 819 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef _RAR_RS_
#define _RAR_RS_

#define MAXPAR 255 // Maximum parity data size.
#define MAXPOL 512 // Maximum polynomial degree.

class RSCoder
{
  private:
    void gfInit();
    int gfMult(int a,int b);
    void pnInit();
    void pnMult(int *p1,int *p2,int *r);

    int gfExp[MAXPOL];   // Galois field exponents.
    int gfLog[MAXPAR+1]; // Galois field logarithms.

    int GXPol[MAXPOL*2]; // Generator polynomial g(x).

    int ErrorLocs[MAXPAR+1],ErrCount;
    int Dnm[MAXPAR+1];

    int ParSize; // Parity bytes size and so the number of recovery volumes.
    int ELPol[MAXPOL]; // Error locator polynomial.
    bool FirstBlockDone;
  public:
    void Init(int ParSize);
    void Encode(byte *Data,int DataSize,byte *DestData);
    bool Decode(byte *Data,int DataSize,int *EraLoc,int EraSize);
};

#endif