1. Field of Invention
The present invention relates to method of image compression, and particularly relates to image compression method by applying an intelligent prediction mechanism by referring to the recorded information of adjacent line.
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 by quite high degree of difference between the compressed-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 the 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, the JPEG has between 10 to 20 times compression ratio, 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.
The method of this invention of image data compression is to achieve a reasonable high compression ratio compared to prior art lossless compression algorithms without sacrificing much the image quality.
The present invention is related to a method of the image compression with intelligent prediction of compressing the current line of pixels by adopting adjacent line information. The present invention significantly increases image quality compared to other counter part high quality compression methods.
The present invention of the image compression compresses the image data segment by segment by referring to the adjacent line image information.
The present invention of the image compression compresses the image data by referring to the complexity of the adjacent line of pixels.
The present invention applies the following main new concept of taking advantage of the correlation between neighboring lines of pixels which have higher similarity and less differential value to achieve low bit rate of storing the frame of pixels:
The present invention of the image compression records the pixel information of complexity of upper line and saves into a register for further compressing pixels of future adjacent line without inserting the upper line information to the bit stream of the current line of pixels.
According to one embodiment of present invention, a code of 1 to 4 bits are saved to represent that the prediction mode of selecting one of 3 upper pixels and 3-5 left pixels as the reference of DPCM calculation.
According to another embodiment of the present invention, a code of 1 to 8 bits are saved to represent the predicted divider of the DPCM coding which complex pixel in previous line using larger divider value and simple pattern using smaller divider.
According to an embodiment of this invention, the previous line pattern complexity is saved for predicting the bit rate distribution for future line compression.
According to another embodiment of the present invention, the simpler patter of previous line, the wider range of bit rate will be allowed for current line, and the more complex in previous line, the narrow range of bit rate will be allowed in current line in compression.
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 convenience 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.
ITU and ISO have developed and defined some image and video compression algorithms including JPEG, a 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:
Step1: 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 lo
A well known prior art of the lossless image compression method is shown in
JPEG is a lossy compression algorithm, the JPEG picture with less than 5× compression rate has sharp image quality, 10× 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:
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 adopts the basic concept of a prior art of lossless compression of taking difference of adjacent pixels for most pixels and applying a VLC coding method. One of the key inventions of this new method is applying a concept of taking advantage of close correlation 23 of line to line information 21, 22 as shown in
A key method of this invention applies predictive means of taking differential value of adjacent pixels and selects the pixel with smallest difference to be the reference of the DPCM coding, Differential Pulse Coded Modulation. The current pixel 31 is subtracted from surrounding pixels A 32, B 33, C 39, of previous line and multiple pixels of the left D, E, F, G, H, 34, 35, 36, 37, 38. In this example, using 3 bits of data can identify the right pixel to be the reference.
Line by line, the complexity of pixels is recorded and saved into a temporary register which information is to be used as the reference of compressing future line of pixels.
The selected VLC coding method in this invention is a lossless compression to code the DPCM coded value which codes the value of “Quotient(Q)” and “Remainder(R)” as in Eq. (1) by dividing the predictive “Divider” and a marker bit to separate the Q and R. For instance, a DPCM value of 11 with the Divider=4, the Quotient will be 2 and Remainder is 3, then, the code will be 00111. For simplification in hardware implementation, the divider of this invention is shifted to be the power of “2” and used implicit way to code without coding the divider into the bit stream.
D
—
n=Q×M+R (Y:Quotient, M:Divider, R:Remainder) (Eq.1)
For instant, a divider can always be predefined to be the average of current differential value of adjacent pixels and previous average divider as show in the equation Eq. 2, as below:
Div
13 nn=(Div—n-1+Diff—n)/2 (Eq. 2)
This predictive divider has 50% weighted factor of the latest pixel information, said the Diff—n and another 50% from accumulated dividers.
The pixels with high complexity of previous line are saved to a register for reference in compressing the current line. If complexity is higher than a threshold value, the DPCM value is too large and VLC code will exceed original length, said 8 bits, there is a good way to minimize it by referring to previous line and can code it as original value instead of DPCM value. Another possibility is to calculated the DPCM value and divides the DPCM value by predetermined dividers, for examples, by 2, by 4, . . . by 32, or by 64 to check which results in shortest code in coding the Quotient and Remainder and is selected to be the divider value for compressing the current line of pixels.
Besides predicting the compression algorithm and the reference of DPCM coding, this invention also uses a new way of deciding bit rate distribution by referring to the information, the pattern complexity of the adjacent line. In principle, the segment of a group of pixels will have similar pattern than the corresponding segment of adjacent line. Therefore, the previous line pixel data can be referred in deciding the bit rate of each segment in compression.
Since there will be correlation between adjacent frames in video frames, applying this invention of frame image compression, one can compress a video sequence with good quality. The complexity of each frame or region of a frame can be saved to a register for reference in compressing future frame and results in optimized good video quality.
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.