1. Field of Invention
The present invention relates to digital image and graphics data compression, and, more specifically to an efficient image compression method that results in a high image quality in natural and animated images.
2. Description of Related Art
Compression has key benefits in cost reduction of storage device and speedup in accessing the compressed data. Most popular still image compression standards including JPEG, JPEG2000 are lossy algorithms which cause data difference between the decompressed and original image during the procedure of image compression. The data loss caused by lossy compression algorithm degrades the image quality which might not be acceptable in some applications.
There are very few lossless image compression algorithms of image data reduction. One of most commonly adopted approach is taking differential value between adjacent pixels and applying the so called “entropy coding” or “Variable Length Coding” method which uses the shortest code to represent the most frequent happened pattern.
Lossy compression algorithms can achieve higher compression rate, for example, between 10 to 20 times, at the cost of sacrificing the image quality. Sharp image quality can be achieved by the lossless compression algorithm but the compression rate is most likely lower than that of the popular lossy algorithms like JPEG or JPEG2000.
Most compression algorithms are conceptually good for natural images and might not be good in animated image. Very few compression algorithms can reach good compression ratio of animated image.
The method of this invention of image and graphics data compression is to achieve a reasonable high compression ratio compared to prior art lossless compression algorithms without sacrificing much the image quality in both natural and animated images.
The present invention overcomes the drawback of the popular compression algorithms which introduce high degree of quality degradation. The present invention reduces the computing times compared to its counterparts in the image compression and decompression and reaches higher compression ratio for both natural and animated images.
The present invention of this high quality natural and graphics image compression applies a prediction mechanism to decide which of the selected coding modes is applied to reduce the data rate of image and graphics data.
For gaining higher image quality, the present invention of this natural and graphics image compression decides which of the following four coding algorithms is selected to reduce the data rate of the differential value between the adjacent pixels of a group of images.
According to one embodiment of the present invention, the first table stores for example, approximately 16 patterns which are most frequent values in previous pixels within an image.
According to one embodiment of the present invention, the second table stores for example, approximately 4 patterns which are most frequent happened values which might be comprised of the 2 most frequent happened patterns in upper segment and 2 most frequent happened patterns in previous pixels within an image frame.
According to one embodiment of the present invention, multiple counters are used to calculate the time of “Pattern Repeat” and if the time is larger than a threshold, this mode is selected to be the coding method of representing the present image.
According to another embodiment of the present invention, the “Repeat” pattern can be a pattern being coded by predicting the divider and coding the Quotient and Remainder, or one of the top 16 patterns or one of the top 4 patterns.
It is to be understood that both the foregoing general description and the following detailed description are by examples, and are intended to provide further explanation of the invention as claimed.
Due to sharp quality and good immunity to the noise, and convenient in storage, the digital image has prevailingly become popular in mass applications like digital camera, digital camcorder, digital photo albums, scanner/printer/fax, image archiving and storage . . . etc.
For saving the requirement of density of storage device and time of transmission, image compression technology has been deployed to reduce the data rate of the digital image. In the past decades, many image compression algorithms have been applied to image applications. Some are lossy and very few are lossless. Lossy means the recovered or decompressed image from a compressed image will have data loss compared to the original image. ITU and ISO have developed and defined some image and video compression algorithms including JPEG, an still image compression standard and MPEG, the video compression standard. The JPEG image has widely applications with the cost of data loss compared to the original image.
JPEG image compression as shown in
A color space conversion 10 mechanism transfers each 8×8 block pixels of the R(Red), G(Green), B(Blue) components into Y(Luminance), U(Chrominance), V(Chrominance) and further shifts them to Y, Cb and Cr. JPEG compresses 8×8 block of Y, Cb, Cr 11, 12, 13 by the following procedures:
Step 1: Discrete Cosine Transform (DCT)
Step 2: Quantization
Step 3: Zig-Zag scanning
Step 4: Run-Length pair packing and
Step 5: Variable length coding (VLC).
DCT 15 converts the time domain pixel values into frequency domain. After transform, the DCT “Coefficients” with a total of 64 sub-bands of frequency represent the block image data, no long represent single pixel. The 8×8 DCT coefficients form the 2-dimension array with lower frequency accumulated in the left top corner, the farer away from the left top, the higher frequency will be. Further on, the closer to the left top, the more DC frequency which dominates the more information. The more right bottom coefficient represents the higher frequency which less important in dominance of the information. Like filtering, quantization 16 of the DCT coefficient is to divide the 8×8 DCT coefficients and to round to predetermined values. Most commonly used quantization table will have larger steps for right bottom DCT coefficients and smaller steps for coefficients in more left top corner. Quantization is the only step in JPEG compression causing data loss. The larger the quantization step, the higher the compression and the more distortion the image will be.
After quantization, most DCT coefficient in the right bottom direction will be rounded to “0s” and only a few in the left top corner are still left non-zero which allows another step of said “Zig-Zag” scanning and Run-Length packing 17 which starts left top DC coefficient and following the zig-zag direction of scanning higher frequency coefficients. The Run-Length pair means the number of “Runs of continuous 0s”, and value of the following non-zero coefficient.
The Run-Length pair is sent to the so called “Variable Length Coding” 18 (VLC) which is an entropy coding method. The entropy coding is a statistical coding which uses shorter bits to represent more frequent happen patter and longer code to represent the less frequent happened pattern. The JPEG standard accepts “Huffman” coding algorithm as the entropy coding. VLC is a step of lossless compression. JPEG is a lossy compression algorithm, the JPEG picture with less than 10× compression rate has sharp image quality, 20× compression will have more or less noticeable quality degradation.
The JPEG compression procedures are reversible, which means the following the backward procedures, one can decompresses and recovers the JPEG image back to raw and uncompressed YUV (or further on RGB) pixels. The main disadvantage of JPEG compression algorithm is the input data are sub-sampled and the compression algorithm itself is a lossy algorithm caused by quantization step which might not be acceptable in some applications.
Very few lossless image compression algorithms have been developed due to the following two factors:
A well know prior art of the lossless image compression method is shown in
This invention of the image compression overcomes disadvantages of both lossy compression algorithm like JPEG and another prior art of VLC coding of the differential values of adjacent pixel in quality and compression rate issues. This invention applies a mixture of new lossless compression algorithms and another new lossy compression algorithm to reach high image quality and reasonable high compression rate.
As shown in
Div
—
=(Div—
This predictive divider has 50% weighted factor of the latest pixel information, said the Diff—
Should a lossless compression under a predetermined bit rate is not possible, a lossy compression of quantization step 33 will play the role of compression followed by the VLC coding as above paragraph.
Another mechanism of reaching higher compression ratio of digital image of this invention is applying a mapping method. A predetermined size of a table, a temporary buffer is used to save the most frequent show-up patterns, for example, 16 patterns. Should the current pixel happens to be the same of one of the patterns saved in the table, the corresponding code can be used to represent the differential value of that pixel. For coding efficiency, this invention applies two separate look up tables with each for example having top 16 most frequent patterns 35 and 4 most frequent patterns 36. The 16 most frequent patterns require 4 bits to represent, while the 4 most frequent patterns need 2 bits to represent. Each input pixel will be sent this these two mechanisms for calculating the frequency of show-up. The input pixels will also be conducted to be counted how many times the pattern is continuously repeated 37. The counter bit number is predetermined, for instant, a 3 bits to represent up to 7 times of continuously show up pattern. Another code is reserved to represent “End of Group” 38 means no longer “Non-zero” differential value of adjacent pixels to the end of a group.
For gaining higher coding efficiency, the first table saves up to 16 the most frequent patterns which can use a fixed 4 bits to represent each pattern, while the second table saves up to 4 the most frequent patterns which can use a fixed 2 bits to represent each pattern.
It will be apparent to those skills in the art that various modifications and variations can be made to the structure of the present invention without departing from the scope or the spirit of the invention. In the view of the foregoing, it is intended that the present invention cover modifications and variations of this invention provided they fall within the scope of the following claims and their equivalents.