rust-j2k 0.1.0

Pure-Rust JPEG 2000 (ISO/IEC 15444) codec, built GRIB2-decode-first toward OpenJPEG-level coverage.
Documentation
// @generated by scripts/gen-tier1-vectors.py — do not edit by hand.
//
// Golden Tier-1 code-block vectors. Each is a real MQ code-block segment
// sliced from a reversible (5/3), single-resolution OpenJPEG codestream;
// `coeffs` is the decoder-independent ground truth (decoded sample minus
// the 2^7 DC level shift). See the generator for the full provenance.

/// One golden code-block: the coded MQ `segment` plus the Tier-2-supplied
/// `num_passes`/`zero_bit_planes` decode to the signed `coeffs` grid.
pub(super) struct GoldenBlock {
    pub name: &'static str,
    pub width: u32,
    pub height: u32,
    pub num_passes: u32,
    pub zero_bit_planes: u32,
    pub segment: &'static [u8],
    pub coeffs: &'static [i32],
}

pub(super) const GOLDEN_BLOCKS: &[GoldenBlock] = &[
    GoldenBlock {
        name: "gradient_8x8", // gradient + spikes: all three passes, signs, refinement
        width: 8,
        height: 8,
        num_passes: 19,
        zero_bit_planes: 2,
        segment: &[
            0x13, 0x08, 0x72, 0x85, 0x97, 0xf6, 0x37, 0xb5, 0xc8, 0x64, 0x5a, 0x43, 0x5b, 0x4b,
            0x2a, 0xbd, 0x4a, 0x4d, 0x18, 0xa4, 0xe8, 0x56, 0x47, 0x76, 0x4c, 0x29, 0x4f, 0xee,
            0x4f, 0x2c, 0xb7, 0x18, 0x9a, 0xf2, 0x93, 0xc9, 0xd4, 0xf4, 0x9c, 0xe6, 0x10, 0x80,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x80, 0xe3,
        ],
        coeffs: &[
            72, -112, -96, -80, -64, -48, -32, -16, -126, -123, -94, -78, -62, -46, -30, -14, -124,
            -108, -92, -76, -60, -44, -28, -12, -122, -106, -90, -74, -58, -42, -26, -10, -120,
            -104, -88, -72, -56, -40, -24, -8, -118, -102, -86, -70, -54, -38, -22, -6, -116, -100,
            -84, -68, -52, -36, -20, -4, -114, -98, -82, -66, -50, -34, -18, 127,
        ],
    },
    GoldenBlock {
        name: "sparse_8x8", // mostly-DC: heavy cleanup run-length over insignificant columns
        width: 8,
        height: 8,
        num_passes: 16,
        zero_bit_planes: 3,
        segment: &[0x24, 0x09, 0x1e, 0x90, 0x05, 0xe2, 0x29, 0xea, 0x96, 0xb6],
        coeffs: &[
            0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -32, 0, 0, 0, 0, 32,
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -28, 0, 0,
            0, 0, 0, 0, 0, 0, 0, 0,
        ],
    },
    GoldenBlock {
        name: "small_4x4", // small magnitudes: few bit-planes, low num_passes
        width: 4,
        height: 4,
        num_passes: 10,
        zero_bit_planes: 5,
        segment: &[0x15, 0xe0, 0x89, 0xd6, 0x4f, 0xd6, 0xd4, 0xc5],
        coeffs: &[2, -4, 0, 3, 0, -8, 8, 0, -3, 0, 0, -6, 0, 5, -1, 0],
    },
];