jp2k_decode function
Decodes a raw J2K codestream (starts FF4F = SOC marker — not the
box-structured .jp2 file format) from data/length.
reduced_resolution_factor discards the N highest-resolution wavelet
levels during decode (0 = full resolution), letting a caller who only
needs a coarse preview skip most of the decode cost — pass 0 unless you
have a specific reason not to.
Blocking/synchronous: this call occupies the calling isolate for its full duration. It has no main-isolate restriction (unlike dart:ui's image codecs), so call it from a background isolate to keep decode work off the UI thread.
Implementation
@ffi.Native<
ffi.Pointer<Jp2kDecodeResult> Function(
ffi.Pointer<ffi.Uint8>,
ffi.IntPtr,
ffi.Int32,
)
>()
external ffi.Pointer<Jp2kDecodeResult> jp2k_decode(
ffi.Pointer<ffi.Uint8> data,
int length,
int reduced_resolution_factor,
);