Expand description
§rusty_flac — pure-Rust FLAC codec
A self-contained FLAC encoder + decoder: no FFI, no required dependencies.
Encoder: feed planar or interleavedi32samples (8/16/24-bit, up to 8 channels), get a complete spec-valid FLAC stream with STREAMINFO MD5.Decoder: streaming per-frame decode of a FLAC stream to planari32, with CRC verification;decodeis the whole-stream convenience.
Lossless is the invariant: decode(encode(x)) == x exactly, and every
stream interoperates with libFLAC/ffmpeg in both directions.
§no_std
The crate is no_std + alloc with default-features = false plus the
libm feature (pure-Rust math for the window design, LPC quantisation and
the Rice estimate). The std feature adds per-thread scratch reuse,
runtime AVX2 detection and the RUSTY_FLAC_TIMING stage print; the
output bytes do not depend on it — only on whether libm is in use.
Structs§
- Decoder
- Streaming FLAC decoder over a complete in-memory stream.
- Encode
Stats - Wiring-audit counters: every decision path in the encoder counts what it chose, so a corpus run can prove no path is silently dead and no fallback is silently hot. Cheap (a few increments per subframe).
- Encoder
- A pure-Rust FLAC encoder. Feed planar or interleaved
i32samples at the configured bit depth, thenEncoder::finishreturns the complete stream. - Frame
Decoder - Decodes FLAC frames handed over one at a time — e.g. the packets a
demuxer cuts — given the stream’s STREAMINFO. It owns its per-channel
scratch, so one
FrameDecoderserves a whole stream without re-allocating, and nothing needs thefLaCheader in front of a frame. Same checks asDecoder: header CRC-8, frame CRC-16, channel count. - Stream
Info - Parsed STREAMINFO.
Enums§
- Decode
Error - Encode
Error - Encoder configuration / stream errors.
Traits§
- Sample
- Output sample types for
Decoder::next_frame_interleaved:i32(native width),f32(normalised) andi16(streams of at most 16 bits). Sealed: the conversions belong to this crate.
Functions§
- decode
- Decode a complete FLAC stream to
(StreamInfo, planar samples).