Documentation ¶
Overview ¶
Package jbig2 provides the jbig2 standard image Encoder and Decoder. All the comments reference to the 'ISO/IEC 14992 INFORMATION TECHNOLOGY - CODED REPRESENTATION OF PICTURE AND AUDIO INFORMATION - LOSSY/LOSSLESS CODING OF BI-LEVEL IMAGES JBIG commitee 1999 July 16' document. The document is available and can be downloaded at: 'https://github.com/agl/jbig2enc/blob/master/fcd14492.pdf'
The decoder was based on the 'Apache PDFBox JBIG2 Java plugin' which can be found at: 'https://github.com/apache/pdfbox-jbig2'.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoGlobalsYet = errors.New("no global segment added yet") ErrNoGlobalFound = errors.New("no global segment found") )
Common errors definitions.
Functions ¶
This section is empty.
Types ¶
type Document ¶
type Document struct { // Pages contains all pages of this document. Pages map[int]*Page // NumberOfPagesUnknown defines if the ammount of the pages is known. NumberOfPagesUnknown bool // NumberOfPages - D.4.3 - Number of pages field (4 bytes). Only presented if NumberOfPagesUnknown is true. NumberOfPages uint32 // GBUseExtTemplate defines wether extended Template is used. GBUseExtTemplate bool // SubInputStream is the source data stream wrapped into a SubInputStream. InputStream *reader.Reader // GlobalSegments contains all segments that aren't associated with a page. GlobalSegments Globals // OrganisationType is the document segment organization. OrganizationType segments.OrganizationType // contains filtered or unexported fields }
Document is the jbig2 document model containing pages and global segments. By creating new document with method NewDocument or NewDocumentWithGlobals all the jbig2 encoded data segment headers are decoded. In order to decode whole document, all of it's pages should be decoded using GetBitmap method. PDF encoded documents should contains only one Page with the number 1.
func NewDocument ¶
NewDocument creates new Document for the 'data' byte slice.
func NewDocumentWithGlobals ¶
NewDocumentWithGlobals creates new Document for the provided encoded 'data' byte slice and the 'globals' Globals.
func (*Document) GetGlobalSegment ¶
GetGlobalSegment implements segments.Documenter interface.
func (*Document) GetNumberOfPages ¶
GetNumberOfPages gets the amount of Pages in the given document.
type Globals ¶
Globals store segments that aren't associated to a page. If the data is embedded in another format, for example PDF, this segments might be stored separately in the file. This segments will be decoded on demand, all results are stored in the document.
func (Globals) AddSegment ¶
AddSegment adds the segment to the globals store.
type Page ¶
type Page struct { // Segments relation of the page number to their structures. Segments map[int]*segments.Header // PageNumber defines page number. // NOTE: page numeration starts from 1. PageNumber int // Bitmap represents the page image. Bitmap *bitmap.Bitmap FinalHeight int FinalWidth int ResolutionX int ResolutionY int // Document is a relation to page's document Document *Document }
Page represents JBIG2 Page structure. It contains all the included segments header definitions mapped to their number relation to the document and the resultant page bitmap.
func (*Page) GetSegment ¶
GetSegment implements segments.Pager interface.
Directories ¶
Path | Synopsis |
---|---|
Package bitmap contains the bitmap data container for the binary images used when decoding the jbig2 encoded images.
|
Package bitmap contains the bitmap data container for the binary images used when decoding the jbig2 encoded images. |
decoder
|
|
arithmetic
Package arithmetic contains the jbig2 arithmetic decoder used to decode the jbig2 encoded segments.
|
Package arithmetic contains the jbig2 arithmetic decoder used to decode the jbig2 encoded segments. |
huffman
Package huffman contains jbig2 huffman tables used to decode jbig2 encoded data segments.
|
Package huffman contains jbig2 huffman tables used to decode jbig2 encoded data segments. |
mmr
Package mmr contains the jbig2 mmr decoder used to decode jbig2 encoded data segments.
|
Package mmr contains the jbig2 mmr decoder used to decode jbig2 encoded data segments. |
Package encoder contains jbig2 encoder structures.
|
Package encoder contains jbig2 encoder structures. |
Package reader provides the stream readers used by the jbig2 segments decoder.
|
Package reader provides the stream readers used by the jbig2 segments decoder. |
Package segments provides jbig2 segments models used in the jbig2 document decoding process.
|
Package segments provides jbig2 segments models used in the jbig2 document decoding process. |
Package tests contains the tests and benchmarks for the JBIG2 decoder.
|
Package tests contains the tests and benchmarks for the JBIG2 decoder. |
Package writer contains the data writer that implements io.Writer, io.ByteWriter and allows to write single bits.
|
Package writer contains the data writer that implements io.Writer, io.ByteWriter and allows to write single bits. |