Patent Publication Number: US-9420292-B2

Title: Content adaptive compression system

Description:
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention generally relates to image compression, and more particularly to a content adaptive compression system. 
     2. Description of Related Art 
     In order to increase efficiency of storing or transmitting image data, an image is commonly subjected to image compression to reduce irrelevance and redundancy of the image data. 
     Tremendous compression algorithms have been disclosed. Each compression algorithm may be efficiently suitable for one or a few kinds of image, but there is no universal compression algorithm that may be applicable to all kinds of image. Accordingly, an image to be compressed should be determined beforehand, and an appropriate compression algorithm would be decided and consequently used to encode the image at hand. 
     This conventional scheme lacks adaptation and immediateness of changing compression algorithm to make it suitable for a new kind of image. Moreover, it is not unusual that an image may ordinarily include many kinds of image contents, and there is no effective way of correctly and promptly deciding which compression algorithm should be adopted. 
     For the foregoing reasons, a need has arisen to propose a novel compression scheme capable of efficiently and promptly encoding an image. 
     SUMMARY OF THE INVENTION 
     In view of the foregoing, it is an object of the embodiment of the present invention to provide a content adaptive compression system that adaptively encodes a portion of an image with an efficient encoder that best suits the content of that portion of the image. 
     According to one embodiment, a content adaptive compression system includes encoders, an error count unit and a mode decision unit. The encoders receive a portion of an image, and accordingly generate candidate compressed codes, respectively. The encoders are configured for encoding images of different contents. The error count unit determines an amount of error between the image and the candidate compressed code for each of the encoders. The mode decision unit receives a plurality of the amount of error. The candidate compressed code associated with least amount of error is outputted as an adaptive compressed code for the image. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         FIG. 1  shows a block diagram illustrated of a content adaptive compression system according to one embodiment of the present invention; 
         FIG. 2  shows a flow diagram of performing the gradient encoder of  FIG. 1  according to the embodiment of the present invention; 
         FIG. 3  shows a flow diagram of performing the edge encoder of  FIG. 1  according to the embodiment of the present invention; and 
         FIG. 4  shows a flow diagram of performing the texture encoder of  FIG. 1  according to the embodiment of the present invention. 
     
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
       FIG. 1  shows a block diagram illustrated of a content adaptive compression system (“compression system” hereinafter)  100  according to one embodiment of the present invention. The shown blocks of the compression system  100  may be implemented or performed, for example, by circuitry such as a digital image processor. As the code generated from the compression system  100  of the embodiment has a fixed number of bits, the compression system  100  is a fixed length compression system. Moreover, an image to be compressed by the compression system  100  should be first divided into blocks, and one block (e.g., composed of 2×8 pixels) of the image is received and compressed at a time by the compression system  100 , which is therefore a block-based compression system. 
     As shown in  FIG. 1 , the compression system  100  may include a number of encoders, for example, three encoders  11 A,  11 B and  11 C as exemplified in  FIG. 1 . The encoders  11 A- 11 C are coupled to receive a block of the image, and accordingly generate candidate compressed codes, respectively. According to one aspect of the embodiment, the encoders  11 A- 11 C are configured for encoding images of different contents, respectively. Specifically, in the embodiment, a gradient encoder  11 A is configured for encoding the image of a gradient content, an edge encoder  11 B is configured for encoding the image of an edge content, and a texture encoder  11 C is configured for encoding the image of a texture content. 
     The compression system  100  may include an error count unit  12  that is configured to determine an amount of error between the (original) image and the candidate compressed code. In one embodiment, as exemplified in  FIG. 1 , the error count unit  12  may include three error count sub-units  12 A,  12 B and  12 C for the gradient encoder  11 A, the edge encoder  11 B and the texture encoder  11 C, respectively. In another embodiment, not shown in  FIG. 1 , a single error count unit  12  may be used for the encoders  11 A- 11 C in sequence. 
     In the embodiment, sum of absolute differences (SAD) is adopted to determine the amount of error. Specifically, an absolute difference between each pixel in the block of the (original) image and a corresponding pixel in the candidate compressed code is taken. Absolute differences corresponding to at least a portion of pixels in the block of the image are then summed to generate a metric of error. The less is the metric, the less is the error. Accordingly, the error count unit  12  generates metrics for different codings, e.g., gradient coding, edge coding and texture coding. 
     The compression system  100  of the embodiment may also include a mode decision unit  13  that is coupled to receive the metrics (e.g., SADs) for gradient coding, edge coding and texture coding. The coding associated with the least metric is then determined (by the mode decision unit  13 ) as an adaptive coding, and the candidate compressed code from the corresponding encoder  11 A,  11 B or  11 C is then used as an adaptive compressed code for the (block of the) image. The adaptive compressed codes of all blocks of the image construct a compressed image, which may be then stored, transmitted or subjected to further processing. The gradient encoder  11 A, the edge encoder  11 B and the texture encoder  11 C mentioned above will be described in details in the following paragraphs. 
       FIG. 2  shows a flow diagram of performing the gradient encoder  11 A of  FIG. 1  according to the embodiment of the present invention. In the embodiment, the gradient coding is performed by bitstream coding algorithm. Although the bitstream coding is exemplified here, however, other algorithms in the conventional art suitable for coding a gradient content may be used instead. Specifically, in step  21 , a pixel is predicted according to neighboring pixels. In the embodiment, a median adaptive prediction is adopted to carry out pixel prediction according to an upper pixel and a left pixel. In step  22 , a maximum residual length is estimated for some different conditions, such as RGB color space, YUV color space, lossless coding or lossy coding. In step  23 , components (e.g., R, G and B) of the pixel are then encoded, for example, using bitstream coding algorithm, with the maximum residual length determined in step  22 . 
       FIG. 3  shows a flow diagram of performing the edge encoder  11 B of  FIG. 1  according to the embodiment of the present invention. In the embodiment, the edge coding is performed, for example, in YUV color space. Although the YUV color space is used here, however, other color spaces in the conventional art suitable for coding an edge content may be used instead. Specifically, in step  31 , the least significant bit (LSB) of a luminance component Y is truncated. Step  32  is performed to determine whether a smooth region exists. If it is determined to be a smooth region, adaptive interpolation is adopted to encode the pixels (step  33 ); otherwise, the pixels are stored directly (step  34 ). In one embodiment, the smoothness may be determined by comparing the block of image with a block shifted with one pixel. If the difference (e.g., SAD) between the two blocks is less than a predetermined threshold, a smooth region is thus determined. 
       FIG. 4  shows a flow diagram of performing the texture encoder  1   1 C of  FIG. 1  according to the embodiment of the present invention. In the embodiment, the texture coding is performed by block truncation coding (BTC). Although the block truncation coding is exemplified here, however, other algorithms in the conventional art suitable for coding a texture content may be used instead. Specifically, in step  41 , a color table is constructed for the block of image to be encoded. The color table records some dominating colors, such as a color with the maximum intensity, a color with the minimum intensity, and at least one color with an intermediate intensity. In one embodiment, the color table is constructed progressively. Specifically speaking, a first sub-block (e.g., composed of 2×2 pixels) and a second sub-block are compared to record dominating colors in the color table. Next, a third sub-clock is inspected, and further dominating colors may be determined to update the color table. The color table is updated progressively until the final sub-block has been inspected. 
     Subsequently, in step  42 , indices are respectively assigned to the colors recorded in the color table. In step  43 , the pixels in the block of image are then encoded using the indices in the color table. Accordingly, the number of levels in each block of image may be reduced (or quantized) while maintaining the same mean and standard deviation. 
     Although specific embodiments have been illustrated and described, it will be appreciated by those skilled in the art that various modifications may be made without departing from the scope of the present invention, which is intended to be limited solely by the appended claims.