PICTools Programmer's Reference
JBIG2_REGION, JBIG2_UNION

JBIG2_REGION: OP_JBIG2P, OP_JBIG2E

The JBIG2_REGION structure supplies additional information to OP_JBIG2P to encode a JBIG2 region This structure is not used by OP_JBIG2E.

 
Copy Code
typedef struct {
   DWORD                 XOff;
   DWORD                 YOff;
   DWORD                 Width;
   DWORD                 Height;
   DWORD                 EncodeMode;
   DWORD                 RegionFlags;
   void PICHUGE*         Reserved0;
   DWORD                 Looseness;
   LONG                  Reserved[9];
} JBIG2_REGION;

Fields:

Name Description

XOff

YOff

Width

Height

The xoffset, yoffset, width, and height of the region. Set them all to zero to select the entire image.

EncodeMode

Select a mode.

Value

Meaning

JBIG2_EncodeMode_Lossless_Generic_MQ

Fast, great lossless compression, use for any content, uses MQ arithmetic coding.

JBIG2_EncodeMode_Lossless_Generic_MMR

Fast, very good lossless compression, use for any content, similar to G4 coding, uses Huffman/MMR coding.

JBIG2_EncodeMode_Lossless_Text_MQ

Great lossless compression possible, use for text or symbols, uses MQ arithmetic coding.

JBIG2_EncodeMode_Lossless_Text_MMR

Very good lossless compression possible, use for text or symbols, uses Huffman/MMR coding.

JBIG2_EncodeMode_Lossless_Text_SPM_MQ

Potentially best lossless compression for text or symbols, uses MQ arithmetic coding.

JBIG2_EncodeMode_Lossless_Text_SPM_MMR

Potentially best lossless compression for text or symbols, uses Huffman/MMR coding plus MQ arithmetic coding.

JBIG2_EncodeMode_Lossy_Text_MQ

Great lossy compression for text or symbols, uses MQ arithmetic coding.

JBIG2_EncodeMode_Lossy_Text_MMR

Very good lossy compression for text or symbols, uses Huffman/MMR coding.

JBIG2_EncodeMode_Lossy_Halftone_MQ

Good lossy compression for halftones, uses MQ arithmetic coding.

JBIG2_EncodeMode_Lossy_Halftone_MMR

Good lossy compression for halftones, uses Huffman/MMR coding.

RegionFlags

Value

Meaning

JBIG2_RegionFlags_InvertedRegion

Invert bits prior to symbol analysis; may provide better compression if text is light bits against a dark background instead of the otherwise assumed dark bits against a light background; only used by the text region encoding modes.

Reserved0

This field is not currently used and must be set to 0.

Looseness

A value between 0 and 100 that tells OP_JBIG2P how loose to be when matching symbols and compressing text using either of the lossy text region encoding modes: JBIG2_EncodeMode_Lossy_Text_MQ or JBIG2_EncodeMode_Lossy_Text_MMR. The larger the number, the greater the compression and the greater the risk of introducing errors. Set to 50 for a reasonably small filesize and low risk of error. If set to 0, the compression will be lossless.

 

JBIG2_UNION: OP_JBIG2P, OP_JBIG2E

The JBIG2_UNION structure supplies parameters to the OP_JBIG2E and OP_JBIG2P opcodes used for expanding JBIG2 images to DIBs and for compressing DIBs to JBIG2 images, respectively.

 
Copy Code
typedef struct {
   DWORD                           Reserved0;
   BYTE PICHUGE*                   Reserved1;
   BYTE PICHUGE*                   Reserved2;
   BYTE PICHUGE*                   Reserved3;
   BYTE PICHUGE*                   Reserved4;
   BYTE PICHUGE*                   Reserved5;
   BYTE PICHUGE*                   Reserved6;
   BYTE PICHUGE*                   Reserved7;
   BYTE PICHUGE*                   Reserved8;
   PICFLAGS                        PicFlags;
   PICFLAGS                        PicFlags2;
   REGION                          Region;
   DWORD                           StripSize;
   DWORD                           ImageWidth;
   DWORD                           ImageHeight;
   DWORD                           FileOrg;
   DWORD                           NumOfPages;
   DWORD                           PageNum;
   DWORD                           PageFlags;
   DWORD                           MaxStripeSize;
   JBIG2_REGION                    BaseJBIG2Region;
   DWORD                           NumOtherJBIG2Regions;
   JBIG2_REGION PICHUGE*           OtherJBIG2Regions;
} JBIG2_UNION;

Fields:

Name Description

Reserved0

Reserved1

Reserved2

Reserved3

Reserved4

Reserved5

Reserved6

Reserved7

Reserved8

These fields are not currently used and must be set to 0.

PicFlags

Set the PF_YieldPut flag if the RES_PUT_DATA_YIELD response is desired in OP_JBIG2E. Set the PF_YieldGet flag if the RES_GET_DATA_YIELD response is desired in OP_JBIG2P.

PicFlags2

Flags

Value

Meaning

PF2_SwapBW

Set to tell OP_JBIG2E to swap the black and white entries of the constructed colormap.

PF2_OmitPICMetaData Set to suppress insertion of Accusoft metadata in the output.

Region

This field is used to define image characteristics. OP_JBIG2E returns the image characteristics in this structure in addition to returning them in the PIC_PARM.Head structure.  OP_JBIG2P requires that these be set before the call to REQ_INIT.  For OP_JBIG2E, Stride can be changed from its default after REQ_INIT, before REQ_EXEC.

StripSize

This is set by REQ_INIT to the size of one input strip. For OP_JBIG2P, the Get queue buffer must be large enough to hold at least one strip. For OP_JBIG2E, the Put queue buffer must be large enough to hold at least one strip. Note that if Stride is changed after REQ_INIT, then StripSize must be recalculated accordingly.

ImageWidth

ImageHeight

OP_JBIG2E returns the full image width and height for the page retrieved in these fields. These will have the same value as the corresponding fields in PIC_PARM.Head and in uJBIG2.Region unless the output image is cropped. These fields are not used by OP_JBIG2P.

FileOrg

This field is used by OP_JBIG2P to set the file organization of the JBIG2 bitstream and by OP_JBIG2E to report the file organization of the bitstream.

Value

Meaning

JBIG2_FileOrg_Default

Default (sequential) organization.

JBIG2_FileOrg_Sequential

Sequential organization.

JBIG2_FileOrg_RandomAccess

Random access organization.

JBIG2_FileOrg_ForEmbeddedPDF

Reserved for internal use only.

NumOfPages

OP_JBIG2E attempts to determine this value for the compressed image and makes it available following REQ_INIT. OP_JBIG2P ignores this field.

PageNum

This field is used to request by page number which page of a multi-page JBIG2 document is to be expanded by OP_JBIG2E and must be set before the call to REQ_INIT. The default (set to 0) means use the ImageNumber member of the PIC_PARM structure to specify the page to expand by its position in the document. After REQ_INIT, this field will contain the number of the page expanded. OP_JBIG2P uses this field to determine the page number to assign to the image being encoded. For a single-page document, setting PageNum to 0 will assign the page number 1.

PageFlags

Flags

Value

Meaning

JBIG2_PageFlags_IsLossless

Set by OP_JBIG2E if the compressed image indicates the page is lossless. Used by OP_JBIG2P to set the lossless indicator bit in the page header of the compressed bitstream.

JBIG2_PageFlags_IsStriped

Set by OP_JBIG2E if the compressed image indicates the page is encoded in stripes, each of which is no longer than MaxStripSize

MaxStripeSize

This field directs OP_JBIG2P to encode the page as stripes, each of which is no longer than MaxStripeSize. The largest allowed value for this field is 32767. The default (set to 0) means no striping. Currently, a page can only be striped if encoded as a single generic region; otherwise this field is ignored. OP_JBIG2E returns this value as read from the bitstream setting JBIG2_PageFlags_IsStriped in PageFlags if the bitstream bit is set indicating that the page is striped.

BaseJBIG2Region

Structure for specifying parameters for base (or only if only one) JBIG2_REGION. See JBIG2_REGION.

NumOtherJBIG2Regions

Number of OtherJBIG2Regions when there is more than one. See JBIG2_REGION.

OtherJBIG2Regions

Pointer to array of NumOtherJBIG2Regions JBIG2_REGION structures. See JBIG2_REGION.

 

 


©2022. Accusoft Corporation. All Rights Reserved.

Send Feedback