# Patent

## Title
Compressed domain system and method for compression gains in encoded data

## Abstract

A system and method for compressed domain compression are provided for improving compression gains in an encoded image, such as a Joint Photographic Experts Group (JPEG)-encoded images, or encoded video, such as Motion Joint Photographic Experts Group (Motion JPEG)-encoded video, without fully decoding and re-encoding the compressed images or video.

## Background
PRIORITY CLAIMS/RELATED APPLICATIONS
This application is a continuation of and claims priority under 35 USC 120 to U.S. patent application Ser. No. 13/001,035 filed on Jun. 22, 2009 (issued as U.S. Pat. No. 8,422,804 on Apr. 16, 2013) which in turn claims the benefit under 35 USC 119(e) to U.S. Provisional Patent Application Ser. No. 61/074,829 filed on Jun. 23, 2008 and entitled “Compressed Domain System and Method for Compression Gains in Encoded Data” and claims priority under 35 USC 120 to U.S. patent application Ser. No. 11/605,892 filed on Nov. 28, 2006 entitled “Efficient Content Compression and Decompression System and Method” which in turn claims the benefit under 35 USC 119(e) to U.S. Provisional Patent Application Ser. Nos. 60/795,822 filed on Apr. 28, 2006 and 60/816,115 filed on Jun. 22, 2006, all of which are incorporated herein by reference.


FIELD
A system and method for compressed domain methodologies for improving compression gains in encoded data, such as for example images or video, without fully decoding and re-encoding the encoded data is described.
BACKGROUND
Content, such as digital data, is comprised of bytes of information, with each byte representing, in some sense, a sample of source data at a particular point in time and/or space. There is usually some type of redundancy in such data. As is well known, this fact is used to compress the data to make it more efficient for data transmission and storage.
In addition to data redundancy, data importance is another factor present in such data. In other words, some parts of the data are more important than others, from the point of view of human perception of the data.
One type of content is digital images. Digital images are comprised of pixels, with each pixel represented by one or more bytes of information. For typical color images, 3 color components (usually Red, Green and Blue) are needed, with each component typically represented by one byte of information. Hence, color images can be adequately represented by 3 bytes of information for every pixel in the image.
The number of pixels in an image is determined by the resolution of the image. A 1-MegaPixel image contains one million pixels. The amount of information carried by a 1-Mega Pixel color image is, therefore, of the order of 3 Megabytes. Today's digital cameras generate images much higher in resolution and thus a 6-Mega Pixel color image would translate to about 18 MB of data. Since digital images carry so much information and take up lots of space, it is only natural that techniques are developed to compress the large of amount of image data.
The JPEG (Joint Photographic Experts Group) standard is an image compression standard that was standardized in 1992, and is the most commonly used method of compression for photographic images. It is the most common image format used by digital cameras and other photographic image capturing devices—including mobile phones—and is the most common format for storing and transmitting photographic images on the World Wide Web. It is estimated that over 90% of the world's digital images are stored in the JPEG format.
JPEG typically achieves 10 to 1 compression for photographic images with little perceivable loss in image quality. Other image compression algorithms have since been developed that provide additional compression gains over JPEG. Notable among them is the JPEG 2000 still image compression standard, standardized by the Joint Photographic Experts Group in 2000. However, the world of digital images still revolves around JPEG and has yet to migrate to the new image codecs. Part of the reason for this loyalty to JPEG is the simple, fast, yet efficient algorithm that JPEG provides.
One of the challenges of research in image compression is to come up with simple image codecs that provide fast yet efficient implementations of image compression—providing higher compression gains than JPEG but at the speed and complexity of the simple JPEG algorithm.
Thus, it is desirable to provide a technique that boosts up the compression gains of compression methods, such as JPEG or any other compression algorithm, without adding much to the cost of complexity of the system and it is to this end that the system and method described below are directed.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 illustrates a process of applying a ‘least significant bit-plane removal’ system and method on a JPEG image in a spatial domain;
FIGS. 2a and 2b illustrate manifestation of the operations S(O(k)) and O(S(k)); and
FIG. 3 illustrates a partial decoding/encoding approach of applying the ‘least significant bit-plane removal’ technique on a JPEG image in a compressed domain.



DETAILED DESCRIPTION OF ONE OR MORE EMBODIMENTS
The system and method described below are particularly applicable to JPEG images and compressing JPEG images and it is in this context that the system and method will be described. It will be appreciated, however, that the system and method has greater utility since a similar approach can be used to improve the compression of other image compression algorithms, video/moving picture algorithms, other data compression algorithms and the like and the system and method are not limited to the JPEG example described below. For example, the compressed domain system and method described below can be applied to each individual frame of motion JPEG video to achieve similar compression gains.
In the illustrative example, the system and method may be used to further compress JPEG images. The system and method may be implemented in compressed domain so that full decoding and re-encoding of JPEG images is not required. In terms of complexity, only about 20% or less of the JPEG decoding and encoding complexity is needed to implement the system and method.
In general, image compression is achieved by de-correlating the image data using an appropriate known mathematical transformation, such as the Discrete Cosine Transform, the Discrete Wavelet Transform, and the Discrete Haar Transform. The characteristics of image data can be analyzed by looking at two important parameters used in image data compression—1) Data Rate, and 2) Data Distortion. In the description below, the image data is analyzed with respect to these two parameters by breaking the image into its constituent image data planes.
Data Rate
When the image data is analyzed based on the individual image bit-planes, the image data correlation decreases as the analysis moves to less significant image bit-planes. Thus, the least significant image bit-plane has the least data correlation and has image data that is very similar in behavior to random noise. Furthermore, it is well-known that random noise has data that is highly de-correlated and has the highest entropy value for a particular source data type so that this data is the hardest to compress. In other words, random data cannot be efficiently compressed.
Since the least significant image bit-plane has a data distribution close to random noise, it cannot be efficiently compressed. As we go up the image bit-planes to more significant bit-planes, the data becomes more correlated and is, therefore, more efficient to compress. In other words, the least significant bit-plane makes up largest part of the data, among individual image bit-planes, in the compressed image data.
Data Distortion
The other important factor in the analysis is the contribution of individual image bit-planes to the distortion (or conversely quality level) of the image. When the image data in terms of its individual bit-planes is analyzed, it is found that each image bit-plane has a certain weight associated with it that contributes collectively to the overall image data value. For example, the least significant bit-plane has a weight of 1, the next significant bit-plane has a weight of 2, and the next has 4, then 8, 16, and so on. In other words, if a bit has a value of 1 in a bit-plane, then its value contribution to the overall pixel data value in the bit-planes, from least significant to most significant, is 1, 2, 4, 8, 16, and so on.
From the weight distribution, it is easy to see that the contribution of the least significant image bit-plane to the overall image pixels is the least. Thus, the loss of the least significant bit-plane would result in a maximum loss of pixel value of 1 from all the pixels in the image. In almost all cases, this loss is not visually discernible. Hence, the least significant image bit-plane adds the least to the image quality.
Removal of Data
As seen from the above analysis, the least significant image bit-plane has two important characteristics: 1) it cannot be compressed efficiently; and 2) it does not add much value to the overall image distortion (or conversely, quality). Hence, if the least significant image bit-plane is removed, its impact is two-fold: 1) the size of the compressed data will reduce significantly; and 2) the removal of such data will not adversely affect the perceptual image quality. The removal of the least significant image bit-plane can be accomplished by right-shifting the image pixel values by one bit shift. It is known that right-shifting a non-negative integer value by one shift is equivalent to integer division of the value by two. Thus, the above concept of increasing the compression efficiency by removing the least significant image bit-plane can be accomplished by dividing the original pixel values by 2.
In the system and method described herein, the removal of one or more bit-planes (at least one least significant bit-plane) may be implemented in compressed domain (e.g., on an image that is already compressed.) The motivation for such a methodology is the fact that several computing devices, including hand-held mobile devices, are constrained in computing power. In an uncompressed domain, to remove the least significant image bit-plane on an already stored and compressed image, such as JPEG, the image must first be fully decoded, then processed as above, and finally fully encoded again as JPEG. For devices constrained in computing power, this entire process is very expensive in terms of processing power and time. A compressed domain approach would not require full decoding and re-encoding of the image, thereby providing significant savings in processing power and time.
Compressed Domain Approach
The concept of ‘least significant bit-plane removal’ may be applied to image pixel data that is uncompressed, i.e., it can be applied to uncompressed image data at the time of capture and before it is encoded. However, it can also be applied to already encoded JPEG (or other encoding methods, such as Motion JPEG) data, such as images or video. In an uncompressed domain, this process involves full decoding and re-encoding of the image. A much more efficient way of applying this concept is to do the processing in the compressed domain, without going through the full decode-encode cycle that would be required by the uncompressed domain approach.
FIG. 1 illustrates a process of applying a ‘least significant bit-plane removal’ system and method on a JPEG image in the spatial uncompressed domain. Consider an image that has already been encoded using the JPEG compression standard. FIG. 1 shows how the concept of ‘least significant bit-plane removal’ can be applied on the JPEG image to increase its compression efficiency. Basically, the image is fully decoded (as illustrated by a Huffman decoder 10, inverse quantizer 12, inverse discrete cosine transform 14 and a YUV to RGB converter 16 which are the typical steps performed during the decoding of a JPEG encoded image), a bit-shifting or division operation 18 is applied to the raw uncompressed image data, and finally the image is fully re-encoded (using a RGB to YUV converter 20, a forward discrete cosine transform 22, a quantizer 24 and a Huffman encoder 26.)
The modules of Image Transformation (DCT) and Color Transformation (RGB/YUV) in the JPEG codec illustrated in FIG. 1 belong to the class of linear systems. In the analysis that follows, it is shown that these two modules are invariant to (unaffected by) the operation of ‘Division by 2’, i.e., if O(k) denotes the operation ‘Division by 2’ on a data set k, and S denotes a linear system, then:

S(O(k))=O(S(k))  (1)

In other words, processing a data set as shown in FIGS. 2a and 2b with the ‘Division by 2’ operation and then passing it through the system is equivalent to passing it through the system and then processing it with the ‘Division by 2’ operation.
Below, we show that the ‘Division by 2’ operation is invariant to the first two steps of the JPEG decoder: 1) the Color Transformation, and 2) the Image Transformation.
Color Transformation
Color Transformation in JPEG is done to convert between the color transforms of RGB and YUV color space. There are many variants of the RGB→YUV color transformation, but they all take the following form:

Y=α0R+β0G+γ0B 

U=α1R+β1G+γ1B 

V=α2R+β2G+γ2B  (2)

where, αi,βi,γi, i=0,1,2, are scalar constants, R,G,B represent the Red, Green and Blue pixel values of the RGB color space, and Y,U,V represent the 1 Luminance (Y) and 2 Chrominance (U,V) values of the YUV color space.
Likewise, there are many variants of the YUV→RGB color transformation, but they all take the following form:

R=α0′Y+β0′U+γ0′V 

G=α1′Y+β1′U+γ1′V 

B=α2′Y+β2′U+γ2′V  (3)

where, αi′,βi′,γi′, i=0,1,2, are scalar constants, R,G,B represent the Red, Green and Blue pixel values of the RGB color space, and Y,U,V represent the 1 Luminance (Y) and 2 Chrominance (U,V) values of the YUV color space.
Without loss of generality, let us consider one of the above equations for proof of linearity for the ‘Division by 2’ operation. We have the original data set (R,G,B) represented in RGB color space. Conversion to Y value is given by:

Y=α0R+β0G+γ0B  (4)

If we apply the ‘Division by 2’ operation to the original (R,G,B) pixel values, then the data set will be represented by (R/2,G/2,B/2) respectively. Conversion to Y value for the modified data set gives:




  
    
      
        
          
            
              α
              0
            
            ⁡
            
              (
              
                R
                /
                2
              
              )
            
          
          +
          
            
              β
              0
            
            ⁡
            
              (
              
                G
                /
                2
              
              )
            
          
          +
          
            
              γ
              0
            
            ⁡
            
              (
              
                B
                /
                2
              
              )
            
          
        
        =
        
          
            
              
                (
                
                  
                    α
                    0
                  
                  ⁢
                  R
                
                )
              
              /
              2
            
            +
            
              
                (
                
                  
                    β
                    0
                  
                  ⁢
                  G
                
                )
              
              /
              2
            
            +
            
              
                (
                
                  
                    γ
                    0
                  
                  ⁢
                  B
                
                )
              
              /
              2
            
          
          =
          
            
              
                (
                
                  
                    
                      α
                      0
                    
                    ⁢
                    R
                  
                  +
                  
                    
                      β
                      0
                    
                    ⁢
                    G
                  
                  +
                  
                    
                      γ
                      0
                    
                    ⁢
                    B
                  
                
                )
              
              /
              2
            
            =
            
              Y
              /
              2
            
          
        
      
    
    
      
        (
        5
        )
      
    
  




Thus, YUV values for the data set (R/2,G/2,B/2) are given by (Y/2,U/2,V/2). In other words, performing the ‘Division by 2’ operation on RGB values and then doing RGB→YUV color transformation is the same as performing the ‘Division by 2’ operation on YUV values.
Similar results are applicable for YUV→RGB conversion module, and are not shown here for brevity and because the results would be known to one of ordinary skill in the art.
Image Transformation
Image Transformation in JPEG is done to convert YUV image values to DCT transformed coefficients and vice versa. The 2-dimensional DCT transform used in JPEG takes the following form:




  
    
      
        
          F
          ⁡
          
            (
            
              u
              ,
              v
            
            )
          
        
        =
        
          
            α
            ⁡
            
              (
              u
              )
            
          
          ⁢
          
            α
            ⁡
            
              (
              v
              )
            
          
          ⁢
          
            
              ∑
              
                i
                =
                0
              
              7
            
            ⁢
            
              
                ∑
                
                  j
                  =
                  0
                
                7
              
              ⁢
              
                
                  f
                  ⁡
                  
                    (
                    
                      i
                      ,
                      j
                    
                    )
                  
                
                ⁢
                
                  cos
                  ⁡
                  
                    [
                    
                      
                        π
                        8
                      
                      ⁢
                      
                        (
                        
                          
                            i
                            +
                            1
                          
                          2
                        
                        )
                      
                      ⁢
                      u
                    
                    ]
                  
                
                ⁢
                
                  cos
                  ⁡
                  
                    [
                    
                      
                        π
                        8
                      
                      ⁢
                      
                        (
                        
                          
                            j
                            +
                            1
                          
                          2
                        
                        )
                      
                      ⁢
                      v
                    
                    ]
                  
                
              
            
          
        
      
    
    
      
        (
        6
        )
      
    
  




where, α(u), α(v), are scalar constants, f(i,j) represents the image (YUV) values, and F(u,v) represents the transformed DCT coefficients.
Consider the input image values f(i,j) used in Eq. (6). If we apply the ‘Division by 2’ operation to these values, then the data set will be represented by f(i,j)/2. Passing this data through the DCT module, and making use of Equation (6), we get the output:




  
    
      
        
          
            α
            ⁡
            
              (
              u
              )
            
          
          ⁢
          
            α
            ⁡
            
              (
              v
              )
            
          
          ⁢
          
            
              ∑
              
                i
                =
                0
              
              7
            
            ⁢
            
              
                ∑
                
                  j
                  =
                  0
                
                7
              
              ⁢
              
                
                  [
                  
                    
                      f
                      ⁡
                      
                        (
                        
                          i
                          ,
                          j
                        
                        )
                      
                    
                    /
                    2
                  
                  ]
                
                ⁢
                
                  cos
                  ⁡
                  
                    [
                    
                      
                        π
                        8
                      
                      ⁢
                      
                        (
                        
                          
                            i
                            +
                            1
                          
                          2
                        
                        )
                      
                      ⁢
                      u
                    
                    ]
                  
                
                ⁢
                
                  cos
                  ⁡
                  
                    [
                    
                      
                        π
                        8
                      
                      ⁢
                      
                        (
                        
                          
                            j
                            +
                            1
                          
                          2
                        
                        )
                      
                      ⁢
                      v
                    
                    ]
                  
                
              
            
          
        
        =
        
          
            
              
                
                  α
                  ⁡
                  
                    (
                    u
                    )
                  
                
                ⁢
                
                  α
                  ⁡
                  
                    (
                    v
                    )
                  
                
              
              2
            
            ⁢
            
              
                ∑
                
                  i
                  =
                  0
                
                7
              
              ⁢
              
                
                  ∑
                  
                    j
                    =
                    0
                  
                  7
                
                ⁢
                
                  
                    [
                    
                      f
                      ⁡
                      
                        (
                        
                          i
                          ,
                          j
                        
                        )
                      
                    
                    ]
                  
                  ⁢
                  
                    cos
                    ⁡
                    
                      [
                      
                        
                          π
                          8
                        
                        ⁢
                        
                          (
                          
                            
                              i
                              +
                              1
                            
                            2
                          
                          )
                        
                        ⁢
                        u
                      
                      ]
                    
                  
                  ⁢
                  
                    cos
                    ⁡
                    
                      [
                      
                        
                          π
                          8
                        
                        ⁢
                        
                          (
                          
                            
                              j
                              +
                              1
                            
                            2
                          
                          )
                        
                        ⁢
                        v
                      
                      ]
                    
                  
                
              
            
          
          =
          
            
              
                1
                2
              
              [
              
                
                  α
                  ⁡
                  
                    (
                    u
                    )
                  
                
                ⁢
                
                  α
                  ⁡
                  
                    (
                    v
                    )
                  
                
                ⁢
                
                  
                    ∑
                    
                      i
                      =
                      0
                    
                    7
                  
                  ⁢
                  
                    
                      ∑
                      
                        j
                        =
                        0
                      
                      7
                    
                    ⁢
                    
                      
                        f
                        ⁡
                        
                          (
                          
                            i
                            ,
                            j
                          
                          )
                        
                      
                      ⁢
                      
                        cos
                        ⁡
                        
                          [
                          
                            
                              π
                              8
                            
                            ⁢
                            
                              (
                              
                                
                                  i
                                  +
                                  1
                                
                                2
                              
                              )
                            
                            ⁢
                            u
                          
                          ]
                        
                      
                      ⁢
                      
                        cos
                        ⁡
                        
                          [
                          
                            
                              π
                              8
                            
                            ⁢
                            
                              (
                              
                                
                                  j
                                  +
                                  1
                                
                                2
                              
                              )
                            
                            ⁢
                            v
                          
                          ]
                        
                      
                    
                  
                
              
              ]
            
            =
            
              
                F
                ⁡
                
                  (
                  
                    u
                    ,
                    v
                  
                  )
                
              
              /
              2
            
          
        
      
    
    
      
        (
        7
        )
      
    
  




Thus, the DCT coefficients for the data set f(i,j)/2 are given by F(u,v)/2. In other words, performing the ‘Division by 2’ operation on image values and then doing DCT transformation is the same as performing the ‘Division by 2’ operation on DCT coefficients directly.
Similar results are applicable for the inverse DCT transformation, and are not shown here for brevity and because the results would be known to one of ordinary skill in the art.
Compressed Domain Compression
As seen from the analysis above, the effect of ‘Right bit-shift by 1’ or ‘Division by 2’ is invariant to the Color Transform or Image (DCT) Transform. Thus, an approriate compressed domain method and system can produce the same effect for these operations when applied to the DCT coefficients, as we get for applying them on input RGB pixel values.
FIG. 3 illustrates a partial decoding/encoding approach of applying the ‘least significant bit-plane removal’ technique on a JPEG image in compressed domain. The elements of the partial decoder and partial encoder described below may be implemented in hardware (circuits or programmable devices that performs the function described below) or in software (a plurality of lines of code for each element that performs the function described below.) The above analysis shows that it is not necessary to fully decode a JPEG image to apply the bit-plane removal operation. Rather, we can decode the JPEG image up to the point where we get the DCT coefficients as shown in FIG. 3 (perform a Huffman decoding 30 and an inverse quantization 32.) The Huffman decoder and the inverse quantizer may be collectively known as a partial decoder. Once the inverse quanitization is performed, the data prior to the inverse DCT are well known DCT coefficients and the least significant bit-plane removal (using a division by 2 operation 18) can be performed on the DCT coefficients. The least significant bit-plane removal may be performed by a least significant bit-plane removal unit that may be implemented in software code or hardware. The least significant bit-plane removal unit may remove the least significant bit-plane of the DCT coefficient, and may be implemented using a right bit-shift or a divide by 2 operation. Once the one or more bit-planes have been removed, the JPEG bitstream can be re-created without having to fully re-encode the data using the JPEG encoder. In particular, since we already have the DCT coefficients, we only need to apply the rest of the JPEG encoder modules (a quantizer 34 and a Huffman encoder 36) to create a valid JPEG bitstream. The quantizer and the Huffman encoder may be collectively known as a partial encoder. Thus, a ‘least significant bit-plane removal’ process on a JPEG image may be performed as follows:
1) Partially decode the JPEG image by passing it through Huffman decoder and Inverse Quantizer. This gives us access to DCT coefficients for the JPEG image.
2) Modify the DCT coefficients by dividing them by 2 or right-shifting them by 1 bit. This produces the same effect as removing the last bit-plane of the RGB pixel values of the image. Note that we may perform more than one bit-plane removal using this technique. For e.g., we can remove 2 bit-planes by right-shfting the DCT coefficient by 2 bits or dividing it by 4 (i.e., 22). The more bit-planes we remove, the more compression we get, at the cost of more visual quality degradation.
3) Partially re-encode the JPEG data by passing the modified DCT coefficients through Forward Quantizer and Huffman encoder.
4) If needed, modify the JPEG Quantization tables in the JPEG header to reflect the Quantization tables used in the Forward Quantizer. One simple way to avoid this issue is to use the same Quantization Table as the original one that is already present in the JPEG image.
The above compressed domain system and method provides an efficient method for applying the technique of ‘least significant bit-plane removal’ to boost the compression efficiency of JPEG images because it has been found that the Image and Color Transform modules take up more than 80% of the computational load of the entire JPEG encoding or decoding process. Bypassing these two modules provides highly substantial speed-ups. On power constrained platforms, such as hand held devices, the gains are even more. Tests run on hand-held mobile devices have shown that using this system and method, the image compression/decompression is sped up by up to 10× as compared to the spatial domain approach shown in FIG. 1.
While the foregoing has been with reference to a particular embodiment of the invention, it will be appreciated by those skilled in the art that changes in this embodiment may be made without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims.

## Claims

1. A compressed domain compression apparatus for video, comprising:
a partial decoder that partially decodes an encoded piece of video to generate a partially decoded piece of video data;
a least significant bit plane removal unit that removes at least one least significant bit plane from the partially decoded piece of video data to generate a modified partially decoded piece of video data; and
a partial encoder that encodes the modified partially decoded piece of video data to generate fully compressed video data that is more compressed than the encoded piece of video data.

2. The apparatus of claim 1, wherein the least significant bit plane removal unit performs a divide by two operation to remove at least one least significant bit plane.

3. The apparatus of claim 1, wherein the least significant bit plane removal unit performs a right bit-shift operation to remove at least one least significant bit plane.

4. The apparatus of claim 1, wherein the video data further comprises a motion joint photographic experts group video.

5. The apparatus of claim 1, wherein the partially decoded piece of video data further comprises a plurality of inverse quantized transform coefficients.

6. A compressed domain compression method, comprising:
partially decoding an encoded piece of video data to generate a partially decoded piece of video data;
removing, using a least significant bit plane removal unit, at least one least significant bit plane from the partially decoded piece of video data to generate a modified partially decoded piece of video data; and
encoding the modified partially decoded piece of video data to generate fully compressed video data that is more compressed than the encoded piece of video data.

7. The method of claim 6, wherein removing at least one least significant bit plane further comprises performing a divide by two operation to remove the at least one least significant bit plane.

8. The method of claim 6, wherein removing at least one least significant bit plane further comprises performing a right bit-shift operation to remove the at least one least significant bit plane.

9. The method of claim 6, wherein the video data further comprises a motion joint photographic experts group video.

10. The method of claim 6, wherein the partially decoded piece of data further comprises a plurality of inverse quantized transform coefficients.