AccurateRip Checksum Calculation module

Calculate checksums of audio tracks.

An Algorithm specifies a ruleset how to to calculate Checksums over an input of audio samples. AccurateRip specifies two distinct algorithms for calculating a checksum, v1 and v2. Since a v1 checksum is materialized as a subtotal when calculating a v2 checksum, there are three variants of the Algorith: V1, V2 and V1and2 which provides both types of checksums at once.

Settings provide an interface for configuring an Algorithm or the calculation process.

The Context in which a Calculation is performed as part of the Settings. The Algorithm is aware of the Context, too. The Context indicates if either FIRST_TRACK, LAST_TRACK, or both have to be treated specially.

A Calculation represents the technical process of calculating Checksums by an Algorithm. It has to be parametized with an Algorithm, initialized with the offsets and the leadout of the audio image and then subsequently be updated with portions of samples in the right order. A Calculation can be also finetuned by providing Settings.

Updating a Calculation is done by providing a sample portion represented by two instances of SampleInputIterator that represent start and stop of the update. SampleInputIterator is a wrapper iterator for any iterator with a value_type of sample_t, the declared type for PCM 32 bit samples. Using a SampleSequence may be of convenience for establishing compatibility of the sample input format.

When a Calculation is complete() its result can be requested. The result are Checksums which represent the result for all requested checksum types and all tracks of the audio input. It is an aggregation of the ChecksumSets for each track of an respective audio input. Depending on the input, it can represent either an entire album or a single track.

ChecksumSet is a set of Checksums of different checksum::types of the same track.

A Checksum refers to a particular track and a particular checksum::type. Checksums are calculated by a Calculation using an Algorithm.

Namespaces

namespace arcstk::v_1_0_0::AccurateRip
AccurateRip checksum calculation algorithms.
namespace arcstk::v_1_0_0::accuraterip
Calculating AccurateRip checksums.
namespace arcstk::v_1_0_0::checksum
Operations on checksum types and their names.

Classes

class arcstk::v_1_0_0::Algorithm
Interface: Checksum calculation algorithm.
class arcstk::v_1_0_0::Calculation
Perform checksums calculation.
class arcstk::v_1_0_0::Checksum
An AccurateRip checksum for a single file or track.
class arcstk::v_1_0_0::ChecksumSet
A set of Checksum instances of different types for a single track.
class arcstk::v_1_0_0::SampleInputIterator
Type erasing interface for iterators over PCM 32 bit samples.
template<typename T, bool is_planar>
class arcstk::v_1_0_0::SampleSequence
A sequence of samples represented by 16 or 32 bit integral types.
class arcstk::v_1_0_0::Settings
Settings for a Calculation.

Enums

enum class Context: unsigned { TRACK = 0, FIRST_TRACK = 1, LAST_TRACK = 2, ALBUM = 3 }
Represent what is to be relevant for calculation process.

Typedefs

using Checksums = std::vector<ChecksumSet>
A list of ChecksumSets.
using ChecksumtypeSet = std::unordered_set<checksum::type>
Set of checksum types.
template<typename T>
using InterleavedSamples = SampleSequence<T, false>
Interleaved sample sequence with samples of type T.
template<typename T>
using PlanarSamples = SampleSequence<T, true>
Planar sample sequence with samples of type T.
using Points = std::vector<AudioSize>
List of split points within a range of samples.
using sample_t = uint32_t
Represent a 32 bit wide PCM stereo sample.

Functions

auto any(const Context& c) -> bool noexcept
Returns TRUE iff c is not equivalent to 0.
auto make_calculation(std::unique_ptr<Algorithm> algorithm, const ToC& toc) -> std::unique_ptr<Calculation>
Create a Calculation from an Algorithm and a ToC.
void swap(Context& lhs, Context& rhs) noexcept
Swap two Context instances.
auto to_string(const Context& c) -> std::string noexcept
String representation of a Context.

Variables

const Checksum EmptyChecksum
Global instance of an empty Checksum.
const Checksums EmptyChecksums
Global instance of empty Checksums.
const ChecksumSet EmptyChecksumSet
Global instance of an empty ChecksumSet.

Enum documentation

enum class Context: unsigned

Represent what is to be relevant for calculation process.

AccurateRip algorithm contain different restrictions for calculating the checksums of the the first and last track of an album. Thus, the information has to be represented whether a first or last track of an album is to be processed. This is achieved by the Context.

Typedef documentation

typedef std::vector<ChecksumSet> Checksums

A list of ChecksumSets.

Each ChecksumSet represents a track an the order of the ChecksumSets follows the order of tracks on the original compact disc.

using ChecksumtypeSet = std::unordered_set<checksum::type>

Set of checksum types.

Guaranteed to be iterable and duplicate-free.

#include <samples.hpp>
template<typename T>
using InterleavedSamples = SampleSequence<T, false>

Interleaved sample sequence with samples of type T.

An interleaved sequence has one input buffer, in which the samples for each channel occurr in order.

T can only be some signed or unsigned integral type of either 16 or 32 bit width.

#include <samples.hpp>
template<typename T>
using PlanarSamples = SampleSequence<T, true>

Planar sample sequence with samples of type T.

A planar sequence has two separated input buffers, one for each channel.

T can only be some signed or unsigned integral type of either 16 or 32 bit width.

using Points = std::vector<AudioSize>

List of split points within a range of samples.

Guaranteed to be forward iterable and have operator [].

using sample_t = uint32_t

Represent a 32 bit wide PCM stereo sample.

An unsigned integer of exact 32 bit length.

The type is not intended to do arithmetic operations on it.

Bitwise operators are guaranteed to work as on unsigned types.

Function documentation

bool any(const Context& c) noexcept

Returns TRUE iff c is not equivalent to 0.

Parameters
in Context to evaluate
Returns TRUE iff c is not equivalent to 0

std::unique_ptr<Calculation> make_calculation(std::unique_ptr<Algorithm> algorithm, const ToC& toc)

Create a Calculation from an Algorithm and a ToC.

Parameters
algorithm in The algorithm to use for calculating
toc in Complete ToC to perform calculation for

If the ToC is not complete, the Calculation must be updated with the correct total number of input samples before calling Calculation::update().

void swap(Context& lhs, Context& rhs) noexcept

Swap two Context instances.

std::string to_string(const Context& c) noexcept

String representation of a Context.

Returns Name of the Context

Variable documentation

const Checksum EmptyChecksum

Global instance of an empty Checksum.

This is for convenience since in most cases, the creation of an empty Checksum can be avoided when a reference instance is at hand.

const Checksums EmptyChecksums

Global instance of empty Checksums.

const ChecksumSet EmptyChecksumSet

Global instance of an empty ChecksumSet.