edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiBb07f07aTahinli3 months ago1061 commits
| 1 | //! Vorbis I — decoder and encoder. |
| 2 | //! |
| 3 | //! The decoder is the whole format: both floor types, all three residue types, |
| 4 | //! square-polar channel coupling, every legal blocksize and the four window |
| 5 | //! shapes a long block takes next to a short one. It is written against the |
| 6 | //! Xiph Vorbis I specification and nothing else. |
| 7 | //! |
| 8 | //! The encoder is deliberately narrower and states its own terms: |
| 9 | //! |
| 10 | //! - **Any channel count, natively.** Mono, stereo and surround each get a |
| 11 | //! setup header written for that layout, with coupling where coupling pays |
| 12 | //! (stereo) and none where it does not. There is no stereo-only profile to |
| 13 | //! work around and no dual-mono widening of a mono mix. |
| 14 | //! - **No pre-roll.** The first block is centred on input sample 0, so the |
| 15 | //! decoder's first output sample *is* input sample 0. A caller does not feed |
| 16 | //! silence ahead of the mix and does not subtract a hop from every granule. |
| 17 | //! - **Exact length.** The last packet's granule states the input's own sample |
| 18 | //! count, so a file decodes to exactly as many samples as went in — no block |
| 19 | //! grid overshoot survives to the player. |
| 20 | //! - **ABR.** [`EncoderConfig::bitrate_bps`] is tracked by a feedback loop over |
| 21 | //! the headroom the floor leaves under the masking curve; |
| 22 | //! [`EncoderConfig::quality`] sets where that loop starts, and holds the |
| 23 | //! headroom still when no bitrate is asked for. The loop tracks rather than |
| 24 | //! hits: a signal too simple to spend the budget on comes out under it. |
| 25 | //! |
| 26 | //! Timing contract: an audio packet answers the samples that became final when |
| 27 | //! its window closed, so the *first* packet of a stream answers none. That is |
| 28 | //! Vorbis, not an artefact — a block's left half is only half of the samples it |
| 29 | //! overlaps. |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | pub use ; |
| 44 | pub use ; |
| 45 | pub use ; |