home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / compress / research / 388 < prev    next >
Encoding:
Text File  |  1993-01-24  |  5.9 KB  |  117 lines

  1. Newsgroups: comp.compression.research
  2. Path: sparky!uunet!spool.mu.edu!nigel.msen.com!fmsrl7!lynx.unm.edu!umn.edu!csus.edu!netcom.com!pdh
  3. From: pdh@netcom.com (Phil Howard )
  4. Subject: Re: best way to describe jpeg
  5. Message-ID: <1993Jan24.020112.9370@netcom.com>
  6. Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
  7. References: <1993Jan15.2816.1029@dosgate>
  8. Distribution: comp
  9. Date: Sun, 24 Jan 1993 02:01:12 GMT
  10. Lines: 105
  11.  
  12. "danny hawrysio" <danny.hawrysio@canrem.com> writes:
  13.  
  14. > On a graphic BBS I'm often asked how JPEG works in technical terms (and
  15. >yet they want it a fashion they can understand), I find any
  16. >explanation I come with is too long and hard to understand for the
  17. >average computer graphics user.  Has anybody come up with a brief but
  18. >yet all covering description of JPEG?
  19. > The JPEG frequent question list is really no help since they avoid the
  20. >questions by recommending periodicals.
  21.  
  22.  
  23. Since I am sort of in between with regard to understanding this compression,
  24. and because I frequently try to explain complicated things in simple terms,
  25. let me give this a try.  I have read about JPEG from two sources, although
  26. I did not pay attention to the fine details needed to actually implement it
  27. (I might try my hand at that "someday").
  28.  
  29. I assume the degree of technical terms most of the users on the graphic BBS
  30. Danny Hawrysio refers to are not wanting the specifications to implement
  31. JPEG, but just want to get an idea of what the technology is that is being
  32. employed.  If implementation details are needed, the references usually
  33. provided on comp.compression.research and other places really are needed.
  34.  
  35. Please do *NOT* distribute this until I have a chance to clean it up via
  36. feed back from others that REALLY know how JPEG works.
  37.  
  38.  
  39.  
  40.             A summary of JPEG
  41.                 by
  42.             Philip D. Howard
  43.  
  44.  
  45. JPEG works with 24-bit color images.  It functions separately in each of the
  46. 3 primary colors, that is, do the reds, then do the greens, then do the blues.
  47. The three colors are 8 bits each.  It also works with gray scale 8-bit.  The
  48. theory could also be applied in other ways.
  49.  
  50. JPEG is not magic.  It simply depends on the fact that certain spectral
  51. parts of the image (very tight repeating patterns in various angles) do
  52. not usually contribute much to the image as perceived by the human eye.
  53. Where such patterns really are present, they are noticeably significant
  54. and cover some area of the image.
  55.  
  56. The image is chopped up into little squares of 8 pixels by 8 pixels in order
  57. to reduce the computation scale.  These image segments are then analyzed by
  58. a method called the Digital Cosine Transform, which is similar in certain
  59. ways to a Fourier Transform.  The result of this transform is that the various
  60. repetitious patterns are extracted with respect to their periodicy and their
  61. amplitude (the degree to which they contribute).
  62.  
  63. The reason the DCT is done is because the non-noise part of most images will
  64. concentrate the information into a small portion of the DCT output.  The DCT
  65. output has as many numbers of information as the original image, but because
  66. it is a spectral type of data (in 2 dimensions) the lower frequency groups
  67. are likely to hold most of the relevant information.
  68.  
  69. The next step is to quantize the DCT output.  The numbers have increments
  70. of 1 in their amplitudes when they come out of the DCT, but small changes
  71. in these values will typically not be visible except by the most analytical
  72. eye (or computer).  The higher frequencies, which occur less, can suffer
  73. even greater amplitude changes before they get noticed.  The quantization
  74. performed rounds the numbers to the lower multiple of a certain number.
  75. That number is different for different pieces of that DCT output.
  76.  
  77. The quantization is the lossy step of JPEG.  This lossyness typically reduces
  78. most of the higher frequency components to zero.  This is what basically
  79. allows JPEG to store the image in a smaller space.  The quantization is more
  80. severe when the loss level is set for greater loss.  This results in more of
  81. the zeroes being produced.
  82.  
  83. These quantized numbers are then formed into variable length integers that
  84. occupy only a few bits.  The zeroes are treated as a special case since it
  85. is known that the quantizing results in a lot of them; they take the fewest
  86. bits, typically 1 bit and maybe fewer (I have not looked at this area of
  87. detail yet).  The more loss there is, the more zeroes and the smaller the
  88. data.  The non-zero numbers will also have less range and can be squeezed
  89. into few bits in many cases as well.
  90.  
  91. The steps from DCT transform to outputting bits is done for each of the 3
  92. primary colors, and for each square the image is chopped into.
  93.  
  94. The reverse simply involves converting the variable length numbers from
  95. their bits, and applying the reverse DCT transform.  As before, this is
  96. done for each color and each block of the image until the whole image
  97. has been restored.
  98.  
  99. JPEG performs somewhat poorly when working with images that have been a
  100. part of GIF files.  The reason for this is that GIF also applies a form
  101. of information loss that is sufficiently different to come across as noise
  102. to the JPEG compression.  What GIF does is force the full ranges of colors
  103. that JPEG could use (any pixel can be any of 16777216 colors) into a small
  104. subset of only 256 colors that can be chosen different for each image.
  105. While this distortion is visually small, it can make some difference in
  106. how small the image comes out in JPEG.
  107.  
  108. The best way to compress a JPEG image is to start from the original 24-bit
  109. data.  Images with less noise work better, of course, since noise can appear
  110. to be high frequency spectral components.  Noise typically appears in the
  111. image as graininess.
  112. -- 
  113. /************************************************************************\
  114. | Phil Howard,  pdh@netcom.com,  KA9WGN    Spell protection?  "1(911)A1" |
  115. | "It's not broken... it's just functionally challenged" --Phil and Pete |
  116. \************************************************************************/
  117.