Optimize speed when reading subchannels.

This commit is contained in:
2020-06-14 18:42:33 +01:00
parent c1d9ce5aea
commit 1f52389048
6 changed files with 13 additions and 35 deletions

View File

@@ -55,7 +55,7 @@ namespace Aaru.Core.Devices.Dumping
ExtentsULong extents, int offsetBytes, bool readcd, int sectorsForOffset, uint subSize,
MmcSubchannel supportedSubchannel, ref double totalDuration, SubchannelLog subLog,
MmcSubchannel desiredSubchannel, Track[] tracks, Dictionary<byte, string> isrcs,
ref string mcn, ExtentsInt subchannelExtents)
ref string mcn, HashSet<int> subchannelExtents)
{
bool sense = true; // Sense indicator
byte[] cmdBuf = null; // Data buffer
@@ -447,7 +447,7 @@ namespace Aaru.Core.Devices.Dumping
void RetrySubchannel(bool readcd, uint subSize, MmcSubchannel supportedSubchannel, ref double totalDuration,
SubchannelLog subLog, MmcSubchannel desiredSubchannel, Track[] tracks,
Dictionary<byte, string> isrcs, ref string mcn, ExtentsInt subchannelExtents)
Dictionary<byte, string> isrcs, ref string mcn, HashSet<int> subchannelExtents)
{
bool sense = true; // Sense indicator
byte[] cmdBuf = null; // Data buffer
@@ -495,18 +495,7 @@ namespace Aaru.Core.Devices.Dumping
cdRepeatRetry:
_resume.BadSubchannels = new List<int>();
foreach(Tuple<int, int> extent in subchannelExtents.ToArray())
{
for(int sub = extent.Item1; sub <= extent.Item2; sub++)
{
if(sub >= (int)_resume.NextBlock)
continue;
_resume.BadSubchannels.Add(sub);
}
}
_resume.BadSubchannels.AddRange(subchannelExtents);
_resume.BadSubchannels.Sort();
if(!forward)