/** Look up the default probability for a given (block_type, band, ctx, prob_idx). */ export declare function defaultCoefProb(blockType: number, band: number, ctx: number, probIdx: number): number; /** Clamp a quantiser-table index into the valid 0..127 range. */ export declare function clampQi(qi: number): number; /** * Get the 9-element B-mode probability vector for a given (above, left) * neighbour pair. Returns a Uint8Array slice — callers should index into * it as `probs[i]` for i in 0..8. */ export declare function kfBmodeProbs(above: number, left: number): Uint8Array; /** Look up a single B-mode probability for `[above][left][i]`. */ export declare function kfBmodeProb(above: number, left: number, idx: number): number; /** * VP8 constant tables. * * Every value here is a verbatim transcription of libwebp's * `src/dec/tree_dec.c` (default coef probs, coef update probs, * keyframe B-mode probs, kBands, kZigzag) and `src/dec/vp8_dec.c` * (CAT1..CAT6 extra-bit probabilities). Maintaining bit-exact * agreement with libwebp's reference data is the cheapest way to * stay bit-exact with `cwebp`/`dwebp`-produced files; the tables * are big, but every byte matters. * * Sections referenced inline are RFC 6386 sections. */ // --------------------------------------------------------------------------- // Block-type / coefficient infrastructure // --------------------------------------------------------------------------- export declare const NUM_BLOCK_TYPES: 4; export declare const NUM_COEF_BANDS: 8; export declare const NUM_DCT_TOKENS: 12; /** * For each of the 16 coefficient positions in a 4×4 block (in zig-zag * order), which of the 8 "bands" it belongs to. Position 16 is a * sentinel that maps back to band 0 — libwebp keeps the extra entry so * `bands_ptr[type][n+1]` is always valid even when the loop has just * advanced past position 15. */ export declare const COEF_BANDS: Uint8Array; /** Zig-zag scan order: zig-zag position → output (raster) index. */ export declare const ZIGZAG: Uint8Array; /** * CAT3..CAT6 extra-magnitude bit probabilities, terminated by a 0 * sentinel (libwebp's loop runs `for (tab = kCat3456[cat]; *tab; ++tab)`). */ export declare const CAT3_PROBS: Uint8Array; export declare const CAT4_PROBS: Uint8Array; export declare const CAT5_PROBS: Uint8Array; export declare const CAT6_PROBS: Uint8Array; export declare const CAT3456_PROBS: ReadonlyArray; // --------------------------------------------------------------------------- // Default coefficient probabilities — libwebp `CoeffsProba0` // --------------------------------------------------------------------------- // // Layout: [block_type][band][ctx][prob_idx] flattened to a single // Uint8Array. The flat index is // // block_type * NUM_COEF_BANDS * 3 * 11 // + band * 3 * 11 // + ctx * 11 // + prob_idx // // Block types follow libwebp's convention: // 0 = "Y after Y2" (16 luma blocks when 16×16 prediction is used) // 1 = "Y2" (the WHT block of luma DCs) // 2 = "UV" (8 chroma blocks) // 3 = "Y NO Y2" (16 luma blocks when B_PRED prediction is used) // // libwebp keeps band 0 of "Y after Y2" as an all-128 sentinel because // those blocks always start at zig-zag position 1 (DC lives in Y2). export declare const DEFAULT_COEF_PROBS: () => unknown; // --------------------------------------------------------------------------- // Coef-probability update probabilities — libwebp `CoeffsUpdateProba` // --------------------------------------------------------------------------- export declare const COEF_UPDATE_PROBS: () => unknown; /** * AC dequantisation lookup — libwebp `kAcTable`. NOTE: this is a * different table from the DC lookup; the values rise faster at the * high-quality end. Conflating them is a common bug. */ export declare const AC_QUANT: Uint16Array; /** DC dequantisation lookup — libwebp `kDcTable`. */ export declare const DC_QUANT: Uint16Array; /** Aliases retained for backward compatibility with earlier modules. */ export declare const Y_AC_QUANT: unknown; export declare const Y_DC_QUANT: unknown; export declare const UV_AC_QUANT: unknown; export declare const UV_DC_QUANT: unknown; export declare const Y2_AC_QUANT: unknown; export declare const Y2_DC_QUANT: unknown; /** * Luma 16×16 prediction modes. libwebp aliases these onto the 4×4 * B-mode enum values (DC=B_DC, V=B_VE, H=B_HE, TM=B_TM) so that when * a non-B_PRED MB writes its ymode into the intra_t/intra_l B-mode * tracker, the value propagates correctly into the next MB's * `kBModesProba` lookup. */ export declare const DC_PRED: unknown; /** * Per-4×4 luma intra modes. libwebp's enum has B_RD/B_VR/B_LD at * positions 4/5/6 (NOT the RFC 6386 / libvpx ordering of LD/RD/VR). * This matters because the bit-tree decodes mode indices that get * stored in `intra_t`/`intra_l` and used to index `kBModesProba`, * so the value MUST match libwebp's convention to be bit-exact. */ export declare const B_DC_PRED: 0; export declare const B_TM_PRED: 1; export declare const B_VE_PRED: 2; export declare const B_HE_PRED: 3; export declare const B_RD_PRED: 4; export declare const B_VR_PRED: 5; export declare const B_LD_PRED: 6; export declare const B_VL_PRED: 7; export declare const B_HD_PRED: 8; export declare const B_HU_PRED: 9; export declare const NUM_BMODES: 10; /** * Y mode tree and probabilities (4 modes, used when 16×16 prediction * is in effect). libwebp inlines this as a hand-unrolled tree decode * for speed; we keep both shapes available so consumers can pick. */ export declare const KF_Y_MODE_TREE: Int8Array; export declare const KF_Y_MODE_PROBS: Uint8Array; /** UV mode tree (same set as luma 16×16). */ export declare const UV_MODE_TREE: Int8Array; export declare const KF_UV_MODE_PROBS: Uint8Array; /** B-mode (per-subblock 4×4 luma) tree (10 modes). */ export declare const B_MODE_TREE: Int8Array; // --------------------------------------------------------------------------- // Keyframe B-mode probabilities — libwebp `kBModesProba` // --------------------------------------------------------------------------- // // 10 above-modes × 10 left-modes × 9 probs = 900 entries. export declare const KF_BMODE_PROBS: () => unknown; /** Same as COEF_BANDS above; exposed under the libwebp-style canonical name. */ export { COEF_BANDS as DCT_COEF_BAND };