diff --git a/CUERipper/CUERipper.csproj b/CUERipper/CUERipper.csproj index 82bec8d..1676c3b 100644 --- a/CUERipper/CUERipper.csproj +++ b/CUERipper/CUERipper.csproj @@ -2,7 +2,7 @@ Debug AnyCPU - 8.0.50727 + 9.0.30729 2.0 {39B43BBB-BAFC-4D85-9BEA-3BCB7EFED89C} WinExe @@ -48,12 +48,22 @@ frmCUERipper.cs + + Form + + + frmProperties.cs + Designer frmCUERipper.cs + + frmProperties.cs + Designer + ResXFileCodeGenerator Resources.Designer.cs diff --git a/CUETools.AccurateRip/AccurateRip.cs b/CUETools.AccurateRip/AccurateRip.cs index 07b9e17..d24ab1a 100644 --- a/CUETools.AccurateRip/AccurateRip.cs +++ b/CUETools.AccurateRip/AccurateRip.cs @@ -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], CRCsB = &_offsetedCRC[iTrack, 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++) @@ -118,7 +115,6 @@ All the other CRC's in this offset range are calculated by consequently adding s currentOffset2 -= (int)trackLength; } _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++) 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; 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)); stepSum += sampleValue; 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; 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; baseSum -= stepSum; - //_offsetedCRC32[i] = _crc32.ComputeChecksum (CRC32[i], samples, count); } } + _offsetedCRC32[_currentTrack, 10 * 588 - 1] = crc32; } 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) { - 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) @@ -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) { - uint crc0 = _CRC32[0]; - uint crc1 = _CRC32[_currentTrack]; uint crc2 = _CRCWONULL[0]; 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++) { int s = pSampleBuff[i]; - byte s0 = (byte)s; - byte s1 = (byte)(s >> 8); 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) ^ s1]; crc3 = (crc3 >> 8) ^ t[((byte)crc3) ^ s0]; 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; if (_currentTrack > 0) - { - _CRC32[_currentTrack] = crc1; _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) @@ -318,7 +413,12 @@ All the other CRC's in this offset range are calculated by consequently adding s int pos = 0; 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); @@ -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 (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) { 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 si1 = Math.Min(copyCount, Math.Max(0, 588 * (_currentTrack == 1 ? 10 : 5) - currentOffset)); - int si2 = Math.Min(copyCount, Math.Max(si1, trackLength - currentOffset - 588 * (_currentTrack == _toc.AudioTracks ? 10 : 5))); - if (_currentTrack == 1) - CalculateAccurateRipCRCs(pSampleBuff, si1, _currentTrack - 1, currentOffset, previousOffset, trackLength); + if ((_currentTrack == 1 && currentSector < 10) || (_currentTrack == _toc.AudioTracks && remaingSectors < 10)) + CalculateAccurateRipCRCs(pSampleBuff, copyCount, _currentTrack - 1, currentOffset, previousOffset, trackLength); + else if (currentSector < 5 || remaingSectors < 5) + CalculateAccurateRipCRCsSemifast(pSampleBuff, copyCount, _currentTrack - 1, currentOffset, previousOffset, trackLength); else - CalculateAccurateRipCRCsSemifast(pSampleBuff, si1, _currentTrack - 1, currentOffset, previousOffset, trackLength); - 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); + CalculateAccurateRipCRCsFast(pSampleBuff, copyCount, _currentTrack - 1, currentOffset); } } } @@ -357,14 +457,12 @@ All the other CRC's in this offset range are calculated by consequently adding s public void Init() { _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]; - _CRC32 = new uint[_toc.AudioTracks + 1]; _CRCWONULL = new uint[_toc.AudioTracks + 1]; for (int i = 0; i <= _toc.AudioTracks; i++) - { - _CRC32[i] = 0xffffffff; _CRCWONULL[i] = 0xffffffff; - } _currentTrack = 0; _sampleCount = _toc[_toc.FirstAudio][0].Start * 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++) { string inLog, extra = ""; - if (CRCLOG(iTrack) == CRC32(iTrack)) + if (CRCLOG(iTrack) == 0) + inLog = ""; + else if (CRCLOG(iTrack) == CRC32(iTrack)) inLog = " CRC32 "; else if (CRCLOG(iTrack) == CRCWONULL(iTrack)) inLog = " W/O NULL "; - else if (CRCLOG(iTrack) == 0) - inLog = ""; else { 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)) { - inLog = string.Format(": W/O NULL for track {0}", jTrack); + extra = string.Format(": W/O NULL for track {0}", jTrack); 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)); } @@ -840,9 +947,11 @@ All the other CRC's in this offset range are calculated by consequently adding s int _currentTrack; private List _accDisks; private HttpStatusCode _accResult; + private uint[,] _offsetedCRC32; + private uint[,] _offsetedCRC32Res; private uint[,] _offsetedCRC; private uint[,] _offsetedFrame450CRC; - private uint[] _CRC32, _CRCWONULL, _CRCLOG; + private uint[] _CRCWONULL, _CRCLOG; private uint[] _backupCRC; Crc32 _crc32; diff --git a/CUETools.Codecs/CRCs/CRC32.cs b/CUETools.Codecs/CRCs/CRC32.cs index 7e68443..db4f876 100644 --- a/CUETools.Codecs/CRCs/CRC32.cs +++ b/CUETools.Codecs/CRCs/CRC32.cs @@ -98,5 +98,103 @@ namespace CUETools.Codecs 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; + } } } diff --git a/CUETools.Processor/CUETools.Processor.csproj b/CUETools.Processor/CUETools.Processor.csproj index 0d8c02f..47f9b53 100644 --- a/CUETools.Processor/CUETools.Processor.csproj +++ b/CUETools.Processor/CUETools.Processor.csproj @@ -67,12 +67,6 @@ - - Form - - - frmProperties.cs - @@ -113,12 +107,6 @@ MusicBrainz - - - Designer - frmProperties.cs - - False diff --git a/CUETools.Processor/frmProperties.Designer.cs b/CUETools.Processor/frmProperties.Designer.cs deleted file mode 100644 index 1a1100d..0000000 --- a/CUETools.Processor/frmProperties.Designer.cs +++ /dev/null @@ -1,184 +0,0 @@ -namespace CUETools.Processor -{ - partial class frmProperties - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - 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; - } -} \ No newline at end of file diff --git a/CUETools.Processor/frmProperties.cs b/CUETools.Processor/frmProperties.cs deleted file mode 100644 index 4ef5916..0000000 --- a/CUETools.Processor/frmProperties.cs +++ /dev/null @@ -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; - } - } -} \ No newline at end of file diff --git a/CUETools.Processor/frmProperties.resx b/CUETools.Processor/frmProperties.resx deleted file mode 100644 index 3781f6e..0000000 --- a/CUETools.Processor/frmProperties.resx +++ /dev/null @@ -1,537 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - Top, Left, Right - - - - 48, 12 - - - 375, 20 - - - - 0 - - - textArtist - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 15 - - - True - - - 12, 15 - - - 30, 13 - - - 1 - - - Artist - - - label1 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 14 - - - True - - - NoControl - - - 12, 41 - - - 27, 13 - - - 3 - - - Title - - - label2 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 12 - - - Top, Left, Right - - - 48, 38 - - - 375, 20 - - - 2 - - - textTitle - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 13 - - - 347, 90 - - - 75, 23 - - - 14 - - - Ok - - - button1 - - - System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 11 - - - 266, 90 - - - 75, 23 - - - 15 - - - Cancel - - - button2 - - - System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 10 - - - True - - - 12, 67 - - - 29, 13 - - - 6 - - - Year - - - label3 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 9 - - - 48, 64 - - - 67, 20 - - - 7 - - - textYear - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 8 - - - 163, 64 - - - 100, 20 - - - 8 - - - textGenre - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 7 - - - 318, 64 - - - 104, 20 - - - 9 - - - textCatalog - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 6 - - - True - - - 121, 67 - - - 36, 13 - - - 10 - - - Genre - - - label4 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 5 - - - True - - - 269, 67 - - - 43, 13 - - - 11 - - - Catalog - - - label5 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 4 - - - True - - - 12, 95 - - - 22, 13 - - - 16 - - - CD - - - labelCD - - - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 3 - - - 48, 92 - - - 50, 20 - - - 17 - - - textBoxDiscNumber - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 2 - - - 125, 92 - - - 50, 20 - - - 18 - - - textBoxTotalDiscs - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 1 - - - True - - - 107, 95 - - - 12, 13 - - - 19 - - - / - - - labelSlash - - - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 0 - - - True - - - 6, 13 - - - 435, 127 - - - CenterParent - - - Release information - - - frmProperties - - - System.Windows.Forms.Form, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/CUETools/CUETools.TestCodecs/AccurateRipTest.cs b/CUETools/CUETools.TestCodecs/AccurateRipTest.cs index acf92e8..d744785 100644 --- a/CUETools/CUETools.TestCodecs/AccurateRipTest.cs +++ b/CUETools/CUETools.TestCodecs/AccurateRipTest.cs @@ -86,6 +86,14 @@ namespace CUETools.TestCodecs Crc32 crc32 = new Crc32(); uint crc1 = crc32.ComputeChecksum(0xffffffff, buff.Bytes, 0, buff.ByteLength) ^ 0xffffffff; Assert.AreEqual(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(crc2, crc5, "CRC32 was not combined correctly."); + uint crc6 = crc2 ^ crc32.Combine(crc3, 0, buff.ByteLength - 7); + Assert.AreEqual(crc4, crc6, "CRC32 was not substracted correctly."); Assert.AreEqual(3856971150, target.CRC32(0), "CRC32 was not set correctly."); Assert.AreEqual(1921661108, target.CRCWONULL(0), "CRC32WONULL was not set correctly."); } diff --git a/CUETools/CUETools.TestCodecs/CUETools.TestCodecs.csproj b/CUETools/CUETools.TestCodecs/CUETools.TestCodecs.csproj index 8f09ca9..8405440 100644 --- a/CUETools/CUETools.TestCodecs/CUETools.TestCodecs.csproj +++ b/CUETools/CUETools.TestCodecs/CUETools.TestCodecs.csproj @@ -3,7 +3,7 @@ Debug AnyCPU - 8.0.50727 + 9.0.30729 2.0 {04945FB2-8410-4F14-8262-2ED18DCDACD6} Library @@ -26,9 +26,9 @@ false - true + false ..\bin\Release\ - TRACE + DEBUG;TRACE