Field Guide · term

Also known as: AMBE+2 quantizer tables, AMBE+2 codebook tables

The AMBE+2 codebooks are the fixed quantizer tables that give an AMBE+2 2400 bps voice frame its meaning: the 49 information bits split into nine quantization indices, and each index is a lookup into a stored codebook that returns a piece of the multi-band excitation model — the harmonic count, the per-band voicing pattern, the frame gain, and the spectral-amplitude vectors.1 They are the AMBE+2 analogue of IMBE’s parameter quantization, but built almost entirely from vector quantizer codebooks rather than scalar formulas. GopherTrunk’s tables are transcribed byte-identically from szechyjs/mbelib’s ambe3600x2400_const.h.2

b0 → L table b1 → Vuv b2 → gain b3,b4 → PRBA b5–b8 → HOC spectral amplitudesinverse DCT → Tl[1..L]
Each of the nine AMBE+2 indices addresses a stored codebook; the gain, PRBA, and HOC lookups feed an inverse DCT that reconstructs the per-harmonic spectral amplitudes.

The scalar tables

Three of the codebooks are simple indexed arrays. The L table (AmbePlusLtable, 126 entries) maps the 7-bit fundamental index b_0 directly to the harmonic count L, which climbs from 9 at the high-pitch end to 56 at the low-pitch end. The gain table (AmbePlusDg, 64 entries) maps the 6-bit index b_2 to a gain delta — AMBE+2 codes gain differentially, so the synthesizer adds half the previous frame’s gain to this delta. The voicing-pattern table (AmbePlusVuv, 16 rows of 8) maps the 4-bit b_1 to one of sixteen voiced/unvoiced patterns across eight bands; the decoder picks a band per harmonic as ⌊l · 16 · f₀⌋ and reads that column:

var AmbePlusVuv = [16][8]int{
    {0, 0, 0, 0, 0, 0, 0, 0}, // b1 = 0: all unvoiced
    {0, 0, 0, 0, 0, 0, 1, 1},
    // … fourteen further rows, up to …
    {1, 1, 1, 1, 1, 1, 1, 1}, // b1 = 15: all voiced
}

The vector-quantizer codebooks

The spectral envelope uses true vector quantizers — each index selects a short vector, not a scalar. The two PRBA codebooks carry the coarse gain shape: AmbePlusPRBA24 (512 entries of 3 values, indexed by the 9-bit b_3) supplies Gm[2..4], and AmbePlusPRBA58 (128 entries of 4 values, indexed by the 7-bit b_4) supplies Gm[5..8]. The four HOC (higher-order coefficient) codebooks (AmbePlusHOCb5HOCb8, each 16 entries of 4 values, indexed by b_5b_8) fill in the finer per-band detail.

Codebook Dimensions Index Supplies
AmbePlusLtable 126 b0 (7 bit) harmonic count L
AmbePlusVuv 16 × 8 b1 (4 bit) voicing pattern
AmbePlusDg 64 b2 (6 bit) gain delta
AmbePlusPRBA24 512 × 3 b3 (9 bit) PRBA Gm[2..4]
AmbePlusPRBA58 128 × 4 b4 (7 bit) PRBA Gm[5..8]
AmbePlusHOCb5..b8 16 × 4 each b5..b8 HOC per band

From codebooks to a spectrum

The lookups are only the front end. The eight PRBA values feed an inverse 8-point DCT-II to produce band DC terms; those plus the HOC vectors form the per-band coefficient sets Cik, sized to the per-band harmonic counts Ji read from an L-indexed table (AmbePlusLmprbl). A final per-band inverse DCT expands each band’s coefficients into the log-amplitude residuals Tl[1..L], whose lengths sum to L by construction of the table. This is where the stored codebooks become a continuous spectral envelope.

Relevance to SDR

These codebooks are what GopherTrunk consults for every AMBE+2 frame in P25 Phase 2, DMR, and NXDN voice. Because they are transcribed 1:1 from mbelib and the surrounding control flow mirrors the C reference, any drift between the two is detectable — a mis-copied codebook entry would decode to a slightly wrong amplitude rather than a crash. The table values are facts about the published algorithm and ISC-licensed via mbelib; the AMBE+2 algorithm that drives them carries a separate patent status, discussed in the AMBE+2 entry.

Sources

  1. Multi-Band Excitation — Wikipedia, on the MBE model parameters the AMBE+2 codebooks quantize. 

  2. szechyjs/mbelib — the ISC-licensed reference whose ambe3600x2400_const.h codebook values GopherTrunk reproduces. 

See also