public class GenericRefinementRegionDecodingProcedure extends Object
This class is purely algorithmic. It has no knowledge of how its inputs
are obtained and no dependency on segment headers or input streams.
The entry point is the static decode() method; callers
supply the ArithmeticDecoder and CX context model directly,
so they decide whether to create fresh instances or share existing ones:
GenericRefinementRegion — creates its own
ArithmeticDecoder and CX, then calls decode().ArithmeticDecoder and CX.ArithmeticDecoder and CX.This class cannot be instantiated by callers. The private constructor and
the internal run(int, int, short, boolean, org.apache.pdfbox.jbig2.Bitmap, int, int, short[], short[]) method exist solely to let the many private helper
methods share state through fields rather than through long parameter lists.
| Modifier and Type | Class and Description |
|---|---|
static class |
GenericRefinementRegionDecodingProcedure.Template
Encapsulates the template-specific operations: context bit formation
(
GenericRefinementRegionDecodingProcedure.Template.form(short, short, short, short, short)) and initial CX index selection (GenericRefinementRegionDecodingProcedure.Template.setIndex(org.apache.pdfbox.jbig2.decoder.arithmetic.CX)). |
| Modifier and Type | Field and Description |
|---|---|
static GenericRefinementRegionDecodingProcedure.Template |
T0
Singleton template 0 instance (stateless).
|
static GenericRefinementRegionDecodingProcedure.Template |
T1
Singleton template 1 instance (stateless).
|
| Modifier and Type | Method and Description |
|---|---|
static Bitmap |
decode(ArithmeticDecoder arithDecoder,
CX cx,
int width,
int height,
short grTemplate,
boolean isTPGROn,
Bitmap referenceBitmap,
int referenceDX,
int referenceDY,
short[] grAtX,
short[] grAtY)
Executes the Generic Refinement Region decoding procedure (§6.3.5.6) and
returns the decoded bitmap.
|
public static final GenericRefinementRegionDecodingProcedure.Template T0
public static final GenericRefinementRegionDecodingProcedure.Template T1
public static Bitmap decode(ArithmeticDecoder arithDecoder, CX cx, int width, int height, short grTemplate, boolean isTPGROn, Bitmap referenceBitmap, int referenceDX, int referenceDY, short[] grAtX, short[] grAtY) throws IOException
A short-lived instance is created internally so that the many private helper methods can share state through fields rather than through long parameter lists. No state survives the return of this method.
arithDecoder - the arithmetic decoder — shared with the parent
when called from a symbol dictionary or text region,
or freshly created when called from a standalone segment;
must not be nullcx - the context model — shared or fresh, as above;
must not be nullwidth - decoded bitmap width (GRW); must be > 0height - decoded bitmap height (GRH); must be > 0grTemplate - template index: must be 0 or 1 (GRTEMPLATE)isTPGROn - whether typical prediction is enabled (TPGRON)referenceBitmap - the reference / base bitmap (GRREFERENCE);
must not be nullreferenceDX - horizontal offset of reference bitmap (GRREFERENCEDX)referenceDY - vertical offset of reference bitmap (GRREFERENCEDY)grAtX - AT pixel X offsets; required for grTemplate == 0,
must be a non-null array of length 2 in that case;
ignored for grTemplate == 1grAtY - AT pixel Y offsets; same requirements as grAtXIllegalArgumentException - if any parameter constraint above is violatedIOException - if an underlying I/O operation failsCopyright © 2026 The Apache Software Foundation. All rights reserved.