HPDFSelectFlatePredictor Function
Selects identity, TIFF or PNG predictor encoding by comparing bounded distributed row samples
Declaration
function HPDFSelectFlatePredictor(const Data: AnsiString; Colors,
BitsPerComponent, Columns: Integer;
const Options: THPDFFlatePredictorSelectionOptions;
out Info: THPDFFlatePredictorSelectionInfo): Integer;
Unit
HPDFPredictor
Parameters
| Name | Purpose |
|---|---|
Data | Complete unfiltered rows packed in PDF sample order |
Colors | Number of colour components per pixel |
BitsPerComponent | Sample width of 1, 2, 4, 8 or 16 bits |
Columns | Pixel count in each complete input row |
Options | Hard sample-byte, row and work limits plus the CPU cost weight |
Info | Returns the selected predictor, sampled size, candidate count, estimated costs, work used and budget status |
Return value
Returns 1, 2 or a PNG predictor from 10 through 15
Usage notes
- Start with
HPDFDefaultFlatePredictorSelectionOptionsand override only the budgets or CPU weighting required by the workload - Rows are sampled deterministically across the complete input instead of only from its leading bytes
- The selector never exceeds
MaxSampleBytes,MaxSampleRowsorMaxWorkUnits - A higher
CPUCostWeightfavours less expensive predictors when their estimated byte costs are close - Use
HPDFTrySelectFlatePredictorwhen invalid geometry or options should return a diagnostic instead of raisingEHPDFPredictorError
Example
Options := HPDFDefaultFlatePredictorSelectionOptions;
Predictor := HPDFSelectFlatePredictor(Raster, 3, 8, Width, Options, Info);
Predicted := HPDFEncodePredictor(Raster, Predictor, 3, 8, Width);