mirror of
https://github.com/claunia/Claunia.ReedSolomon.git
synced 2025-12-16 19:24:45 +00:00
Add ByteOutputInputTableCodingLoop class.
This commit is contained in:
32
Claunia.ReedSolomon/ByteOutputInputTableCodingLoop.cs
Normal file
32
Claunia.ReedSolomon/ByteOutputInputTableCodingLoop.cs
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -41,6 +41,7 @@
|
|||||||
<Compile Include="ByteInputOutputExpCodingLoop.cs" />
|
<Compile Include="ByteInputOutputExpCodingLoop.cs" />
|
||||||
<Compile Include="ByteInputOutputTableCodingLoop.cs" />
|
<Compile Include="ByteInputOutputTableCodingLoop.cs" />
|
||||||
<Compile Include="ByteOutputInputExpCodingLoop.cs" />
|
<Compile Include="ByteOutputInputExpCodingLoop.cs" />
|
||||||
|
<Compile Include="ByteOutputInputTableCodingLoop.cs" />
|
||||||
<Compile Include="CodingLoopBase.cs" />
|
<Compile Include="CodingLoopBase.cs" />
|
||||||
<Compile Include="Galois.cs" />
|
<Compile Include="Galois.cs" />
|
||||||
<Compile Include="ICodingLoop.cs" />
|
<Compile Include="ICodingLoop.cs" />
|
||||||
|
|||||||
Reference in New Issue
Block a user