Need for Data Compression
Total Page:16
File Type:pdf, Size:1020Kb
Need for Data Compression Reducing the amount of data needed to reproduce images or video (compression) saves storage space, increases access speed, and is the only way to achieve digital motion video on personal computers. In order to compare video compression systems, one must have ways to evaluate compression performance. Three key parameters need to be considered: i. Amount or degree of compression ii. Image quality iii. Speed of compression or decompression. In addition, we must also look at the hardware and software required by each compression method. • Compression is useful because it helps reduce resource usage, such as data storage space or transmission capacity. • Because compressed data must be decompressed to use, this extra processing imposes computational or other costs through decompression; this situation is far from being a free lunch. Data compression is subject to a space–time complexity trade- off. For instance, a compression scheme for video may require expensive hardware for the video to be decompressed fast enough to be viewed as it is being decompressed, and the option to decompress the video in full before watching it may be inconvenient or require additional storage. The design of data compression schemes involves trade-offs among various factors, including the degree of compression, the amount of distortion introduced (e.g., when using lossy data compression), and the computational resources required to compress and uncompress the data.[ However, the most important reason for compressing data is that more and more we share data. The Web and its underlying networks have limitations on bandwidth that define the maximum number of bits or bytes that can be transmitted from one place to another in a fixed amount of time. Non-lossy and Lossy Compression for images Image compression may be lossless(non-lossy) or lossy. Lossless compression means that the reproduced image is not changed in any way by the compression/decompression process therefore, we do not have worry about the picture quality for a lossless system- the output picture will be exactly the same as the input picture. Lossless compression is possible because we can use more efficient methods of data transmission than the pixel-by-pixel PCM (Pulse-Code Modulation)format that comes from a digitizer. Lossless compression is preferred for archival purposes and often for medical imaging, technical drawings, clip art, or comics. Lossless compression is used in cases where it is important that the original and the decompressed data be identical, or where deviations from the original data could be deleterious. Typical examples are executable programs, text documents, and source code. Some image file formats, like PNG(Portable Network Graphics) or GIF(Graphic Interface Format), use only lossless compression, while others like TIFF(Tagged Image File Format) and MNG(Multimedia Network Group) may use either lossless or lossy methods. Lossless data compression is used in many applications. For example, it is used in the ZIP file format and in the GNU tool gzip. It is also often used as a component within lossy data compression technologies (e.g. lossless mid/side joint stereo preprocessing by the LAME MP3 encoder and other lossy audio encoders). One of the reasons that there is still some interest in new loss- less compression techniques, is that only very inexact data structures can survive Lossy Compression. It is often the case that loss of a single bit, renders a whole phrase or line of data inaccurate. This is why we attempt to build more and more stable memory systems. The recent shift from RD to SD ram for instance was partially because RD ram needed more interactive maintenance of its data. If we are so protective of the memory of data, then it makes sense that we must also be protective of the compression scheme we use to store and retrieve data. So the only places Lossy Compression can be used, are places where the accuracy at the bit level, does not materially affect the quality of the data. Methods for lossless image compression are: • Run-length encoding – used as default method in PCX and as one of possible in BMP, TGA, TIFF Area image compression DPCM and Predictive Coding Entropy encoding Adaptive dictionary algorithms such as LZW – used in GIF and TIFF Deflation– used in PNG, MNG, and TIFF Chain codes Lossy compression system by definition do make some change to the image – something is different. The trick is making that difference hard for the viewer to see. Lossy compression systems may introduce any of the digital video artifacts, or they may even create some unique artifacts if their own. None of these effects is easy to quantify, and final decisions about compression systems, or about any specific compressed image, will usually have to be made after a subjective evaluation- there‘s not a good alternative to looking at test pictures. The various measures of analog picture quality- signal-to- noise ratio, resolution, color errors, etc., may be useful in some cases, but only after viewing real pictures to make sure that the right artifacts are being measured. Lossy compression methods, especially when used at low bit rates, introduce compression artifacts. Lossy methods are especially suitable for natural images such as photographs in applications where minor (sometimes imperceptible) loss of fidelity is acceptable to achieve a substantial reduction in bit rate. The lossy compression that produces imperceptible differences may be called visually lossless. Lossy compression is most commonly used to compress multimedia data (audio, video, and still images), especially in applications such as streaming media and internet telephony. By contrast, lossless compression is typically required for text and data files, such as bank records and text articles. In many cases it is advantageous to make a master lossless file that can then be used to produce compressed files for different purposes. For example, a multi-megabyte file can be used at full size to produce a full-page advertisement in a glossy magazine, and a 10 kilobyte lossy copy can be made for a small image on a web page. Methods for lossy compression: Reducing the color space to the most common colors in the image. The selected colors are specified in the color palette in the header of the compressed image. Each pixel just references the index of a color in the color palette, this method can be combined with dithering to avoid posterization. Chroma subsampling. This takes advantage of the fact that the human eye perceives spatial changes of brightness more sharply than those of color, by averaging or dropping some of the chrominance information in the image. Transform coding. This is the most commonly used method. In particular, a Fourier-related transform such as the Discrete Cosine Transform (DCT) is widely used. The DCT is sometimes referred to as "DCT-II" in the context of a family of discrete cosine transforms; e.g., see discrete cosine transform. The more recently developed wavelet transform is also used extensively, followed by quantization and entropy coding. Color Adding color to a grayscale image is a neat little effect you see all over the place. Now, this isn‘t to be confused with taking a color image and removing its color, only to add some of it back in certain places. This technique is entirely different. What I‘m going to show you today is how to apply a new color to a naked image, so to speak. It‘s a really simple technique that‘s fun to use, it‘s great for creating visual interest, and drawing attention to a certain portion of a photo. Admittedly, the process of colorizing a grayscale photo certainly seems straight forward enough, in that it probably involves grabbing a paint brush and painting color onto the image itself. The problem, though, is that while you would succeed in adding color to the photo, you would systematically destroy any detail it once contained. Using the cutest photo *ever* (snatched from iStockphoto.com), I‘m going to show you the trick to adding color while retaining all the glorious detail of the photo. The very first thing we want to do is make sure the document is in color mode, and not grayscale. Else, we won‘t get very far and your frustration level with all things digital could reach an all time high. Step 1: Choose Image > Mode and make sure the document is set to either RGB or CMYK. If the document mode is Grayscale, you won‘t be allowed you to paint in color, which can be quite maddening. NOTE: If this image will be printed professionally, then you want to choose CMYK. If you‘re going to print the image on your home color inkjet or if the image is destined to live out its life only on screen, then go with RGB. Step 2: Create a new layer by clicking the New Layer button at the bottom of the Layers Palette. This is where the new paint will live, so that we don‘t screw up the original photo. Step 3: Change the blending mode of the new layer to either Color or Overlay, as shown below. This will allow the detail of the image to show through the paint, instead of the paint being a solid coat. Step 4: Press B to select the Brush tool, and click on the foreground color chip at the bottom of the main Toolbar. Pick a nice pastel color from the resulting color picker and press OK. TIP: Press Command + (PC: Ctrl + ) to zoom in, and Command – (PC: Ctrl -) to zoom back out of your document. Another handy tip to remember while doing detail work is that while zoomed in on your document, pressing the spacebar turns the cursor into a little hand which you can then use to mouse over to a different area of the image, like so: Step 5: Since we‘re about to embark upon a bit of detail work, I‘m going to share a workspace trick with you before we start painting.