mirror of
https://github.com/claunia/Claunia.ReedSolomon.git
synced 2025-12-16 19:24:45 +00:00
Add OutputByteInputTableCodingLoop class.
This commit is contained in:
@@ -51,6 +51,7 @@
|
|||||||
<Compile Include="InputOutputByteTableCodingLoop.cs" />
|
<Compile Include="InputOutputByteTableCodingLoop.cs" />
|
||||||
<Compile Include="Matrix.cs" />
|
<Compile Include="Matrix.cs" />
|
||||||
<Compile Include="OutputByteInputExpCodingLoop.cs" />
|
<Compile Include="OutputByteInputExpCodingLoop.cs" />
|
||||||
|
<Compile Include="OutputByteInputTableCodingLoop.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
38
Claunia.ReedSolomon/OutputByteInputTableCodingLoop.cs
Normal file
38
Claunia.ReedSolomon/OutputByteInputTableCodingLoop.cs
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/**
|
||||||
|
* One specific ordering/nesting of the coding loops.
|
||||||
|
*
|
||||||
|
* Copyright 2015, Backblaze, Inc. All rights reserved.
|
||||||
|
* Copyright © 2019 Natalia Portillo
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Claunia.ReedSolomon
|
||||||
|
{
|
||||||
|
public class OutputByteInputTableCodingLoop : CodingLoopBase
|
||||||
|
{
|
||||||
|
public override void CodeSomeShards(byte[][] matrixRows, byte[][] inputs, int inputCount, byte[][] outputs,
|
||||||
|
int outputCount, int offset, int byteCount)
|
||||||
|
{
|
||||||
|
byte[][] table = Galois.MULTIPLICATION_TABLE;
|
||||||
|
|
||||||
|
for(int iOutput = 0; iOutput < outputCount; iOutput++)
|
||||||
|
{
|
||||||
|
byte[] outputShard = outputs[iOutput];
|
||||||
|
byte[] matrixRow = matrixRows[iOutput];
|
||||||
|
|
||||||
|
for(int iByte = offset; iByte < offset + byteCount; iByte++)
|
||||||
|
{
|
||||||
|
int value = 0;
|
||||||
|
|
||||||
|
for(int iInput = 0; iInput < inputCount; iInput++)
|
||||||
|
{
|
||||||
|
byte[] inputShard = inputs[iInput];
|
||||||
|
byte[] multTableRow = table[matrixRow[iInput] & 0xFF];
|
||||||
|
value ^= multTableRow[inputShard[iByte] & 0xFF];
|
||||||
|
}
|
||||||
|
|
||||||
|
outputShard[iByte] = (byte)value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user