Patent Document

BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     This invention relates to the compression of pixel data. 
     2. Related Art 
     In picture processing applications, particularly video display applications such as those that use one or more standards defined by the Motion Picture Group (MPEG). The amount of memory space required to display and process picture data can be quite large, and can sometimes exceed the capability of the processing entity, commonly a graphics processor in a computer. 
     As an example, when utilizing the MPEG 2 standard method of processing motion picture data in the PAL format, the amount of picture data which must be stored per frame can be as much as approximately 2.5 megabytes of raw data. Without compression, this image would require five 256 K×16 bit memory chips for display. However, using a compression algorithm, the same 2.5 megabyte image can be stored in 2.0 megabytes or less, requiring only four memory chips instead of five. This reduction in memory requirements translates into real cost savings when considering engineering design time, component costs, and the physical space needed for more memory devices and associated control circuits. Thus, it is desirable to reduce the amount of memory space required for storing and displaying pixel data. 
     One method that is sometimes used in other picture processing contexts is to compress the picture data, that is to rewrite the data in another format, which requires less memory space. There are two types of compression, lossless and lossy. In lossless compression, the entire amount of information can be recovered from the compressed data; whereas in lossy compression, the process of compression loses some information. 
     Lossless compression would have the advantage of preserving the original pixel data and allowing that information to be recovered from the compressed data. However, known methods of lossless compression, such as the Liv-Zempel compression algorithm, may record individual pixels in fewer or more bits than in the original pixel data, and thus do not preserve the relative locations of pixels in memory. Thus, it can be difficult to identify the pixel data associated with a particular selected pixel. 
     Known methods of lossy compression suffer from the drawback that information which is lost is occasionally apparent to a viewer, resulting in a degraded display of the video data on the screen. The visual fidelity of the displayed picture width respect to the original image is then lower than desired. 
     It would be advantageous to provide a method of compressing pixel data in which the compressed pixel data has a high degree of fidelity with the original pixel data, and in which data associated with each pixel of information in a video display can be quickly and easily located i.e. randomly accessed quickly and with the minimum logic. It would also be advantageous to provide a method of compressing data which upon decompression is scalable and capable of being displayed in multiple environments such as TV, PC, or PDA environments. 
     SUMMARY OF THE INVENTION 
     The invention provides a method and system for pixel data compression in which sets of adjacent pixels are compressed as a block, in a manner, which is sometimes lossy and sometimes lossless. When lossy, the greatest loss in fidelity between the original and the compressed pixels is almost entirely reserved for circumstances where the loss is masked by the high-frequency components of the video data, resulting in a display which is indistinguishable from the original picture. 
     This invention is not format restricted, and can be used with other video signal formats such as SECAM, NTSC, etc. Depending on the video format being used, there are generally several pixel values which when used together, make up the pixel represented on the display screen. For a pixel R, there might be three bytes of data, each representing a degree of color, one for red, one for green, and one for blue. When choosing the values to be compared in the extant method, data representing common pixel attributes are compared and compressed together. For instance, in pixels R 1  through R 4 , each represented by pixel values 1 through 3, pixel values R 11 , R 21 , R 31  and R 41  would be compared for similarity. Next, pixel values R 12 , R 22 , R 32 , and R 42  might be compared, and so on. 
     The plurality of pixel values in the block are reformatted using a technique in which a first pixel value is represented as an approximate absolute value, and a set of dependent pixel values are represented as approximate relative differences in value. In cases where the relative differences are small or zero, the compression is completely lossless. In cases where the relative differences are larger, the formatting of the first pixel value is responsive to the degree of lossiness required to encode all of the pixels in the memory space allotted. 
     In a preferred embodiment, the first pixel value and the corresponding dependent pixel relative differences are compressed to a sufficient degree that the resulting compressed values fit within the available memory space. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 shows a memory diagram of one choice of a set of four adjacent pixels selected from an entire frame of pixels. 
     FIG. 2 shows two different sets of four adjacent pixels with different dependencies between pixels. 
     FIG. 3 is a flow chart of a pixel data compression algorithm. 
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT 
     In the following description, a preferred embodiment of the invention is described with regard to preferred process steps and data structures. Those skilled in the art would recognize after perusal of this application that embodiments of the invention can be implemented using DSP circuits adapted to particular process steps and data structures described herein, and that implementation of the process steps and data structures described herein would not require undue experimentation or further invention. 
     In a memory space for processing picture data, a frame comprises a plurality of horizontal lines, and each horizontal line comprises a plurality of pixels. For instance, one RGB display format in common use comprises 640×480 pixels, with each pixel represented with three pixel values (red, green, blue). 
     FIG. 1 shows one embodiment of a pixel group  102  consisting of a set of four pixels selected from an entire frame  100  of pixels. 
     In an uncompressed format, a set of four pixels, each represented by three pixel values would require twelve eight-bit bytes of memory for storage. However, in a compressed format such as that described herein, each set of four pixel values (32 bits total) is reformatted as a unit and requires only three eight-bit bytes (24 bits total) for storage. Thus, four pixels which previously used twelve bytes for storage now on average requires eight, a 25% decrease in storage requirements. Reformatted units of pixel values will be termed a “codeword” for the purposes of this specification. 
     FIG. 2 shows two different arrangements of pixels. Pixel grouping  104  depicts four pixels chosen such that each pixel is immediately adjacent to all other pixels in its group, whether diagonally, horizontally, or vertically. Pixel grouping  106  depicts four pixels which are linearly arranged such that each successive pixel is adjacent to and linearly arranged with the previous pixel. Although any of the pixel relationships shown would be acceptable for this algorithm, grouping  104  provides the best arrangement of primary and dependent pixels because pixels R 1 , R 2 , and R 3  are likely to contain information which has a high degree of similarity to one another and pixel R 0  due to their relative closeness to one another in the frame. 
     Should the location of R 0  be such that R 1 , R 2 , or R 3  would fall outside the display area, the difference values associated with those pixels would be assigned a value of zero. For example, if R 2  and R 3  fall outside the viewing area, Diff 12 =R 1 −R 2  is set to zero, and DIFF 23 =R 2 −R 3  is set to zero. This situation will never occur when using data decoded from MPEG standards, since the block size for MPEG data is 16×16, resulting in a block which is always evenly divisible by 4. In this case, four 4-pixel groups will always be available. 
     Pixel value P 0 , chosen from pixel R 0 , might represent a saturation for a particular hue, perhaps red, as seen in an RGB format, or a value representing a luminance or chrominance value(such as a Y value, a Cr value, or a Cb value), as seen in a YUV format. Similarly, pixel values P 1 , P 2 , and P 3 , might represent the saturation level for the color red for pixels R 1 , R 2 , and R 3 . Referring to the flow chart depicted in FIG. 3, the process begins at block  201  where the difference between pixel values is computed in order to determine their relative similarity. Next, at a block  203  the resulting data is examined to decided if the absolute value of the difference between them is less than 16. If so, a block  204  generates the codeword using pixel value P 0  and the four least significant bits of the difference between values P 0  and P 1 , P 1  and P 2 , P 2  and P 3 , followed by a tag comprising a trailing tag bit “1”. It is the location of this tag bit “1”, in bit position “0”, “1”, “2”, or “3”, that tells a restoration technique which method was used in constructing the codeword so that the proper restoration steps may be used. 
     If, at the block  203 , the resulting differences are greater than  16 , the method then examines the three most significant bits. This is accomplished, as shown at a block  205 , when the differences between the pixel values are examined to decide if they are less than  32 . If so, the codeword is generated, in a block  206 , as the seven most significant bits of the base value P 0  and P 1 , P 1  and P 2 , P 2  and P 3 , followed by two trailing tags bits “10”. 
     If, in block  205 , the resulting differences are greater than  32 , the algorithm then examines the two most significant bits. This is accomplished, as shown in block  207 , when the differences between the pixel values are examined to determine if they are less than 64. If yes, the codeword is generated, in block  208 , as the six most significant bits of the base value P 0 , followed by bits  2  through  6  of the differences between pixels P 0  and P 1 , P 1  and P 2 , P 2  and P 3 , followed by three trailing tag bits “100”. 
     If, in block  207 , the resulting differences are greater than 64, the worst case has been identified, and in blocks  209  and  211 , the algorithm then forms the codeword using the four most significant bits of pixel value P 0 , followed by bits  3  through  7  of the differences between P 0  and P 1 , P 1  and P 2 , P 2  and P 3 , followed by the sum of the two least significant bits, bit  0  and bit  1 , of values P 0 , P 1 , P 2 , and P 3 , followed by three trailing tag bits “000”. 
     In sum, compression according to the invention can be performed by a method including the steps of accessing and selecting a plurality of pixels, identifying a first pixel and a second pixel in the plurality of pixels, determining a first difference between a value for the first pixel and a value for the second pixel, comparing the difference with a threshold, and storing a codeword responsive to the difference and a result of the comparison. Preferably, the storing step includes storing exact values (i.e., all bits) for the first value and for the difference when the difference is less than the selected threshold, and storing approximate values (i.e., less than all bits) when the difference is greater than the selected threshold. The steps of the method can be expanded for application to more than a first and second pixel, for example four pixels at a time as discussed above. 
     This method is performed for all pixel values representing the four pixel groups in succession in any order desired. Its embodiment herein is unique in its efficiency and simplicity as well as its ability to perform random access to compressed pixels. 
     The embodiment described herein typically follows the decoding of a formatted signal such as MPEG 1 or MPEG 2. Thus, I, B and P frames within the MPEG signal are decoded into raw picture data, compressed into DRAM or other video memory using the method described in this application, then decompressed for display on the view screen. In particular, the embodiment described herein provides particularly good random access to pixels by compressing very small blocks i.e. four pixels at a time. Furthermore, the embodiment described herein is particularly suited to interlaced video and allows for example, every third or fourth line to be displayed. Hence, scalability of output is enabled fast, simply and with the minimum logic. Therefore, this embodiment allows flexibility of display in for example, a VGA environment as well as in a TV environment. 
     In one embodiment, compression according to the invention is performed by an MPEG decoder after that decoder decodes an MPEG formatted signal. 
     The following pseudocode also describes operation of the method of compression: 
     Case 1 
     Calculate: 
     D 01 [ 7 : 0 ]=P 0 [ 7 : 0 ]−P 1 [ 7 : 0 ], 
     D 12 [ 7 : 0 ]=P 1 [ 7 : 0 ]−P 2 [ 7 : 0 ] 
     D 23 [ 7 : 0 ]=P 2 [ 7 : 0 ]−P 3 [ 7 : 0 ] 
     If D 01 [ 7 : 5 ]==D 01 [ 4 ],D 01 [ 4 ], D 01 [ 4 ])&amp;&amp;(D 12 [ 7 : 5 ]==D 12 [ 4 ],D 12 [ 4 ], D 12 [ 4 ])&amp;&amp;(D 23 [ 7 : 5 ]==D 23 [ 4 ],D 23 [ 4 ],D 23 [ 4 ]) 
     Then 
     Codeword[ 23 : 0 ]=(P 1 [ 7 : 0 ],D 01 [ 4 : 0 ],D 12 [ 4 : 0 ],D 23 [ 4 : 0 ],1′b 1 ). 
     Case 2 
     Set: 
     PP 0 [ 6 : 0 ]=P 0 [ 7 : 1 ], 
     PP 1 [ 6 : 0 ]=P 1 [ 7 : 1 ], 
     PP 2 [ 6 : 0 ]=P 2 [ 7 : 1 ], and 
     PP 3 [ 6 : 0 ]=P 3 [ 7 : 1 ]. 
     Calculate: 
     DD 01 [ 6 : 0 ]=PP 0 [ 6 : 0 ]−PP 1 [ 6 : 0 ], 
     DD 12 [ 6 : 0 ]=PP 1 [ 6 : 0 ]−PP 2 [ 6 : 0 ], 
     DD 23 [ 6 : 0 ]=PP 2 [ 6 : 0 ]−PP 3 [ 6 : 0 ], 
     If (DD 01 [ 6 : 5 ]==DD 01 [ 4 ],DD 01 [ 4 ])&amp;&amp;(DD 12 [ 6 : 5 ]==DD 12 [ 4 ],DD 12 [ 4 ]&amp;&amp;(DD 23 [ 6 : 5 ]==DD 23 [ 4 ],DD 23 [ 4 ]) 
     Then 
     Codeword[ 23 , 0 ]=(PP 1 [ 6 : 0 ],DD 01 [ 4 : 0 ],DD 12 [ 4 : 0 ],DD 23 [ 4 : 0 ],2′b 10 ). 
     Case 3 
     Set: 
     PPP 0 [ 5 : 0 ]=P 0 [ 7 : 2 ], 
     PPP 1 [ 5 : 0 ]=P 1 [ 7 : 2 ], 
     PPP 2 [ 5 : 0 ]=P 2 [ 7 : 2 ], and 
     PPP 3 [ 5 : 0 ]=P 3 [ 7 : 2 ]. 
     Calculate: 
     DDD 01 [ 5 : 0 ]=PPP 0 [ 6 : 0 ]−PPP 1 [ 6 : 0 ], 
     DDD 12 [ 5 : 0 ]=PPP 1 [ 6 : 0 ]−PPP 2 [ 6 : 0 ], 
     DDD 23 [ 5 : 0 ]=PPP 2 [ 6 : 0 ]−PPP 3 [ 6 : 0 ], 
     If (DDD 01 [ 5 ]==DDD 01 [ 4 ])&amp;&amp;(DDD 12 [ 5 ]==DDD 12 [ 4 ])&amp;&amp;(DDD 23 [ 5 ]==(DD 23 [ 4 ]), 
     then 
     Codeword[ 23 , 0 ]=(PPP 1 [ 5 : 0 ],DDD 01 [ 4 , 0 ],DDD 12 [ 4 , 0 ],DDD 23 [ 4 , 0 ],3′b 100 ). 
     Case 4 
     Set: 
     PPPP 0 [ 4 : 0 ]=P 0 [ 7 : 3 ], 
     PPPP 1 [ 4 : 0 ]=P 1 [ 7 : 3 ], 
     PPPP 2 [ 4 : 0 ]=P 2 [ 7 : 3 ], and 
     PPPP 3 [ 4 : 0 ]=P 3 [ 7 : 3 ]. 
     Calculate: 
     DDDD 01 [ 4 : 0 ]=PPPP 0 [ 4 : 0 ]−PPPP 1 [ 4 : 0 ], 
     DDDD 12 [ 4 : 0 ]=PPPP 1 [ 4 : 0 ]−PPPP 2 [ 4 : 0 ], 
     DDDD 23 [ 4 : 0 ]=PPPP 2 [ 4 : 0 ]−PPPP 3 [ 4 : 0 ], 
     R[ 4 : 0 ]={2′b 00 ,P 0 [ 2 : 0 ]}+{2′b 00 ,P 1 [ 2 : 0 ]}+{2′b 00 ,P 2 [ 2 : 0 ]}+{2′b 00 ), P 3[2:0]}   
     Then 
     Codeword[ 23 , 0 ]=(PPPP 1 [ 4 : 0 ],DDDD 01 [ 4 : 0 ],DDDD 12 [ 4 : 0 ],DDDD 23 [ 4 : 0 ],R[ 4 ],3′b 000 ) 
     In order to expand the compressed file for display, the trailing tag bits for each block of pixel values is examined to determine what degree of compression was applied to that block. Once the degree of compression is determined, the compression process which applied for that particular case may be reversed, and the values restored to viewable form. 
     Alternative Embodiments 
     Although preferred embodiments are disclosed herein, many variations are possible which remain within the concept, scope, and spirit of the invention, and these variations would become clear to those skilled in the art after perusal of this application.

Technology Category: h