vlc

package
v0.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: LGPL-2.1 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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

func New(lengths []uint8, codes []uint32, syms []uint16) *Table

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

func (t *Table) Decode(r *bits.Reader) (sym uint32, ok bool)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL