The priority application Number JP2003-320166 upon which this patent application is based is hereby incorporated by reference.
1. Field of the Invention
The present invention relates to a digital clamp circuit for clamping a digital signal.
2. Description of Related Art
In a related art, a signal output from a CCD solid-state imaging element, which is an intermittent output signal, is converted into a consecutive signal by means of correlated double sampling (CDS), with the gain being automatically controlled by means of automatic gain control (AGC). After analog clamping of a reference black signal to a direct current potential such that the potential is within an operating range of an A/D converter circuit which will be described below, the signal is converted by the A/D converter circuit into a digital video signal. The black level of the digital video signal is corrected (digital clamping) in a digital clamp circuit, and then predetermined digital signal processing, such as digital gain or γ correction, is performed.
The analog video signal is then converted into a digital signal by the A/D converter circuit to provide a digital video signal Y0 shown in
Then, the average reference black level BL, which is an average of the digital code values of the reference black signals for each frame, is calculated and this is set as a clamp level CL. The average reference black level BL is obtained by averaging output signals from the reference black region on a frame-by-frame basis, and this is converted to a 8-bit digital code value having the same accuracy as the subject signal.
In a digital clamp circuit, the digital video signal Y0 is clamped by subtraction of an amount corresponding to the clamp level CL, to provide a digital video signal Y1 as shown in
Such variation in the average reference black level BL causes the digital code value of a subject signal after digital clamping to also vary, which leads to a problem of so-called hunting in which brightness varies on a frame-by-frame basis. Further, when a digital signal processing such as digital gain or γ correction is performed based on the digital video signal Y1 which has been subjected to digital clamping as described above, a code shift of “1” in the digital code would be emphasized in multiples, which further emphasizes the hunting state.
It is therefore necessary to prevent hunting caused by variation of the clamp level on a frame-by-frame basis in the digital clamp circuit, thereby stabilizing display of an output signal from the solid-state imaging element.
In accordance with one aspect of the present invention, there is provided a digital clamp circuit for clamping a digital video signal which represents a subject image in frame units, a reference black signal and a subject signal periodically appearing for each frame of the digital video signal, the digital clamp circuit comprising a clamp circuit for clamping the reference black signal of the digital video signal to a predetermined level, and a clamp level generation circuit for generating a clamp level by which clamping is performed in the clamp circuit, wherein the clamp level generation circuit includes a comparator circuit for comparing the reference black signal for a plurality of frames with an existing clamp level.
Preferred embodiments of the present invention will be described in further detail based on the following drawings, wherein:
Preferred embodiments of the present invention will be described in further detail with reference to the accompanying drawings.
A vertical driver signal VD which is generated for each frame is input to the frame counter 14, which outputs an update clock signal RC to the update circuit 12 for every predetermined number of frames, thereby resetting the register value of the comparison result register 12a to “0”.
In the clamp level memory 13 is pre-stored a clamp level CL of a total of 10 bits including a 8-bit integer portion and a 2-bit decimal portion. The 10-bit data is input, as a clamp level CL, to the clamp circuit 20, where a digital video signal Y0 is digital-clamped by an amount corresponding to the clamp level CL. The clamp level CL is also input to the comparator circuit 11, to which a digital video signal Y0 having a 8-bit integer portion is further input. The comparator circuit 11 calculates an average output signal of the reference black region from the digital video signal Y0 to generate an average reference black level BL of a total of 10 bits including a 8-bit integer portion and a 2-bit decimal portion. The average reference black level BL is a digital code value having a higher accuracy of “0.25” than a subject signal. The comparator circuit 11 then compares the average reference black level BL with the clamp level CL.
The average reference black level BL and the clamp level CL are compared on a frame-by-frame basis by the comparator circuit 11. As a result of comparison, when the average reference black level BL is greater than the clamp level CL by a predetermined set value or more, the register value of the up register is increased by “+1”. When the average reference black level BL is smaller than the clamp level CL by a predetermined set value or more, the register value of the down register is increased by “+1”. When the difference between the average reference black level BL and the clamp level CL is a predetermined set value or less, the register value of the hold register is increased by “+1”. Further, the difference between the average reference black level BL and the clamp level CL is added to the register value already held in the differential register to update the register value of the differential register. Thus, a value obtained by accumulation of past differences is held in the differential register.
Then, when a new update clock signal RC is input to the update circuit 12 by the frame counter 14, the determination circuit 12b performs a determination operation, and after the determination operation, the register value of the comparison result register 12a is reset once again. At this time, the determination circuit 12b, receiving an update clock signal RC, performs a determination operation for performing either up, hold, or down of the clamp level CL stored in the clamp level memory 13 based on the contents of the comparison result register 12a, and overwrites the current clamp level CL and stores a new clamp level CL which is a result of the determination operation in the clamp level memory 13. Consequently, digital clamping of the subsequent digital video signals Y0 will be performed using the new clamp level CL which is written and stored in the clamp level memory 13 as described above.
Thereafter, for each update clock signal RC supplied from the frame counter 14, the determination circuit 12b similarly updates the clamp level CL stored in the clamp level memory 13 based on the contents of the comparison result register 12a.
In the determination operation of the present embodiment, different determination operations are used between a stable state and a transient state. More specifically, the clamp level CL is increased and decreased in a relatively simple manner in the transient state, whereas, once it is determined that a stable state exists, the clamp level remains unchanged to the extent possible. The determination circuit 12b includes a flag indicating the stable state or the transient state, and the transient state is set as an initial setting immediately after the start of image capturing.
First, at step S0, it is determined whether the state is a stable state or a transient state by means of the flag of the determination circuit 12b. The process proceeds to step S1 when it is determined that a transient state exists, and the process proceeds to step S5 when it is determined that a stable state exists.
When the flag of the determination circuit 12b is set to a transient state, at step S1, it is determined whether or not the register value of the up register exceeds 50% of the predetermined number of frames, namely whether or not the register value is “11” or more. If the determination is Yes, the process proceeds to step S2, and, if NO, the process proceeds to step S3. When the register value of the differential register is “80” or greater at step S2, the clamp level is increased by “1”. When the register value of the differential register is less than “80” at step S2, the clamp level is increased by “0.25”. In either case, the flag maintains setting of a transient state. Here, the fact that register value of the differential register is “80” or greater indicates that the average reference black level BL is greater than the clamp level CL by “4” or more on a frame average. Accordingly, the clamp level CL is increased by “1”, so that the clamp level CL is made to approach the average reference black level BL immediately. On the other hand, the fact that register value of the differential register is less than “80” indicates that the difference between the average reference black level BL and the clamp level CL is less than “4” on a frame average. Accordingly, the clamp level CL is increased by “0.25”, so that the clamp level CL is made to approach the average reference black level BL slowly.
Next, at step S3, when the register value of the down register exceeds 50% of the predetermined number of frames, namely the register value is “11” or greater, the process proceeds to step S4, whereas, when the register value is less than “11”, the clamp level is not updated and the setting of the flag is changed from a transient state to a stable state. At step S4, when the register value of the differential register is “−80” or less, the clamp level is decreased by “1”, whereas when the register value is greater than “−80”, the clamp level is decreased by “0.25”. In either case, the flag retains the setting of the transient state. Here, the fact that register value of the differential register is “−80” or smaller indicates that the average reference black level BL is smaller than the clamp level CL by “4” or more on a frame average. Accordingly, the clamp level CL is decreased by “1”, so that the clamp level CL is made to approach the average reference black level BL immediately. On the other hand, the fact that register value of the differential register is greater than “−80” indicates that the difference between the average reference black level BL and the clamp level CL is less than “4” on a frame average. Accordingly, the clamp level CL is decreased by “0.25”, so that the clamp level CL is made to approach the average reference black level BL slowly.
On the other hand, when the flag of the determination circuit 12b indicates a stable state, not to a transient state, it is determined, at step S5, whether or not the register value of the up register exceeds 50% of the predetermined number of frames, namely whether or not the register value is “11” or greater, and also whether or not the register value of the down register is “0”. If Yes, the process proceeds to step S6, whereas if No, the process proceeds to step S7. At step S6, when it is determined that the register value of the differential register is “80” or greater, the clamp level is increased by “1”, whereas, when it is determined that the register value is less than “80”, the clamp level is increased by “0.25”. In either case, the setting of the flag is changed from a stable state to a transient state.
At step S7, it is determined whether or not the register value of the down register exceeds 50% of the predetermined number of frames, namely whether or not the register value is “11” or greater, and also whether or not the register value of the up register is “0”. If Yes, the process proceeds to step S8, whereas if No, the clamp level is not updated and the flag maintains the setting of the stable state. At step S8, when the register value of the differential register is “−80” or smaller, the clamp level is decreased by “1”, whereas the register value is greater than “−80”, the clamp level is decreased by “0.25”. In either case, the setting of the flag is changed from a stable state to a transient state.
As described above, the determination operation is performed based not only on the register value of the differential register, but the register values of the up and down registers are also used for the determination operation. Consequently, even when a significant noise is included in a part of a reference black signal and the register value of the differential register varies significantly, variation of the clamp level caused by the noise can be suppressed because such a noise would not have a large effect on the register values of the up register and the down register. In addition, the determination operation is performed separately and in different manners in the transient state and in the stable state. More specifically, the increase and decrease of the clamp level is less in the stable state than in the transient state, and once the stable state is established, a change of the clamp level is suppressed.
The flowchart of the determination operation in
Further, while in the above-described example shown in
In addition, while in the above example the clamp level is increased or decreased by “1” when the register value of the differential register is “80” or more, or “−80” or less, it is also possible to increase or decrease the clamp level by the number obtained by dividing the register value of the differential register by the predetermined number of frames.
The comparison result memory 42a sequentially stores, as differential data, a difference between an average reference black level BL for a predetermined number of frames and a clamp level CL. The comparison result memory 42a includes, for example, a shift register formed by a flip-flop, a ring buffer memory, or the like. The determination circuit 42b updates, on a frame-by-frame basis, the clamp level CL stored in the clamp level memory 43 based on the differential data for the predetermined number of frames including the corresponding frame and the previous frames, which is stored in the comparison result memory 42a. In such a case, the determination operation of the determination circuit 42b may follow the flowchart shown in
According to the present embodiments, as the clamp level of digital clamping is calculated from the reference black signal for a plurality of frames, variation of the clamp level due to the noise can be suppressed and the hunting state can be overcome. At this point, by allowing the clamp level to be updated only every plurality of frames, frequent variation of the clamp level caused when the clamp level is updated for each frame can be eliminated, thereby further overcoming the hunting problem. On the other hand, by updating the clamp level on a frame-by-frame basis using the average reference black signal among a plurality of the past frames, the hunting state can be overcome and also the clamp level can be made to immediately correspond to a change in the level of the reference black signal due to a temperature change, even when such a change occurs.
While in both the first and second embodiments as described above, the comparator circuit 11 or 41 compares the average reference black level BL with the clamp level CL, the present invention is not limited to such a structure. For example, it is also possible that a reference black signal and a clamp level are sequentially compared and then averaged, and that the result is transferred to the update circuit 12 or 42 for each a frame.
Further, while in the above examples the value of the clamp level CL is made to be as close to the average reference black level BL as possible using the comparison results among a plurality of frames, the clamp level CL and the black level BL need not necessarily be equal. In other words, while the digital value of the reference black signal after digital clamping is made to become “0” in the present invention, any value other than “0” may also be used.
While the preferred embodiments of the present invention have been described using specific terms, such description is for illustrative purposes only, and it is to be understood that changes and variations may be made without departing from the spirit or scope of the appended claims.
Number | Date | Country | Kind |
---|---|---|---|
JP2003-320166 | Sep 2003 | JP | national |