PICTools Programmer's Reference
OP_JLSE

OP_JLSE: Expand JPEG-LS to DIB or RAW

See the JLS_UNION:OP_JLSP, OP_JLSE, the LSSCAN, and the REGION sections for additional information about expanding DIBs using JPEG-LS. 

OP_JLSE is used for expanding images according to the JPEG-LS standard. See the OP_JLSP entry for a detailed discussion of the JPEG-LS algorithm and the parameters affecting its performance.

OP_JLSE is capable of decompressing single-component images with sample size ranging from 2 to 16 bits and 24-bit three-component images (assumed to be RGB). OP_JLSE does not support the advanced JPEG LS features of sub-sampled components and mapping tables for palletized mages. In order to support larger images, this opcode supports the optional use of REGION2. If ParmVerMinor is set to 4, then the opcode treats u.JLS.Region as a REGION2 structure instead of a REGION structure. Otherwise, ParmVerMinor should be set to 2. See the REGION2 section for more information.

StripSize will have been set by OP_JLSE after REQ_INIT is complete.  The Put queue must be at least StripSize bytes in length. If an RGB image had been compressed as one component per scan (i.e., ILVparam was set to JLS_NONINTERLEAVED), then the PUT queue must be large enough to hold the entire decompressed image (all three components); OP_JLSE sets StripSize to the proper value. Otherwise, StripSize is set to Region.Stride and OP_JLSE fills the PUT queue line-by-line. For RGB (24-bit) images, OP_JLSE interleaves data in the PUT queue as RGB when RF_SwapRB is set in Region.Flags or as BGR when RF_SwapRB is clear.

If PF_YieldPut is set in u.JLS.PicFlags then OP_JLSE will return a RES_PUT_DATA_YIELD response periodically during compression.  This would allow an application to progressively display the image being expanded, or to update expansion progress reporting.

OP_JLSE optionally returns comments and application data using PIC2List packets. See the PIC2List section of Accessing Comments and Other Auxiliary Data in the PICTools and AIMTools Programmer's Guide for more information about how opcodes use PIC2List packets.

A subrectangle of the image can be decompressed by setting F_InputCrop in PicParm.Flags and setting PicParm.IOCropXoff, PicParm.IOCropYoff, PicParm.IOCropWidth, and PicParm.IOCropHeight to describe the subrectangle. Cropping can also be done by using F_Crop in PicParm.Flags and setting PicParm.CropXoff, PicParm.CropYoff, PicParm.CropWidth, and PicParm.CropHeight. However, the recommended approach is to use F_InputCrop.

Java Advanced Imaging (JAI) Images

Accusoft has found that images with sample size ranging from 13 to 16 bits encoded using Java Advanced Imaging will not correctly decode using a JPEG-LS decoder that is compliant with the JPEG-LS specification, such as OP_JLSE, because of a bug in JAI's compressor.  Accusoft has implemented a decompressor work-around to allow these non-compliant images to be decompressed.  Set PF_BadJAIThresholds in u.JLS.PicFlags to decompress an image known to be a non-compliant JAI image. Be aware, however, that setting this flag for a correct image that is 13 to 16 bits per sample and without an LSE marker will cause the image to be decompressed incorrectly. All other images, whether encoded by JAI or otherwise, will decode correctly whether this flag is set or clear.

It is impossible in principle for OP_JLSE, or any decompressor, to detect with absolute certainty whether a compressed image was created with a buggy compressor or by a compliant compressor. However, OP_JLSE provides a Accusoft-proprietary method that, with high probability, will automatically detect whether the compressed image is compliant or not and then correctly decode it.  OP_JLSE does this when PF_AutoBadJAIThresholds is set in u.JLS.PicFlags.  If a bad 13 to 16 bits per sample image without an LSE marker is detected and successfully decoded using the non-compliant JAI parameters, OP_JLSE will set PF_BadJAIThresholds in u.JLS.PicFlags. If the image was found to be compliant or if the bad image cannot be decoded using the non-compliant JAI parameters, the flag will be cleared. In the unlikely case that OP_JLSE cannot do an automatic detection and return without error or if OP_JLSE returns without error but the decoded image appears wrong, do not set PF_AutoBadJAIThresholds but set or clear PF_BadJAIThresholds to explicitly force non-compliant or compliant decoding, respectively. If the error persists, then the image is bad.

 

 


©2022. Accusoft Corporation. All Rights Reserved.

Send Feedback