PICTools Programmer's Reference
OP_JBIG2E

OP_JBIG2E: Expand JBIG2 to DIB or RAW

See the JBIG2_UNION:OP_JBIG2E, the JBIG2_REGION, and the REGION sections for additional information about expanding JBIG2 images to DIBs.  Note that OP_JBIG2E requires that ParmVerMinor be 2.

OP_JBIG2E is used for expanding bi-level images according to the JBIG2 standard. See the OP_JBIG2P entry for a further discussion of the JBIG2 algorithm and the parameters affecting its performance.

OP_JBIG2E is capable of decompressing images compressed as lossless or lossy using JBIG2. OP_JBIG2E sets JBIG2_PageFlags_IsLossless in u.JBIG2.PageFlags if the JBIG2 compressed image indicates that the page returned is a lossless representation of the original (pre-coding) page. If the JBIG2 file is a multi-page document, before REQ_INIT set either PicParm.ImageNumber or u.JBIG2.PageNum to request which page to expand. Use PicParm.ImageNumber (and set u.JBIG2.PageNum to 0) to request a page by its position in the document; i.e., the ImageNumber-th page encountered in the file. Use u.JBIG2.PageNum (and set PicParm.ImageNumber to 0) to request a page by its page number. The default (both set to 0) is the first-encountered page. Information returned by REQ_INIT is appropriate for the requested page.

The output decompressed image can be formatted as a Windows DIB, if F_Bmp is set or if F_Raw is clear in PicParm.Flags, or as raw image data otherwise. In both cases, the image is 1 bit per pixel packed 8 pixels per byte with the most significant bit corresponding to the leftmost pixel. A Windows DIB has each row padded to a 32-bit boundary. By default the returned bits are the inverse of what has been decoded from the bitstream; assuming that the encoded image follows the interpretation of a zero bit as white and a one bit as black, the returned bitmap will be zero where black and one where white. If F_Bmp is set, then the colormap is set to display the zero bits in the bitmap as black and the one bits as white; set PF2_SwapBW in u.JBIG2.PicFlags2 to have OP_JBIG2E swap the values for the black and white entries of the colormap. If F_Raw, set the flag RF_WhiteIsZero in u.JBIG2.Region.Flags to prevent OP_JBIG2E from inverting the decoded bits and thereby return a raw bitmap whose bits are identical to what had been encoded in the bitstream.

u.JBIG2.StripSize will have been set by OP_JBIG2E after REQ_INIT is complete.  The Put queue must be at least StripSize bytes in length.

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

OP_JBIG2E optionally returns comments (found in comment extension segments) using PIC2List packets. Comments are returned as name-value pairs; a null character separates the name from the value. One pair is returned in each packet of type P2P_JBIG2Comment with the SegNum field set to the number of the JBIG2 segment from which the pair was retrieved; all packets with the same SegNum came from the same segment and are thus related. Comments can be 8-bit ANSI or 16-bit Unicode; the CharSet field indicates which. 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. See the pic2file.h in the PICTools include directory for more information about the JBIG2Comment packet.

 

 


©2022. Accusoft Corporation. All Rights Reserved.

Send Feedback