🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.compression.research
Article #142

Re: best way to describe jpeg

#142
From: Phil Howard
Date: Sun, 24 Jan 1993 02:01
105 lines
6137 bytes
"danny hawrysio" <danny.hawrysio@canrem.com> writes:

> On a graphic BBS I'm often asked how JPEG works in technical terms (and
>yet they want it a fashion they can understand), I find any
>explanation I come with is too long and hard to understand for the
>average computer graphics user.  Has anybody come up with a brief but
>yet all covering description of JPEG?
> The JPEG frequent question list is really no help since they avoid the
>questions by recommending periodicals.


Since I am sort of in between with regard to understanding this compression,
and because I frequently try to explain complicated things in simple terms,
let me give this a try.  I have read about JPEG from two sources, although
I did not pay attention to the fine details needed to actually implement it
(I might try my hand at that "someday").

I assume the degree of technical terms most of the users on the graphic BBS
Danny Hawrysio refers to are not wanting the specifications to implement
JPEG, but just want to get an idea of what the technology is that is being
employed.  If implementation details are needed, the references usually
provided on comp.compression.research and other places really are needed.

Please do *NOT* distribute this until I have a chance to clean it up via
feed back from others that REALLY know how JPEG works.



			A summary of JPEG
				by
			Philip D. Howard


JPEG works with 24-bit color images.  It functions separately in each of the
3 primary colors, that is, do the reds, then do the greens, then do the blues.
The three colors are 8 bits each.  It also works with gray scale 8-bit.  The
theory could also be applied in other ways.

JPEG is not magic.  It simply depends on the fact that certain spectral
parts of the image (very tight repeating patterns in various angles) do
not usually contribute much to the image as perceived by the human eye.
Where such patterns really are present, they are noticeably significant
and cover some area of the image.

The image is chopped up into little squares of 8 pixels by 8 pixels in order
to reduce the computation scale.  These image segments are then analyzed by
a method called the Digital Cosine Transform, which is similar in certain
ways to a Fourier Transform.  The result of this transform is that the various
repetitious patterns are extracted with respect to their periodicy and their
amplitude (the degree to which they contribute).

The reason the DCT is done is because the non-noise part of most images will
concentrate the information into a small portion of the DCT output.  The DCT
output has as many numbers of information as the original image, but because
it is a spectral type of data (in 2 dimensions) the lower frequency groups
are likely to hold most of the relevant information.

The next step is to quantize the DCT output.  The numbers have increments
of 1 in their amplitudes when they come out of the DCT, but small changes
in these values will typically not be visible except by the most analytical
eye (or computer).  The higher frequencies, which occur less, can suffer
even greater amplitude changes before they get noticed.  The quantization
performed rounds the numbers to the lower multiple of a certain number.
That number is different for different pieces of that DCT output.

The quantization is the lossy step of JPEG.  This lossyness typically reduces
most of the higher frequency components to zero.  This is what basically
allows JPEG to store the image in a smaller space.  The quantization is more
severe when the loss level is set for greater loss.  This results in more of
the zeroes being produced.

These quantized numbers are then formed into variable length integers that
occupy only a few bits.  The zeroes are treated as a special case since it
is known that the quantizing results in a lot of them; they take the fewest
bits, typically 1 bit and maybe fewer (I have not looked at this area of
detail yet).  The more loss there is, the more zeroes and the smaller the
data.  The non-zero numbers will also have less range and can be squeezed
into few bits in many cases as well.

The steps from DCT transform to outputting bits is done for each of the 3
primary colors, and for each square the image is chopped into.

The reverse simply involves converting the variable length numbers from
their bits, and applying the reverse DCT transform.  As before, this is
done for each color and each block of the image until the whole image
has been restored.

JPEG performs somewhat poorly when working with images that have been a
part of GIF files.  The reason for this is that GIF also applies a form
of information loss that is sufficiently different to come across as noise
to the JPEG compression.  What GIF does is force the full ranges of colors
that JPEG could use (any pixel can be any of 16777216 colors) into a small
subset of only 256 colors that can be chosen different for each image.
While this distortion is visually small, it can make some difference in
how small the image comes out in JPEG.

The best way to compress a JPEG image is to start from the original 24-bit
data.  Images with less noise work better, of course, since noise can appear
to be high frequency spectral components.  Noise typically appears in the
image as graininess.
-- 
/************************************************************************\
| Phil Howard,  pdh@netcom.com,  KA9WGN    Spell protection?  "1(911)A1" |
| "It's not broken... it's just functionally challenged" --Phil and Pete |
\************************************************************************/
Technical Details
Message-ID: <1993Jan24.020112.9370@netcom.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!nigel.msen.com!fmsrl7!lynx.unm.edu!umn.edu!csus.edu!netcom.com!pdh
References: <1993Jan15.2816.1029@dosgate>

Show Full Headers
Complete Article Headers
Newsgroups: comp.compression.research
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!nigel.msen.com!fmsrl7!lynx.unm.edu!umn.edu!csus.edu!netcom.com!pdh
From: pdh@netcom.com (Phil Howard )
Subject: Re: best way to describe jpeg
Message-ID: <1993Jan24.020112.9370@netcom.com>
Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
References: <1993Jan15.2816.1029@dosgate>
Distribution: comp
Date: Sun, 24 Jan 1993 02:01:12 GMT
Lines: 105