1. Field of the Invention
The present invention relates to a method for dithering image data. More particularly, the present invention relates to a method for dithering image data capable of completely representing source signal grayscale values.
2. Description of Related Art
It is a common problem in the display of digital images that the grayscale resolution of a display device is less than the grayscale resolution of an output device. For example, the output device is a personal computer with an 8-bit resolution, while the display device is a thin film transistor liquid crystal display panel (TFT LCD panel) with a 6-bit resolution. At this time, the simplest method is to delete two least significant bits (LSB) of the signal grayscale value output from the personal computer, so as to turn the 8-bit grayscale value to a 6-bit grayscale value. However, the color levels of the displayed images are sacrificed if this method is adopted.
Accordingly, a method for increasing the color levels is developed, which performs dithering on the signal grayscale values of the output device. The method utilizes the feature that human eyes automatically average the grayscale values in a small region when viewing from distance to enable the average values to have more color levels. There are two common dithering methods: one of the methods includes the spatial dithering or also referred to as 2-dimensional dithering, and the other method includes the spatial dithering plus temporal dithering or also referred to as 3-dimensional dithering.
The 2-dimensional dithering process is performed in a unit of a pixel block of a fixed size. Table 1 is a table of correspondence between input blocks and output blocks according to the conventional 2-dimensional dithering method, in which the pixel block with a size of 4*2 is used. In the input block section, only two LSBs of the signal grayscale values, i.e., the bits deleted before being transmitted to the display device, are listed. In the output block section, 0 denotes that the signal grayscale value of this pixel needs a non-carry operation, and 1 denotes that the signal grayscale value of this pixel needs a carry operation.
TABLE 1Table of Correspondence of Conventional 2-Dimensional DitheringInput BlocksOutput Blocks(Two LSBs)(Carry)000000000000000000000000010101011000010101010010101010100000101010101111111111110111111111111101
The non-carry operation is performed to set the two LSBs of the signal grayscale value to 0, and the carry operation is performed to set the two LSBs of the signal grayscale value to 0 and then add 4 to the result. For example, Table 2 shows the output blocks of the signal grayscale values from 8 (1000 in binary) to 11 (1011 in binary) obtained in accordance with the rules of Table 1. As for the values from 8-11, the result of the carry operation is 12, and the result of the non-carry operation is 8.
TABLE 2Examples of Conventional 2-Dimensional DitheringInput BlocksOutput Blocks(Decimal)(Decimal)88888888888888889999128889999881281010101088881010101012121212111111118121212111111111212812
It is known from Table 2 that the average values of four output blocks equal to the signal grayscale values of the respective corresponding input blocks, while Table 2 only uses two numerals 8 and 12 to represent 4 different color levels. The two LSBs of 8 and 12 are both 0, which is applicable to the 6-bit resolution.
In another aspect, the 3-dimensional dithering process is performed in a unit of the pixel block of a fixed size in several continuous frames. Table 3 is a table of correspondence between input blocks and output blocks according to the conventional 3-dimensional dithering method, in which the pixel block with the size of 4*2 in four continuous frames is used. Similarly, only two LSBs of the signal grayscale values are listed in the input block section in Table 3. After an input block is found, the fields under the input block are the corresponding output blocks in four continuous frames, wherein 0 denotes that the signal grayscale value of this pixel needs the non-carry operation, and 1 denotes that the signal grayscale value of this pixel needs the carry operation. According to the rules of Table 3, the overall average value of all pixels in the four continuous frames equals to the input signal grayscale value.
TABLE 3Table of Correspondence of Conventional 3-Dimensional DitheringInput Blocks (LSB)00000000010101011010101011111111000000000101010110101010111111111st Frame0000100000000111(Carry)00000010111111012nd Frame0000000111111110(Carry)00000100000010113rd Frame0000001000001101(Carry)00001000111101114th Frame0000010011111011(Carry)0000000100001110
However, the conventional dithering methods are disadvantageous in that not all signal grayscale values are represented. For example, in the above examples, the display device has a 6-bit resolution only, so the maximum value is 63, and after being multiplied by 4, only 252 signal grayscale values can be represented in maximum. However, the three primary colors red, green, and blue can be combined to represent 2563=16,777,216 color originally, while only 2533=16,194,277 is represented after the dithering, thus losing about 3.5% of the color levels.