code wiki / (root) / nx_vcodec_color_wasm.nx

nx_vcodec_color_wasm.nx

buildroot/runtime/nx_vcodec_color_wasm.nx

6670 B108 linesdepth 5pulls 14 transitivereach 0 importersview sourcekind tooltopic vcodec
docsdependenciesstructsconstsfunctions

about

nx_vcodec_color_wasm.nx -- the BROWSER entry wrapper for the COLOR codec, fixed-offset linear-memory model (mirrors nx_vcodec_wasm). wasm has NO syscalls, so every buffer is a fixed offset (no sys_mmap) and the color glue (RGB<->YCbCr, 4:2:0 subsample/upsample) is inlined; the heavy lifting is the PROVEN nx_vcodec engine (vc_enc/dec_frame_packed) run once per Y/Cb/Cr plane. JS only blits RGB in/out at the offsets; all codec logic is sovereign nx -> nx_compile_wat -> nx_wat_compiler -> .wasm. Frame cap 128x128 (chroma 64x64). license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_vcodec.nx nx_vcodec_color_wasm.nx

imports: nx_vcodec.nx

imported by: nobody (leaf or entry point)

structs

none

consts

10const O_RGB: i64 = 0 // input RGB (interleaved), up to 49152
11const O_Y: i64 = 49152 // luma plane (16384)
12const O_CB: i64 = 65536 // full Cb (16384)
13const O_CR: i64 = 81920 // full Cr (16384)
14const O_CBS: i64 = 98304 // subsampled Cb (4096)
15const O_CRS: i64 = 102400 // subsampled Cr (4096)
16const O_PREVY: i64 = 106496 // prev recon Y (16384)
17const O_PREVCB: i64 = 122880 // prev recon Cb (4096)
18const O_PREVCR: i64 = 126976 // prev recon Cr (4096)
19const O_RECONY: i64 = 131072 // enc recon Y (16384)
20const O_RECONCB: i64 = 147456 // enc recon Cb (4096)
21const O_RECONCR: i64 = 151552 // enc recon Cr (4096)
22const O_STRY: i64 = 155648 // stream Y (16384)
23const O_STRCB: i64 = 172032 // stream Cb (8192)
24const O_STRCR: i64 = 180224 // stream Cr (8192)
25const O_DECY: i64 = 188416 // dec recon Y (16384)
26const O_DECCB: i64 = 204800 // dec recon Cb (4096)
27const O_DECCR: i64 = 208896 // dec recon Cr (4096)
28const O_DECCBU: i64 = 212992 // dec Cb upsampled (16384)
29const O_DECCRU: i64 = 229376 // dec Cr upsampled (16384)
30const O_RGBOUT: i64 = 245760 // output RGB (49152)
31const O_BLK: i64 = 294912 // 16 i64 transform scratch (128)
32const O_MV: i64 = 295040 // 2 i64 motion vector (16)
33const O_TMP: i64 = 295056 // 3 i64 color temp (24) -- end 295080

functions

35func vc_clamp8(v: i64) -> i64 { if v < 0 { return 0 } if v > 255 { return 255 } return v }
38func vc_color_wasm_encode(W: i64, H: i64, qp: i64, keyframe: i64, sad: i64) -> i64
70func vc_color_wasm_decode(W: i64, H: i64, qp: i64) -> i64
100func vc_color_rgb_off() -> i64 { return O_RGB }
101func vc_color_rgbout_off() -> i64 { return O_RGBOUT }
102func vc_color_prevy_off() -> i64 { return O_PREVY }
103func vc_color_prevcb_off() -> i64 { return O_PREVCB }
104func vc_color_prevcr_off() -> i64 { return O_PREVCR }
105func vc_color_decy_off() -> i64 { return O_DECY }
106func vc_color_deccb_off() -> i64 { return O_DECCB }
107func vc_color_deccr_off() -> i64 { return O_DECCR }
108func main() -> i64 { return 0 }