PICTools Programmer's Reference
F2D_STRUC

F2D_STRUC: OP_F2D, OP_F2DPLUS

The F2D_STRUC structure supplies parameters to the OP_F2D and OP_F2DPLUS opcodes used to convert support image file formats (e.g., Targa, TIFF, etc.) to DIBs.

 
Copy Code
typedef struct {
   DWORD                 Reserved0;
   BYTE PICHUGE*         AuxSpace;
   BYTE PICHUGE*         Ptr2;
   BYTE PICHUGE*         GIFHead;
   DWORD PICHUGE*        TIFFIFDOffsetArray;
   BYTE PICHUGE*         MaskBuffer;
   BYTE PICHUGE*         Reserved6;
   BYTE PICHUGE*         Reserved7;
   BYTE PICHUGE*         Reserved8;
   PICFLAGS              PicFlags;
   PICFLAGS              PicFlags2;
   DWORD                 AllocType;
   DWORD                 AuxSize;
   DWORD                 AuxUsed;
   DWORD                 AuxNeeded;
   DWORD                 ApplyResponse;
   DWORD                 ProgressiveMode;
   BITMAPINFOHEADER      BiOut;
   DWORD                 YieldEvery;
   DWORD                 PhotoCDResolution;
   LONG                  Compression;
   BYTE                  TransparentColorIndex;
   BYTE                  RawG3FillOrder;
   BYTE                  RawG3PhotometricInterpretation;
   BYTE                  DisposalMethod;
   WORD                  DelayTime;
   BYTE                  BackgroundColor;
   BYTE                  AspectRatio;
   DWORD                 WidthPad;   
   WORD                  LogicalScreenWidth;   
   WORD                  LogicalScreenHeight;  
   WORD                  ImageLeftPosition;   
   WORD                  ImageTopPosition;     
   DWORD                 TIFFPhotometricInterpretation;
   DWORD                 TIFFIFDOffset;
   BYTE                  TIFFFirstByte;
   BYTE                  OutBpp;      
   BYTE                  Expansion10c;
   BYTE                  Expansion10d;
   DWORD                 MaskBufferSize;
   DWORD                 UseJ2DBehavior;
   DWORD                 EnhanceMethod;
} F2D_STRUC;

Fields:

Name Description

Reserved0

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

AuxSpace

AuxSpace may be set to point to a block of memory whose size is AuxSize. If applicable to the input image format and data, this block of memory will be returned by OP_F2D organized as a sequential series of one or more 'chunks'. Each chunk consists of a DWORD Tag, followed by a DWORD Length, followed by Length bytes of data. Thus the total length of each chunk is Length + 8. AuxUsed is set by OP_F2D to the sum of all the chunk(s) lengths output so far. See the OP_F2D input image format sections for additional information about AuxSpace and supported tags for each image format.

Ptr2

This field is not currently used by the OP_F2D opcode and must be set to 0.

GIFHead

GIFHead may be set to point to a 781-byte block of memory in which OP_F2D will return the GIF header. This is particularly useful if you want to process animated GIFs.

TIFFIFDOffsetArray

TIFFIFDOffsetArray may be set to point to an array of PIC_PARM.ImageNumber DWORDs that OP_F2D will fill with the TIFF IFD offsets from 1 to PIC_PARM.ImageNumber.

MaskBuffer

MaskBuffer may be set to point to an array of size MaskBufferSize in which OP_F2D will return the icon and mask. If zero, OP_F2D will assign to MaskBuffer a pointer to a buffer it allocates (and frees during REQ_TERM) to return the same information.

Reserved6

Reserved7

Reserved8

These fields are not used by the OP_F2D opcode and must be 0.

PicFlags

Flags that control the OP_F2D operation.

Value

Meaning

PF_IncludeBMPHead

If set, then the output data will begin with a BITMAPINFOHEADER, followed by a color map if applicable, followed by the DIB bits. If clear, then the output data will be the DIB bits only.

PF_IsGray

Set by OP_F2D on completion if the input image is a gray scale image. If a color table is present, and the color table consists entirely of shades of gray, then PF_IsGray is also set.

PF_ApplyTransparency

Set for an OP_F2DPLUS GIF image which has transparency data in order that transparent pixels are not set in the output DIB, allowing previous DIB pixels to show through the GIF image. If clear, then transparent pixels are set to the color whose color table index is the same as the transparent color index.

PF_NoDibPad

If set, OP_F2D will not pad the output DIB to a 4-byte boundary.

PF_WidthPadKnown

If set, the byte length of one DIB pixel line has been set by the application in WidthPad. Otherwise the length is computed by OP_F2D, padded to a 4-byte boundary unless PF_NoDibPad is set.

PF_NoCrossBlockSmoothing Set if the decode operation should not smooth edges between blocks (group of pixels). It is recommended to use this flag together with the EnhanceMethod field to enable proprietary image enhancement techniques and improve decoded image quality. Cross-block smoothing should only be enabled when working with overcompressed (more than 10:1) jpeg images with visible artifacts. In this case, the algorithm will perform slightly better than the recommended enhancement techniques with a similar decoding quality. In order to use the EnhanceMethod field, the UseJ2DBehavior field is required to be set to a value of 1.
PF_MultiImage  For GIF images, returned after REQ_EXEC to indicate there may be additional frames.

PicFlags2

Flags that control the OP_F2D operation.

Value

Meaning

PF2_IsInterlacedGIF

Set by OP_F2D on completion if the input image is an interlaced GIF.

PF2_GIFColorsSorted

Set by OP_F2D on completion if the input image is a GIF with sorted colors.

PF2_GIFAllow1and4Bpp

If set, OP_F2D will create 1 and 4 bpp DIBs for 2 and 16 color input GIFs, respectively. Otherwise, the output DIB will be 8 bpp.

PF2_PCXGetResolution

If set, PCX resolution information, if present, is biX/YPelsPerMeter.

PF2_RetrieveAlpha

If set, indicates that an alpha channel should be returned if any alpha information is present in the input file.

PF2_HaveAlpha

Set by OP_F2D, indicates that the original image had alpha or transparency information.

PF2_RGBAIsPremultiplied

Set by OP_F2D, indicates that RGB values are premultiplied by alpha.

AllocType

If non-zero, all input data must be present in the Get queue before REQ_EXEC. OP_F2D may advance the Get.Front pointer as it processes the input data. If so, the input data preceding Get.Front should not be considered to have been consumed by OP_F2D and that data must not be modified. Even though the entire input image is present, OP_F2D may issue RES_SEEK events. If so, these events can be handled as:

 
Copy Code

    case RES_SEEK:

      if ( ( PicParm.SeekInfo & SEEK_FILE ) == 0 )

        {

        PicParm.Get.Front =

          PicParm.Get.Start +

          ( PicParm.SeekInfo & SEEK_OFFSET );

        }

      else

        {

        /* if the Put queue is also large enough to hold

            the entire output image */

        PicParm.Put.Front = PicParm.Put.Rear =

          PicParm.Put.Start +

          ( PicParm.SeekInfo & SEEK_OFFSET );

        }

      break;

If AllocType is 0, then a smaller input queue may be used which does not contain all the input image data. In that case, OP_F2D may issue RES_SEEK events to access non-sequential locations in the input image. Assuming that the input image data resides in an open file, these RES_SEEK events might be handled as:

 
Copy Code

   case RES_SEEK:

      if ( ( PicParm.SeekInfo & SEEK_FILE ) == 0 )

        {

        PicParm.Get.Front = PicParm.Get.Rear =

          PicParm.Get.Start;

        lseek(infile, PicParm.SeekInfo & SEEK_OFFSET, 0);

        }

      else

        {

        /* if the Put queue is also too small to hold

            entire output image */

        PicParm.Put.Front = PicParm.Put.Rear =

          PicParm.Put.Start;

        lseek(outfile, PicParm.SeekInfo & SEEK_OFFSET, 0);

        }

      break;

AuxSize

The size of the AuxSpace buffer.

AuxUsed

The total length in the AuxSpace buffer which is currently consumed by chunks.

AuxNeeded

The additional space needed in the AuxSpace buffer when a RES_AUX_NEEDED response is returned. If AuxSize is not increased by at least AuxNeeded when REQ_CONT is called, then additional auxiliary data is not returned.

ApplyResponse

This field is not used by the OP_F2D opcode and must be 0.

ProgressiveMode

This field is only used for OP_F2DPLUS GIF images. Note that ProgressiveModes 1 and 3 are only useful if the data from prior interlace passes remain available in the Put queue for later interlace passes.

Value

Meaning

0

RES_DONE is returned four times. The first DIB returned is 1/8 the height of the full image. The second DIB returned is 1/4 the height of the full image. The third DIB returned is 1/2 the height of the full image. The final DIB returned is the complete image at full size.

1

RES_DONE is returned four times. Each returned DIB is the same size as the complete, full-size image. The first DIB has every 8th line, the second DIB has every 4th line and the third DIB has every 2nd line. In each case, the lines between the interlace pass lines are filled with copies of the preceding interlace pass line. The final DIB is the complete image at full size.

2

RES_DONE is returned once. The returned DIB is the complete image at full size.

3

RES_DONE is returned four times. Each returned DIB is the same size as the complete, full-size image. The first DIB has every 8th line, the second DIB has every 4th line, the third DIB has every 2nd line and the fourth DIB is the complete image. The first DIB fills in the lines between each 8th line with copies of the preceding line. The second DIB adds image data from the second interlace pass to the first DIB. The third DIB adds image data from the third interlace pass to the second DIB. The final DIB adds image data from the fourth interface pass to the third DIB. Only the first DIB fills in the lines between the current interface pass lines.

BiOut

When OP_F2D is complete (RES_DONE after REQ_EXEC), then BiOut contains the BITMAPINFOHEADER for the output DIB, whether or not PF_IncludeBMPHeader has been set in F2D.PicFlags.

YieldEvery

If PF_YieldPut is set in F2D.PicFlags, then OP_F2D returns a RES_PUT_DATA_YIELD response after every YieldEvery lines have been output to the Put queue.

PhotoCDResolution

This field is not currently used by the OP_F2D opcode and must be 0.

Compression

The TIFF input image compression is returned in this field.

Value

Meaning

0

Uncompressed

1

Uncompressed

2

Modified G3

3

1-dimensional G3

-3

2-dimensional G3

4

G4

5

LZW

6

JPEG (old style)

7

JPEG (new style)

8

Deflate (ZLIB)

32946

Deflate (ZLIB)

32773

Packbits

TransparentColorIndex

For OP_F2DPLUS, if a GIF image has transparent pixels, then when OP_F2DPLUS is complete, this value is the color index of the transparent pixels. If PF_ApplyTransparency were set, then the output DIB will not have replaced DIB pixels corresponding to GIF image pixels with this color index so this value will not be useful. If PF_ApplyTransparency is not set, then pixels in the output DIB which have this color index value were intended to be transparent pixels.

RawG3FillOrder

If a raw G3 fax is input, this field allows the TIFF FillOrder to be specified. RawG3FillOrder equal to 1 is equivalent to the usual TIFF FillOrder equal to 1, filling bytes from most-significant-bit to least-significant-bit. RawG3FillOrder not equal to 1 is equivalent to the unusual TIFF FillOrder equal to 2, filling bytes from lsb to msb. Although the usual TIFF FillOrder is 1, raw G3 faxes will usually require a RawG3FillOrder of 2.

RawG3PhotometricInterpretation

If a raw G3 fax is output, this field allows the TIFF PhotometricInterpretation to be specified. If RawG3PhotometricInterpretation is 0, then the input G3 fax is interpreted as the usual TIFF WhiteIsZero. Otherwise, the input G3 fax is interpreted as the unusual TIFF BlackIsZero. Ordinarily, raw G3 faxes will require a RawG3PhotometricInterpretation of 0.

DisposalMethod

For a GIF image, if the GIF89a Graphics Extension block is present, the disposal method field will be returned by OP_F2D in DisposalMethod. This field indicates what should occur after the graphic is displayed.

DelayTime

For a GIF image, if the GIF89a Graphics Extension block is present, the delay time field will be returned by OP_F2D in DelayTime. This field specifies the time (in hundredths of a second) to wait before continuing processing the data stream.

BackgroundColor

For a GIF image, the background color from the GIF header will be returned by OP_F2D in BackgroundColor.

AspectRatio

For a GIF image, the pixel aspect ratio from the GIF header will be returned by OP_F2D in AspectRatio. The actual pixel aspect ratio can be computed with

PixelAspectRatio = PixelWidth/PixelHeight = (AspectRatio+ 15) / 64

WidthPad

Specifies the width of an uncompressed DIB pixel line in bytes. WidthPad takes into account the number of bits needed to represent a pixel and any padding that may be required at the end of each line. WidthPad will be output by Pegasus aligned to a 4-byte boundary unless the PF_WidthPadKnown flag is set in PicFlags. If PF_WidthPadKnown is set, then WidthPad must be input by the application. If PF_NoDIBPad is set, then the WidthPad computed by Pegasus will not include any padding necessary to align the DIB to a 4-byte boundary.

LogicalScreenWidth

For a GIF image, the logical screen width from the GIF header will be returned by OP_F2D in LogicalScreenWidth.

LogicalScreenHeight

For a GIF image, the logical screen height from the GIF header will be returned by OP_F2D in LogicalScreenHeight.

ImageLeftPosition

For a GIF image, the image left position (the column number of the left edge of the image) from the GIF image descriptor will be returned by OP_F2D in ImageLeftPosition.

ImageTopPosition

For a GIF image, the image top position (the row number of the top edge of the image) from the GIF image descriptor will be returned by OP_F2D in ImageTopPosition.

TIFFPhotometricInterpretation

For a TIFF image, the value of the PhotoMetricInterpretation tag will be returned by OP_F2D in TIFFPhotometricInterpretation.

Value

Meaning

0

For bilevel and grayscale images 0 is imaged as white.

1

For bilevel and grayscale images 0 is imaged as black.

2

RGB 24bpp, no palette.

3

RGB palette.

4

Transparency Mask.

5

CMYK.

6

YCBCR.

8

CIELAB.

9

CIELABICC.

TIFFIFDOffset

If TIFFFirstByte is 'I' or 'M', then TIFFIFDOffset should be set either to the offset of the IFD to start scanning for the PIC_PARM.ImageNumber image, or to 0 to start scanning at the first IFD. Upon return, OP_F2D will set this member to the offset of the IFD for the requested image.

TIFFFirstByte

If TIFFFirstByte is 'I' or 'M' and TIFFIFDOffset is set, OP_F2D will skip reading the TIFF header.

OutBpp

For a BMP, ICO or TARGA image, if OutBpp is 32 and the input is 32 bpp, the output will be 32 bpp as well.

Expansion10c

Expansion10d

These fields are not used by the OP_F2D opcode and must be 0.

MaskBufferSize

For an ICO image, the number of bytes in MaskBuffer.

UseJ2DBehavior

Value

Meaning

0

When PF_NoCrossBlockSmoothing is NOT set, then use existing F2D TIFF JPEG behavior identical to
EnhanceMethod = (EM_ReduceContouring |
EM_ReduceArtifacts |
EM_ReduceBlockEdgeArtifacts)

1

When PF_NoCrossBlockSmoothing is NOT set, then use default behavior of J2D and the EnhanceMethod field below.

EnhanceMethod If PF_NoCrossBlockSmoothing is not set in PicFlags and the UseJ2DBehavior field is 1, then this field further specifies which of the Accusoft proprietary enhancement algorithms to apply when decompressing TIFF JPEG images. Either set this field to 0 to select Method 0 or set it to a value that is the bitwise 'OR' of the numeric values of the individual methods other than Method 0 to select those methods; any combination of methods may be chosen.

Method

Meaning

EM_CrossBlockSmoothing

Clean up low frequency contouring and artifacts (default).

EM_ReduceContouring

Clean up only low frequency contouring.

EM_ReduceArtifacts

Clean up only low frequency artifacts.

EM_ReduceBlockEdgeArtifacts

Clean up block edge artifacts.

 

 


©2022. Accusoft Corporation. All Rights Reserved.

Send Feedback