forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 682c080551bbe0ebee106d55c19fcc95b260a4f9Filtered to crates/ec-alac/src/decode.rsClear filter

2026-08-21

2026-08-20

fix(alac): read a Golomb escape's raw value past the 32-bit prefix peek; drop the mode-1 emission knobAhmet Kaan Gümüş · b8b47ce
fix(alac): read a Golomb escape's raw value past the 32-bit prefix peek; drop the mode-1 emission knob

The adaptive-Golomb escape (9 ones + a raw maxbits value) was decoded from
a single 32-bit peek, so any element whose coded width is 24 or more bits
(24-bit unshifted mono = 24, stereo = 25) lost the raw value's low bit(s)
and desynced the rest of the channel. A smooth 24-bit tone is the first
content whose opening residuals are large enough to escape at that width;
random data goes out as a whole-frame raw escape and 16-bit-derived
24-bit audio codes 16 bits after bytes_shifted, so neither ever hit it.

The encoder's mode-1 (double-difference) path and its EC_ALAC_MODE1 env
knob are gone: no real-world decoder accepts prediction type 1, so a knob
producing such files was a trap. The decoder keeps reading mode 1.
EC_ALAC_NO_SHIFT becomes a hidden AlacEncoder::set_byte_shift setter.

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.