PICTools Programmer's Reference
LOSSLESS3

The LOSSLESS3 structure supplies parameters to the following:

LOSSLESS3: OP_LIE3, OP_LIE3PLUS

The LOSSLESS3 structure supplies parameters to the OP_LIE3 and OP_LIE3PLUS opcodes used for expanding IMStar or lossless JPEG images to DIBs.

 
Copy Code
typedef struct {
   DWORD                           Reserved0;
   LAYER PICHUGE*                  Layer;
   BYTE PICHUGE*                   AHT;
   BYTE PICHUGE*                   Reserved3;
   RGBQUAD PICHUGE*                UniversalCT;
   BYTE PICHUGE*                   Reserved5;
   BYTE PICHUGE*                   Reserved6;
   BYTE PICHUGE*                   Reserved7;
   BYTE PICHUGE*                   Reserved8;
   PICFLAGS                        PicFlags;
   PICFLAGS                        PicFlags2;
   REGION                          Region;
   LONG                            StripSize;
   SHORT                           NumUC;
   SBYTE                           MinLayerWanted;
   SBYTE                           CurrentLayer;
   BYTE                            RestartLo;
   BYTE                            RestartHi;
   BYTE                            ProgHeight;
   BYTE                            NumRestarts;
   DWORD                           RestartOff[4];
   PICXSHORT                       NumOfPages;
   PICXSHORT                       PageNum;
   SHORT                           Transparent;
   SHORT                           UserDelay;
   PICXSHORT                       XOff;
   PICXSHORT                       YOff;
   BYTE                            DispMethod;
   BYTE                            AllowedBitErr;
   BYTE                            CompMethod;
   BYTE                            CompOrder;
   BYTE                            PTuning;
   BYTE                            Channel;
   BYTE                            IOPixType;
   BYTE                            NativeBpp;
   DWORD                           RestartCount;
   DWORD                           SetBits;
   DWORD PICHUGE*                  PixelMap;
   BYTE                            EffectiveBpp;
   BYTE                            PrecisionUCT;
   BYTE                            Reserved9[2];
   DWORD                           AHTLen;
   DWORD                           AppsToOmit;
   DWORD                           NumUC2;
   LONG                            ImageWidth;
   LONG                            ImageHeight;
} LOSSLESS3;

Fields:

Name Description

Reserved0

Layer

AHT

Reserved3

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

UniversalCT

UniversalCT allows the application to specify a translation from input pixel gray scale or color component brightness levels to corresponding output pixel values.

The number of elements in the translation array is NumUC2.

The precision in bits of each element is PrecisionUCT:

  • When PrecisionUCT is less than or equal to 8, UniversalCT is considered to be a pointer to an array of BYTE values.
  • When PrecisionUCT is between 9 and 16, inclusively, UniversalCT is considered to be a pointer to an array of WORD values.

The input gray level is interpolated to obtain the zero-based index into the UniversalCT table:

 
Copy Code
NumInputGrayLevels = 2NativeBpp – AllowedBitErr
UniversalCTIndex = InputGrayLevel * ( NumUC2 – 1 ) / ( NumInputGrayLevels – 1 )
When PrecisionUCT is different than the output pixel precision, typically Region.Bpp, each UniversalCT element is interpolated into the valid pixel range. 

Reserved5

Reserved6

Reserved7

Reserved8

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

PicFlags

Flags that control or report on the OP_LIE3 operation.

Value

Meaning

PF_HaveWatermark

If set by OP_LIE3, then a watermark was encountered in the input image and returned in PIC2List.  If the PIC2List is 0 or PIC2ListSize is 0, or if the PIC2List is not reallocated in response to a RES_EXTEND_PIC2LIST response, then the watermark may be discarded and PF_Watermark will not be set.

PF_IsTransparency

If set by OP_LIE3, then Transparent contains the color index for transparent pixels.  Otherwise Transparent is -1.

PF_YieldPut

If set by the application, then OP_LIE3 will periodically return RES_PUT_DATA_YIELD as it expands the image.

PF_IgnoreBadSuffix

If set by the application, forces the decompressor to use non-compliant decoding, thereby allowing certain non-compliant, non-Accusoft images to be decompressed. If PF_AutoIgnoreBadSuffix is set requesting automatic detection and decoding, then OP_LIE3 sets or clears this flag to indicate whether it used non-compliant or compliant decoding, respectively. This flag is not needed for images compressed with OP_LIP3.

PF_AutoIgnoreBadSuffix

If set by the application, use the Accusoft-proprietary automatic detection algorithm to decode a 16bpp image that may or may not be compliant. This flag is not needed for images compressed with OP_LIP3.

PicFlags2

Additional Flags that control or report on the OP_LIE3 operation.

Value

Meaning

PF2_FastDecompress

Set by OP_LIE3 if the more optimized lossless JPEG decompressor was used because the image was 8bpp grayscale, predictor 1, with an appropriate Huffman table, and decompressed with a full-size Put queue.

PF2_FoundDicom

Set by OP_LIE3 if it detects a DICOM file that therefore may contain more than one image to decode.

PF2_FoundEOI

Set by OP_LIE3 if the End Of Image marker was reached.

PF2_AllowOutOfRangeBits If set by the application, out-of-range bits in output pixels will not be masked off. Without this flag, out-of-range bits will be masked off to keep them in range.
PF2_FoundBadPaddingBits Set by OP_LIE3PLUS to signify that padding bits that are not all ones were encountered in the image.
PF2_AllowBadPaddingBits If set by the application, then OP_LIE3PLUS will not set the Status to ERR_BAD_DATA when padding bits which are not all ones are encountered. This does not affect PF2_FoundBadPaddingBits being set.

Region

OP_LIE3 returns the image's characteristics in this structure and in PIC_PARM.Head. For images with stride greater than 32767, REGION2 should be used (see the discussion of the REGION2 structure) and ParmVerMinor must be at least 4. 

StripSize

Prior to REQ_INIT, indicates the minimum strip length in bytes.

Upon RES_PUT_NEED_SPACE, indicates the strip length in bytes for the current layer only.

After REQ_INIT, indicates the maximum strip length in bytes and the minimum PUT queue size.                          

NumUC

This field has been deprecated and must be set to 0. Use NumUC2 instead.

MinLayerWanted

CurrentLayer

RestartLo

RestartHi

ProgHeight

NumRestarts

RestartOff

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

NumOfPages

For PIC2 input files only, a comment stored with the image to indicate the cardinality of a set of images to which the current image belongs. This value is reported, but otherwise ignored.

PageNum

For PIC2 input files only, a comment stored in the image to identify the current image in a set of images to which it belongs. This value is reported, but otherwise ignored.

Transparent

For PIC2 input files only, a comment stored with the image to denote the intended transparent color index. This value is reported, but otherwise ignored.

When presenting the current image as an overlay upon another image, the pixels in the current image whose color index match this value should not obscure coinciding pixels of the overlaid image.

UserDelay

For PIC2 input files only, a comment stored with the image to indicate the intended count of 10ms intervals to wait before replacing the current image with the next image. This value is reported, but otherwise ignored.

When presenting the current image in a series of images, the next image should not be displayed until this delay has elapsed.

XOff

For PIC2 input files only, a comment stored with the image to indicate its intended overlay horizontal offset. This value is reported, but otherwise ignored.

When presenting the current image as an overlay upon another image, the left edge of the current image should be horizontally offset from the left edge of the overlaid image by this amount.

YOff

For PIC2 input files only, a comment stored with the image to indicate its intended overlay vertical offset. This value is reported, but otherwise ignored.

When presenting the current image as an overlay upon another image, the top edge of the current image should be vertically offset from the top edge of the overlaid image by this amount.

DispMethod

For PIC2 input files only, a comment stored with the image to indicate its intended disposition method. This value is reported, but otherwise ignored.

When presenting the current image with a series of images, this transition technique should be used to replace the current image with the next image.

AllowedBitErr

The number of least significant bits that were masked off of each pixel’s gray level before compression. Non-zero AllowedBitErr values imply lossy image compression; the original image cannot be recovered losslessly.

See the LOSSLESS3: OP_LIP3 section for a description of the meaning of AllowedBitErr during compression.

CompMethod

The method used to compress the image.

Value

Meaning

METHOD_JPEG

Lossless JPEG compression

METHOD_PPMD

IMACSTAR compression

METHOD_LOCO

Lossless LOCO

See the LOSSLESS3: OP_LIP3 section for a description of the meaning of CompMethod during compression.

CompOrder

A compression tuning parameter:

  • For lossless JPEG compression, this value specifies the predictor value.  Valid values are 1 to 7, inclusively.
  • For IMACSTAR compression, this value specifies the order, or length, of the context used to predict image pixels. Valid values are 0 to 4, inclusively.
  • For lossless LOCO compression, this value is unused.

See the LOSSLESS3: OP_LIP3 section for a description of the meaning of CompOrder during compression.

PTuning

Channel

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

IOPixType

Instructs OP_LIE3 to convert decompressed image pixels to the specified type.

IOPixType is only used with lossless JPEG images that use compression order 1, lack restart markers, and possess an effective bit depth of 8bpp.

When a UniversalCT table is provided, IOPixType is ignored.

NativeBpp

The native bits per pixel of the compressed image.

RestartCount

The number of pixels between restart markers.

SetBits

PixelMap

EffectiveBpp

These fields are used internally and must be set to 0.

PrecisionUCT

Establishes the precision of UniversalCT values.

When PrecisionUCT is different than the output pixel precision, typically Region.Bpp, each UniversalCT element is interpolated into the valid pixel range.

Reserved9

AHTLen

AppsToOmit

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

NumUC2

The number of universal colors in UniversalCT. If setting this field, ensure that NumUC is 0.

ImageWidth

Original width of the image, in pixels, before cropping.

ImageHeight

Original height of the image, in pixels, before cropping.

 

LOSSLESS3: OP_LIP3, OP_LIP3PLUS

The LOSSLESS3 structure supplies parameters to the OP_LIP3 and OP_LIP3PLUS opcodes used for compressing DIB or RAW image data to Lossless JPEG or IMStar images.

 
Copy Code
typedef struct {
   DWORD                           Reserved0;
   LAYER PICHUGE*                  Layer;
   BYTE PICHUGE*                   AHT;
   BYTE PICHUGE*                   Reserved3;
   RGBQUAD PICHUGE*                UniversalCT;
   BYTE PICHUGE*                   Reserved5;
   BYTE PICHUGE*                   Reserved6;
   BYTE PICHUGE*                   Reserved7;
   BYTE PICHUGE*                   Reserved8;
   PICFLAGS                        PicFlags;
   PICFLAGS                        PicFlags2;
   REGION                          Region;
   LONG                            StripSize;
   SHORT                           NumUC;
   SBYTE                           MinLayerWanted;
   SBYTE                           CurrentLayer;
   BYTE                            RestartLo;
   BYTE                            RestartHi;
   BYTE                            ProgHeight;
   BYTE                            NumRestarts;
   DWORD                           RestartOff[4];
   PICXSHORT                       NumOfPages;
   PICXSHORT                       PageNum;
   SHORT                           Transparent;
   SHORT                           UserDelay;
   PICXSHORT                       XOff;
   PICXSHORT                       YOff;
   BYTE                            DispMethod;
   BYTE                            AllowedBitErr;
   BYTE                            CompMethod;
   BYTE                            CompOrder;
   BYTE                            PTuning;
   BYTE                            Channel;
   BYTE                            IOPixType;
   BYTE                            NativeBpp;
   DWORD                           RestartCount;
   DWORD                           SetBits;
   DWORD PICHUGE*                  PixelMap;
   BYTE                            EffectiveBpp;
   BYTE                            PrecisionUCT;
   BYTE                            Reserved9[2];
   DWORD                           AHTLen;
   DWORD                           AppsToOmit;
   DWORD                           NumUC2;
   LONG                            ImageWidth;
   LONG                            ImageHeight;
} LOSSLESS3;

Fields:

Name Description

Reserved0

Layer

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

AHT

Points to an optional Abbreviated Huffman Table that is used when PF_SkipHuffman is set in PicFlags.

The length of the table must be assigned to AHTLen.

Reserved3

UniversalCT

Reserved5

Reserved6

Reserved7

Reserved8

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

PicFlags

Flags that control or report on the OP_LIP3 operation.

Value

Meaning

PF_HaveWatermark

If set by the application, a P2P_Watermark packet in PIC2List will be combined with the image in such a way that the watermark can be recovered when the image is expanded.  In this case the compression is lossy, because the original source image pixel values cannot be exactly recovered, although the loss will ordinarily be invisible.  A watermark cannot be combined with non-grayscale, 1bpp images.

PF_HaveTransparency

If set by the application, then Transparent contains the color index for transparent pixels.

PF_DidPolish

If set by OP_LIP3, then a CRC was added to the image. A CRC is only added to PIC2 images and only when the Put buffer is large enough to hold the entire image.

PF_JPEGFileOnly

If set by the application, a standard lossless JPEG file will be created instead of the default PIC2 file.

PF_LIPUseYCbCrForColors

If set by the application, then 24bpp RGB input pixels are converted to a pseudo-YCbCr colorspace before compression.  This proprietary format requires PICTools for viewing, but compresses better than RGB and is still lossless.

PF_SkipHuffman

If set by the application, OP_LIP3 will not create a Huffman table.  Instead, the table pointed to by AHT will be used if AHT is not NULL, otherwise built-in default tables will be used.  The default tables are faster than generating optimum Huffman values because a prepass through the data is avoided.

PF_YieldGet

If set by the application, then OP_LIP3 will periodically return RES_GET_DATA_YIELD as it compresses the image.

PicFlags2

Additional flags that control or report on the OP_LIP3 operation.

Value

Meaning

PF2_AHTCodeChanged

If set by OP_LIP3, then AHT was detected to specify a single 15-bit Huffman code and zero, one or two 16-bit Huffman codes.  The codes were changed to avoid having to generate a 0xFFFF code to code a prefix not coded by the AHT.

Region

If F_Raw is set in PIC_PARM.Flags, then this structure describes the image characteristics and PIC_PARM.Head is not used.   For images with a stride greater than 32767, REGION2 should be used (see the discussion of the REGION2 structure) and ParmVerMinor must be at least 4. 

StripSize

After REQ_INIT, indicates the maximum strip length in bytes and the minimum GET queue size.

NumUC

MinLayerWanted

CurrentLayer

RestartLo

RestartHi

ProgHeight

NumRestarts

RestartOff

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

NumOfPages

For PIC2 output files only, a comment stored with the image to indicate the cardinality of a set of images to which the current image belongs.

PageNum

For PIC2 output files only, a comment stored with the image to identify the current image in a set of images to which it belongs.

Transparent

For PIC2 output files only, a comment stored with the image to denote the intended transparent color index. The value -1 indicates no transparent color is used.

A value is not written unless PF_ApplyTransparency is set in PicFlags.

When presenting the current image as an overlay upon another image, the pixels in the current image whose color index match this value should not obscure coinciding pixels of the overlaid image.

UserDelay

For PIC2 output files only, a comment stored with the image to indicate the intended count of 10ms intervals to display the current image.

When presenting the current image in a series of images, the next image should not be displayed until this delay has elapsed.

XOff

For PIC2 output files only, a comment stored with the image to indicate its intended overlay horizontal offset. 

When presenting the current image as an overlay upon another image, the left edge of the current image should be horizontally offset from the left edge of the overlaid image by this amount.

YOff

For PIC2 output files only, a comment stored with the image to indicate its intended overlay vertical offset. 

When presenting the current image as an overlay upon another image, the top edge of the current image should be vertically offset from the top edge of the overlaid image by this amount.

DispMethod

For PIC2 output files only, a comment stored with the image to indicate its intended disposition method.

When presenting the current images with a series of images, this transition technique should be used to replace the current image with the next image.

AllowedBitErr

Use AllowedBitErr to filter noise or other low-intensity variations from grayscale images.  Non-zero AllowedBitErr values indicate the number of least significant bits to mask from each pixel’s gray level prior to compression.  This may improve the compression and, in some cases, the appearance of the image.  However, non-zero AllowedBitErr values imply lossy image compression; the original image cannot be recovered losslessly.

AllowedBitErr must be 0 for non-grayscale images.

CompMethod

Must be set to one of the compression methods listed in the table below or left as 0, which is equivalent to METHOD_AUTO.

Value

Meaning

METHOD_AUTO

Picks compression based on image type.

METHOD_JPEG

Standard lossless JPEG compression. Appropriate for continuous-tone images such as photographs and x-rays. To create a standards-compliant lossless JPEG file, also set PF_JPEGFileOnly in PicFlags; otherwise, the result will be lossless JPEG in a proprietary PIC2 file.

METHOD_PPMD

IMPACSTAR compression. Appropriate for discrete images such as computer graphics, maps, cartoons and faxes.

METHOD_LOCO

Lossless LOCO. Appropriate for continuous-tone images such as photographs and x-rays.

CompOrder

For lossless JPEG, CompOrder specifies the predictor value. The value may be between 1 and 7, inclusively. For best performance set to 1.

For IMStar compression, CompOrder specifies the order, or length, of the context that used to predict the image pixels. The value may be between 0 and 4, inclusively. When 0, an order of 4 will be used.

For Lossless LOCO, this value is ignored.

PTuning

Channel

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

IOPixType

After REQ_EXEC, indicates the pixel type of the output image.

NativeBpp

After REQ_EXEC, indicates the native bit depth of the output image.

RestartCount

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

SetBits

PixelMap

EffectiveBpp

These fields are used internally by OP_ LIP3 and must be set to 0.

PrecisionUCT

Reserved9

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

AHTLen

The length, in bytes, of the AHT buffer.

AppsToOmit

This bit flag field indicates which application markers should be omitted.

Set bit 0 to exclude the LJIF App0 marker from the output stream.

NumUC2

ImageWidth

ImageHeight

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

 

 


©2022. Accusoft Corporation. All Rights Reserved.

Send Feedback