Calculating CRC32 with offsets and fast

This commit is contained in:
chudov
2010-02-09 07:40:37 +00:00
parent f23ea0811b
commit 6d5e0602bd
9 changed files with 269 additions and 835 deletions

View File

@@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion> <ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{39B43BBB-BAFC-4D85-9BEA-3BCB7EFED89C}</ProjectGuid> <ProjectGuid>{39B43BBB-BAFC-4D85-9BEA-3BCB7EFED89C}</ProjectGuid>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
@@ -48,12 +48,22 @@
<Compile Include="frmCUERipper.Designer.cs"> <Compile Include="frmCUERipper.Designer.cs">
<DependentUpon>frmCUERipper.cs</DependentUpon> <DependentUpon>frmCUERipper.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="frmProperties.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmProperties.Designer.cs">
<DependentUpon>frmProperties.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="frmCUERipper.resx"> <EmbeddedResource Include="frmCUERipper.resx">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<DependentUpon>frmCUERipper.cs</DependentUpon> <DependentUpon>frmCUERipper.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="frmProperties.resx">
<DependentUpon>frmProperties.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>

View File

@@ -46,9 +46,6 @@ All the other CRC's in this offset range are calculated by consequently adding s
fixed (uint* CRCsA = &_offsetedCRC[Math.Max(0, iTrack - 1), 0], fixed (uint* CRCsA = &_offsetedCRC[Math.Max(0, iTrack - 1), 0],
CRCsB = &_offsetedCRC[iTrack, 0], CRCsB = &_offsetedCRC[iTrack, 0],
CRCsC = &_offsetedCRC[Math.Min(_toc.AudioTracks - 1, iTrack + 1), 0] CRCsC = &_offsetedCRC[Math.Min(_toc.AudioTracks - 1, iTrack + 1), 0]
//CRC32A = &_offsetedCRC32[Math.Max(0, iTrack - 1), 0],
//CRC32B = &_offsetedCRC32[iTrack, 0],
//CRC32C = &_offsetedCRC32[Math.Min(_toc.AudioTracks - 1, iTrack + 1), 0]
) )
{ {
for (int si = 0; si < count; si++) for (int si = 0; si < count; si++)
@@ -118,7 +115,6 @@ All the other CRC's in this offset range are calculated by consequently adding s
currentOffset2 -= (int)trackLength; currentOffset2 -= (int)trackLength;
} }
_offsetedCRC[iTrack2, _arOffsetRange - oi] += sampleValue * (uint)(currentOffset2 + 1); _offsetedCRC[iTrack2, _arOffsetRange - oi] += sampleValue * (uint)(currentOffset2 + 1);
//_offsetedCRC32[iTrack2, _arOffsetRange - oi] = _crc32.ComputeChecksum(_offsetedCRC32[iTrack2, _arOffsetRange - oi], sampleValue);
} }
} }
} }
@@ -138,7 +134,9 @@ All the other CRC's in this offset range are calculated by consequently adding s
for (int oi = firstOffset; oi <= lastOffset; oi++) for (int oi = firstOffset; oi <= lastOffset; oi++)
FrameCRCs[_arOffsetRange - oi] += sampleValue * (uint)(magicFrameOffset - oi); FrameCRCs[_arOffsetRange - oi] += sampleValue * (uint)(magicFrameOffset - oi);
} }
fixed (uint* CRCs = &_offsetedCRC[iTrack, 0])
uint crc32 = _offsetedCRC32[_currentTrack, 10 * 588 - 1];
fixed (uint* CRCs = &_offsetedCRC[iTrack, 0], t = _crc32.table)
{ {
uint baseSum = 0, stepSum = 0; uint baseSum = 0, stepSum = 0;
int* s = samples; int* s = samples;
@@ -147,6 +145,10 @@ All the other CRC's in this offset range are calculated by consequently adding s
uint sampleValue = (uint)((*(s++) & 0xffff) + (*(s++) << 16)); uint sampleValue = (uint)((*(s++) & 0xffff) + (*(s++) << 16));
stepSum += sampleValue; stepSum += sampleValue;
baseSum += sampleValue * mult; baseSum += sampleValue * mult;
crc32 = (crc32 >> 8) ^ t[(byte)(crc32 ^ sampleValue)];
crc32 = (crc32 >> 8) ^ t[(byte)(crc32 ^ (sampleValue >> 8))];
crc32 = (crc32 >> 8) ^ t[(byte)(crc32 ^ (sampleValue >> 16))];
crc32 = (crc32 >> 8) ^ t[(byte)(crc32 ^ (sampleValue >> 24))];
} }
currentOffset += _arOffsetRange + 1; currentOffset += _arOffsetRange + 1;
baseSum += stepSum * (uint)currentOffset; baseSum += stepSum * (uint)currentOffset;
@@ -154,9 +156,9 @@ All the other CRC's in this offset range are calculated by consequently adding s
{ {
CRCs[i] += baseSum; CRCs[i] += baseSum;
baseSum -= stepSum; baseSum -= stepSum;
//_offsetedCRC32[i] = _crc32.ComputeChecksum (CRC32[i], samples, count);
} }
} }
_offsetedCRC32[_currentTrack, 10 * 588 - 1] = crc32;
} }
public uint CRC(int iTrack) public uint CRC(int iTrack)
@@ -249,7 +251,56 @@ All the other CRC's in this offset range are calculated by consequently adding s
public uint CRC32(int iTrack) public uint CRC32(int iTrack)
{ {
return _CRC32[iTrack] ^ 0xffffffff; return CRC32(iTrack, 0);
}
public uint CRC32(int iTrack, int oi)
{
if (_offsetedCRC32Res[iTrack, _arOffsetRange + oi] == 0)
{
uint crc = 0xffffffff;
if (iTrack == 0)
{
for (iTrack = 0; iTrack <= _toc.AudioTracks; iTrack++)
{
int trackLength = (int)(iTrack > 0 ? _toc[iTrack + _toc.FirstAudio - 1].Length : _toc[_toc.FirstAudio].Pregap) * 588 * 4;
crc = _crc32.Combine(crc, _offsetedCRC32[iTrack, 10 * 588 - 1], trackLength);
}
iTrack = 0;
}
else
{
int trackLength = (int)(iTrack > 0 ? _toc[iTrack + _toc.FirstAudio - 1].Length : _toc[_toc.FirstAudio].Pregap) * 588 * 4;
if (oi > 0)
{
// Calculate track CRC skipping first oi samples by 'subtracting' their CRC
crc = _crc32.Combine(_offsetedCRC32[iTrack, oi - 1], _offsetedCRC32[iTrack, 10 * 588 - 1], trackLength - oi * 4);
// Use 0xffffffff as an initial state
crc = _crc32.Combine(0xffffffff, crc, trackLength - oi * 4);
// Add oi samples from next track CRC
if (iTrack < _toc.AudioTracks)
crc = _crc32.Combine(crc, _offsetedCRC32[iTrack + 1, oi - 1], oi * 4);
else
crc = _crc32.Combine(crc, 0, oi * 4);
}
else if (oi < 0)
{
// Calculate CRC of previous track's last oi samples by 'subtracting' it's last CRCs
crc = _crc32.Combine(_offsetedCRC32[iTrack - 1, 10 * 588 + oi - 1], _offsetedCRC32[iTrack - 1, 10 * 588 - 1], -oi * 4);
// Use 0xffffffff as an initial state
crc = _crc32.Combine(0xffffffff, crc, -oi * 4);
// Add this track's CRC without last oi samples
crc = _crc32.Combine(crc, _offsetedCRC32[iTrack, 10 * 588 + oi - 1], trackLength + oi * 4);
}
else // oi == 0
{
// Use 0xffffffff as an initial state
crc = _crc32.Combine(0xffffffff, _offsetedCRC32[iTrack, 10 * 588 - 1], trackLength);
}
}
_offsetedCRC32Res[iTrack, _arOffsetRange + oi] = crc ^ 0xffffffff;
}
return _offsetedCRC32Res[iTrack, _arOffsetRange + oi];
} }
public uint CRCWONULL(int iTrack) public uint CRCWONULL(int iTrack)
@@ -275,8 +326,6 @@ All the other CRC's in this offset range are calculated by consequently adding s
public unsafe void CalculateCRCs(AudioBuffer buff, int pos, int count) public unsafe void CalculateCRCs(AudioBuffer buff, int pos, int count)
{ {
uint crc0 = _CRC32[0];
uint crc1 = _CRC32[_currentTrack];
uint crc2 = _CRCWONULL[0]; uint crc2 = _CRCWONULL[0];
uint crc3 = _CRCWONULL[_currentTrack]; uint crc3 = _CRCWONULL[_currentTrack];
@@ -286,29 +335,75 @@ All the other CRC's in this offset range are calculated by consequently adding s
for (int i = 0; i < 2 * count; i++) for (int i = 0; i < 2 * count; i++)
{ {
int s = pSampleBuff[i]; int s = pSampleBuff[i];
byte s0 = (byte)s;
byte s1 = (byte)(s >> 8);
if (s != 0) if (s != 0)
{ {
byte s0 = (byte)s;
byte s1 = (byte)(s >> 8);
crc2 = (crc2 >> 8) ^ t[((byte)crc2) ^ s0]; crc2 = (crc2 >> 8) ^ t[((byte)crc2) ^ s0];
crc2 = (crc2 >> 8) ^ t[((byte)crc2) ^ s1]; crc2 = (crc2 >> 8) ^ t[((byte)crc2) ^ s1];
crc3 = (crc3 >> 8) ^ t[((byte)crc3) ^ s0]; crc3 = (crc3 >> 8) ^ t[((byte)crc3) ^ s0];
crc3 = (crc3 >> 8) ^ t[((byte)crc3) ^ s1]; crc3 = (crc3 >> 8) ^ t[((byte)crc3) ^ s1];
} }
crc0 = (crc0 >> 8) ^ t[((byte)crc0) ^ s0];
crc0 = (crc0 >> 8) ^ t[((byte)crc0) ^ s1];
crc1 = (crc1 >> 8) ^ t[((byte)crc1) ^ s0];
crc1 = (crc1 >> 8) ^ t[((byte)crc1) ^ s1];
} }
} }
_CRC32[0] = crc0;
_CRCWONULL[0] = crc2; _CRCWONULL[0] = crc2;
if (_currentTrack > 0) if (_currentTrack > 0)
{
_CRC32[_currentTrack] = crc1;
_CRCWONULL[_currentTrack] = crc3; _CRCWONULL[_currentTrack] = crc3;
} }
public unsafe void CalculateCRCs(int* pSampleBuff, int count, int currentOffset)
{
uint crc = _offsetedCRC32[_currentTrack, 10 * 588 - 1];
fixed (uint* t = _crc32.table)
{
for (int i = 0; i < count; i++)
{
int s;
byte s0, s1;
s = *(pSampleBuff++);
s0 = (byte)s;
s1 = (byte)(s >> 8);
crc = (crc >> 8) ^ t[((byte)crc) ^ s0];
crc = (crc >> 8) ^ t[((byte)crc) ^ s1];
s = *(pSampleBuff++);
s0 = (byte)s;
s1 = (byte)(s >> 8);
crc = (crc >> 8) ^ t[((byte)crc) ^ s0];
crc = (crc >> 8) ^ t[((byte)crc) ^ s1];
_offsetedCRC32[_currentTrack, currentOffset + i] = crc;
}
}
_offsetedCRC32[_currentTrack, 10 * 588 - 1] = crc;
}
public unsafe void CalculateCRCs(int* pSampleBuff, int count)
{
uint crc = _offsetedCRC32[_currentTrack, 10 * 588 - 1];
fixed (uint* t = _crc32.table)
{
for (int i = 0; i < count; i++)
{
int s;
byte s0, s1;
s = *(pSampleBuff++);
s0 = (byte)s;
s1 = (byte)(s >> 8);
crc = (crc >> 8) ^ t[((byte)crc) ^ s0];
crc = (crc >> 8) ^ t[((byte)crc) ^ s1];
s = *(pSampleBuff++);
s0 = (byte)s;
s1 = (byte)(s >> 8);
crc = (crc >> 8) ^ t[((byte)crc) ^ s0];
crc = (crc >> 8) ^ t[((byte)crc) ^ s1];
}
}
_offsetedCRC32[_currentTrack, 10 * 588 - 1] = crc;
} }
public void Write(AudioBuffer sampleBuffer) public void Write(AudioBuffer sampleBuffer)
@@ -318,7 +413,12 @@ All the other CRC's in this offset range are calculated by consequently adding s
int pos = 0; int pos = 0;
while (pos < sampleBuffer.Length) while (pos < sampleBuffer.Length)
{ {
int copyCount = (int)Math.Min((long)sampleBuffer.Length - pos, _samplesRemTrack); // Process no more than there is in the buffer, no more than there is in this track, and no more than up to a sector boundary.
int copyCount = Math.Min(Math.Min(sampleBuffer.Length - pos, (int)_samplesRemTrack), 588 - (int)_sampleCount % 588);
// Calculate offset within a track
int currentOffset = (int)_sampleCount - (int)(_currentTrack > 0 ? _toc[_currentTrack + _toc.FirstAudio - 1].Start * 588 : 0);
int currentSector = currentOffset / 588;
int remaingSectors = (int)(_samplesRemTrack - 1) / 588;
CalculateCRCs(sampleBuffer, pos, copyCount); CalculateCRCs(sampleBuffer, pos, copyCount);
@@ -327,23 +427,23 @@ All the other CRC's in this offset range are calculated by consequently adding s
fixed (int* pSampleBuff = &sampleBuffer.Samples[pos, 0]) fixed (int* pSampleBuff = &sampleBuffer.Samples[pos, 0])
//fixed (byte* pByteBuff = &sampleBuffer.Bytes[pos * sampleBuffer.BlockAlign]) //fixed (byte* pByteBuff = &sampleBuffer.Bytes[pos * sampleBuffer.BlockAlign])
{ {
if (currentSector < 5)
CalculateCRCs(pSampleBuff, copyCount, currentOffset);
else if (remaingSectors < 5)
CalculateCRCs(pSampleBuff, copyCount, 10 * 588 - (int)_samplesRemTrack);
else if (_currentTrack == 0 || (_currentTrack == 1 && currentSector < 10) || (_currentTrack == _toc.AudioTracks && remaingSectors < 10))
CalculateCRCs(pSampleBuff, copyCount);
if (_currentTrack > 0) if (_currentTrack > 0)
{ {
int trackLength = (int)_toc[_currentTrack + _toc.FirstAudio - 1].Length * 588; int trackLength = (int)_toc[_currentTrack + _toc.FirstAudio - 1].Length * 588;
int currentOffset = (int)_sampleCount - (int)_toc[_currentTrack + _toc.FirstAudio - 1].Start * 588;
int previousOffset = _currentTrack > 1 ? (int)_toc[_currentTrack + _toc.FirstAudio - 2].Length * 588 : (int)_toc[_toc.FirstAudio].Pregap * 588; int previousOffset = _currentTrack > 1 ? (int)_toc[_currentTrack + _toc.FirstAudio - 2].Length * 588 : (int)_toc[_toc.FirstAudio].Pregap * 588;
int si1 = Math.Min(copyCount, Math.Max(0, 588 * (_currentTrack == 1 ? 10 : 5) - currentOffset)); if ((_currentTrack == 1 && currentSector < 10) || (_currentTrack == _toc.AudioTracks && remaingSectors < 10))
int si2 = Math.Min(copyCount, Math.Max(si1, trackLength - currentOffset - 588 * (_currentTrack == _toc.AudioTracks ? 10 : 5))); CalculateAccurateRipCRCs(pSampleBuff, copyCount, _currentTrack - 1, currentOffset, previousOffset, trackLength);
if (_currentTrack == 1) else if (currentSector < 5 || remaingSectors < 5)
CalculateAccurateRipCRCs(pSampleBuff, si1, _currentTrack - 1, currentOffset, previousOffset, trackLength); CalculateAccurateRipCRCsSemifast(pSampleBuff, copyCount, _currentTrack - 1, currentOffset, previousOffset, trackLength);
else else
CalculateAccurateRipCRCsSemifast(pSampleBuff, si1, _currentTrack - 1, currentOffset, previousOffset, trackLength); CalculateAccurateRipCRCsFast(pSampleBuff, copyCount, _currentTrack - 1, currentOffset);
if (si2 > si1)
CalculateAccurateRipCRCsFast(pSampleBuff + si1 * 2, si2 - si1, _currentTrack - 1, currentOffset + si1);
if (_currentTrack == _toc.AudioTracks)
CalculateAccurateRipCRCs(pSampleBuff + si2 * 2, copyCount - si2, _currentTrack - 1, currentOffset + si2, previousOffset, trackLength);
else
CalculateAccurateRipCRCsSemifast(pSampleBuff + si2 * 2, copyCount - si2, _currentTrack - 1, currentOffset + si2, previousOffset, trackLength);
} }
} }
} }
@@ -357,14 +457,12 @@ All the other CRC's in this offset range are calculated by consequently adding s
public void Init() public void Init()
{ {
_offsetedCRC = new uint[_toc.AudioTracks, 10 * 588]; _offsetedCRC = new uint[_toc.AudioTracks, 10 * 588];
_offsetedCRC32 = new uint[_toc.AudioTracks + 1, 10 * 588];
_offsetedCRC32Res = new uint[_toc.AudioTracks + 1, 10 * 588];
_offsetedFrame450CRC = new uint[_toc.AudioTracks, 10 * 588]; _offsetedFrame450CRC = new uint[_toc.AudioTracks, 10 * 588];
_CRC32 = new uint[_toc.AudioTracks + 1];
_CRCWONULL = new uint[_toc.AudioTracks + 1]; _CRCWONULL = new uint[_toc.AudioTracks + 1];
for (int i = 0; i <= _toc.AudioTracks; i++) for (int i = 0; i <= _toc.AudioTracks; i++)
{
_CRC32[i] = 0xffffffff;
_CRCWONULL[i] = 0xffffffff; _CRCWONULL[i] = 0xffffffff;
}
_currentTrack = 0; _currentTrack = 0;
_sampleCount = _toc[_toc.FirstAudio][0].Start * 588; _sampleCount = _toc[_toc.FirstAudio][0].Start * 588;
_samplesRemTrack = _toc[_toc.FirstAudio].Pregap * 588; _samplesRemTrack = _toc[_toc.FirstAudio].Pregap * 588;
@@ -667,12 +765,12 @@ All the other CRC's in this offset range are calculated by consequently adding s
for (int iTrack = 1; iTrack <= _toc.AudioTracks; iTrack++) for (int iTrack = 1; iTrack <= _toc.AudioTracks; iTrack++)
{ {
string inLog, extra = ""; string inLog, extra = "";
if (CRCLOG(iTrack) == CRC32(iTrack)) if (CRCLOG(iTrack) == 0)
inLog = "";
else if (CRCLOG(iTrack) == CRC32(iTrack))
inLog = " CRC32 "; inLog = " CRC32 ";
else if (CRCLOG(iTrack) == CRCWONULL(iTrack)) else if (CRCLOG(iTrack) == CRCWONULL(iTrack))
inLog = " W/O NULL "; inLog = " W/O NULL ";
else if (CRCLOG(iTrack) == 0)
inLog = "";
else else
{ {
inLog = String.Format("[{0:X8}]", CRCLOG(iTrack)); inLog = String.Format("[{0:X8}]", CRCLOG(iTrack));
@@ -685,10 +783,19 @@ All the other CRC's in this offset range are calculated by consequently adding s
} }
if (CRCLOG(iTrack) == CRCWONULL(jTrack)) if (CRCLOG(iTrack) == CRCWONULL(jTrack))
{ {
inLog = string.Format(": W/O NULL for track {0}", jTrack); extra = string.Format(": W/O NULL for track {0}", jTrack);
break; break;
} }
} }
if (extra == "")
{
for (int oi = -_arOffsetRange; oi <= _arOffsetRange; oi++)
if (CRCLOG(iTrack) == CRC32(iTrack, oi))
{
inLog = " CRC32 ";
extra = string.Format(": offset {0}", oi);
}
}
} }
sw.WriteLine(String.Format(" {0:00}\t[{1:X8}]\t[{2:X8}]\t{3:10}{4}", iTrack, CRC32(iTrack), CRCWONULL(iTrack), inLog, extra)); sw.WriteLine(String.Format(" {0:00}\t[{1:X8}]\t[{2:X8}]\t{3:10}{4}", iTrack, CRC32(iTrack), CRCWONULL(iTrack), inLog, extra));
} }
@@ -840,9 +947,11 @@ All the other CRC's in this offset range are calculated by consequently adding s
int _currentTrack; int _currentTrack;
private List<AccDisk> _accDisks; private List<AccDisk> _accDisks;
private HttpStatusCode _accResult; private HttpStatusCode _accResult;
private uint[,] _offsetedCRC32;
private uint[,] _offsetedCRC32Res;
private uint[,] _offsetedCRC; private uint[,] _offsetedCRC;
private uint[,] _offsetedFrame450CRC; private uint[,] _offsetedFrame450CRC;
private uint[] _CRC32, _CRCWONULL, _CRCLOG; private uint[] _CRCWONULL, _CRCLOG;
private uint[] _backupCRC; private uint[] _backupCRC;
Crc32 _crc32; Crc32 _crc32;

View File

@@ -98,5 +98,103 @@ namespace CUETools.Codecs
table[i] = Reflect(table[i], 32); table[i] = Reflect(table[i], 32);
} }
} }
const int GF2_DIM = 32;
private unsafe uint gf2_matrix_times(uint* mat, uint vec)
{
return *(mat++) * (vec & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1) ^
*(mat++) * ((vec >>= 1) & 1);
}
/* ========================================================================= */
private unsafe void gf2_matrix_square(uint *square, uint *mat)
{
for (int n = 0; n < GF2_DIM; n++)
square[n] = gf2_matrix_times(mat, mat[n]);
}
public unsafe uint Combine(uint crc1, uint crc2, long len2)
{
int n;
uint row;
uint* even = stackalloc uint[GF2_DIM]; /* even-power-of-two zeros operator */
uint* odd = stackalloc uint[GF2_DIM]; /* odd-power-of-two zeros operator */
/* degenerate case */
if (len2 == 0)
return crc1;
/* put operator for one zero bit in odd */
odd[0] = 0xedb88320; /* CRC-32 polynomial */
row = 1;
for (n = 1; n < GF2_DIM; n++) {
odd[n] = row;
row <<= 1;
}
/* put operator for two zero bits in even */
gf2_matrix_square(even, odd);
/* put operator for four zero bits in odd */
gf2_matrix_square(odd, even);
/* apply len2 zeros to crc1 (first square will put the operator for one
zero byte, eight zero bits, in even) */
do {
/* apply zeros operator for this bit of len2 */
gf2_matrix_square(even, odd);
if ((len2 & 1) != 0)
crc1 = gf2_matrix_times(even, crc1);
len2 >>= 1;
/* if no more bits set, then done */
if (len2 == 0)
break;
/* another iteration of the loop with odd and even swapped */
gf2_matrix_square(odd, even);
if ((len2 & 1) != 0)
crc1 = gf2_matrix_times(odd, crc1);
len2 >>= 1;
/* if no more bits set, then done */
} while (len2 != 0);
/* return combined crc */
crc1 ^= crc2;
return crc1;
}
} }
} }

View File

@@ -67,12 +67,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="AudioReadWrite.cs" /> <Compile Include="AudioReadWrite.cs" />
<Compile Include="frmProperties.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmProperties.Designer.cs">
<DependentUpon>frmProperties.cs</DependentUpon>
</Compile>
<Compile Include="Processor.cs" /> <Compile Include="Processor.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Settings.cs" /> <Compile Include="Settings.cs" />
@@ -113,12 +107,6 @@
<Name>MusicBrainz</Name> <Name>MusicBrainz</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<EmbeddedResource Include="frmProperties.resx">
<SubType>Designer</SubType>
<DependentUpon>frmProperties.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup> <ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5"> <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible> <Visible>False</Visible>

View File

@@ -1,184 +0,0 @@
namespace CUETools.Processor
{
partial class frmProperties
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmProperties));
this.textArtist = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.textTitle = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.textYear = new System.Windows.Forms.TextBox();
this.textGenre = new System.Windows.Forms.TextBox();
this.textCatalog = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.labelCD = new System.Windows.Forms.Label();
this.textBoxDiscNumber = new System.Windows.Forms.TextBox();
this.textBoxTotalDiscs = new System.Windows.Forms.TextBox();
this.labelSlash = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// textArtist
//
resources.ApplyResources(this.textArtist, "textArtist");
this.textArtist.Name = "textArtist";
//
// label1
//
resources.ApplyResources(this.label1, "label1");
this.label1.Name = "label1";
//
// label2
//
resources.ApplyResources(this.label2, "label2");
this.label2.Name = "label2";
//
// textTitle
//
resources.ApplyResources(this.textTitle, "textTitle");
this.textTitle.Name = "textTitle";
//
// button1
//
this.button1.DialogResult = System.Windows.Forms.DialogResult.OK;
resources.ApplyResources(this.button1, "button1");
this.button1.Name = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel;
resources.ApplyResources(this.button2, "button2");
this.button2.Name = "button2";
this.button2.UseVisualStyleBackColor = true;
//
// label3
//
resources.ApplyResources(this.label3, "label3");
this.label3.Name = "label3";
//
// textYear
//
resources.ApplyResources(this.textYear, "textYear");
this.textYear.Name = "textYear";
//
// textGenre
//
resources.ApplyResources(this.textGenre, "textGenre");
this.textGenre.Name = "textGenre";
//
// textCatalog
//
resources.ApplyResources(this.textCatalog, "textCatalog");
this.textCatalog.Name = "textCatalog";
//
// label4
//
resources.ApplyResources(this.label4, "label4");
this.label4.Name = "label4";
//
// label5
//
resources.ApplyResources(this.label5, "label5");
this.label5.Name = "label5";
//
// labelCD
//
resources.ApplyResources(this.labelCD, "labelCD");
this.labelCD.Name = "labelCD";
//
// textBoxDiscNumber
//
resources.ApplyResources(this.textBoxDiscNumber, "textBoxDiscNumber");
this.textBoxDiscNumber.Name = "textBoxDiscNumber";
//
// textBoxTotalDiscs
//
resources.ApplyResources(this.textBoxTotalDiscs, "textBoxTotalDiscs");
this.textBoxTotalDiscs.Name = "textBoxTotalDiscs";
//
// labelSlash
//
resources.ApplyResources(this.labelSlash, "labelSlash");
this.labelSlash.Name = "labelSlash";
//
// frmProperties
//
this.AcceptButton = this.button1;
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.button2;
this.Controls.Add(this.labelSlash);
this.Controls.Add(this.textBoxTotalDiscs);
this.Controls.Add(this.textBoxDiscNumber);
this.Controls.Add(this.labelCD);
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.textCatalog);
this.Controls.Add(this.textGenre);
this.Controls.Add(this.textYear);
this.Controls.Add(this.label3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.label2);
this.Controls.Add(this.textTitle);
this.Controls.Add(this.label1);
this.Controls.Add(this.textArtist);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "frmProperties";
this.Load += new System.EventHandler(this.frmProperties_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textArtist;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textTitle;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox textYear;
private System.Windows.Forms.TextBox textGenre;
private System.Windows.Forms.TextBox textCatalog;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label labelCD;
private System.Windows.Forms.TextBox textBoxDiscNumber;
private System.Windows.Forms.TextBox textBoxTotalDiscs;
private System.Windows.Forms.Label labelSlash;
}
}

View File

@@ -1,58 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CUETools.Processor;
namespace CUETools.Processor
{
public partial class frmProperties : Form
{
public frmProperties()
{
InitializeComponent();
}
private void frmProperties_Load(object sender, EventArgs e)
{
textArtist.Text = _cueSheet.Artist;
textTitle.Text = _cueSheet.Title;
textYear.Text = _cueSheet.Year;
textGenre.Text = _cueSheet.Genre;
textCatalog.Text = _cueSheet.Catalog;
textBoxDiscNumber.Text = _cueSheet.DiscNumber;
textBoxTotalDiscs.Text = _cueSheet.TotalDiscs;
}
public CUESheet CUE
{
get
{
return _cueSheet;
}
set
{
_cueSheet = value;
}
}
CUESheet _cueSheet;
private void button1_Click(object sender, EventArgs e)
{
foreach (TrackInfo track in _cueSheet.Tracks)
if (track.Artist == _cueSheet.Artist)
track.Artist = textArtist.Text;
_cueSheet.Artist = textArtist.Text;
_cueSheet.Title = textTitle.Text;
_cueSheet.Year = textYear.Text;
_cueSheet.Genre = textGenre.Text;
_cueSheet.Catalog = textCatalog.Text;
_cueSheet.DiscNumber = textBoxDiscNumber.Text;
_cueSheet.TotalDiscs = textBoxTotalDiscs.Text;
}
}
}

View File

@@ -1,537 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="textArtist.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="textArtist.Location" type="System.Drawing.Point, System.Drawing">
<value>48, 12</value>
</data>
<data name="textArtist.Size" type="System.Drawing.Size, System.Drawing">
<value>375, 20</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="textArtist.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="&gt;&gt;textArtist.Name" xml:space="preserve">
<value>textArtist</value>
</data>
<data name="&gt;&gt;textArtist.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;textArtist.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;textArtist.ZOrder" xml:space="preserve">
<value>15</value>
</data>
<data name="label1.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label1.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 15</value>
</data>
<data name="label1.Size" type="System.Drawing.Size, System.Drawing">
<value>30, 13</value>
</data>
<data name="label1.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="label1.Text" xml:space="preserve">
<value>Artist</value>
</data>
<data name="&gt;&gt;label1.Name" xml:space="preserve">
<value>label1</value>
</data>
<data name="&gt;&gt;label1.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label1.ZOrder" xml:space="preserve">
<value>14</value>
</data>
<data name="label2.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label2.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="label2.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 41</value>
</data>
<data name="label2.Size" type="System.Drawing.Size, System.Drawing">
<value>27, 13</value>
</data>
<data name="label2.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
</data>
<data name="label2.Text" xml:space="preserve">
<value>Title</value>
</data>
<data name="&gt;&gt;label2.Name" xml:space="preserve">
<value>label2</value>
</data>
<data name="&gt;&gt;label2.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label2.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label2.ZOrder" xml:space="preserve">
<value>12</value>
</data>
<data name="textTitle.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
</data>
<data name="textTitle.Location" type="System.Drawing.Point, System.Drawing">
<value>48, 38</value>
</data>
<data name="textTitle.Size" type="System.Drawing.Size, System.Drawing">
<value>375, 20</value>
</data>
<data name="textTitle.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
</data>
<data name="&gt;&gt;textTitle.Name" xml:space="preserve">
<value>textTitle</value>
</data>
<data name="&gt;&gt;textTitle.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;textTitle.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;textTitle.ZOrder" xml:space="preserve">
<value>13</value>
</data>
<data name="button1.Location" type="System.Drawing.Point, System.Drawing">
<value>347, 90</value>
</data>
<data name="button1.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
</data>
<data name="button1.TabIndex" type="System.Int32, mscorlib">
<value>14</value>
</data>
<data name="button1.Text" xml:space="preserve">
<value>Ok</value>
</data>
<data name="&gt;&gt;button1.Name" xml:space="preserve">
<value>button1</value>
</data>
<data name="&gt;&gt;button1.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;button1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;button1.ZOrder" xml:space="preserve">
<value>11</value>
</data>
<data name="button2.Location" type="System.Drawing.Point, System.Drawing">
<value>266, 90</value>
</data>
<data name="button2.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
</data>
<data name="button2.TabIndex" type="System.Int32, mscorlib">
<value>15</value>
</data>
<data name="button2.Text" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="&gt;&gt;button2.Name" xml:space="preserve">
<value>button2</value>
</data>
<data name="&gt;&gt;button2.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;button2.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;button2.ZOrder" xml:space="preserve">
<value>10</value>
</data>
<data name="label3.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label3.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 67</value>
</data>
<data name="label3.Size" type="System.Drawing.Size, System.Drawing">
<value>29, 13</value>
</data>
<data name="label3.TabIndex" type="System.Int32, mscorlib">
<value>6</value>
</data>
<data name="label3.Text" xml:space="preserve">
<value>Year</value>
</data>
<data name="&gt;&gt;label3.Name" xml:space="preserve">
<value>label3</value>
</data>
<data name="&gt;&gt;label3.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label3.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label3.ZOrder" xml:space="preserve">
<value>9</value>
</data>
<data name="textYear.Location" type="System.Drawing.Point, System.Drawing">
<value>48, 64</value>
</data>
<data name="textYear.Size" type="System.Drawing.Size, System.Drawing">
<value>67, 20</value>
</data>
<data name="textYear.TabIndex" type="System.Int32, mscorlib">
<value>7</value>
</data>
<data name="&gt;&gt;textYear.Name" xml:space="preserve">
<value>textYear</value>
</data>
<data name="&gt;&gt;textYear.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;textYear.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;textYear.ZOrder" xml:space="preserve">
<value>8</value>
</data>
<data name="textGenre.Location" type="System.Drawing.Point, System.Drawing">
<value>163, 64</value>
</data>
<data name="textGenre.Size" type="System.Drawing.Size, System.Drawing">
<value>100, 20</value>
</data>
<data name="textGenre.TabIndex" type="System.Int32, mscorlib">
<value>8</value>
</data>
<data name="&gt;&gt;textGenre.Name" xml:space="preserve">
<value>textGenre</value>
</data>
<data name="&gt;&gt;textGenre.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;textGenre.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;textGenre.ZOrder" xml:space="preserve">
<value>7</value>
</data>
<data name="textCatalog.Location" type="System.Drawing.Point, System.Drawing">
<value>318, 64</value>
</data>
<data name="textCatalog.Size" type="System.Drawing.Size, System.Drawing">
<value>104, 20</value>
</data>
<data name="textCatalog.TabIndex" type="System.Int32, mscorlib">
<value>9</value>
</data>
<data name="&gt;&gt;textCatalog.Name" xml:space="preserve">
<value>textCatalog</value>
</data>
<data name="&gt;&gt;textCatalog.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;textCatalog.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;textCatalog.ZOrder" xml:space="preserve">
<value>6</value>
</data>
<data name="label4.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label4.Location" type="System.Drawing.Point, System.Drawing">
<value>121, 67</value>
</data>
<data name="label4.Size" type="System.Drawing.Size, System.Drawing">
<value>36, 13</value>
</data>
<data name="label4.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
</data>
<data name="label4.Text" xml:space="preserve">
<value>Genre</value>
</data>
<data name="&gt;&gt;label4.Name" xml:space="preserve">
<value>label4</value>
</data>
<data name="&gt;&gt;label4.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label4.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label4.ZOrder" xml:space="preserve">
<value>5</value>
</data>
<data name="label5.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label5.Location" type="System.Drawing.Point, System.Drawing">
<value>269, 67</value>
</data>
<data name="label5.Size" type="System.Drawing.Size, System.Drawing">
<value>43, 13</value>
</data>
<data name="label5.TabIndex" type="System.Int32, mscorlib">
<value>11</value>
</data>
<data name="label5.Text" xml:space="preserve">
<value>Catalog</value>
</data>
<data name="&gt;&gt;label5.Name" xml:space="preserve">
<value>label5</value>
</data>
<data name="&gt;&gt;label5.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label5.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label5.ZOrder" xml:space="preserve">
<value>4</value>
</data>
<data name="labelCD.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="labelCD.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 95</value>
</data>
<data name="labelCD.Size" type="System.Drawing.Size, System.Drawing">
<value>22, 13</value>
</data>
<data name="labelCD.TabIndex" type="System.Int32, mscorlib">
<value>16</value>
</data>
<data name="labelCD.Text" xml:space="preserve">
<value>CD</value>
</data>
<data name="&gt;&gt;labelCD.Name" xml:space="preserve">
<value>labelCD</value>
</data>
<data name="&gt;&gt;labelCD.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;labelCD.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;labelCD.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="textBoxDiscNumber.Location" type="System.Drawing.Point, System.Drawing">
<value>48, 92</value>
</data>
<data name="textBoxDiscNumber.Size" type="System.Drawing.Size, System.Drawing">
<value>50, 20</value>
</data>
<data name="textBoxDiscNumber.TabIndex" type="System.Int32, mscorlib">
<value>17</value>
</data>
<data name="&gt;&gt;textBoxDiscNumber.Name" xml:space="preserve">
<value>textBoxDiscNumber</value>
</data>
<data name="&gt;&gt;textBoxDiscNumber.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;textBoxDiscNumber.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;textBoxDiscNumber.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="textBoxTotalDiscs.Location" type="System.Drawing.Point, System.Drawing">
<value>125, 92</value>
</data>
<data name="textBoxTotalDiscs.Size" type="System.Drawing.Size, System.Drawing">
<value>50, 20</value>
</data>
<data name="textBoxTotalDiscs.TabIndex" type="System.Int32, mscorlib">
<value>18</value>
</data>
<data name="&gt;&gt;textBoxTotalDiscs.Name" xml:space="preserve">
<value>textBoxTotalDiscs</value>
</data>
<data name="&gt;&gt;textBoxTotalDiscs.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;textBoxTotalDiscs.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;textBoxTotalDiscs.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="labelSlash.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="labelSlash.Location" type="System.Drawing.Point, System.Drawing">
<value>107, 95</value>
</data>
<data name="labelSlash.Size" type="System.Drawing.Size, System.Drawing">
<value>12, 13</value>
</data>
<data name="labelSlash.TabIndex" type="System.Int32, mscorlib">
<value>19</value>
</data>
<data name="labelSlash.Text" xml:space="preserve">
<value>/</value>
</data>
<data name="&gt;&gt;labelSlash.Name" xml:space="preserve">
<value>labelSlash</value>
</data>
<data name="&gt;&gt;labelSlash.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;labelSlash.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;labelSlash.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>6, 13</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>435, 127</value>
</data>
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
<value>CenterParent</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>Release information</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>frmProperties</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>System.Windows.Forms.Form, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>

View File

@@ -86,6 +86,14 @@ namespace CUETools.TestCodecs
Crc32 crc32 = new Crc32(); Crc32 crc32 = new Crc32();
uint crc1 = crc32.ComputeChecksum(0xffffffff, buff.Bytes, 0, buff.ByteLength) ^ 0xffffffff; uint crc1 = crc32.ComputeChecksum(0xffffffff, buff.Bytes, 0, buff.ByteLength) ^ 0xffffffff;
Assert.AreEqual<uint>(3856971150, crc1, "CRC32 was not set correctly."); Assert.AreEqual<uint>(3856971150, crc1, "CRC32 was not set correctly.");
uint crc2 = crc32.ComputeChecksum(0, buff.Bytes, 0, buff.ByteLength);
uint crc3 = crc32.ComputeChecksum(0, buff.Bytes, 0, 7);
uint crc4 = crc32.ComputeChecksum(0, buff.Bytes, 7, buff.ByteLength - 7);
uint crc5 = crc32.Combine(crc3, crc4, buff.ByteLength - 7);
Assert.AreEqual<uint>(crc2, crc5, "CRC32 was not combined correctly.");
uint crc6 = crc2 ^ crc32.Combine(crc3, 0, buff.ByteLength - 7);
Assert.AreEqual<uint>(crc4, crc6, "CRC32 was not substracted correctly.");
Assert.AreEqual<uint>(3856971150, target.CRC32(0), "CRC32 was not set correctly."); Assert.AreEqual<uint>(3856971150, target.CRC32(0), "CRC32 was not set correctly.");
Assert.AreEqual<uint>(1921661108, target.CRCWONULL(0), "CRC32WONULL was not set correctly."); Assert.AreEqual<uint>(1921661108, target.CRCWONULL(0), "CRC32WONULL was not set correctly.");
} }

View File

@@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion> <ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{04945FB2-8410-4F14-8262-2ED18DCDACD6}</ProjectGuid> <ProjectGuid>{04945FB2-8410-4F14-8262-2ED18DCDACD6}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
@@ -26,9 +26,9 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>false</DebugSymbols> <DebugSymbols>false</DebugSymbols>
<Optimize>true</Optimize> <Optimize>false</Optimize>
<OutputPath>..\bin\Release\</OutputPath> <OutputPath>..\bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />