(Page 10 of 13 in this chapter)


2.9 Online Image Conversion

Online (on-the-fly) conversions take place while transmitting and receiving a fax. Since image conversion consumes significant processor time, you may want to perform file conversions offline using nfxConvertFileDirect in order to continue processing events during an active fax session.

NaturalFax uses parameters to determine how a fax will be transmitted, received, and stored.

The receive and transmit data structures, NFX_RECEIVE_PARMS and NFX_TRANSMIT_PARMS, contain image format parameters for encoding, resolution, and page width. These parameters are used to determine the desired format of the image being transmitted or received.

The on-the-fly (OTF) conversion parameter refers to the process of changing image format while the fax is being sent or received. The OTF parameter may be set to:

Once an image is received, the data structure NFX_DOCS_PARMS contains the image parameters to determine how the image will be stored.

The receive data structure also contains the bad line action parameter, badlineaction. The parameter may be set to:

2.9.1 Conversions When Transmitting Faxes

Figure 8 illustrates the conversions which take place during fax transmission.

The first step in determining the transmission format is based on the capabilities of the transmitter and receiver. The remote receiver announces its capabilities in the DIS frame. NaturalFax uses the image format parameters in the NFX_TRANSMIT_PARMS structure and the receiver's capabilities to choose the transmission format. The transmission format is set to the NFX_TRANSMIT_PARMS value if the remote receiver is capable of supporting it; otherwise the nearest value supported by the receiver is chosen.

The next step in determining the transmission format is based on the setting of the OTF mode parameter. The image format of the file is compared with the desired transmission format. When the OTF mode parameter is set to NFX_OTF_NEVER, if the file format requires capabilities less than or equal to the desired transmission format, the file format becomes the new transmission format. If the file requires more capabilities than is specified by the desired transmission format, a failure event is returned (NFXEVN_SESSION_DONE with the reason NFXERR_CONVERSION_REQUIRED) and no file is sent since the system cannot satisfy the needs of the receiver without doing a file conversion.

When the OTF mode parameter is set to NFX_OTF_ONLY_IF_FAIL, if the file format requires capabilities less than or equal to the desired transmission format, the file format becomes the new transmission format. If the file requires more capabilities than is specified by the desired transmission format, the file is converted to match the desired transmission format.

For NFX_OTF_ALWAYS, the desired transmission format will always be used for the encoding characteristics. There will only be a conversion for resolution and page width if it is necessary to support a lesser transmission capability.

Once the decision is made, the transmission format is sent back to the receiver in the DCS message. You can interrogate the NFX_DOC_STATUS and NFX_STATUS data structures to find out what format was chosen.

In general, the NFX_TRANSMIT_PARMS should be set to NFX_ENCODE_2D, NFX_RESOLUTION_SUPER_HIGH, and NFX_PAGE_WIDTH_A3. These settings use the best capabilities of the receiving fax machine. The OTF mode parameter can be set to NFX_OTF_ONLY_IF_FAIL to minimize the host execution time, or to NFX_OTF_ALWAYS to minimize transmission time. Checking and replacing of bad lines is done if the OTF parameter is set to NFX_OTF_ONLY_IF_FAIL or NFX_OTF_ALWAYS.

Figure 8. Image Format Decision When Transmitting

2.9.2 Conversions When Receiving Faxes

Figure 9 illustrates the conversions which take place while receiving a fax.

When receiving a fax, the NFX_RECEIVE_PARMS are used to compose a DIS frame to announce the desired capabilities to the transmitter. The transmitter sends back a DCS message with the chosen transmission format.

Once the transmission format is determined, the NFX_DOC_PARMS structure and the OTF mode parameter are used to determine how the incoming data is actually stored in the file. Conversion will only take place if the OTF mode parameter is set to NFX_OTF_ALWAYS. Otherwise, the file is stored in the format received.

For NFX_OTF_ALWAYS, the NFX_DOC_PARMS for the document determines the format of the file. Even a conversion from lower to higher resolution and narrower to wider pages is performed. After the document is received, the NFX_DOC_STATUS or NFX_STATUS structure can be examined to find out the resulting file format.

The most efficient way to manage image conversion when receiving a fax is to accept the highest quality that the sender can provide and saving directly to a file. Set the NFX_RECEIVE_PARMS to NXF_ENCODE_2D, NFX_RESOLUTION_SUPER_HIGH, and NFX_PAGE_WIDTH_A3. The OTF mode parameter should be set to NFX_OTF_NEVER. While receiving, checking and possibly replacing bad lines is done based on the bad line action parameter regardless of the setting of the OTF mode parameter.

Figure 9. Image Format Decision When Receiving



(Page 10 of 13 in this chapter)


tech_support@nmss.com
Copyright © 1997, Natural MicroSystems, Inc. All rights reserved.