code wiki / _hdl_build / nx_jpeg_huff_enc.nx
nx_jpeg_huff_enc.nx
buildroot/runtime/_hdl_build/nx_jpeg_huff_enc.nx
about
nx_jpeg_huff_enc.nx -- SOVEREIGN JPEG baseline Huffman ENCODE substrate (J1 of the sovereign JPEG
encoder yardstick, for the patent-free codec RD head-to-head). The JPEG arc was decode-only; this is
the missing encode side. Provides the STANDARD ITU-T T.81 Annex K.3 luminance Huffman tables (DC +
AC) as canonical code/size lookups, the JPEG magnitude-category + sign-magnitude additional-bits
encoding, and DC/AC symbol emission over the shared MSB-first bit writer (nx_h264_bitwriter, reused
as the generic hardware-rung bit primitive -- DRY). JPEG/Annex K is fully public since 1992 and
patent-expired -> patent-clean. Self-proof = encode->decode round-trip (no 3rd party). The byte
0xFF-stuffing belongs to the scan-writer stage (J3), not here. license_tier: ORIGINAL
dependencies 2 imports · 21 importers
diagram shows first 10 each side; +0 more imports, +11 more importers in the complete lists below.
imports: nx_syscalls.nxnx_h264_bitwriter.nx
imported by: nx_cam_poster.nxnx_codec_rd2_gate.nxnx_codec_rd_gate.nxnx_codec_real_rd2.nxnx_codec_real_rd2f.nxnx_codec_real_rd2g.nxnx_codec_real_rd3.nxnx_galx_thumb_oneshot.nxnx_jpeg_block_enc.nxnx_jpeg_block_enc_gate.nxnx_jpeg_color_write.nxnx_jpeg_color_write_gate.nxnx_jpeg_huff_enc_gate.nxnx_jpeg_rst_gate.nxnx_jpeg_sym.nxnx_jpeg_write.nxnx_jpeg_write_gate.nxnx_reader_panels_gate.nxnx_reader_tile.nxnx_reader_tile_gate.nxnx_reader_zoomserve_gate.nx
structs
| none |
consts
| none |
functions
| 13 | func jhe_dc_bits(b: *i64) -> i64 |
| 18 | func jhe_dc_val(v: *i64) -> i64 { var i: i64=0; while i<12 { v[i]=i; i=i+1 } return 12 } |
| 21 | func jhe_ac_bits(b: *i64) -> i64 |
| 26 | func jhe_ac_val(v: *i64) -> i64 |
| 53 | func jhe_gen(bits: *i64, huffval: *i64, nval: i64, ehufco: *i64, ehufsi: *i64) -> i64 |
| 73 | func jhe_mag_cat(v: i64) -> i64 { var a: i64=v; if a<0 { a=0-a } var c: i64=0; while a>0 { c=c+1; a=a>>1 } return c } |
| 76 | func jhe_mag_bits(v: i64, cat: i64) -> i64 { var m: i64=v; if v<0 { m=v+(1<<cat)-1 } return m & ((1<<cat)-1) } |
| 79 | func jhe_emit_dc(bw: *BitWriter, ehufco: *i64, ehufsi: *i64, diff: i64) -> i64 |
| 88 | func jhe_emit_ac(bw: *BitWriter, ehufco: *i64, ehufsi: *i64, run: i64, v: i64) -> i64 |
| 97 | func jhe_read_bit(buf: *u8, pos: *i64) -> i64 { let p: i64=pos[0]; let bit: i64=((buf[p>>3] as i64) >> (7-(p&7))) & 1; pos[0]=p+1; return bit } |
| 98 | func jhe_decode_sym(buf: *u8, pos: *i64, ehufco: *i64, ehufsi: *i64) -> i64 |
| 107 | func jhe_decode_mag(buf: *u8, pos: *i64, cat: i64) -> i64 |