MCPcopy Create free account
hub / github.com/abbeycode/UnrarKit / Init

Method Init

Libraries/unrar/rs16.cpp:74–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72
73
74bool RSCoder16::Init(uint DataCount, uint RecCount, bool *ValidityFlags)
75{
76 ND = DataCount;
77 NR = RecCount;
78 NE = 0;
79
80 Decoding=ValidityFlags!=NULL;
81 if (Decoding)
82 {
83 delete[] ValidFlags;
84 ValidFlags=new bool[ND + NR];
85
86 for (uint I = 0; I < ND + NR; I++)
87 ValidFlags[I]=ValidityFlags[I];
88 for (uint I = 0; I < ND; I++)
89 if (!ValidFlags[I])
90 NE++;
91 uint ValidECC=0;
92 for (uint I = ND; I < ND + NR; I++)
93 if (ValidFlags[I])
94 ValidECC++;
95 if (NE > ValidECC || NE == 0 || ValidECC == 0)
96 return false;
97 }
98 if (ND + NR > gfSize || NR > ND || ND == 0 || NR == 0)
99 return false;
100
101 delete[] MX;
102 if (Decoding)
103 {
104 MX=new uint[NE * ND];
105 MakeDecoderMatrix();
106 InvertDecoderMatrix();
107 }
108 else
109 {
110 MX=new uint[NR * ND];
111 MakeEncoderMatrix();
112 }
113 return true;
114}
115
116
117void RSCoder16::MakeEncoderMatrix()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected