code wiki / (root) / nx_apng_decode.nx

nx_apng_decode.nx

buildroot/runtime/nx_apng_decode.nx

4611 B86 linesdepth 8pulls 13 transitivereach 1 importersview sourcekind librarytopic apng
docsdependenciesstructsconstsfunctions

about

nx_apng_decode.nx -- INGEST animated PNG -> frames (roadmap R1: video/gif/image ingest, the front door of the video->pose->motion keystone). Reuses the sovereign nx_png_decode (inflate + unfilter) per frame: walk the APNG chunks, and for each frame's IDAT (frame 0) / fdAT (frames 1+) reconstruct a standalone single-frame PNG (sig+IHDR+IDAT+IEND) and decode it. Our encoder nx_apng writes exactly one IDAT/fdAT per full-frame, so the split is 1:1. Bit-exact inverse of nx_apng. license_tier: ORIGINAL

dependencies 3 imports · 1 importers

nx_syscalls.nx nx_png.nx nx_png_decoder.nx nx_apng_decode.nx nx_apng_decode_gate.nx

imports: nx_syscalls.nxnx_png.nxnx_png_decoder.nx

imported by: nx_apng_decode_gate.nx

structs

none

consts

9const K_MAGIC_1024: i64 = 1024
10const K_MAGIC_65536: i64 = 65536

functions

12func ad_be32(buf: *u8, o: i64) -> i64 { return ((buf[o]&0xff)<<24)|((buf[o+1]&0xff)<<16)|((buf[o+2]&0xff)<<8)|(buf[o+3]&0xff) }
called by 1: apng_decode
13func ad_type(buf: *u8, o: i64, a: i64, b: i64, c: i64, d: i64) -> i64 { if (buf[o]&0xff)==a { if (buf[o+1]&0xff)==b { if (buf[o+2]&0xff)==c { if (buf[o+3]&0xff)==d { return 1 } } } } return 0 }
called by 1: apng_decode
16func ad_build_png(ihdr13: *u8, zlib: *u8, zlen: i64, out: *u8) -> i64
called by 1: apng_decode calls 2: png_be32png_crc32
43func apng_decode(buf: *u8, len: i64, frames_out: *i64, wh_out: *i64, cap_frames: i64) -> i64