moon_jpegls

    Pure MoonBit JPEG-LS Part 1 streaming codec with abbreviated formats, restart intervals and extended geometry

    jpeg-ls
    streaming
    image
    lossless
    multicomponent
    Download zip
    Author
    Version
    0.12.1
    License
    BSD-3-Clause
    Last updated
    26 minutes ago
    Downloads
    247

    No dependencies

    #MoonJLS

    MoonJLS preserves high-precision integer images through lossless or bounded near-lossless JPEG-LS exchange. The same MoonBit codec runs as a Native CLI and drives the JavaScript and Wasm GC SDKs. It keeps prediction rows in core memory and lets a pipe or Worker deliver reconstructed rows while the input is still arriving.

    #Try the workbench

    Build the SDK and launch the existing workbench from the repository root.

    node sdk/build.mjs node web/build.mjs python -m http.server 8000 --bind 127.0.0.1 --directory web/dist

    Open the local workbench. Load the 8-bit or 16-bit microscopy example, choose ILV and NEAR, and run. The scan inspector shows the coded component order and geometry. The comparison uses the original integer samples. Download the JPEG-LS stream or the run report. Browser checks

    For a single PGM, enable the physical error budget under Advanced. Buffered exchange allows up to 4 MiB per artifact. Eligible browsers can stream a single-component exchange up to 128 MiB. In Multicomponent physical exchange, add two to four matching PGM or U16 RAW planes, set each component's calibration and run the MoonBit scan candidates. The workbench reports actual verified JLS sizes and exports the selected JLS, v2 sidecar and report for independent Native recovery. Raster exchange · Independent Native commands

    The Native CLI can encode and inspect a tiny 8-bit image from a pipe.

    printf 'P5\n3 2\n255\n\000\177\377\001\052\020' | moon run --target native cmd/moonjls -- encode-pgm 0 - sample.jls 7 moon run --target native cmd/moonjls -- inspect sample.jls --json

    For sampled images, encode from separate component PGMs with explicit H/V factors and decode to separate PGMs. CLI and SDK API · Streaming pipe example · MoonBit consumer

    Native ILV=1/2 reads regular planar files through bounded positioned windows. For stdin or a FIFO, --input-policy spool bounds RAM under explicit disk and time limits. Use encode-scans to declare mixed scans with separate component files. The independent raster exchange tools verify single- and multicomponent files by row and offer opt-in task recovery on Linux/WSL. Native CLI · Large file exchange

    Native can plan from a v2 request with plan-raster-scans and use compare to test actual output sizes under a cumulative disk budget. The fixed 67,117,056-byte input completes all three plans at 160 MiB. Write ledger, verification and recovery

    #Verified scope

    StageDelivered capabilityEvidence
    M2Coded precision 2–16 bits, explicit MAXVAL, legal NEAR, LSE1 presets388-case M2 matrix
    M3-ANon-interleaved multi-component scans and cross-scan LSE1 defaultsM3-A acceptance
    M3-BILV=1 line interleave, ILV=2 sample interleave, H/V sampling and edge MCU handlingAnnex E 12/12 on JS, Wasm GC and Native
    Point transformUnmapped Pt=0–15, separate error domains, exact 32-bit outputIndependent Pt and sampling validation
    M4 incrementInterchange encoding and decoding of embedded LSE2/LSE3 tables (Wt=1–255), including replacement and per-component selectionMapping vector results
    M4 table streamsC.4 frameless table encode and load with immutable snapshotsC.4 conformance
    M4 abbreviated imagesC.3 encode and decode against explicit external mapping snapshotsC.3 conformance
    M4 restart intervalsDRI and RST state resets across all interleave modesRestart verification
    M4 deferred and extended geometryDNL, LSE4 and legal marker positionsFrame geometry and marker verification

    HP 1.00 independently verifies all 12 official cases in both directions. CharLS Wasm 0.10.0 independently verifies ten and reports unsupported sampling for E.2-7/8. The pinned conformance report records inputs, decoded samples, candidate streams, artifact hashes, and the tested source revision. The NASA LOLA example verifies 1,036,800 reconstructed samples from a public elevation raster. Evidence and reproduction · LOLA fixture

    moon test core --target js --deny-warn moon test core --target wasm-gc --deny-warn CC=clang moon test core --target native --deny-warn

    Encoder, decoder, and context model implement the codec in MoonBit. Native CLI links the same core. The MoonBit bridge generates JS and Wasm GC bindings. Handwritten SDK, Worker, and workbench code handle transport and presentation. Implementation map

    #T.87 Part 1 roadmap

    MoonJLS implements the ITU-T T.87 / ISO/IEC 14495-1 Part 1 encoding, decoding and wire formats within its documented resource limits. All 12 official Annex E cases use Pt=0. The supplementary checks exercise Pt, mapping and abbreviated formats, restarts, extended geometry and marker syntax. Conformance matrix · Support scope · Release evidence