code wiki / (root) / nx_webp_vp8l.nx

nx_webp_vp8l.nx

buildroot/runtime/nx_webp_vp8l.nx

16319 B404 linesdepth 6pulls 6 transitivereach 40 importersview sourcekind librarytopic webp
docsdependenciesstructsconstsfunctions

about

nx_webp_vp8l.nx -- sovereign WebP VP8L (lossless) pixel decoder. THE LAST MILE. WebP already reaches four layers deep in this tree: sniffed by nx_media_sniff, sized by nx_img_dims, negotiated by nx_cms_image and transfer-validated by nx_manga_get. Nothing turned the bitstream into pixels. This does. VP8L is, in order: a 5-byte header, an optional stack of up to 4 reversible transforms, an optional colour cache, an optional meta-Huffman image that selects which of N Huffman groups applies to each 2^k block, and then one LZ77 stream over ARGB pixels. Decode runs the stream, then UNDOES the transforms in reverse order. Composes: nx_bitstream (LSB-first, matches VP8L exactly), nx_webp_huff (canonical trees incl. the zero-bit single-symbol case). genealogy_id: webp_lossless_bitstream_spec_2012 lineage_id: nx_webp_vp8l_v1 license_tier: ORIGINAL

dependencies 4 imports · 2 importers

nx_syscalls.nx nx_bitstream.nx nx_huffman.nx nx_webp_huff.nx nx_webp_vp8l.nx nx_webp.nx nx_webp_vp8l_gate.nx

imports: nx_syscalls.nxnx_bitstream.nxnx_huffman.nxnx_webp_huff.nx

imported by: nx_webp.nxnx_webp_vp8l_gate.nx

structs

none

consts

28const NX_VP8L_SIG: i64 = 0x2f
29const NX_VP8L_NUM_LIT: i64 = 256
30const NX_VP8L_NUM_LEN: i64 = 24
31const NX_VP8L_NUM_DIST: i64 = 40
32const NX_VP8L_GROUP_SIZE: i64 = 5
33const NX_VP8L_PLANE_CODES: i64 = 120
34const NX_VP8L_BLACK: i64 = 0xff000000
35const NX_VP8L_CACHE_MUL: i64 = 0x1e35a7bd
36const NX_VP8L_U32: i64 = 0xffffffff
38const NX_VP8L_XF_PREDICT: i64 = 0
39const NX_VP8L_XF_COLOR: i64 = 1
40const NX_VP8L_XF_SUBGREEN: i64 = 2
41const NX_VP8L_XF_PALETTE: i64 = 3
42const NX_VP8L_XF_COUNT: i64 = 4

functions

46func vl_min(a: i64, b: i64) -> i64 { if a < b { return a } return b }
48func vl_abs(a: i64) -> i64 { if a < 0 { return 0 - a } return a }
called by 1: vl_sub3
50func vl_clip255(v: i64) -> i64
57func vl_subsample_size(size: i64, bits: i64) -> i64
61func vl_chan(argb: i64, shift: i64) -> i64 { return (argb >> shift) & 255 }
63func vl_argb(a: i64, r: i64, g: i64, b: i64) -> i64
68func vl_average2(a: i64, b: i64) -> i64
80func vl_sub3(a: i64, b: i64, c: i64) -> i64
called by 1: vl_select calls 1: vl_abs
86func vl_select(t: i64, l: i64, tl: i64) -> i64
called by 2: vl_predictmain calls 2: vl_sub3vl_chan
95func vl_clamp_add_sub_full(c0: i64, c1: i64, c2: i64) -> i64
103func vl_add_sub_half(a: i64, b: i64) -> i64
called by 1: vl_clamp_add_sub_half calls 1: vl_clip255
107func vl_clamp_add_sub_half(c0: i64, c1: i64, c2: i64) -> i64
116func vl_predict(mode: i64, l: i64, t: i64, tl: i64, tr: i64) -> i64
139func vl_plane_table(out: *i64) -> i64
called by 2: webp_decodemain
167func vl_dist_map(plane: *i64, dist_code: i64, xsize: i64) -> i64
182func vl_prefix_value(bs: *NxBitStream, prefix: i64) -> i64
191func vl_cache_index(argb: i64, bits: i64) -> i64
called by 1: vl_decode_pixels
206func vl_decode_pixels(bs: *NxBitStream, out: *i64, width: i64, height: i64,
304func vl_inv_subtract_green(argb: *i64, npix: i64) -> i64
called by 2: wb_decode_streammain calls 2: vl_chanvl_argb
317func vl_inv_predict(argb: *i64, w: i64, h: i64, bits: i64, sub: *i64) -> i64
354func vl_s8(v: i64) -> i64
called by 1: vl_inv_color
360func vl_inv_color(argb: *i64, w: i64, h: i64, bits: i64, sub: *i64) -> i64
391func vp8l_read_header(bs: *NxBitStream, wh: *i64) -> i64