Why is it counting 150 sectors as part of write offset? Is it a bug?
As it is written in the comment of http://redump.org/disc/77974/ , these discs start AMSF 00:00:00, not 00:02:00. Due to this problem, there is not the sync in the last 150 data sectors. EccEdc judges it as error.
Here is my proposed method for automatic offset detection for Audio CD's:
I translate the src I already coded to English. Thanks to Intothisworld, perhaps it's almost coded except -10.000 to +10.000 samples you say.
I hope to test the latest version of the https://github.com/saramibreak/DiscImag … /issues/95 to more people.
1. Check the non-zero byte position from last - 75 to last + 75.
2. Check the non-zero byte position from LBA 0 - 75 to LBA 0 + 75.
3-1. If the difference of the last non-zero byte position and 1st non-zero byte position are bigger than 0 sample and smaller than 588 samples...
3-1-1. If the last non-zero byte position is equal to the 1st non-zero byte position, Set the custom offset.
3-1-2. If the last non-zero byte position is bigger than the 1st non-zero byte position, It can't set the custom offset.
3-1-3. If the last non-zero byte position is smaller than the 1st non-zero byte position.
3-1-3-1. If the 1st non-zero byte position is smaller than the combined offset, Set the custom offset.
3-1-3-2. If not 3-1-3-1, it's no need to fix the combined offset.
3-2. If the difference of the last non-zero byte position and 1st non-zero byte position are bigger than 588 samples... (last < 1st)
3-2-1. If the last non-zero byte exists in the last sector or lead-out and the 1st non-zero byte exists in the LBA 0 or backward.
3-2-1-1. If the last non-zero byte position exists in the last sector and its position is smaller than the combined offset, it's no need to fix the combined offset.
3-2-1-2. If not 3-2-1-1, set the custom offset.
3-2-2. If the last non-zero byte exists in the forward than the last sector and the 1st non-zero byte exists in the LBA 0 or backward.
3-2-2-1. If the 1st non-zero byte exists in the LBA 0 and the 1st non-zero byte position is smaller than the combined offset, Set the custom offset.
3-2-2-2. If not 3-2-2-1, it's no need to fix the combined offset.
3-2-3. If the last non-zero byte exists in the forward than the last sector and the 1st non-zero byte exists in the pregap sector, Set the custom offset.
3-3. If the difference of the last non-zero byte position and 1st non-zero byte position are bigger than 588 samples... (1st < last)
3-3-1. If the 1st non-zero byte exists in the LBA 0 or backward and the last non-zero byte exists in the last sector or lead-out, it can't set the custom offset.
3-3-2. If the 1st non-zero byte exists in the pregap and the last non-zero byte exists in the last sector or lead-out, it can't set the custom offset.
3-3-3. If the last non-zero byte exists in the last sector and the last non-zero byte position is smaller than the combined offset, it's no need to fix the combined offset.
3-3-4. if not 3-3-3, set the custom offset.
3-3-5. If the 1st non-zero byte exists in the pregap and the last non-zero byte exists in the forward than the last sector, it can't set the custom offset.
3-3-6. If not 3-3-5, it's no need to fix the combined offset.