pub fn decode_frame(
frame: &[u8],
out: &mut [u16],
max_macroblocks: u32,
pump_every: u32,
pump: &mut impl FnMut(),
) -> Result<usize, DecodeError>Expand description
Decode one version-1 or version-2 BS frame (header included) into MDEC halfwords. The two versions code the bitstream the same way: version 1 is what the earliest (1995) Sony encoder wrote, WipEout’s intro among them.
Stops at the end-of-frame code or after max_macroblocks, whichever
comes first, then pads the output with END_OF_BLOCK to a multiple of
64 halfwords (32-word DMA blocks) and at least up to the size the header
announced. Returns the number of 32-bit words to send.
pump runs after every pump_every macroblocks (one column when set to
height / 16). A streaming player drains CD sectors there so the drive
never runs ahead of the decoder.