Skip to content

Latest commit

 

History

History
120 lines (97 loc) · 4.42 KB

File metadata and controls

120 lines (97 loc) · 4.42 KB

open_htj2k_enc — encoder CLI reference

Part 15 (HTJ2K) compliant encoder. Produces either a raw codestream (.j2c, .j2k, .jphc) or an HTJ2K JPH file (.jph). Accepts PGM, PPM, PGX, and TIFF (with libtiff) inputs. The streaming path handles all four formats — PGX with subsampled component sets (4:2:2, 4:2:0) and basic TIFF (8/16-bit, RGB or grayscale, single-strip or strip-compressed). Tiled TIFFs are not supported.

Full runtime help: open_htj2k_enc -h.

Synopsis

open_htj2k_enc -i <input-image(s)> -o <output> [options...]

Multiple input files can be passed as a comma-separated list. For example, to encode separate YCbCr component files:

open_htj2k_enc -i inputY.pgx,inputCb.pgx,inputCr.pgx -o output

-o takes the base name; the extension decides the container: .j2c / .j2k / .jphc for raw HTJ2K codestream, .jph for the JPH file format.

Options

Tile and image structure

  • Stiles=Size
    • Tile size in {height,width} format. Default is equal to the image size.
  • Sorigin=Size
    • Offset from the reference grid origin to the image area. Default is {0,0}.
  • Stile_origin=Size
    • Offset from the reference grid origin to the first tile. Default is {0,0}.

DWT and codeblock structure

  • Clevels=Int
    • Number of DWT decomposition levels. Valid range: 0–32. Default is 5.
  • Creversible=yes|no
    • yes for lossless mode, no for lossy mode. Default is no.
  • Cblk=Size
    • Code-block size. Default is {64,64}.
  • Cprecincts=Size
    • Precinct size. Must be a power of two.
  • Cycc=yes|no
    • yes to apply RGB→YCbCr color space conversion. Default is yes.
  • Corder=<LRCP|RLCP|RPCL|PCRL|CPRL|PRCL>
    • Progression order. Default is LRCP.
    • PRCL (position-resolution level-component-layer) is an ISO/IEC 15444-2 (Part 2) extension; selecting it sets bit-14 of Ccap2 in the CAP marker (Table A.49).
  • Cuse_sop=yes|no
    • yes to insert SOP (Start Of Packet) marker segments. Default is no.
  • Cuse_eph=yes|no
    • yes to insert EPH (End of Packet Header) markers. Default is no.

Quantization and quality

  • Qstep=Float
    • Base step size for quantization. Valid range: 0.0 < Qstep <= 2.0.
  • Qguard=Int
    • Number of guard bits. Valid range: 0–7. Default is 1.
  • Qderived=yes|no
    • yes selects scalar-derived quantization: a single step size is signalled for the LL band and the other subband step sizes are derived from it. Default is no (scalar-expounded; each subband's step size is signalled explicitly).
  • Qfactor=Int
    • Quality factor for lossy compression. Valid range: 0–100 (100 = best quality).
    • When specified, Qstep is ignored. Cycc defaults to yes; disabling it on 3-component input only warns (Qfactor assumes YCbCr input).
    • See qfactor.md for how the factor maps to step sizes.
  • Qcsf=legacy|mannos|daly (experimental)
    • Visual-weighting model for the Qfactor path. Default legacy (the historical fixed tables; output is bit-identical). mannos / daly derive per-subband weights from an analytic contrast sensitivity function. Requires Qfactor.
  • Qppd=Float (experimental)
    • Reference pixels-per-degree at zoom 1.0 for the analytic CSF. Default 72.
  • Qzoom=Float (experimental)
    • Display magnification; > 1 is zoom-in, which flattens the weighting toward flat MSE-optimal quantization. Default 1.0.
    • See qfactor.md for the analytic visual-weighting model.

JPH and component layout

  • -jph_color_space RGB|YCC
    • Declare the color space of the input components. Use YCC if the inputs are already in YCbCr.

Runtime

  • -num_threads Int
    • Number of threads. 0 (default) uses all available hardware threads.
  • -iter n
    • Repeat encoding n times (benchmarking) and report the mean elapsed time. The input image is read only once and the output is written only once.

Examples

# Lossless encode, default DWT / codeblock settings
open_htj2k_enc -i input.ppm -o out.j2c Creversible=yes

# Lossy encode at quality 90, write to JPH file format
open_htj2k_enc -i input.ppm -o out.jph Qfactor=90

# Encode YCbCr components into a JPH file with explicit color space
open_htj2k_enc -i Y.pgx,Cb.pgx,Cr.pgx -o out.jph -jph_color_space YCC

# Lossless encode with 6 DWT levels and RPCL progression
open_htj2k_enc -i input.ppm -o out.j2c Creversible=yes Clevels=6 Corder=RPCL