Module flac

Source
Expand description

Walks the FLAC frame structure, with bounded precision confirmation.

Two claims a file makes about itself cannot be checked from its header alone: how many bits of resolution it really carries, and whether its two channels hold different sound. Both answers are already written in the encoded stream. The structural walk finds candidates; padding claims also need the exact integer samples after stereo decorrelation.

Resolution. When the low bits of every sample are zero — the signature of 16-bit audio re-encoded as 24-bit — the encoder does not store them. It records a wasted bits count in each subframe instead. A file claiming 24 bits with eight wasted bits everywhere may carry 16 bits of real music. Correlated and constant subframes can hide significant original low bits, so a lazy existing decoder confirms candidates one bounded frame at a time, from the bytes already read. An unavailable confirmation makes no padding claim. The checksum walk remains entirely structural.

Channels. For stereo, the encoder picks the cheapest of four correlations per frame. When both channels are identical the difference channel is constant zero, which shows up as a CONSTANT subframe.

An encoder that skipped these optimisations yields no additional evidence. Precision confirmation can withdraw a structural padding candidate; it does not certify the file’s integrity or establish the recording’s origin.

Reference: https://xiph.org/flac/format.html

Structs§

FlacAudit
What the frame structure says about the audio, beyond what the header claims.
Limits
How much of a file the walk is allowed to read.

Enums§

StereoContent
What a stereo file’s two channels hold relative to one another.

Functions§

audit
Walks the frames of a FLAC file and reports what they reveal.