Class GenericRefinementRegion
java.lang.Object
org.apache.pdfbox.jbig2.segments.GenericRefinementRegion
- All Implemented Interfaces:
Region, SegmentData
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classprivate static classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ArithmeticDecoderprivate CXprivate boolean[]private short[]Generic refinement region segment AT flags, 7.4.7.3private short[]private booleanGeneric refinement region segment flags, 7.4.7.2private booleanIf true, AT pixels are not on their nominal location and have to be overridden.private BitmapVariables for decodingprivate intprivate intprivate BitmapDecoded data as pixel values (use row stride/width to wrap line)private RegionSegmentInformationRegion segment information flags, 7.4.1private SegmentHeaderprivate SubInputStreamprivate static final GenericRefinementRegion.Templateprivate static final GenericRefinementRegion.Templateprivate GenericRefinementRegion.Templateprivate short -
Constructor Summary
ConstructorsConstructorDescriptionGenericRefinementRegion(SubInputStream subInputStream) GenericRefinementRegion(SubInputStream subInputStream, SegmentHeader segmentHeader) -
Method Summary
Modifier and TypeMethodDescriptionprivate voiddecodeOptimized(int lineNumber, int width, int rowStride, int refRowStride, int paddedWidth, int deltaRefStride, int lineOffset) private intprivate voiddecodeTemplate(int lineNumber, int width, int rowStride, int refRowStride, int paddedWidth, int deltaRefStride, int lineOffset, int byteIndex, int currentLine, int refByteIndex, GenericRefinementRegion.Template templateFormation) private voiddecodeTypicalPredictedLine(int lineNumber, int width, int rowStride, int refRowStride, int paddedWidth, int deltaRefStride) private voiddecodeTypicalPredictedLineTemplate0(int lineNumber, int width, int rowStride, int refRowStride, int paddedWidth, int deltaRefStride, int byteIndex, int currentLine, int refByteIndex) private voiddecodeTypicalPredictedLineTemplate1(int lineNumber, int width, int rowStride, int refRowStride, int paddedWidth, int deltaRefStride, int byteIndex, int currentLine, int refByteIndex) private Bitmapprivate byteDecode using a template and arithmetic coding, as described in 6.3.5.6Simply returns theRegionSegmentInformation.voidinit(SegmentHeader header, SubInputStream sis) Parse the stream and read information of header.private intoverrideAtTemplate0(int context, int x, int y, int result, int minorX) private voidParses the flags described in JBIG2 ISO standard: 7.4.7.2 Generic refinement region segment flags 7.4.7.3 Generic refinement refion segment AT flagsprivate voidprotected voidsetParameters(CX cx, ArithmeticDecoder arithmeticDecoder, short grTemplate, int regionWidth, int regionHeight, Bitmap grReference, int grReferenceDX, int grReferenceDY, boolean isTPGRon, short[] grAtX, short[] grAtY) private void
-
Field Details
-
T0
-
T1
-
subInputStream
-
segmentHeader
-
regionInfo
Region segment information flags, 7.4.1 -
isTPGROn
private boolean isTPGROnGeneric refinement region segment flags, 7.4.7.2 -
templateID
private short templateID -
template
-
grAtX
private short[] grAtXGeneric refinement region segment AT flags, 7.4.7.3 -
grAtY
private short[] grAtY -
regionBitmap
Decoded data as pixel values (use row stride/width to wrap line) -
referenceBitmap
Variables for decoding -
referenceDX
private int referenceDX -
referenceDY
private int referenceDY -
arithDecoder
-
cx
-
override
private boolean overrideIf true, AT pixels are not on their nominal location and have to be overridden. -
grAtOverride
private boolean[] grAtOverride
-
-
Constructor Details
-
GenericRefinementRegion
public GenericRefinementRegion() -
GenericRefinementRegion
-
GenericRefinementRegion
-
-
Method Details
-
parseHeader
Parses the flags described in JBIG2 ISO standard:- 7.4.7.2 Generic refinement region segment flags
- 7.4.7.3 Generic refinement refion segment AT flags
- Throws:
IOException
-
readAtPixels
- Throws:
IOException
-
getRegionBitmap
public Bitmap getRegionBitmap() throws IOException, IntegerMaxValueException, InvalidHeaderValueExceptionDecode using a template and arithmetic coding, as described in 6.3.5.6- Specified by:
getRegionBitmapin interfaceRegion- Returns:
- The decoded region as
Bitmap. - Throws:
IOException- if an underlying IO operation failsInvalidHeaderValueException- if a segment header value is invalidIntegerMaxValueException- if the maximum value limit of an integer is exceeded
-
decodeSLTP
- Throws:
IOException
-
getGrReference
private Bitmap getGrReference() throws IntegerMaxValueException, InvalidHeaderValueException, IOException -
decodeOptimized
private void decodeOptimized(int lineNumber, int width, int rowStride, int refRowStride, int paddedWidth, int deltaRefStride, int lineOffset) throws IOException - Throws:
IOException
-
decodeTemplate
private void decodeTemplate(int lineNumber, int width, int rowStride, int refRowStride, int paddedWidth, int deltaRefStride, int lineOffset, int byteIndex, int currentLine, int refByteIndex, GenericRefinementRegion.Template templateFormation) throws IOException - Throws:
IOException
-
updateOverride
private void updateOverride() -
decodeTypicalPredictedLine
private void decodeTypicalPredictedLine(int lineNumber, int width, int rowStride, int refRowStride, int paddedWidth, int deltaRefStride) throws IOException - Throws:
IOException
-
decodeTypicalPredictedLineTemplate0
private void decodeTypicalPredictedLineTemplate0(int lineNumber, int width, int rowStride, int refRowStride, int paddedWidth, int deltaRefStride, int byteIndex, int currentLine, int refByteIndex) throws IOException - Throws:
IOException
-
decodeTypicalPredictedLineTemplate1
private void decodeTypicalPredictedLineTemplate1(int lineNumber, int width, int rowStride, int refRowStride, int paddedWidth, int deltaRefStride, int byteIndex, int currentLine, int refByteIndex) throws IOException - Throws:
IOException
-
overrideAtTemplate0
private int overrideAtTemplate0(int context, int x, int y, int result, int minorX) throws IOException - Throws:
IOException
-
getPixel
- Throws:
IOException
-
init
Description copied from interface:SegmentDataParse the stream and read information of header.- Specified by:
initin interfaceSegmentData- Parameters:
header- - The segments' header (to make referred-to segments available in data part).sis- - WrappedImageInputStreamintoSubInputStream.- Throws:
IOException- if an underlying IO operation fails
-
setParameters
protected void setParameters(CX cx, ArithmeticDecoder arithmeticDecoder, short grTemplate, int regionWidth, int regionHeight, Bitmap grReference, int grReferenceDX, int grReferenceDY, boolean isTPGRon, short[] grAtX, short[] grAtY) -
getRegionInfo
Description copied from interface:RegionSimply returns theRegionSegmentInformation.- Specified by:
getRegionInfoin interfaceRegion- Returns:
- The
RegionSegmentInformation.
-