Add a codec
Decoders are no_std, allocation-free crates in crates/codecs/<name>,
host-tested first, then linked into the firmware. The design is
04 §2 and §4.
- Licence first. Port only permissively licensed sources (MIT, Apache-2.0, BSD); never GPL code (decision D-1). Record the origin and licence in the crate's README and in THIRD-PARTY.md if its licence differs from MIT OR Apache-2.0.
- The crate.
crates/codecs/<name>(the workspace picks it up), depending onorpheus-audio(andorpheus-oggfor Ogg streams). Use#![no_std]and#![forbid(unsafe_code)]. - Implement
orpheus_audio::Decoder:ARENA_MIN,inspect(parse the header without consuming),open(take every buffer from the arena; no allocation later),decode(one frame per call, then return so the task can yield),seek,arena_used. Read input only throughByteSource; it may return less than asked for (NeedData). - Register it in
crates/codecs/lib.rs: a Cargo feature, a variant ofAnyDecoder, and the arm in the probe/openmatch; add the format toorpheus_audio::Formatif it is new, and to the probe. - Conformance. Add files for the codec to the corpus generator in
xtask/src/test.rs(cargo xtask test codecs --genencodes them with ffmpeg, sox or flac and decodes a reference with ffmpeg; theorpheus-codec-conformancebinary compares within the stated tolerance), and seeds for the fuzz targets (cargo xtask test fuzz-seeds; see add a fuzz target). - Size and speed.
cargo xtask test codec-sizereports the code size; the arena must fit the decoder arena of the mode pool. On the player,cargo xtask dev cmd 'play /.orpheus/test/x.ext'thencargo xtask dev cmd statusshows decode time and pager line loads per call (dec:). If it pages heavily, pack the frame loop into ahot.tomlcluster (profile). - Firmware: enable the feature in
fw/firmware/Cargo.toml.
Write down measured numbers (decode time per second of audio at each clock level, arena size, code size) in STATUS and in 04 §4.