Add ByteOutputInputTableCodingLoop class.

This commit is contained in:
2019-02-11 01:40:48 +00:00
parent 24dd036590
commit 43a06cb6dd
2 changed files with 33 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
/**
* One specific ordering/nesting of the coding loops.
*
* Copyright 2015, Backblaze, Inc. All rights reserved.
* Copyright © 2019 Natalia Portillo
*/
namespace Claunia.ReedSolomon
{
public class ByteOutputInputTableCodingLoop : 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 iByte = offset; iByte < offset + byteCount; iByte++)
{
for(int iOutput = 0; iOutput < outputCount; iOutput++)
{
byte[] matrixRow = matrixRows[iOutput];
int value = 0;
for(int iInput = 0; iInput < inputCount; iInput++)
value ^= table[matrixRow[iInput] & 0xFF][inputs[iInput][iByte] & 0xFF];
outputs[iOutput][iByte] = (byte)value;
}
}
}
}
}

View File

@@ -41,6 +41,7 @@
<Compile Include="ByteInputOutputExpCodingLoop.cs" />
<Compile Include="ByteInputOutputTableCodingLoop.cs" />
<Compile Include="ByteOutputInputExpCodingLoop.cs" />
<Compile Include="ByteOutputInputTableCodingLoop.cs" />
<Compile Include="CodingLoopBase.cs" />
<Compile Include="Galois.cs" />
<Compile Include="ICodingLoop.cs" />