<< Chapter < Page
  Image coding   Page 1 / 1
Chapter >> Page >
This module briefly look at the sync codes and header information that are needed in order to complete the coding process.

We have described how individual 8 8 blocks of DCT coefficients are coded. Now we shall briefly look at the sync codes and header information that are needed in orderto complete the coding process.

JPEG is rather complex in this aspect, so we shall just give an overview of the basic principles (see the JPEG Book, chapter 7 for thefull picture).

JPEG data is divided into segments , each of which starts with a 2-byte marker .

All markers are byte-aligned - they start on the byte boundaries of the transmission/storage medium. Any variable-length data whichprecedes a marker is padded with extra ones to achieve this.

The first byte of each marker is FF H . The second byte defines the type of marker.

To allow for recovery in the presence of errors, it must be possible to detect markers without decoding all of the intervening data. Hencemarkers must be unique. To achieve this, if an FF H byte occurs in the middle of a segment, an extra 00 H stuffed byte is inserted after it and 00 H is never used as the second byte of a marker.

Some important markers in the order they are often used are:

Name Code (hex) Purpose
SOI FFD8 Start of image.
COM FFFE Comment (segment ignored by decoder). L seg ,<Text comments>
DQT FFDB Define quantisation table(s). L seg ,< Q lum , Q chr …>
SOF 0 FFC0 Start of Baseline DCT frame. L seg ,<Frame size, no. of components (colours), sub-sampling factors, Q-table selectors>
DHT FFC4 Define Huffman table(s). L seg ,<DC Size and AC (Run,Size) tables for each component>
SOS FFDA Start of scan. L seg ,<Huffman table selectors for each component><Entropy coded DCT blocks>
EOI FFD9 End of image.

In the data which follows each marker is shown between<>brackets. The first 2-byte word of most segments is the length (in bytes) of the segment, L seg . The length of<Entropy coded DCT blocks>, which forms the main bulk of the compressed data, is not specified explicitly, sinceit may be determined by decoding the entropy codes. This also allows the data to be transmitted with minimal delay, since it is notnecessary to determine the total length of the compressed data before any of the DCT block data can be sent.

Long blocks of entropy-coded data are rather prone to being corrupted by transmission errors. To mitigate the worst aspects of this,Restart Markers (FFD0→FFD7) may be included at regular intervals (say at the start of each row of DCT blocks in theimage) so that separate parts of the entropy coded stream may be decoded independently of errors in other parts. The restart interval,if required, is defined by a DRI (FFDD) marker segment. There are 8 restart markers, which are used in sequence, so that if one (or more)is corrupted by errors, its absence may be easily detected.

The use of multiple scans within each image frame and multiple frames within a given image allows many variations on the ordering andinterleaving of the compressed data. For example:

  • Chrominance and luminance components may be sent in separate scans or interleaved into a single scan.
  • Lower frequency DCT coefs may be sent in one or more scans before higher frequency coefs.
  • Coarsely quantised coefs may be sent in one or more scans before finer(refinement) coefs.
  • A coarsely sampled frame of the image may be sent initially and then the detail may be progressively improved by addingdifferentially-coded correction frames of increasing resolution.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Image coding. OpenStax CNX. Jan 22, 2004 Download for free at http://cnx.org/content/col10206/1.3
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Image coding' conversation and receive update notifications?

Ask