mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
Preparing for next version of CTDB
This commit is contained in:
Binary file not shown.
@@ -39,6 +39,16 @@ namespace CUETools.Parity
|
||||
erasure_diff = Galois16.instance.gfdiff(erasure_loc_pol);
|
||||
}
|
||||
|
||||
public static unsafe string ToBase64String(ushort[,] inArray, int offset, int length)
|
||||
{
|
||||
var outBuf = new byte[inArray.GetLength(1) * length * 2];
|
||||
fixed (ushort* inPtr = &inArray[offset, 0])
|
||||
fixed (byte* outPtr = outBuf)
|
||||
for (int i = 0; i < inArray.GetLength(1) * length; i++)
|
||||
((ushort*)outPtr)[i] = inPtr[i];
|
||||
return Convert.ToBase64String(outBuf);
|
||||
}
|
||||
|
||||
public static unsafe byte[] Syndrome2Parity(ushort[,] syndrome, byte[] parity = null)
|
||||
{
|
||||
var stride = syndrome.GetLength(0);
|
||||
@@ -65,14 +75,6 @@ namespace CUETools.Parity
|
||||
return syndrome;
|
||||
}
|
||||
|
||||
public static unsafe byte[] Parity2SyndromeBytes(int stride, int npar, int npar2, byte[] parity)
|
||||
{
|
||||
var syndrome = new byte[stride * npar * 2];
|
||||
fixed (byte* pbpar = parity, psyn = syndrome)
|
||||
Parity2Syndrome((ushort*)pbpar, (ushort*)psyn, stride, npar, npar2);
|
||||
return syndrome;
|
||||
}
|
||||
|
||||
public static unsafe void Parity2Syndrome(ushort *ppar, ushort *psyn, int stride, int npar, int npar2)
|
||||
{
|
||||
if (npar > npar2)
|
||||
|
||||
Reference in New Issue
Block a user