📄 336-339.html
字号:
<HTML>
<HEAD>
<META name=vsisbn content="1558515682"><META name=vstitle content="Java Digital Signal Processing"><META name=vsauthor content="Douglas A. Lyon"><META name=vsimprint content="M&T Books"><META name=vspublisher content="IDG Books Worldwide, Inc."><META name=vspubdate content="11/01/97"><META name=vscategory content="Web and Software Development: Programming, Scripting, and Markup Languages: Java"><TITLE>Java Digital Signal Processing:Digital Images and Image Formats</TITLE>
<!-- HEADER --><STYLE type="text/css"> <!-- A:hover { color : Red; } --></STYLE><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<!--ISBN=1558515682//-->
<!--TITLE=Java Digital Signal Processing//-->
<!--AUTHOR=Douglas A. Lyon//-->
<!--PUBLISHER=IDG Books Worldwide, Inc.//-->
<!--IMPRINT=M & T Books//-->
<!--CHAPTER=8//-->
<!--PAGES=336-339//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="333-336.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="339-341.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H4 ALIGN="LEFT"><A NAME="Heading8"></A><FONT COLOR="#000077">Color Depth, Palettes and Transparency</FONT></H4>
<P>Before an image is rendered on a monitor, regardless of the format it is stored in by an application, it is usually represented by a bitmap in a special memory known as a <I>frame buffer</I>. (The exception is images displayed on a random scan display monitor—a vector image display monitor.) The frame buffer stores the image as it is scanned by the graphics processor that feeds a CRT monitor for viewing. En route to the monitor, the graphics processor may be commanded by the host processor to manipulate the stream of pixels before they are displayed. One example of processing is to convert <I>color depth</I> information by using a <I>color lookup table</I> (CLUT), also known as a <I>color palette</I>. Color depth refers to the number of bits that are used to represent one pixel, or <I>bits per pixel</I> (bpp). For a color depth of 1, you represent a black and white image; a 1 turns on a pixel (white) and a 0 turns off a pixel (black). A color depth of 8 bpp means that you have 256 (2<SUP>8</SUP>) possible values for a color.</P>
<P>A CLUT is a table of color values with an index, and the use of this table can allow for some image size reduction. You essentially form an indirect addressing scheme. Suppose you have 256 possible values (indexes) for a color. You can store 24-bpp color values in each entry of the CLUT, because your hardware supports it. You achieve some data compression, because the image data can reference 8-bit CLUT indexes instead of 24-bit color data. The image data must, however, also include the CLUT. The total data for a 640x480 image is (640x480x8 + 256x24)/8 = 308K. If the CLUT were not used, the total data would be (640x480x24)/8 = 922K. In this example, the use of a CLUT results in a savings of two-thirds in file size.</P>
<P>Using a CLUT doesn’t always make sense. If an image contains a large number of colors, it may be more space-efficient to store the full pixel value directly. Generally, for images with more than 256 colors, it is better to use a <I>literal</I> or <I>absolute</I> format, because the overhead of a very large CLUT is not worth the space. In fact, the size of the CLUT may approach the size of the image.</P>
<H4 ALIGN="LEFT"><A NAME="Heading9"></A><FONT COLOR="#000077">Transparency</FONT></H4>
<P>In the television world, live video is often overlaid onto a static image (such as a weather map). In the bitmap world, two bitmaps can be overlaid; portions of one bitmap can be specified as transparent to allow the background image to show through. Similarly, you could use transparency characteristics to create a fade from one video source to another. In this case, there would be degrees of transparency (not just on or off). Transparency is often described in bitmaps on a pixel-by-pixel basis. Here, transparency information is appended to pixel value information. The TGA format, for example, uses 5 bits each for R, G, B (red, green, blue) and 1 extra bit for transparency, for a total of 16 bits. When the transparency bit is on, the display hardware ignores that particular pixel so that any background image shows through. A 32-bit variant of the TGA format specifies 8 bits for transparency, called the <I>alpha channel.</I> Here, R, G, and B use 8 bits each, and alpha uses an additional 8 bits to specify the degree of transparency (0 = completely transparent; 255 = completely opaque).</P>
<H3><A NAME="Heading10"></A><FONT COLOR="#000077">Graphics Formats</FONT></H3>
<P>This section gives you a directory of popular image formats. Table 8.1 (adapted from [Murray et al.]) shows a list of various formats along with their type. DiffCAD uses a subset of these formats: GIF, JPEG, VEC, PICT and PPM. Later, we’ll discuss general characteristics of graphics formats, such as file organization, compression, and progressive display.
</P>
<TABLE WIDTH="100%"><CAPTION><B>Table 8.1</B> Image Formats and Type
<TR>
<TH COLSPAN="2"><HR>
<TR>
<TH WIDTH="50%" ALIGN="LEFT">Format
<TH WIDTH="50%" ALIGN="LEFT">Type
<TR>
<TD>AutoCAD DXF
<TD>Vector
<TR>
<TD>Autodesk 3D Studio
<TD>Scene Description
<TR>
<TD>BMP (Windows)
<TD>Bitmap
<TR>
<TD>CGM
<TD>Metafile
<TR>
<TD>FLI
<TD>Animation
<TR>
<TD>GEM Raster
<TD>Bitmap
<TR>
<TD>GEM VDI
<TD>Metafile
<TR>
<TD>GIF
<TD>Bitmap
<TR>
<TD>Harvard Graphics
<TD>Metafile
<TR>
<TD>IFF
<TD>Bitmap
<TR>
<TD>Intel DVI
<TD>Multimedia
<TR>
<TD>JPEG File Interchange
<TD>Bitmap
<TR>
<TD>Kodak PhotoCD
<TD>Bitmap
<TR>
<TD>MPEG
<TD>Multimedia
<TR>
<TD>PCX (Windows)
<TD>Bitmap
<TR>
<TD>PICT (Mac)
<TD>Metafile
<TR>
<TD>Pixar RIB
<TD>Scene Description
<TR>
<TD>PNG
<TD>Bitmap
<TR>
<TD>POV
<TD>Vector
<TR>
<TD>PPM
<TD>Bitmap
<TR>
<TD>QuickTime
<TD>Multimedia
<TR>
<TD>Rayshade
<TD>Scene Description
<TR>
<TD>SPIFF
<TD>Bitmap
<TR>
<TD>Sun Raster
<TD>Bitmap
<TR>
<TD>TIFF
<TD>Bitmap
<TR>
<TD>TTDDD
<TD>Vector and Animation
<TR>
<TD>Utah RLE
<TD>Bitmap
<TR>
<TD>VEC
<TD>Vector
<TR>
<TD>WMF (Windows)
<TD>Metafile
<TR>
<TD COLSPAN="2"><HR>
</TABLE>
<P>Most graphics formats support some form of data compression, discussed next.
</P>
<H4 ALIGN="LEFT"><A NAME="Heading11"></A><FONT COLOR="#000077">Compression Methods: Making Bits of Bits</FONT></H4>
<P>Some compression methods are used on digital information (and not just image data), and other methods are specifically suited for image data and other special classes of data. First, we’ll look at four methods of general data compression: RLE, LZW, Huffman encoding, and arithmetic encoding. Later in this section we’ll look at a compression method that is well suited for image data: Discrete Cosine Transform (DCT) or transform-based compression.
</P>
<P>Compression can be <I>lossy</I> or can be perfect (<I>lossless</I>). Lossy compression methods discard information that is considered to be the least relevant in a particular application.</P>
<P>Compression can be <I>symmetric</I>—that is, the process of compression is similar in complexity, time, and methodology to decompression. On the other hand, in <I>asymmetric</I> compression a more complicated process is needed for one direction compared to the other. In the original Intel DVI video format, for example, a parallel supercomputer is used to compress a video sequence; a tiny amount of microcode in a video DSP chip is used to decompress the sequence. This method is highly asymmetric.</P>
<P>For bitmap format files, usually only the bitmap data is compressed. Any other information in the file (such as the header or footer) is left uncompressed for easy reading. For vector format files, there is usually no compression. Vector formats are inherently compact because they work at a higher level of abstraction than bitmaps. Also, rendering a vector format file takes a lot of time to begin with, and adding decompression would further slow applications that use vector format files.</P>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>NOTE: </B>In the discussions that follow, the term encoding is used. Decoding is the inverse operation.<HR></FONT>
</BLOCKQUOTE>
<P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="333-336.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="339-341.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<hr width="90%" size="1" noshade><div align="center"><font face="Verdana,sans-serif" size="1">Copyright © <a href="/reference/idgbooks00001.html">IDG Books Worldwide, Inc.</a></font></div>
<!-- all of the reference materials (books) have the footer and subfoot reveresed --><!-- reference_subfoot = footer --><!-- reference_footer = subfoot --></BODY></HTML><!-- END FOOTER -->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -