Bitmap graphics compression for image data

Information

  • Patent Application
  • 20020051568
  • Publication Number
    20020051568
  • Date Filed
    September 11, 2001
    23 years ago
  • Date Published
    May 02, 2002
    22 years ago
Abstract
The invention relates to the provision of a graphic compression method for pixel data for a display screen and particularly a display screen provided as part of a mobile device. The method includes the splitting of pixels data for the display into quadratic groups of pixels typically 2×2 pixels, and by encoding representing the same with respect to a number of color templates, with a reduced number of bits.
Description


[0001] The invention to which this application relates is to the compression of data and in particular image data.


[0002] With the increasing use of mobile devices which may have a limited memory capacity and/or network bandwidth for receiving data, the compression of data is becoming increasingly important so that the same can be transmitted and received in a usable format.


[0003] A common way of providing indications or options or other information to a user of a device is to provide graphic symbols in addition to text or alternatively to text. However, the volume of data required for graphics can be extremely large, for example, a bitmap image can consist of many pixels and each pixel has an associated colour and in modern applications the colours are typically defined from a palette of roughly 16 million available colours. If a bitmap image is 300 pixels wide and 300 pixels high this means that there are 90,000 pixels, each of which may require up to four bytes of colour information which can give an image which has 360,000 bytes or 352 KB in size.


[0004] Some prior art which is already known is disclosed in U.S. Pat. Nos. 6,091,850 and 5,625,759 which are largely concerned with solving the problem of optimal palette selection. The compression is a side-effect of this process. They do also specify compression techniques, but both patents attempt to compress a bitmap graphic image by analysing both the shapes and colours in that image and this is largely true of any graphics compression method. Furthermore both patents suggest ways of improving the compression ratio using techniques such as run-length encoding and observe that small groups of pixels can have their colour depth reduced to one or two colours in normal images without the results being too detrimental. The present invention aims to improve on these methods by providing a graphics compression method which, when used, can reduce image sizes by a significant amount.


[0005] In a first aspect of the invention there is provided a method for the compression or reduction of data relating to a graphic image for generation on a display screen said method comprising splitting the pixels required for the graphical image into quadratic groups of pixels and then, with reference to each group of four pixels, representing the same with reference to one of one or two colour templates, and then allocating appropriate identification for the selected one of the templates in an encoded format, for the group of four pixels.


[0006] In a preferred embodiment reference is made to eight one or two colour templates one of which is selected and for which the generation of the bits to represent the quadratic group is preferred. The group is preferably a square group of four pixels.


[0007] Typically, for each group of four pixels, the method analyses the similarity between each colour to the other three colours in the group. This therefore means that there are six colour comparisons required to be undertaken for each group of four pixels.


[0008] Typically the method distinguishes between groups of a uniform colour and groups with more than one colour.


[0009] Thus in this invention it is possible in small pixel groups of 2×2 pixels, rather than conventional 4×4 groups, to describe virtually all combinations of pixels in a picture using just two colours without any noticeable loss of colour by the human eye.


[0010] When the comparison has been obtained and the six results obtained these can be compared against a threshold value which determines which of the templates from the eight colour template is best suited. When determined for each of the six comparisons, the appropriate template can be represented by three bits.


[0011] In a further feature of the invention any two colour group of 2×2 pixels can be represented using one of only seven colour templates and so, in turn can be encoded in three bits. Typically the eighth colour template is used for one or single colour groups of pixels.


[0012] In one embodiment a further bit is required to indicate the polarity of the template.


[0013] As the method works on smaller groups of pixels than conventional methods it does not require an anti-aliasing mode. This saves on the required flags overhead, at the expense of storing more templates. That is no loss as the provision of four, three bit templates still requires 25% less bit processing than one 16 bit bitmap which is conventionally used by analysing 4×4 pixel blocks.


[0014] Thus, with the method outlined, it is possible to compress data related to an image by around 50% and this can be improved significantly further by reducing the colour depth of the palette, by computing an optimal palette for the compressed image or by employing the run-length encoding or a similar scheme on the colours for each template.






[0015] A specific embodiment of the invention is now described with reference to the accompanying figures wherein:


[0016] FIGS. 1A-H illustrate the eight colour templates which are used in one embodiment of the method, and


[0017]
FIG. 2 illustrates a pixel group of four pixels as used in accordance with the invention.






[0018] The method of the invention provides for the measurement of how close each colour is to the others. This can be done using six applications of a trigonometric function (based on a 3D version of Pythagoras's function for calculating the length of the hypotenuse of a right-angled triangle from the opposite and adjacent side lengths):




d
=(REDa−REDb)2+(GRNa−GRNb)2+(BLUa−BLUb)2



[0019] This function computes d, the square of the distance between the two colours (a and b) given the red, green and blue components of their colour (assuming an RGB colour model).


[0020] The distance between each colour can be obtained by calculating the square-root of d, but this is an expensive computation not required for the algorithm, so it is not performed, in this embodiment. Also, each component is preferably weighted to match the relative sensitivity of the Human eye to that component.


[0021] For other linear colour models (eg: CMYK), the function above requires a valve for the number of components changing (eg: make it four-dimensional for CMYK).


[0022] The six comparisons required in accordance with the invention and with reference to the group of pixels in accordance with FIG. 2 which shows a group of four pixels, 1, 2, 3, 4.


[0023] 1. Compare the colour of pixel 1 with the colour of pixel 2;


[0024] 2. Compare the colour of pixel 1 with the colour of pixel 3;


[0025] 3. Compare the colour of pixel 1 with the colour of pixel 4;


[0026] 4. Compare the colour of pixel 2 with the colour of pixel 3;


[0027] 5. Compare the colour of pixel 2 with the colour of pixel 4;


[0028] 6. Compare the colour of pixel 3 with the colour of pixel 4.


[0029] With the results of these comparisons, it is possible to tell how close the colour of each pixel in the group is to every other pixel's colour.


[0030] With this information, the six d values are compared against a threshold value, t. This threshold defines what value of d is considered to be ‘close’, thus:


[0031] d1<=t;


[0032] d2<=t;


[0033] d3<=t;


[0034] d4<=t;


[0035] d5<=t;


[0036] d6<=t


[0037] The result for each test can be considered as a single bit; set if TRUE and clear if FALSE. All six bits can be combined to give a six bit field (ie: a number in the range 0 to 63).


[0038] For each value of the six bit field, we ‘know’ which template fits best, if any. As an example, the value 0b000000 indicates that all pixel colours are further from each other than the threshold value. No template fits well with this combination.


[0039] Value 0b100001 indicates that the colours of pixels 1 and 2 are at least as close as the threshold, as are the colours of pixels 3 and 4. The colours of pixels 1 and 2 are further than the threshold from those of pixels 3 and 4. This indicates that template 3 (two horizontal bands) is a good fit.


[0040] Value 0b110000 is ambiguous; it could be template 8, but the colours of pixels 2 and 3 are further from each other than the threshold.


[0041] For every possible value (0 to 63) of the bit field, we can decide to either select a template for the pixels based on what is known about the value, or we can increase the threshold value by some amount (ie: a small amount when the template is slightly ambiguous or a large amount if no template fits) and repeat the process from the six d value comparisons to construct a new bit field. Eventually, a template will fit, but the loss of information increases with t.


[0042] When one of the templates 1A-1H is chosen, the colour(s) for it may be derived by averaging the pixel colour for each subgroup, ‘1’ or ‘2’ (shaded), possibly including error diffusion. The bits required can then be allocated and encoded and so the reduction in data is achieved. Template 1A is used for a single or one colour group of pixels with templates 1B-H used and selected as appropriate for 2 colour groups of pixels.


[0043] To further illustrate the advantages of the invention of a mathematical comparison with the method of U.S. Pat. No. 5,046,119 is now described.


[0044] Given a simple example a (noisy) image of 16 by 16 pixels, giving a total of 256 pixels is used.


[0045] The method in U.S. Pat. No. 5,046,119 would require 16*64=1024 bits to encode the image.


[0046] The invention of the method requires 64*(2+16)−1152 bits for the same image (assuming, that the colours are encoded into eight bits). This is a cost of an extra 128 bits (12.5%) to encode four times the colour information.


[0047] However, if the method in patent U.S. Pat. No. 5,046,119 is applied to blocks of 2 by 2 pixels, without anti-aliasing (it is of no use on such small blocks), to give a more similar comparative resolution to that achieve in the invention, it would require 64*(32+4)=2304 bits.


[0048] This is 1152 bits (50%) more than required by the method of the current invention.


[0049] Even if the pixel depth of the colours store in the prior art encoding scheme were reduced to 8 bits per colour (i.e. the proposed scheme in the US patent is modified), the image would require 64*(2+4+16)=1408 bits.


[0050] This is still 256 bits (18%) more than the method of the invention.


[0051] Note: (noisy) in this case is defined as each pixel in the source image having a wide and random distribution in colour space when compared against other pixels in the image.


[0052] It should be appreciated that the method of the embodiment as herein described is provided for illustrative purposes only and therefore should not be interpreted as the only method which can be followed in accordance with the invention.


[0053] Thus the conventional methods are inherently more complex computationally than that of the current invention. This is an important consideration on most modern devices, where decompression speed is a key factor in the acceptance of a compression standard.


[0054] Furthermore, the method of the current invention will produce better quality output; as the smaller pixel group size allows finer detail to be preserved in the output image. It will also avoid the blurring effect inherent in anti-aliasing.

Claims
  • 1. A method for the compression or reduction of data relating to a graphic image for generation on a display screen, said method comprising splitting the pixels required for the graphical image into quadratic groups of pixels and then, with reference to each group of four pixels, representing the same with reference to one of a number of one or two colour templates, and then allocating appropriate identification for the selected one of the templates in an encoded format, for the group of four pixels.
  • 2. A method according to claim 1 characterised in that reference is made to eight one or two colour templates, one of which is selected, for the generation of the bits to represent the quadratic group.
  • 3. A method according to claim 1 characterised in that for each group of four pixels, the method analyses and compares the similarity between the colour of each pixel to the colour of the other three pixels in the group.
  • 4. A method according to claim 1 characterised in that when the comparison has been obtained for each of the pixels in the group these are compared against a threshold value which determines which of the templates from the eight colour template is best suited.
  • 5. A method according to claim 4 characterised in that when the best suited template is determined which best matches each of the colour comparisons, the appropriate template can be represented by three bits.
  • 6. A method according to claim 1 characterised in that each quadratic group is a square group of four pixels.
Priority Claims (1)
Number Date Country Kind
0022250.5 Sep 2000 GB