Documentation
¶
Overview ¶
Package vlc implements a table-driven decoder for the variable-length codes of the AAC bitstream. The codebook DATA (codes, lengths, symbols) comes verbatim from internal/tables, which pins it byte-for-byte against the pinned FFmpeg tree; the lookup structure here is deliberately NOT a copy of FFmpeg's vlc.c multi-level tables. docs/decoder-analysis.md requires symbol-stream correctness, not structural fidelity, and the decoder below is validated by exhaustive codeword round-trips plus the tools/cdec symbol-stream gate.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Spectral [11]*Table
Spectral holds the decoding tables for the 11 spectral codebooks, built from the same arrays FFmpeg passes to ff_vlc_init_tables_sparse (ff_aac_spectral_codes/_bits with ff_aac_codebook_vector_idx as symbols, libavcodec/aac/aacdec_tab.c:751-762 @ d09d5afc3a). Symbols are the packed vector descriptors documented at aactab.c:1040-1046.
Functions ¶
This section is empty.
Types ¶
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table is an immutable two-level VLC lookup table.
var Scalefactor *Table
Scalefactor is the decoding table for the scalefactor codebook (ff_vlc_scalefactors, aacdec_tab.c:764-771 @ d09d5afc3a); symbols are the codeword indices 0..120.
func New ¶
New builds a decoding table. Entry j maps the codeword codes[j] of lengths[j] bits to symbol syms[j]; syms may be nil, in which case the symbol is the index j (FFmpeg's implicit-symbol convention, used by the scalefactor book). Mirrors the (codes, bits, symbols) triples FFmpeg feeds ff_vlc_init_tables_sparse in libavcodec/aac/aacdec_tab.c:757-771 @ d09d5afc3a.
func (*Table) Decode ¶
Decode reads one codeword from r and returns its symbol. ok is false if the peeked bits are not a codeword of this book (possible only on corrupt input, or past the end of the buffer where peeks return zeros); the caller turns that into an invalid-data error. Overreads latch r.Err.