Flake: fixed minor issue in previous commit

This commit is contained in:
Grigory Chudov
2014-09-19 22:40:47 -04:00
parent fac9689155
commit cc3d921b8d
3 changed files with 25 additions and 10 deletions

View File

@@ -2257,17 +2257,33 @@ new int[] { // 30
_totalSize += fs;
if (verify != null)
{
int decoded = verify.DecodeFrame(frame_buffer, 0, fs);
if (decoded != fs || verify.Remaining != bs)
throw new Exception(Properties.Resources.ExceptionValidationFailed);
fixed (int* s = verifyBuffer, r = verify.Samples)
try
{
for (int ch = 0; ch < channels; ch++)
if (AudioSamples.MemCmp(s + ch * Flake.MAX_BLOCKSIZE, r + ch * Flake.MAX_BLOCKSIZE, bs))
throw new Exception(Properties.Resources.ExceptionValidationFailed);
int decoded = verify.DecodeFrame(frame_buffer, 0, fs);
if (decoded != fs || verify.Remaining != bs)
throw new Exception(Properties.Resources.ExceptionValidationFailed);
fixed (int* s = verifyBuffer, r = verify.Samples)
{
for (int ch = 0; ch < channels; ch++)
if (AudioSamples.MemCmp(s + ch * Flake.MAX_BLOCKSIZE, r + ch * Flake.MAX_BLOCKSIZE, bs))
throw new Exception(Properties.Resources.ExceptionValidationFailed);
}
}
catch (Exception ex)
{
//if (channels == 2)
//{
// var sw = new WAVWriter(string.Format("verify_{0}.wav", this.frame_count), new WAVWriterSettings(this.Settings.PCM));
// sw.FinalSampleCount = this.frame.blocksize;
// var ab = new AudioBuffer(this.Settings.PCM, this.frame.blocksize);
// ab.Prepare(this.frame.blocksize);
// fixed (int* abs = ab.Samples, s = verifyBuffer)
// AudioSamples.Interlace(abs, s, s + Flake.MAX_BLOCKSIZE, this.frame.blocksize);
// sw.Write(ab);
// sw.Close();
//} else
throw ex;
}
}
if (bs < m_blockSize)
{

View File

@@ -754,7 +754,6 @@ namespace CUETools.Codecs
long pred = coefs[2] * (long)*(s++);
pred += c1 * (long)*(s++);
pred += c0 * (long)*(s++);
*(r++) = *s - (int)(pred >> shift);
int d = *(r++) = *s - (int)(pred >> shift);
sum += (uint)((d << 1) ^ (d >> 31));
s -= 2;

Binary file not shown.