• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kviewshell

JB2Image.h File Reference

#include "GString.h"
#include "ZPCodec.h"

Include dependency graph for JB2Image.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


Classes

class  JB2Blit
 Blit data structure. More...
class  JB2Dict::JB2Codec
class  JB2Dict
 Dictionary of JB2 shapes. More...
class  JB2Image
 Main JB2 data structure. More...
class  JB2Shape
 Shape data structure. More...
struct  JB2Dict::JB2Codec::LibRect

Typedefs

JB2Image.h
Files #"JB2Image.h"# and #"JB2Image.cpp"# address the compression of bilevel images using the JB2 soft pattern matching scheme.

These files provide the complete decoder and the decoder back-end. The JB2 scheme is optimized for images containing a large number of self-similar small components such as characters. Typical text images can be compressed into files 3 to 5 times smaller than with G4/MMR and 2 to 4 times smaller than with JBIG1.

{ JB2 and JBIG2} --- JB2 has strong similarities with the forthcoming JBIG2 standard developed by the "ISO/IEC JTC1 SC29 Working Group 1" which is responsible for both the JPEG and JBIG standards. This is hardly surprising since JB2 was our own proposal for the JBIG2 standard and remained the only proposal for years. The full JBIG2 standard however is significantly more complex and slighlty less efficient than JB2 because it addresses a broader range of applications. Full JBIG2 compliance may be implemented in the future.

{ JB2 Images} --- Class {JB2Image} is the central data structure implemented here. A JB2Image# is composed of an array of shapes and an array of blits. Each shape contains a small bitmap representing an elementary blob of ink, such as a character or a segment of line art. Each blit instructs the decoder to render a particular shape at a specified position in the image. Some compression is already achieved because several blits can refer to the same shape. A shape can also contain a pointer to a parent shape. Additional compression is achieved when both shapes are similar because each shape is encoded using the parent shape as a model. A #"O"# shape for instance could be a parent for both a #"C"# shape and a #"Q"# shape.

{ JB2 Dictionary} --- Class {JB2Dict} is a peculiar kind of JB2Image which only contains an array of shapes. These shapes can be referenced from another JB2Dict/JB2Image. This is arranged by setting the ``inherited dictionary'' of a JB2Dict/JB2Image using function {JB2Dict::set_inherited_dict}. Several JB2Images can use shapes from a same JB2Dict encoded separately. This is how several pages of a same document can share information.

{ Decoding JB2 data} --- The first step for decoding JB2 data consists of creating an empty JB2Image# object. Function {JB2Image::decode} then reads the data and populates the JB2Image# with the shapes and the blits. Function {JB2Image::get_bitmap} finally produces an anti-aliased image.

{ Encoding JB2 data} --- The first step for decoding JB2 data also consists of creating an empty JB2Image# object. You must then use functions {JB2Image::add_shape} and {JB2Image::add_blit} to populate the JB2Image# object. Function {JB2Image::encode} finally produces the JB2 data. Function encode# sequentially encodes the blits and the necessary shapes. The compression ratio depends on several factors: {itemize} Blits should reuse shapes as often as possible. Blits should be sorted in reading order because this facilitates the prediction of the blit coordinates. Shapes should be sorted according to the order of first appearance in the sequence of blits because this facilitates the prediction of the shape indices. Shapes should be compared to all previous shapes in the shape array. The shape parent pointer should be set to a suitable parent shape if such a parent shape exists. The parent shape should have almost the same size and the same pixels. {itemize} All this is quite easy to achieve in the case of an electronically produced document such as a DVI file or a PS file: we know what the characters are and where they are located. If you only have a scanned image however you must first locate the characters (connected component analysis) and cut the remaining pieces of ink into smaller blobs. Ordering the blits and matching the shapes is then an essentially heuristic process. Although the quality of the heuristics substantially effects the file size, misordering blits or mismatching shapes never effects the quality of the image. The last refinement consists in smoothing the shapes in order to reduce the noise and maximize the similarities between shapes.

{ JB2 extensions} --- Two extensions of the JB2 encoding format have been introduced with DjVu files version 21. The first extension addresses the shared shape dictionaries. The second extension bounds the number of probability contexts used for coding numbers. Both extensions maintain backward compatibility with JB2 as described in the ICFDD proposal. A more complete discussion can be found in section {JB2 extensions for version 21.}.

{ References} {itemize} Paul G. Howard : {Text image compression using soft pattern matching}, Computer Journal, volume 40:2/3, 1997. JBIG1 : {http://www.jpeg.org/public/jbighomepage.htm}. JBIG2 draft : {http://www.jpeg.org/public/jbigpt2.htm}. ICFDD Draft Proposed American National Standard, 1999-08-26. {itemize}

Version:
$Id: JB2Image.h,v 1.9 2003/11/07 22:08:22 leonb Exp $# Coding bilevel images with JB2.
Author:
Paul Howard <pgh@research.att.com> -- JB2 design\ L\'eon Bottou <leonb@research.att.com> -- this implementation
From: Leon Bottou, 1/31/2002 Lizardtech has split the corresponding cpp file into a decoder and an encoder. Only superficial changes. The meat is mine.

typedef GP< JB2Dict > JB2DecoderCallback (void *)

Typedef Documentation

typedef GP<JB2Dict> JB2DecoderCallback(void *)

JB2 Dictionary callback.

The decoding function call this callback function when they discover that the current JB2Image or JB2Dict needs a pre-existing shape dictionary. The callback function must return a pointer to the dictionary or NULL if none is found.

Definition at line 245 of file JB2Image.h.

kviewshell

Skip menu "kviewshell"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • kviewshell
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal