(a). Field of the Invention
The present invention relates to an apparatus for image processing and a method thereof, and more particularly to an apparatus for color processing and a method thereof.
(b). Description of the Prior Arts
In recent years, in associated with the progress of image technology, the request for higher image quality from users has become more and more demanding. The requisition to realize high quality imaging, including good color representation, high image resolution, and rapid image formation, etc., is overwhelming.
The color model is for defining colors. There are two color models: the RGB (red-green-blue) model which the color is reproduced by adding the three primary RGB colors in varying proportions (which is called additive mixing) and the CMYK (cyan-magenta-yellow-black) model which the color is reproduced by subtraction of one of the components from white light (which is called subtractive mixing).
Color printers are based on 4-color printing, using black (K), in addition to the three primary colors of cyan (C), magenta (M), and yellow (Y). Theoretically, black can be produced by mixing the three CMY colors. However, due to the difficulty in achieving pure black, it's common to add black as the fourth color for printing. Currently six- and seven-color printers are also available. The color model having additional light cyan (C′) and light magenta (M′) along with the original cyan (C), magenta (M), yellow (Y), and black (K) is called CMYKC′M′ model which can produce better and more vibrant color image.
An image displayed on a monitor using the three RGB primary colors must be converted to CMYK or CMYKC′M′ for printing. Each printer comes with printer driver software that converts color images created on the computer into a data format that can be processed by the color printer. However, while converting from RGB colors to CMY is straightforward, converting to CMYK is not, not to mention converting to CMYKC′M′. Usually a color table is used for the conversion between RGB system and the CMYK system or CMYKC′M′ system, nevertheless, the color table using 3-D interpolation will occupy a great many memory space. That is, a typical computer display can produce colors with 28 brightness values for each of the red, green, and blue components to produce a total of 224 different colors that are far more than the human eye can distinguish. Therefore, it is common to use a 3-bit RGB system for displaying, i.e. a computer display with 23 brightness values for each of the red, green, and blue components. Under the circumstances, a color table that converts the RGB system to the 6-color CMYKC′M′ system, by using the respective 23 brightness values of RGB as index corresponding to the CMYKC′M′, will occupy 9×9×9×6=4374 bytes (23+1=9, wherein the value 1 is added for representing 0 state). Similarly, converting a 4-bit RGB system to the 6-color CMYKC′M′ system will occupy 17×17×17×6=29478 bytes, and converting a 5-bit RGB system to the 6-color CMYKC′M′ system will occupy 33×33×33×6=215622 bytes. Please refer to
Pcenter=Inter{Inter[Inter(P0, P1)], Inter [(P2, P3)], Inter[Inter(P4, P5)Inter(P6, P7)]}
Inter (x1, x2): representing an operation for taking the average value of x1 and x2.
During the operation, the 6-color CMYKC′M′ representations of the eight end points are required to be read from the color table first, that is about the total of 48 bytes (6×8=48). For the bandwidth that can access 96 MB data per second, the external color table can only provide a pixel processing capability of 2M per second (96M/48=2M). Since the current high-speed requirement of color processing is at least 10M per second, obviously the aforementioned external color table can not meet the requirement.
The primary goal of the present invention is to provide a method and apparatus for color processing that can increase processing speed so as to achieve high performance color processing.
The secondary goal of the present invention is to provide a method and apparatus for color processing that will not consume too much IC area so as to reduce fabricating cost.
In order to achieve the aforementioned goals, the present invention provides a method for color processing realized by a color processing apparatus, which comprises a color table for storing a plurality of color data, and a cache memory for caching part of the color data. The method comprises the steps of: issuing a color index; returning the color data corresponding to the color index from cache if the color data is cached in the cache memory; and returning the the color data from the color table if the color data is not cached in the cache memory.
The present invention also provides an integrated circuit (IC) for accelerating color processing coupled to an external color table storing a plurality of color data. The IC comprises: a color processor performing color conversions and operations; and a cache coupling the color table and the color processor and storing at least one of the color data selected from the color table. The color processor issues a color index to search for a corresponding one of the color data from the cache. Then, the corresponding one of the color data is loaded from the color table into the cache if the corresponding one of the color data is not found in the cache.
The objects, spirits and advantages of the preferred embodiments of the present invention will be readily understood by the accompanying drawings and detailed descriptions, wherein:
In most cases, the color difference within a small area of the image is not too drastic. Therefore, a storage device can be used to store a portion of color data in correspondence to the need of high-performance calculation. Please refer to
Please refer to
71: Sending out a color index 54 to a cache 52, i.e. when a color processor 51 requires color data during color processing, a color index 54 will be sent out by the color processor 51 to the cache 52.
72: Making an evaluation to determine whether a matching color data exists in the cache 52 or not; if so, goes to step 74; if not, goes to step 73. That is, when the color index 54 is received by the cache 52, a comparison is made to determine whether a color data matching with the color index is available in the cache 52 or not? In order to accelerate the comparison, a plurality of tags 5210 is used.
73: Loading the required color data from the color table 6 to the cache 52; if the result of the comparison is that the required color data does not exist in the cache 52, then the required color data will be loaded from the color table 6 to the cache 52 by way of the cache controller 522. Since the color difference of a pattern is usually progressive and continuously, the neighboring color data similar to the required color data can be loaded simultaneously to minimize the number of loading, so that the efficiency of the cache can be enhanced.
74: Sending back the color data 56 corresponding to the color index 54, thereafter, the process ends. That is, when the color data 56 which matches with the color index 54 does exist in the cache 52, the color data 56 will be send back to the color processor 51, and thereafter the process ends.
Here a detailed discussion about “hit rate” is provided. The definition of hit rate is the percentage representing the number of times that the built-in memory 521 of the cache 52 is able to provide the required color data to the color processor 52, i.e. (hit rate)=(the number of times that the cache is able to provide the required color data to the color processor)/(the total requests of the color processor)×100%. It is obvious that the number of the cache 52 capable of providing the required color data to the color processor 51 have direct impact to the hit rate, and moreover, the aforementioned number of the cache 52 is related to the design of the tag 5210 and the size of the memory 521. In the IC design, the amount of data containing in the memory 521 is proportional to the area thereof, i.e. the size of the memory 521 will have direct influence to the hit rate. However, although an overgreat memory 521 can increase the hit rate, but the wastes of precious area is not the outcome that the present invention intended. Therefore, how to choose an appropriate size of the memory 521 is an important factor for the success of the present invention. In this regard, after many experiments are carried out according to the embodiment of the present invention using an 8 K-bytes cache and employing the fruit plate, which is one of the four standard images of image processing, as test media, the following data are acquired: for a color table having 9×9×9×6 bytes data, it can achieve 99.999831% hit rate, and the required bandwidth is 487 bytes/sec; for a color table having 17×17×17×6 bytes data, it can achieve 99.999831% hit rate, and the required bandwidth is 57237 bytes/sec; for a color table having 33×33×33×6 bytes data, it can achieve 99.613649% hit rate, and the required bandwidth is 1112691 bytes/sec. Hence, the forgoing configuration can fit the requirement of high performance color processing.
The application of the present invention is extensive, for instance, to print an image of the video capture devices, such as digital camera, digital camcorder, etc. from a printer without the use of computer, or in a high-speed video card, 3-D image processing, etc. Those skilled in the art should appreciate that they can readily use the disclosed conception and specific embodiments as a basis for designing or modifying other structures for carrying out the same purpose of the present invention, and that various changes, substitutions and alterations can be made herein without departing from the spirit and scope of the invention as defined by the append claims.