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 HuffmanTableprivate intprivate intNumber of exported symbols, 7.4.2.1.4private intprivate intNumber of new symbols, 7.4.2.1.5private ArithmeticDecoderprivate HuffmanTableprivate CXprivate CXprivate CXprivate CXprivate CXprivate CXprotected CXprivate CXprivate CXprivate HuffmanTableUser-supplied tables *private HuffmanTableReturn value of that segmentprivate GenericRefinementRegionprivate GenericRegionprivate ArithmeticIntegerDecoderprivate booleanprivate booleanprivate booleanprivate Bitmap[]private intprivate short[]Symbol dictionary AT flags, 7.4.2.1.2private short[]private shortprivate shortprivate shortprivate shortprivate short[]Symbol dictionary refinement AT flags, 7.4.2.1.3private short[]private shortSymbol dictionary flags, 7.4.2.1.1private byteprivate SegmentHeaderFurther parametersprivate SubInputStreamprivate TextRegionprivate boolean -
Constructor Summary
ConstructorsConstructorDescriptionSymbolDictionary(SubInputStream subInputStream, SegmentHeader segmentHeader) -
Method Summary
Modifier and TypeMethodDescriptionprivate final voidprivate voidprivate final voiddecodeAggregate(int symbolWidth, int heightClassHeight) private final longprivate final voiddecodeDirectlyThroughGenericRegion(int symWidth, int hcHeight) private final voiddecodeHeightClassBitmap(Bitmap heightClassCollectiveBitmap, int heightClassFirstSymbol, int heightClassHeight, int[] newSymbolsWidths) private final BitmapdecodeHeightClassCollectiveBitmap(long bmSize, int heightClassHeight, int totalWidth) private final longprivate final long6.5.6 if isHuffmanEncodedprivate final voiddecodeNewSymbols(int symWidth, int hcHeight, Bitmap ibo, int rdx, int rdy) private final voiddecodeRefinedSymbol(int symbolWidth, int heightClassHeight) private final voiddecodeThroughTextRegion(int symbolWidth, int heightClassHeight, long amountOfRefinementAggregationInstances) 6.5.5 Decoding the symbol dictionaryprivate int6.5.8.2.3 - Setting SBSYMCODES and SBSYMCODELENprivate int[]private HuffmanTablegetUserTable(int tablePosition) private final longprivate final longvoidinit(SegmentHeader header, SubInputStream sis) Parse the stream and read information of header.private voidprivate voidprivate voidprivate voidreadAtPixels(int amountOfPixels) private voidreadRefinementAtPixels(int amountOfAtPixels) private voidprivate voidConcatenates symbols from all referred-to segments.private voidprivate voidprivate voidsetExportedSymbols(int[] toExportFlags) private voidprivate voidprivate voidprivate final void6.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
-
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:
getDictionaryin 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:
IOExceptionInvalidHeaderValueException
-
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: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:
InvalidHeaderValueException- if the segment header value is invalidIntegerMaxValueException- if the maximum value limit of an integer is exceededIOException- if an underlying IO operation fails
-