title
Products            Buy            Support Forum            Professional            About            Codec Central
 

Where does AR get the CRC required to calculate the pressing offset for a disc from?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • spl23

    • Oct 2008
    • 16

    Where does AR get the CRC required to calculate the pressing offset for a disc from?

    Many moons ago, I wrote a program to verify CDs I had already ripped to Apple Lossless against the AccurateRip checksum, which was a life saver in verifying that my collection was good without having to re-rip 1000 or so CDs.

    I've recently decided to revisit this and to update it to use the new AR v2 checksum, which seems to work fine. But I am getting some discs which rip accurately when I try them with the ripper, but my verifier is unable to confirm this, and this seems to be down to the use of a pressing offset.

    From browsing around what Spoon has written about the pressing offset calculation, I understand that it is calculated using the same method as the drive offset calculation - a sliding window is moved over the data from the disc around frame 450, and when the resulting CRC matches the known CRC for that disc, the offset of the frame is the pressing offset. (Or at least I think that's how it works!)

    All that is fine; the bit I don't understand is how to get the target value for the pressing offset CRC from the AccurateRip database. This has to be stored by the database - is it one of the CRCs in the standard packet that is downloaded for the disc when the database is queried, or is it acquired by some other means?
  • Spoon
    Administrator
    • Apr 2002
    • 44505

    #2
    Re: Where does AR get the CRC required to calculate the pressing offset for a disc fr

    An offset check is done on all the possible offsets (based around frame 450) using the offset finding CRC. Any matches are possible pressing offsets, so the 20 highest confidence pressing offsets are used, potentially 20 calculations are run side by side and at the end any matches verified.
    Spoon
    www.dbpoweramp.com

    Comment

    • spl23

      • Oct 2008
      • 16

      #3
      Re: Where does AR get the CRC required to calculate the pressing offset for a disc fr

      Thanks, Spoon, but that wasn't quite what I was asking - I wanted to know how you could get the target offset finding CRC from the AR database so you could use it. However, in a "d'oh" moment, I've just realised (by looking at your sample code in the developer forum) that it is, in fact, the second 4 byte CRC in each track CRC record in the existing data file that I'm downloading at the moment.

      So, if I understand it correctly, the format of the .bin file downloaded from AccurateRip is <13 byte header><1 byte confidence for track 1, pressing 1><4 byte track CRC for track 1, pressing 1><4 byte offset detect CRC for track 1, pressing 1><1 byte confidence for track 2, pressing 1> and so on.

      So to use this, I need to calculate a frame CRC for all offsets on frame 450, and see which of these matches that second 4 bytes to give me the pressing offset?

      Comment

      • dbfan
        dBpoweramp Guru

        • Jan 2011
        • 937

        #4
        Re: Where does AR get the CRC required to calculate the pressing offset for a disc fr

        Correct

        Comment

        • spl23

          • Oct 2008
          • 16

          #5
          Re: Where does AR get the CRC required to calculate the pressing offset for a disc fr

          Many thanks for the clarification.

          I've been fiddling with an implementation of this today, and can't quite get it to work. Could I please ask you to confirm the following?

          1. The algorithm used for the offset CRC - is it the v1 or the v2 AccurateRip algorithm? (I assume v2?)

          2. The multiplier used for the data in the offset frame - does it count from the start of the file (so sample 450*588 is multiplied by (450*588 + 1)), or the start of the frame (so sample 450x588 is multiplied by 1)?

          3. When you say the CRC is calculated over a single frame, that's 588 samples, correct?

          Many thanks in advance for any help! I'm clearly doing something stupid in my algorithm, but if I can make sure I've got the points above correct, it'll simplify the debugging...

          Comment

          • Spoon
            Administrator
            • Apr 2002
            • 44505

            #6
            Re: Where does AR get the CRC required to calculate the pressing offset for a disc fr

            CRC is v1 always used.

            The multiplier is reset to zero for offset calculation (if I remember correctly).

            588 correct
            Spoon
            www.dbpoweramp.com

            Comment

            • Spoon
              Administrator
              • Apr 2002
              • 44505

              #7
              Re: Where does AR get the CRC required to calculate the pressing offset for a disc fr

              BTW you might want to look at PerfectTunes, it can check all your Apple Lossless files against AccurateRip, no coding required, also it has technologies such as TOC lookup based on track lengths, which are needed to lookup CD Extra discs.
              Spoon
              www.dbpoweramp.com

              Comment

              • spl23

                • Oct 2008
                • 16

                #8
                Re: Where does AR get the CRC required to calculate the pressing offset for a disc fr

                Brilliant! Many thanks, Spoon - I was using the V2 CRC rather than V1; it's working now. BTW, you reset the multiplier to 1 for offset CRCs...

                I did try PerfectTunes yesterday (and it's very good) but it won't work with a lot of my files. Long story - when I first ripped to lossless (pre-AccurateRip), I did it with WMP, which has no concept of offsets; the reason I wrote my verifier in the first place was to check these files. When I did check them, it turned out the drive I'd used to rip had had an offset of 12 samples; my verifier corrects for that, but PerfectTunes (quite reasonably) doesn't. I'd assume that on discs with pressing offsets, it'll work fine, but I tested it on 9 discs yesterday, and it was only able to verify 4 of them, so it looks as if pressing offsets aren't ubiquitous in the database yet.

                Comment

                Working...

                ]]>