1. Field of the Invention
The present invention relates to image compression, and in particular relates to systems and methods of image compression.
2. Description of the Related Art
The rapid growth of digital imaging applications, including desktop publishing, multimedia, teleconferencing, and high-definition television (HDTV) has increased the need for efficient and standardized image compression techniques. Without image compression, the transmission of images would require an unacceptable bandwidth for many applications. As a result, methods of compressing images have been the subject of numerous research publications. Image compression schemes convert an image consisting of a two-dimensional array of pixels into a sequence of bits which are transmitted over a communication link. Each pixel represents the intensity of the image at a particular location therein. The transmission link may be an ordinary telephone line.
Consider an image comprising a gray-scale representation of a photograph at a resolution of 1000×1000 lines. Each pixel typically consists of 8 bits which are used to encode 256 possible intensity levels at the corresponding point on the photograph. Hence, without compression, transmission of the photograph requires that 8 million bits be sent over the communication link. A typical telephone line is capable of transmitting about 9600 bits per second; hence the picture transmission would require more than 10 minutes. Transmission times of this magnitude are unacceptable.
As a result, image compression systems are needed to reduce transmission time. It is also apparent to those skilled in the art that image compression systems may also be advantageously employed in image storage systems to reduce the amount of memory needed to store one or more images.
However, high compression rate demands often lead to low quality in the decoding image. On the other hand, to maintain a high quality from the original image to the decoding data, the compression rate for encoding must be low. Recently, the demands for higher quality images by users are increasing. Thus, quality control plays an important role in image compression. The balance between image quality and image compression rate must be addressed seriously.
A detailed description is given in the following embodiments with reference to the accompanying drawings.
A system of image compression is disclosed. The system comprises a first encoder, a second encoder and a determining device. The determining device further comprises a quality lost calculator, a code length expense calculator and a selector. The first encoder is configured to generate a first coded data. The second encoder is configured to generate a second coded data. Next, the determining device is configured to receive the first coded data and the second coded data. After receiving the said data, the quality lost calculator is configured to calculate a first quality lost value of the first coded data and a second quality lost value of the second coded data. The code length expense calculator is configured to calculate a first code length expense of the first coded data and a second code length expense of the second coded data. Finally, the selector is configured to calculate a first total expense value according to the first quality lost value and the first code length expense, a second total expense value according to the second quality lost value and the second code length expense, and to selectively output one of the first coded data and the second coded data according to the first total expense value and the second total expense value.
A method of image data compression is disclosed. First, a first coded data is generated. A second coded data is generated. Next, a first quality lost value of the first coded data is calculated, and a second quality lost value of the second coded data is calculated. Further, a first code length expense of the first coded data is calculated, a second code length expense of the second coded data is calculated. Then, a first total expense value is calculated according to the first quality lost value and the first code length expense, and a second total expense value is calculated according to the second quality lost value and the second code length expense. Finally, one of the first coded data and the second coded data is selectively output according to the first total expense value and the second total expense value.
The present invention can be more fully understood by reading the subsequent detailed description and examples with references made to the accompanying drawings, wherein:
The following description is of the best-contemplated mode of carrying out the invention. This description is made for the purpose of illustrating the general principles of the invention and should not be taken in a limiting sense. The scope of the invention is best determined by reference to the appended claims.
To achieve the best compression rate with acceptable image quality, a system and a method of image compression with quality control by dynamic coding methods selection is disclosed.
Further, determining device 150 receives the original image data IMG0 with the original length LEN0, the first coded data DAT1 with LEN1, the first image data IMG1, the second coded data DAT2 with LEN2 and the second image data IMG2, and selects the result data DATres between DAT1 and DAT2 according to quality lost value and code length expense of DAT1 and DAT2. First, quality lost calculator 151 calculates the sum of absolute difference (SAD) between the pixels in IMG0 and the one in IMG1 as SAD1, and calculates the sum of absolute difference (SAD) between the pixels in IMG0 and the one in IMG2 as SAD2. Then, quality calculator 151 calculates a first quality lost value QLV1 for DAT1 and a second quality lost value QLV2 for DAT2 according to SAD1 and SAD2 based on a predetermined correlation between the SAD and the quality lost value, respectively. Referencing
Further, code length expense calculator 153 calculates a first code length expense CLE1 according to LEN1 and a second code length expense CLE2 according to LEN2 based on a predetermined correlation between the length and the code length expense.
After QLV1, QLV2, CLE1 and CLE2 are obtained, selector 155 calculates a first total expense value TEV1 for DAT1 by TEV1=α×QLV1+β×CLE1, and a second total expense value TEV2 for DAT2 by TEV2=α×QLV2+β×CLE2. Where α and β are weights of the quality lost value and the code length expense, respectively, and may be predetermined by users. Finally, selector 155 selects the result data DATres between DAT1 and DAT2 according to TEV1 and TEV2. For example, selector 155 selects DAT1 to be the result data DATres if TEV1<TEV2 which means the total expense value of DAT1 is smaller than the one of DAT2, and selects DAT2 to be the result data DATres if TEV1>TEV2.
SAD1, the sum of the absolute differences (SAD) between the pixels in the original image data IMG0 and the pixels in the first image data IMG1, is calculated and temporarily saved. Similarly, SAD2, the SAD between the pixels in the original image data IMG0 and the pixels in the second image data IMG2, is calculated and temporarily saved. (S4) The first quality lost value QLV1 and the second quality lost value QLV2 are calculated and temporarily saved according to SAD1 and SAD2 based on the predetermined correlation between SAD and the quality lost value as shown in
In (S5), whether the original image data IMG0 is in a high frequency region or a low frequency region is determined first. If IMG0 is in a high frequency region, QLV1 and QLV2 are calculated as shown in
In (S6), whether CLE1 and/or CLE2 are/is over the predetermined limiting length is determined. Then, the corresponding code length expense is obtained according to LEN1 and LEN2. In the embodiment, referencing
In (S8), after obtaining TEV1 and TEV2 for DAT1 and DAT2, the result data DATres is selected to be DAT1 if TEV1<TEV2 which means the total expense value of DAT1 is smaller than the one of DAT2. If TEV1<TEV2, DATres is selected to be DAT2.
By the disclosed system and method, the encoding method with the best compression rate under a requested quality is selected to encode the original image data. Different parts in an image may be encoded by an adapted encoding method dynamically in the disclosed system and method to achieve the best compression rate under acceptable quality.
Systems and methods, or certain aspects or portions thereof, may take the form of a program code (i.e., instructions) embodied in a tangible media, such as floppy diskettes, CD-ROMS, hard drives, or any other machine-readable storage medium, wherein, when the program code is loaded into and executed by a machine, such as a computer system and the like, the machine becomes an apparatus for practicing the invention. The disclosed methods and apparatuses may also be embodied in the form of a program code transmitted over some transmission medium, such as electrical wiring or cabling, through fiber optics, or via any other form of transmission, wherein, when the program code is received and loaded into and executed by a machine, such as a computer or an optical storage device, the machine becomes an apparatus for practicing the invention. When implemented on a general-purpose processor, the program code combines with the processor to provide a unique apparatus that operates analogously to specific logic circuits.
While the invention has been described by way of example and in terms of the preferred embodiments, it is to be understood that the invention is not limited to the disclosed embodiments. To the contrary, it is intended to cover various modifications and similar arrangements (as would be apparent to those skilled in the art). Therefore, the scope of the appended claims should be accorded the broadest interpretation so as to encompass all such modifications and similar arrangements.