code wiki / _hdl_build / nx_reader_tile.nx
nx_reader_tile.nx
buildroot/runtime/_hdl_build/nx_reader_tile.nx
about
nx_reader_tile.nx -- SOVEREIGN tiled-pyramid emitter (reader census gap: DZI/IIIF-class smooth mobile zoom of
huge manga/document scans). Given one page image (JPEG or PNG), emits a Deep-Zoom-style pyramid: for each level
0..maxlevel (level maxlevel = full res, each lower level halves) it box-downscales the page and cuts it into
fixed T x T JPEG tiles. A mobile viewer then fetches ONLY the tiles visible at the current zoom = smooth zoom
without downloading the whole 8000px scan. Composes PROVEN sovereign organs (DRY, zero 3rd-party): universal
decode nx_img_bytes_to_rgb (JPEG+PNG) -> nx_img_scale_bilinear -> jcw_write_color. KEY: each level's dims are
rounded to a multiple of 8 and T is a multiple of 8, so EVERY tile (incl right/bottom edges) is a multiple of 8
-> the baseline JPEG encoder handles all tiles. This is a LIB (no main) so nx_reader_tile_gate exercises rt_emit
directly (nx_mgmt_upload lib+gate split). Fork-per-page in the daemon -> the per-tile mmaps die with the child.
license_tier: ORIGINAL
dependencies 9 imports · 2 importers
imports: nx_syscalls.nxnx_img_bytes_to_rgb.nxnx_img_dims.nxnx_img_scale.nxnx_jpeg_color_write.nxnx_quant_table.nxnx_jpeg_huff_enc.nxnx_zigzag.nxnx_dct8.nx
imported by: nx_reader_page_prep.nxnx_reader_tile_gate.nx
structs
| none |
consts
| 20 | const K_MAGIC_1200: i64 = 1200 |
| 21 | const K_MAGIC_1600: i64 = 1600 |
| 22 | const K_MAGIC_1024: i64 = 1024 |
| 23 | const K_MAGIC_8192: i64 = 8192 |
functions
| 25 | func rt_ap_str(dst: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { dst[o + i] = s[i]; i = i + 1 } return o + i } |
| 26 | func rt_ap_num(dst: *u8, o: i64, v: i64) -> i64 |
| 34 | func rt_mkdir(path: *u8) -> i64 { __syscall(258, 0 - 100, path as i64, 0x1ed, 0, 0, 0); return 0 } |
| 35 | func rt_writefile(path: *u8, buf: *u8, n: i64) -> i64 |
| 45 | func rt_raw_manifest(data: *u8, n: i64, outdir: *u8) -> i64 |
| 61 | func rt_emit(src: *u8, outdir: *u8, tilesize: i64) -> i64 called by 2: mainmain calls 19: sys_mmapsys_read_filenx_img_bytes_to_rgbrt_raw_manifestjhe_dc_bitsjhe_dc_val+13 |