Harlequin RIP SDK

The tiling method API is used to sub-divide a page or HVD element, represented by a device space bounding box, into a series of tiles. More...

Files

file  tileapi.h
 Header file defining the Tiling method API.
 

Data Structures

struct  sw_tile_bbox
 Definition of a device space tile bounding box. More...
 
struct  sw_tiling_api_20190924
 The tiling method API. More...
 

Typedefs

typedef HqnResult sw_tile_result
 Return status of the tiling API functions. More...
 
typedef struct sw_tile_iteration_opaque * sw_tile_iteration
 Opaque definition of a tiling iteration.
 
typedef struct sw_tiling_api_20190924 sw_tiling_api_20190924
 The tiling method API.
 

Enumerations

enum  SW_TILE_RESULT { SW_TILE_SUCCESS = HQN_RESULT_SUCCESS , SW_TILE_ERROR , SW_TILE_ERROR_PARAMS , SW_TILE_ERROR_MEMORY }
 Return codes for API calls. More...
 

Functions

HqnResult tileapi_result_translate (sw_tile_result result)
 Translate a tiling API-specific error code to a generic HqnResult error code. More...
 

Detailed Description

The tiling method API is used to sub-divide a page or HVD element, represented by a device space bounding box, into a series of tiles.

When rendering PDF or any of the image formats supported by the HqnImage procset (such as TIFF or JPEG input), the Harlequin RIP can tile pages. Tiling is not supported for PostScript, EPS, or GIF input. Tiling allows very large pages to be split over multiple RIPs and processed in parallel, and it may lower peak memory usage to process large pages. The PostScript language configuration for Tiling is described in the Extensions Manual.

Tiling API implementations

Each implementation of the tiling method API defines an algorithm to produce a series of device-space tile bounding boxes, given: a page or element number, a device-space bounding box, and configuration parameters for the algorithm. Tiling methods may be implemented in either the RIP core or RIP skin.

Implementations of the tiling method API are represented using sw_tiling_api_20190924 structures. These are registered in RDR as Named RDRs, using the RDR_NAMES_TILEAPI namespace, the name under which the tiling method is selected by settilingparams as the name, and the tiling API version number (20190824) as the ID. The data registered in RDR is a pointer to the API structure, and the length of the API structure:

// ...define the methods for this API instance...
static sw_tiling_api_20190924 my_tiling_method = {
validate_params, start_tiling, count_tiles, get_tiles, end_tiling,
} ;
//...
20190924, // Tiling API version
&my_tiling_method, sizeof(my_tiling_method),
// ...cleanup and return...
}
sw_rdr_result SwRegisterNamedRDR(sw_rdr_namespace rdrspace, const char *name, size_t namelen, sw_rdr_id rdrid, void *ptr, size_t length, sw_rdr_priority priority)
Register a Named RDR.
@ SW_RDR_SUCCESS
Definition: rdrapi.h:617
@ RDR_NAMES_TILEAPI
Definition: rdrapi.h:560
@ SW_RDR_NORMAL
Definition: rdrapi.h:610
#define CSTRING_AND_LENGTH(s1_)
Definition: std.h:156
The tiling method API.
Definition: tileapi.h:264

You can register the tiling method instance at any time before making the settilingparams call to configure it. Registration does require RDR to be active, so can be performed at any time after the Harlequin RIP SDK is started, until the Harlequin RIP SDK is shutdown.

The RIP core looks up the configured method for a particular context (/Page, /HVDPage, or /HVDElement) by getting the /Method key from the current tiling parameters dictionary, and looking up the named instance in RDR.

The Harlequin RIP SDK defines three implementations of the tiling API, which you can use for tiling as-is, or use as a model for your own tiling methods. These are:

Rectangular
This implements regular rectangular tilings, potentially with overlaps. It is implemented in tiling_rectangular.c, and documented in the Extensions Manual.
Explicit
This implements explicit tilings, where the client tells the tiling method exactly which tiles to generate. This in implemented in tiling_explicit.c, and documented in the Extensions Manual. This method is used by the Scalable RIP when tiling the same page across multiple Farm RIPs.
Error
This method returns errors for all calls. It exists so that it can be used to abort RIPping when an unexpected job type or job configuration is used. This method in implemented in tiling_error.c, and documented in the Extensions Manual.

The Harlequin SDK registers these implementations when the SDK is started.

Tiling API methods

The RIP makes a call on the tiling method API when configured for tiling using the settilingparams operator. An initial call validates parameters during settilingparams. When a page or element configured for tiling is about to be rendered, additional calls start a tiling iteration, count the number of remaining tiles in a tiling iteration, get a number of the remaining tiles in the tiling iteration, and end the tiling iteration. More than one tiling iteration may be in progress simultaneously, so tiling method implementations should use the iteration handles to contextualize their operation.

The initial call made during settilingparams is sw_tiling_api_20190924::validate(). This is given a data API datum parameter that can be used to extract the configuration parameters provided in the settilingparams method sub-dictionary. An error can be returned if the parameters are not valid or appropriate.

When the RIP is ready to render a tiled page or element, it will call sw_tiling_api_20190924::start_tiling(). This is also given a data API datum parameter that can be used to extract the configuration parameters provided in the settilingparams method sub-dictionary. It should check that the parameters are valid, and not assume that the validate() method was sufficient. If successful, this method returns a tiling iterator, which will be used by the remaining method calls.

The sw_tiling_api_20190924::count_tiles() method may be called to return the number of tiles remaining in an iterator. The return value may be zero, if there are no tiles left. The sw_tiling_api_20190924::get_tiles() method will be called request a number of tiles. The number of tiles requested may be larger than the number of remaining tiles in the iterator, so this method will update the number of tiles and store device space bounding boxes for all tiles returned in the locations provided for them.

When all tiling iteration has been performed, the sw_tiling_api_20190924::end_tiling() method will be called to free any resources used by the tiling iterator. This method is always called if the start_tiling() method was successful, even if an error occurred in extracting or processing tiles.

Tiling and the raster backend

When outputting a tiled page, the raster output backend receive bands of data as normal. The only difference it may notice is the the RasterDescription::pageRelativeBBox array will have non-zero values in it. This indicates that this raster is part of a larger overall page, and indicates where in the page the raster is located. For information and a diagram of the page relative bounding box relation ship to the page, see Raster bounding boxes, margins and size.

Tiling and the Scalable RIP

When tiling parameters are specified for a job (see settilingparams operator in the Extensions Manual), the Scalable RIP schedules tiles to Farm RIPs. There are two different ways this is done, depending on the setting of ScheduleIndividualTiles in the RIP Farm JSON configuration ripfarm_global.json file:

HVD with Tiling and the Scalable RIP

If /HVDElement tiling has been specified, ScheduleIndividualTiles is assumed to be false. This means chunks of pages are always sent to individual Farm RIPs that do their own HVD scanning in isolation, taking into account any tiling parameters specified. This is because we cannot pre-scan /HVDElement tiles in the controlling RIP to determine the elements that will be produced.

If there is no /HVDElement specified but /HVDPage is specified, the HVD page tiles are scheduled based on the ScheduleIndividualTiles value, but with slightly different semantics to those described above:

Typedef Documentation

◆ sw_tile_result

Return status of the tiling API functions.

This is a subclass of HqnResult that also supports some specific extra error codes generated by tiling API functions (declared as the SW_TILE_RESULT enumeration). Before assigning to values of HqnResult type or any of its other subclasses, sw_tile_result values must be converted to change the API specific values to HQN_RESULT_SUCCESS or a monitor UID error code greater than MON_CLASS_ERROR. This can be done by calling the function tileapi_result_translate().

Enumeration Type Documentation

◆ SW_TILE_RESULT

Return codes for API calls.

Enumerator
SW_TILE_SUCCESS 

Normal return value.

SW_TILE_ERROR 

Unspecified tiling error

SW_TILE_ERROR_PARAMS 

Invalid parameters to tiling method

SW_TILE_ERROR_MEMORY 

Memory allocation failed.

Function Documentation

◆ tileapi_result_translate()

HqnResult tileapi_result_translate ( sw_tile_result  result)

Translate a tiling API-specific error code to a generic HqnResult error code.

Parameters
[in]resultOne of the SW_TILE_RESULT values, or an error value greater than MON_CLASS_ERROR.
Returns
Either HQN_RESULT_SUCCESS, or an error value greater than MON_CLASS_ERROR.