Commits
Commits on
50503af092ea77b052d6770536f4108003fdabddFiltered to crates/ec-alac/src/lib.rsClear filter2026-08-21
2026-08-20
feat(alac-enc): mono/stereo ALAC encoder (cookie/escape frames + adaptive-Golomb LPC compression)Ahmet Kaan Gümüş · 98a0f6f
feat(alac-enc): mono/stereo ALAC encoder (cookie/escape frames + adaptive-Golomb LPC compression)
Mirrors decode.rs's element walk and Rice/predictor state machine exactly
(same constants, same mean/zero-run adaptation) so encode_frame's output
decodes bit-exact through the existing AlacDecoder. Per-element it picks
the smaller of raw escape vs compressed, and for stereo the smaller of
direct L/R vs a mix_bits=1/mix_res=1 mid-side transform, searching filter
orders {0,4,8,12,16,31} with an always-zero-seeded sign-adapting predictor
(no Levinson-Durbin design step needed since decode's adaptation is
itself the filter).
Corner-cuts (documented in encode.rs): bytes_shifted always 0 (no 24-bit
low-byte split — correctness unaffected, only 24-bit ratio); predictor
mode always 0 (skips the mode!=0 double-difference-pass variant).2026-08-14
feat(alac): ALAC decoder, bit-exact against ffmpeg on 16 and 24 bitAhmet Kaan Gümüş · d60d66b
feat(alac): ALAC decoder, bit-exact against ffmpeg on 16 and 24 bit Clean-room from the published ALAC format description: magic cookie in all three shapes a container states it, adaptive-Golomb residuals with the zero-run mode, the sign-adapting LPC predictor, the mid/side un-mix and the shifted low bytes of a 24-bit stream. Decode only. Two things the format description does not spell out were measured against ffmpeg's own encoder output and are commented where they are used: a channel element's predictor plan starts 39 bits into the frame (the mix pair is stated by a mono element too), and the predictor's history window is out[j-k], not out[j-1-k]. Oracle: 8 fixtures (mono/stereo/5.1, 44.1 and 48 kHz, 16 and 24 bit) decode byte-for-byte identical to ffmpeg's decoder.