Package org.apache.pdfbox.jbig2.segments
Class SymbolDictionary
java.lang.Object
org.apache.pdfbox.jbig2.segments.SymbolDictionary
- All Implemented Interfaces:
Dictionary
,SegmentData
This class represents the data of segment type "Symbol dictionary". Parsing is described in 7.4.2.1.1 - 7.4.1.1.5 and
decoding procedure is described in 6.5.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate HuffmanTable
private int
private int
Number of exported symbols, 7.4.2.1.4private int
private int
Number of new symbols, 7.4.2.1.5private ArithmeticDecoder
private HuffmanTable
private CX
private CX
private CX
private CX
private CX
private CX
protected CX
private CX
private CX
private HuffmanTable
User-supplied tables *private HuffmanTable
Return value of that segmentprivate GenericRefinementRegion
private GenericRegion
private ArithmeticIntegerDecoder
private boolean
private boolean
private boolean
private Bitmap[]
private int
private short[]
Symbol dictionary AT flags, 7.4.2.1.2private short[]
private short
private short
private short
private short
private short[]
Symbol dictionary refinement AT flags, 7.4.2.1.3private short[]
private short
Symbol dictionary flags, 7.4.2.1.1private byte
private SegmentHeader
Further parametersprivate SubInputStream
private TextRegion
private boolean
-
Constructor Summary
ConstructorsConstructorDescriptionSymbolDictionary
(SubInputStream subInputStream, SegmentHeader segmentHeader) -
Method Summary
Modifier and TypeMethodDescriptionprivate final void
private void
private final void
decodeAggregate
(int symbolWidth, int heightClassHeight) private final long
private final void
decodeDirectlyThroughGenericRegion
(int symWidth, int hcHeight) private final void
decodeHeightClassBitmap
(Bitmap heightClassCollectiveBitmap, int heightClassFirstSymbol, int heightClassHeight, int[] newSymbolsWidths) private final Bitmap
decodeHeightClassCollectiveBitmap
(long bmSize, int heightClassHeight, int totalWidth) private final long
private final long
6.5.6 if isHuffmanEncodedprivate final void
decodeNewSymbols
(int symWidth, int hcHeight, Bitmap ibo, int rdx, int rdy) private final void
decodeRefinedSymbol
(int symbolWidth, int heightClassHeight) private final void
decodeThroughTextRegion
(int symbolWidth, int heightClassHeight, long amountOfRefinementAggregationInstances) 6.5.5 Decoding the symbol dictionaryprivate int
6.5.8.2.3 - Setting SBSYMCODES and SBSYMCODELENprivate int[]
private HuffmanTable
getUserTable
(int tablePosition) private final long
private final long
void
init
(SegmentHeader header, SubInputStream sis) Parse the stream and read information of header.private void
private void
private void
private void
readAtPixels
(int amountOfPixels) private void
readRefinementAtPixels
(int amountOfAtPixels) private void
private void
Concatenates symbols from all referred-to segments.private void
private void
private void
setExportedSymbols
(int[] toExportFlags) private void
private void
private void
private final void
6.5.8.2.4 - Setting SBSYMS
-
Field Details
-
subInputStream
-
sdrTemplate
private short sdrTemplateSymbol dictionary flags, 7.4.2.1.1 -
sdTemplate
private byte sdTemplate -
isCodingContextRetained
private boolean isCodingContextRetained -
isCodingContextUsed
private boolean isCodingContextUsed -
sdHuffAggInstanceSelection
private short sdHuffAggInstanceSelection -
sdHuffBMSizeSelection
private short sdHuffBMSizeSelection -
sdHuffDecodeWidthSelection
private short sdHuffDecodeWidthSelection -
sdHuffDecodeHeightSelection
private short sdHuffDecodeHeightSelection -
useRefinementAggregation
private boolean useRefinementAggregation -
isHuffmanEncoded
private boolean isHuffmanEncoded -
sdATX
private short[] sdATXSymbol dictionary AT flags, 7.4.2.1.2 -
sdATY
private short[] sdATY -
sdrATX
private short[] sdrATXSymbol dictionary refinement AT flags, 7.4.2.1.3 -
sdrATY
private short[] sdrATY -
amountOfExportSymbolss
private int amountOfExportSymbolssNumber of exported symbols, 7.4.2.1.4 -
amountOfNewSymbols
private int amountOfNewSymbolsNumber of new symbols, 7.4.2.1.5 -
segmentHeader
Further parameters -
amountOfImportedSymbolss
private int amountOfImportedSymbolss -
importSymbols
-
amountOfDecodedSymbols
private int amountOfDecodedSymbols -
newSymbols
-
dhTable
User-supplied tables * -
dwTable
-
bmSizeTable
-
aggInstTable
-
exportSymbols
Return value of that segment -
sbSymbols
-
arithmeticDecoder
-
iDecoder
-
textRegion
-
genericRegion
-
genericRefinementRegion
-
cx
-
cxIADH
-
cxIADW
-
cxIAAI
-
cxIAEX
-
cxIARDX
-
cxIARDY
-
cxIADT
-
cxIAID
-
sbSymCodeLen
private int sbSymCodeLen
-
-
Constructor Details
-
SymbolDictionary
public SymbolDictionary() -
SymbolDictionary
public SymbolDictionary(SubInputStream subInputStream, SegmentHeader segmentHeader) throws IOException - Throws:
IOException
-
-
Method Details
-
parseHeader
private void parseHeader() throws IOException, InvalidHeaderValueException, IntegerMaxValueException -
readRegionFlags
- Throws:
IOException
-
setAtPixels
- Throws:
IOException
-
setRefinementAtPixels
- Throws:
IOException
-
readAtPixels
- Throws:
IOException
-
readRefinementAtPixels
- Throws:
IOException
-
readAmountOfExportedSymbols
- Throws:
IOException
-
readAmountOfNewSymbols
- Throws:
IOException
-
setInSyms
-
setRetainedCodingContexts
-
checkInput
- Throws:
InvalidHeaderValueException
-
getDictionary
public ArrayList<Bitmap> getDictionary() throws IOException, IntegerMaxValueException, InvalidHeaderValueException6.5.5 Decoding the symbol dictionary- Specified by:
getDictionary
in interfaceDictionary
- Returns:
- List of decoded symbol bitmaps as an
ArrayList
- Throws:
IOException
- if an underlying IO operation failsIntegerMaxValueException
- if the maximum value limit of an integer is exceededInvalidHeaderValueException
- if the segment header value is invalid
-
setCodingStatistics
- Throws:
IOException
-
decodeHeightClassBitmap
private final void decodeHeightClassBitmap(Bitmap heightClassCollectiveBitmap, int heightClassFirstSymbol, int heightClassHeight, int[] newSymbolsWidths) throws IntegerMaxValueException, InvalidHeaderValueException, IOException -
decodeAggregate
private final void decodeAggregate(int symbolWidth, int heightClassHeight) throws IOException, InvalidHeaderValueException, IntegerMaxValueException -
huffDecodeRefAggNInst
-
decodeThroughTextRegion
private final void decodeThroughTextRegion(int symbolWidth, int heightClassHeight, long amountOfRefinementAggregationInstances) throws IOException, IntegerMaxValueException, InvalidHeaderValueException -
decodeRefinedSymbol
private final void decodeRefinedSymbol(int symbolWidth, int heightClassHeight) throws IOException, InvalidHeaderValueException, IntegerMaxValueException -
decodeNewSymbols
private final void decodeNewSymbols(int symWidth, int hcHeight, Bitmap ibo, int rdx, int rdy) throws IOException, InvalidHeaderValueException, IntegerMaxValueException -
decodeDirectlyThroughGenericRegion
private final void decodeDirectlyThroughGenericRegion(int symWidth, int hcHeight) throws IOException, IntegerMaxValueException, InvalidHeaderValueException -
addSymbol
private final void addSymbol(Region region) throws IntegerMaxValueException, InvalidHeaderValueException, IOException -
decodeDifferenceWidth
-
decodeHeightClassDeltaHeight
-
decodeHeightClassDeltaHeightWithHuffman
private final long decodeHeightClassDeltaHeightWithHuffman() throws IOException, InvalidHeaderValueException6.5.6 if isHuffmanEncoded- Returns:
- long - Result of decoding HCDH
- Throws:
IOException
InvalidHeaderValueException
-
decodeHeightClassCollectiveBitmap
private final Bitmap decodeHeightClassCollectiveBitmap(long bmSize, int heightClassHeight, int totalWidth) throws IOException - Throws:
IOException
-
setExportedSymbols
private void setExportedSymbols(int[] toExportFlags) -
getToExportFlags
-
huffDecodeBmSize
-
getSbSymCodeLen
6.5.8.2.3 - Setting SBSYMCODES and SBSYMCODELEN- Returns:
- Result of computing SBSYMCODELEN
- Throws:
IOException
-
setSymbolsArray
private final void setSymbolsArray() throws IOException, InvalidHeaderValueException, IntegerMaxValueException6.5.8.2.4 - Setting SBSYMS -
retrieveImportSymbols
private void retrieveImportSymbols() throws IOException, InvalidHeaderValueException, IntegerMaxValueExceptionConcatenates symbols from all referred-to segments. -
getUserTable
private HuffmanTable getUserTable(int tablePosition) throws InvalidHeaderValueException, IOException -
init
public void init(SegmentHeader header, SubInputStream sis) throws InvalidHeaderValueException, IntegerMaxValueException, IOException Description copied from interface:SegmentData
Parse the stream and read information of header.- Specified by:
init
in interfaceSegmentData
- Parameters:
header
- - The segments' header (to make referred-to segments available in data part).sis
- - WrappedImageInputStream
intoSubInputStream
.- Throws:
InvalidHeaderValueException
- if the segment header value is invalidIntegerMaxValueException
- if the maximum value limit of an integer is exceededIOException
- if an underlying IO operation fails
-