Background of the Invention
1. Field of the Invention
The present invention relates generally to gamma correction of video intensity values for causing a linear range of video intensity values to be displayed on a cathode ray tube screen as a linear gradation of color intensities.
2. Description of the Related Art
Cathode ray tubes (CRTs) have a nonlinear transfer characteristic, i.e., the reproduced brightness on the CRT screen is a nonlinear function of the control-grid video drive. When display graphics are produced on a workstation it is necessary to compensate for this nonlinearity. The compensation of color intensity values to produce a linear gradation of color intensities in response to a linear range of color intensity values is called gamma correction.
There are several known gamma correction functions, one of which is:
where x is the color intensity value to be displayed, y is the corrected color intensity value, and .gamma., k.sub.1, and k.sub.2 are constants specific to the type of CRT screen used.
A simple method of performing gamma correction on a digitized intensity signal is to translate each of the eight-bit red, green, and blue color intensity values to compensated eight-bit color intensity values using a color lookup table. The lookup table is typically stored in a solid state memory and includes a range of color intensity values, each of which is associated with a corresponding gamma corrected value. The gamma corrected value is derived from the above function and stored in the lookup table.
The gamma corrected values read from the table are converted into analog intensity signals which are applied to a control grid of the CRT. This technique has the advantage of being relatively inexpensive but it is also relatively inaccurate.
While accuracy could be increased by using ten-bit red, green, and blue color intensity values, such a scheme requires more space on an integrated circuit in which a number of video control functions may be implemented.
Another prior art method uses ten-bit color intensity values which are gamma corrected into eight-bit color intensity values that are written to a frame buffer. In this method, gamma correction is performed by using a piece-wise linear approximation of the gamma correction function. The values are read from the frame buffer and are further adjusted in a color lookup table which provides eight-bit color intensity values to a digital-to-analog converter. The first correction by way of the piece-wise linear approximation provides increased accuracy over the eight-bit system with respect to the sampling rate; however, the piece-wise linear approximation is inaccurate enough that additional correction is required by a color lookup table connected to the output of the frame buffer.
When display graphics are produced, it may be necessary to further process color intensity values in the frame buffer. For example, such processing is required when the colors of a background object are blended with the colors of a transparent object in the foreground. When such further processing is required, the gamma corrected color intensity values in the buffer are read therefrom. These values are then generally restored to their uncorrected intensity values using a piece-wise linear approximation of the inverse of the gamma correction function. This process is referred to herein as inverse gamma correction. After inverse gamma correction, additional processing to blend the colors is performed in a conventional fashion thereby creating new color intensity values. The new color intensity values are gamma corrected as described above, and then stored in the frame buffer. The new values are then converted to an analog video drive signal which is used to create a display on the CRT screen.
The prior art method utilizing approximation of the gamma correction function provides improved gamma correction over other techniques but still suffers from disadvantages. For example, there is an increase in the amount of hardware required to implement this method. Additionally, when data is read from the frame buffer for further processing as described above, information is lost. The lost information results from the approximation of the gamma correction and inverse gamma correction functions. In other words, when an uncorrected color intensity value is gamma corrected using this technique and thereafter inverse gamma corrected, the resulting color intensity value is close to, but not necessarily the same as, the original color intensity value.
Summary of the Invention
The present invention comprises a method for gamma correcting video intensity values including the steps of sampling an intensity signal and storing sampled values below a preselected level in a buffer. Samples above the preselected level are gamma corrected and thereafter stored in the buffer. In another aspect, the intensity signal below the preselected level is sampled at a first sampling rate while the intensity signal above the preselected level is sampled at a second sampling rate. Apparatus for performing the method is also provided.
The present invention is advantageous in that it provides an increased sampling rate in the lower color intensity level, the levels in which the eye is most sensitive. In addition, when it is necessary to further process intensity values stored in the frame buffer, the values for the lower range need not be inverse gamma corrected because they are stored in the frame buffer prior to gamma correction. This prevents loss of information in the lower intensity range which is inherent in prior art methods and apparatus when values in the frame buffer are inverse gamma corrected.
The foregoing and other objects, features and advantages of the invention will become more readily apparent from the following detailed description of a preferred embodiment which proceeds with reference to the drawings.
Brief Description of the Drawing
The drawing is a simplified schematic diagram of a gamma correction device constructed in accordance with the present invention.
Detailed Description of the Preferred Embodiment
Indicated generally at 10 in the drawing is a schematic diagram of a circuit constructed in accordance with the present invention. A ten-line input bus 12 provides ten-bit color intensity values from a conventional rasterizing engine (not shown). There are thus a total of 1024 different color intensity values which may appear on bus 12. The range of color intensity values is indicated adjacent the bus in hexadecimal notation as 0.times.000-0.times.3ff. Similar notations appear in circuit 10 adjacent buses to indicate the range of values which may appear on the bus.
Bus 12 is connected to the input of a comparator 14. Comparator 14 provides outputs to a pair of busses 16, 18. Digital values appearing on bus 12 which are less than or equal to 0.times.06b (107.sub.10) appear on bus 16. All values appearing on bus 12 which are greater than 0.times.06b appear on bus 18.
Comparator 14 may be implemented by a person having ordinary skill in the art with conventional logic gates. Bus 18 is applied to one input of an adder 20. A second bus 22 is connected to the other input of the adder and has applied thereto a digital value of -0.times.06c (-108.sub.10). The output of adder 20 is applied to an eight-bit bus 24.
Adder 20 sums the values appearing on ten-bit buses 18, 22 and applies only the eight most significant bits of each result to bus 24. Thus, adder 20 functions to subtract 108.sub.10 from the value applied to bus 18 and place the eight most significant bits of the result on bus 24.
Bus 24 is applied to the input of a lookup table 26. Lookup table 26 can be implemented with either ROM or RAM memory and includes 229 entries ranging from zero to 228.sub.10 by increments of one. Each entry is mapped to a corresponding number ranging from 108.sub.10 -255.sub.10 as illustrated in Table 0 set forth below. Thus, for each input appearing on bus 24, lookup table 26 functions to map that number to the associated number shown in Table 0 and place the associated number on bus 28 which is connected to the output of the lookup table.
A frame buffer 30 receives inputs from both bus 16 and bus 28. It should be noted that only the eight least significant bits of bus 16 are applied to the input of the frame buffer. This, however, causes no loss of information because the two most significant bits output from comparator 14 to bus 16 are always zero. Frame buffer 30 is implemented with conventional VRAM (video random access memory).
Frame buffer 30 includes a pair of eight-bit output buses 32, 34. The contents of frame buffer 30 can be read from frame buffer 30 to an input of a lookup table 36. Lookup table 36 includes 256 integer entries, 0-255.sub.10, each of which is associated with an integer value which ranges from 23.sub.10 through 255.sub.10 as illustrated in Table 2 below. Like table 26, table 36 may be implemented in RAM or ROM and operates to map a number appearing on bus 32 into a number associated therewith in the lookup table which appears on an output bus 37. Bus 37 is connected to a conventional digital-to-analog converter (DAC) which in turn is connected to a grid in a conventional color CRT.
The contents of frame buffer 30 can also be read to bus 34 which is connected to the input of a comparator 38. Comparator 38 is substantially identical to comparator 14 and functions in the same manner. When a digital value appearing on bus 34 is less than or equal to 0.times.6b (108.sub.10), comparator 38 applies that value to a ten-line bus 40. At the same time, comparator 38 prepends two zeros to each value thus providing a ten-bit value having zeros as the two most significant bits.
Digital values appearing on bus 34 which are greater than 0.times.6b are applied to an eight-line bus 42 which is connected to an input of an adder 44. Adder 44 is substantially identical to adder 20. A second bus 46 is applied to another input of the adder and presents a constant value of -0.times.6c (-108.sub.10) which is added to the value appearing on bus 42 with the resultant digital value appearing on an output of the adder which is connected to a bus 48.
As is the case with the previously described lookup tables, digital values appearing on bus 48 at the input of lookup table 50 are mapped so that when a digital value in the left column of Table 1 (set forth below) appears on bus 48, the associated value is applied to the output of table 50 which is connected to bus 40. Bus 40 is connected to bus 54 which in turn is connected to the previously-mentioned rasterizing engine circuit (not shown) which, as will be recalled, generates an output that is supplied to bus 12 at the top of the drawing.
In operation, ten-bit digital values from the rasterizing engine are applied to bus 12 in sequence. The values appearing on bus 12 are referred to herein as video intensity values. These values taken in sequence form what is referred to herein as an intensity signal. The digital values on bus 12 are also referred to herein as sampled values. As previously described, those values less than or equal to 0.times.06b (108.sub.10) are applied to bus 16 while those above this level are applied to bus 18.
The digital values appearing on bus 16 are referred to herein as being below a preselected level while those appearing on bus 18 are referred to herein as being above the preselected level.
Adder 20 subtracts 0.times.06c from all of the digital values appearing on bus 18 thereby generating values on bus 24 which begin at zero and extend to 0.times.3ff-0.times.06c (915.sub.10). As will be recalled, the two least significant bits produced on the ten-line output of adder 20 are terminated therefore applying only the eight most significant bits to bus 24 which is connected to the input of lookup table 26. This has the effect of sampling every fourth value appearing on bus 18. Because 108 possible values can appear on bus 16 and 916 possible values can appear on bus 18, with all of the values appearing on bus 16 being less than bus 18, the video intensity values appearing on bus 16 are referred to herein as being in a low intensity range while those on bus 18 are in a high intensity range. The sum of the possible values which can appear on buses 16, 18 is necessarily 1024.sub.10. Because only every fourth value appearing on bus 18 appears at the input of lookup table 26, the sampling rate in the high intensity range is four times less than that of the low intensity range. A total of 229 video intensity values result from the high intensity range and may be applied via bus 24 to the input of lookup table 26.
The 229 possible values which can appear on bus 24 are mapped to corresponding values contained in lookup table 26 which are set forth above in Table 0. The mapped value then appear on bus 28. Each of the mapped values which appear on bus 28 is referred to herein as a gamma corrected value. The values in lookup table 26 are derived from the following gamma correction function:
The present tables, as well as the cut-off between high and low intensity ranges and the adder offsets, relate to a Sony 16" CRT screen having .gamma.=2.24, k.sub.1 =1.10, k.sub.2 =-0.10. It should be appreciated that the method is equally applicable to screens with different parameters.
The values on bus 16 are written directly into frame buffer 30. The intensity signal sampling on bus 16 therefore represents one of a possible 1024 values, with only 108 values falling within the low intensity range, while, as mentioned above, the values appearing on bus 28 represent one of 256 possible values with only 229 such values falling within the high intensity range.
When the color intensity values in buffer 30 are to be displayed on the CRT as a color intensity, it is read from buffer 30 to bus 32. Bus 32 is applied to the input of lookup table 36 which maps the values, from zero to 255.sub.10 to an associated integer value as shown in Table 2. The mapped value appears on bus 37 each time its associated input value is applied to bus 32.
As can be seen with reference to lookup Table 2, values previously mapped by table 26 prior to entry in buffer 30 retain the same value from buffer 30 to bus 37. Specifically, examination of Table 2 illustrates that for all input values above and including 108.sub.10 the mapped value equals the input value. Input values appearing on bus 32 below 108.sub.10, however, are mapped in accordance with Table 2. As with lookup table 26, these values are derived from the gamma correction function.
Values on bus 37 are supplied to a conventional DAC and from there are applied to bias the color CRT in a known manner to produce gamma corrected color intensities on the CRT screen.
Sometimes the color intensity values stored in frame buffer 30 as described above must be processed further. For example, when the image on the screen includes colors of a background object which are blended with the colors of a transparent object in the foreground, color intensity values for the blended portion must be created by the rasterizing engine. However, it will be recalled that the color intensity values in the high range stored in the frame buffer have been gamma corrected. Before the rasterizing engine can further process the values in the frame buffer, the values in the high range must be inverse gamma corrected, i.e., restored to their original color intensity values before gamma correction.
When it is necessary to inverse gamma correct the values in the frame buffer, the contents of the buffer are read onto bus 34. Comparator 38 routes all of the values less than 0.times.6b to bus 40. As will be recalled, these are the same video intensity values provided to the buffer on bus 16 and are therefore not gamma corrected.
All of the values in the high intensity range, i.e., all of those gamma corrected values in the frame buffer, are routed by comparator 38 to bus 42. These values are offset by -0.times.6c by adder 44 with the resulting number being applied to lookup table 50. Because there are 148 different gamma corrected values in lookup table 26, i.e., different values on bus 24 may be mapped to the same gamma corrected value (see Table 0), lookup table 50 needs only 148 entries, each of which is a ten-bit number ranging between 0.times.06c and 0.times.3ff.
The inverse gamma corrected values are provided on bus 54 to the rasterizing engine which performs conventional processing of the signals to create the desired video intensity values to display blended colors on the CRT screen. The rasterizing engine thereafter provides the processed video intensity values to bus 12 where the low intensity values are again written directly into the frame buffer and the higher intensity values are first gamma corrected and then written to the frame buffer. As before, values read from buffer 30 on bus 32 are mapped by lookup table 36 (Table 2) with the low intensity values being gamma corrected and the high intensity values being mapped into the identical value, i.e., not changed by Table 2.
The dividing line between high intensity and low intensity values which is determined by comparator 14 and comparator 38 is not arbitrary. Because the gamma correction function generally increases lower intensity values and decreases higher intensity values, the dividing line between high and low intensity values must be chosen so that a value provided to frame buffer 30 on bus 28 is not routed by comparator 38 onto bus 40 when it is necessary to inverse gamma correct the data in the buffer. If the dividing line were not so chosen, it would be possible for a high intensity value to be mapped in lookup table 26 to a gamma corrected high intensity value that falls within the uncorrected low intensity range. If such were to occur, error could be injected when the gamma corrected value read from buffer 30 on bus 34 is routed by comparator 38 onto bus 40.
The present method and apparatus is more accurate than prior methods because it digitizes the low intensity range into any of a possible 1024 values. The lower intensity range is more sensitive to the human eye and thus requires greater accuracy than the higher intensity range to create what appears to a viewer as a linear color response.
The present method and apparatus is also more accurate in the higher intensity range because the mapping tables are more accurate than piece-wise linear approximations. The present method and apparatus is also preferable to using a 1024 entry eight-bit forward lookup table for mapping all of the intensity values before entry into the frame buffer because only a 229 entry eight-bit table is required. As mentioned above, this requires less space to implement as an integrated circuit.
Having illustrated and described the principles of our invention in a preferred embodiment thereof, it should be readily apparent to those skilled in the art that the invention can be modified in arrangement and detail without departing from such principles. We claim all modifications coming within the spirit and scope of the accompanying claims.