Summary of the invention
The invention provides automatic gain control method and device, so that can adjust automatic gain and adjust mode according to the variation of the transmission environment of CVBS, improve the accuracy that automatic gain is adjusted.
Technical scheme of the present invention is achieved in that
A kind of automatic gain control method, the method comprises:
Receive composite video broadcast singal CVBS;
If current automatic gain adjustment mode is quick mode, judge then recently that continuously whether the amplitude changing value of the capable CVBS of a is all less than the first thresholding, if begin to adopt average mode to carry out the automatic gain adjustment; Otherwise, continue to adopt quick mode to carry out the automatic gain adjustment;
If current automatic gain adjustment mode adopts average mode, judge then recently that continuously the amplitude changing value that whether has the capable CVBS of c at least among the capable CVBS of b is greater than the second thresholding, if begin to adopt quick mode to carry out the automatic gain adjustment; Otherwise, continue to adopt average mode to carry out the automatic gain adjustment,
Described quick mode is: adopting the synchronous head of current line CVBS or the amplitude of color pulse is fiducial value, and current line CVBS is carried out the mode that automatic gain is adjusted;
Wherein, a, b, c is default positive integer.
Whether the amplitude changing value of the recently continuous capable CVBS of a of described judgement all further comprises less than before the first thresholding:
Every CVBS of delegation among the recently continuous capable CVBS of a deducts the synchronous head of previous row CVBS or the amplitude of color pulse with the synchronous head of this row CVBS or the amplitude of color pulse, with the amplitude changing value of gained difference as this row CVBS.
For the every CVBS of delegation among the recently continuous capable CVBS of a, described the first thresholding is: 1/16 or 1/8 or 1/4 or 1/2 of the synchronous head of previous row CVBS or color pulse amplitude.
The value of described a is 2,4,8 or 16.
Whether described judgement has at least the amplitude changing value of the capable CVBS of c further to comprise greater than before the second thresholding among the capable CVBS of b recently continuously:
For the every CVBS of delegation among the recently continuous capable CVBS of b, calculate the mean value of the amplitude of the recently continuously synchronous head of the capable CVBS of q or color pulse of this row, the synchronous head of this row CVBS or the amplitude of color pulse are deducted this mean value, with the amplitude changing value of gained difference as this row CVBS, wherein, q is default positive integer.
For the every CVBS of delegation among the recently continuous capable CVBS of b, described the second thresholding is: 1/16 or 1/8 or 1/4 or 1/2 of the mean value of the synchronous head of the recently continuous capable CVBS of q of this row or the amplitude of color pulse.
The value of described b is 16.
Default initial automatic gain adjustment mode is average mode or quick mode.
A kind of automatic gain adjustment device, this device comprises:
Signal receiving module: receive CVBS, find that current line CVBS receives, judge that current automatic gain adjustment mode adopts quick mode or average mode, if the former, send the startup indication to the quick mode modular converter; If the latter sends the startup indication to the average mode modular converter, described quick mode is: adopting the synchronous head of current line CVBS or the amplitude of color pulse is fiducial value, and current line CVBS is carried out the mode that automatic gain is adjusted;
Quick mode modular converter: receive to start and indicate, judge recently that continuously whether the amplitude changing value of the capable CVBS of a is all less than the first thresholding, if begin to adopt average mode to carry out the automatic gain adjustment; Otherwise, continue to adopt quick mode to carry out the automatic gain adjustment, wherein, a is default positive integer;
Average mode modular converter: receive to start and indicate, judge recently that continuously the amplitude changing value that whether has the capable CVBS of c at least among the capable CVBS of b is greater than the second thresholding, if begin to adopt quick mode to carry out the automatic gain adjustment; Otherwise, continue to adopt average mode to carry out the automatic gain adjustment, wherein, b, c are default positive integer.
Described quick mode modular converter comprises:
The first amplitude changes determination module: receive to start and indicate, for the every CVBS of delegation among the recently continuous capable CVBS of a, the synchronous head of this row CVBS or the amplitude of color pulse are deducted the synchronous head of previous row CVBS or the amplitude of color pulse, obtain the amplitude changing value of this row CVBS, the amplitude changing value of the every CVBS of delegation among the nearest continuously capable CVBS of a is sent to the first conversion judge module;
The first conversion judge module: receive recently continuously the amplitude changing value of the every CVBS of delegation among the capable CVBS of a, judge whether all changes value all less than the first thresholding, if begin to adopt average mode to carry out the automatic gain adjustment; Otherwise, continue to adopt quick mode to carry out the automatic gain adjustment.
Described average mode modular converter comprises:
The second amplitude changes determination module: receive to start and indicate, for the every CVBS of delegation among the recently continuous capable CVBS of b, calculate the mean value of the amplitude of the recently continuously synchronous head among the capable CVBS of q or color pulse of this row, the synchronous head of this row CVBS or the amplitude of color pulse are deducted this mean value, obtain the amplitude changing value of this row CVBS, the amplitude changing value of every CVBS of delegation among the recently continuous capable CVBS of b is sent to the second conversion judge module, and wherein, q is default positive integer;
The second conversion judge module: receive recently continuously the amplitude changing value of the every CVBS of delegation among the capable CVBS of b, judge whether to have at least c changing value greater than the second thresholding, if begin to adopt quick mode to carry out the automatic gain adjustment; Otherwise, continue to adopt average mode to carry out the automatic gain adjustment.
Compared with prior art, among the present invention, change hour in the amplitude of CVBS, adopt average mode to carry out the automatic gain adjustment, when the amplitude of CVBS changes greatly, adopt quick mode to carry out the automatic gain adjustment, so that the signal after adjusting can reflect the variation of signal more accurately, guaranteed simultaneously the stable of image quality.
Embodiment
The present invention is further described in more detail below in conjunction with drawings and the specific embodiments.
In following examples, quick mode refers to the fiducial value of adjusting as the automatic gain of current line CVBS with the amplitude of the synchronous head of current line CVBS or color pulse.
The automatic gain control method flow chart that Fig. 2 provides for the embodiment of the invention one, as shown in Figure 2, its concrete steps are as follows:
Step 201: receive current line namely, the capable CVBS of m, wherein, m>N_Enter and m>N_Leave.
N_Enter, N_Leave are default positive integer.
Step 202: receive, judge that the automatic gain adjustment mode that the capable CVBS of m-1 adopts is quick mode or average mode, if the former, execution in step 203; If the latter, execution in step 206.
Step 203: judge whether the changing value of amplitude of the CVBS that nearest N continuous _ Enter is capable all less than the first thresholding, if, execution in step 204; Otherwise, execution in step 205.
N_Enter is default positive integer, but value 2,4,8,16.The first thresholding can rule of thumb determine, also can be made as previous row CVBS synchronous head amplitude 1/16 or 1/8 or 1/4 or 1/2.
Step 204: begin to enter average mode, and take the mean value of the amplitude of the synchronous head of the capable CVBS of nearest q as fiducial value, to the capable CVBS of the m adjustment that gains, go to (m+1) row CVBS.
Q is default positive integer.
Step 205: continue to adopt quick mode, and take the amplitude of the synchronous head of the capable CVBS of m as fiducial value, to the capable CVBS of m adjustments that gain, go to (m+1) capable CVBS.
Step 206: judge whether to have at least among the nearest continuously capable CVBS of p the changing value of amplitude of the capable CVBS of N_Leave all greater than the second thresholding, if, execution in step 207; Otherwise, execution in step 208.
P can rule of thumb determine, preferably, but value 16; N_Leave can rule of thumb determine, and, 1≤N_Leave<p.
The second thresholding can rule of thumb determine, perhaps, for every CVBS of delegation, desirable this row of the second thresholding of its correspondence recently continuously 1/16 or 1/8 or 1/4 or 1/2 of the mean value of the amplitude of the synchronous head of the capable CVBS of q.
Step 207: begin to adopt quick mode, and take the amplitude of the synchronous head of the capable CVBS of m as fiducial value, to the capable CVBS of the m adjustment that gains, go to (m+1) row CVBS.
Step 208: continue to adopt average mode, and take the mean value of the amplitude of the synchronous head of the capable CVBS of nearest q as fiducial value, to the capable CVBS of m adjustments that gain, go to (m+1) capable CVBS.
The automatic gain control method flow chart that Fig. 3 provides for the embodiment of the invention two, as shown in Figure 3, its concrete steps are as follows:
Step 301: receive current line namely, the capable CVBS of m, wherein, m>N_Enter and m>N_Leave.
N_Enter, N_Leave are default positive integer.
Step 302: receive, judge that the automatic gain adjustment mode that the capable CVBS of m-1 adopts is quick mode or average mode, if the former, execution in step 303; If the latter, execution in step 308.
Step 303: the amplitude of the synchronous head of the capable CVBS of m is deducted the amplitude of the synchronous head of the capable CVBS of m-1, obtain difference AMP_Diff_Enter (m).
Step 304: judge whether AMP_Diff_Enter (m)<AMP_Enter_Threshold (m) sets up, if, execution in step 305; Otherwise, execution in step 307.
Wherein, AMP_Enter_Threshold (m) is the average mode switching threshold of the capable CVBS of m, value can be the capable CVBS of m-1 synchronous head amplitude 1/16 or 1/8 or 1/4 or 1/2.
The implementation of step 304 can for:
Default the first counter, initial value is 0;
Judge whether AMP_Diff_Enter (m)<AMP_Enter_Threshold (m) sets up, if counter adds 1; Otherwise, counter O reset;
Correspondingly, step 305 is: judge whether counter equals N_Enter, if, then counter O reset, and execution in step 306; Otherwise, execution in step 307.
Step 305: judge whether that nearest N continuous _ Enter provisional capital is satisfied: AMP_Diff_Enter (i)<AMP_Enter_Threshold (i), wherein, m-N_Enter+1≤i≤m, if, execution in step 306; Otherwise, execution in step 307.
N_Enter is default positive integer, but value 2,4,8,16.
Step 306: begin to enter average mode, and take the mean value of the amplitude of the synchronous head of the capable CVBS of nearest q as fiducial value, to the capable CVBS of the m adjustment that gains, go to (m+1) row CVBS.
Q is default positive integer.
Step 307: continue to adopt quick mode, and take the amplitude of the synchronous head of the capable CVBS of m as fiducial value, to the capable CVBS of m adjustments that gain, go to (m+1) capable CVBS.
Step 308: calculate the mean value of amplitude of the synchronous head of the capable CVBS of nearest q, the amplitude of the synchronous head of the capable CVBS of m is deducted this mean value, obtain difference AMP_Diff_Leave (m).
The implementation of step 308 can be:
Set in advance status register;
Judge whether AMP_Diff_Leave (m) 〉=AMP_Leave_Threshold (m) sets up, if the state of the capable CVBS of storage m is 1 in status register; Otherwise the state of the capable CVBS of storage m is 0 in status register;
Correspondingly, step 309 is: according to the state value of storing in the status register, judge whether recently that continuously having the capable state of N_Leave at least among the capable CVBS of p is 1, if, execution in step 311; Otherwise, execution in step 312.
Step 309: judge whether AMP_Diff_Leave (m) 〉=AMP_Leave_Threshold (m) sets up, if, execution in step 310; Otherwise, execution in step 312.
Wherein, AMP_Leave_Threshold (m) is the quick mode switching threshold of the capable CVBS of m, and the value of AMP_Leave_Threshold (m) can be 1/16 or 1/8 or 1/4 or 1/2 of the mean value of the nearest amplitude of the synchronous head of the capable CVBS of q.
Step 310: judge whether recently continuously to have at least the capable CVBS of N_Leave to satisfy among the capable CVBS of p: AMP_Diff_Leave (j) 〉=AMP_Leave_Threshold (j), wherein, m-p+1≤j≤m, if, execution in step 311; Otherwise, execution in step 312.
The value of AMP_Leave_Threshold (j) can be the capable CVBS of j the capable CVBS of nearest q synchronous head amplitude mean value 1/16 or 1/8 or 1/4 or 1/2.
Step 311: begin to adopt quick mode, and take the amplitude of the synchronous head of the capable CVBS of m as fiducial value, to the capable CVBS of the m adjustment that gains, go to (m+1) row CVBS.
Step 312: continue to adopt average mode, and take the mean value of the amplitude of the synchronous head of the capable CVBS of nearest q as fiducial value, to the capable CVBS of m adjustments that gain, go to (m+1) capable CVBS.
In the embodiment of the invention, initial automatic gain control model be need not to limit, can be set to average mode, also can be set to quick mode.
In Fig. 2,3 illustrated embodiments, the fiducial value that adopts under the average mode is the amplitude of synchronous head, in actual applications, also can adopt the amplitude of color pulse, at this moment, all " synchronous heads " in Fig. 2,3 illustrated embodiments is replaced with " color pulse " get final product.
CVBS in the embodiment of the invention can be the CVBS that mobile device receives.
The composition diagram of the automatic gain adjustment device that Fig. 4 provides for the embodiment of the invention, as shown in Figure 4, it mainly comprises: signal receiving module 41, quick mode modular converter 42 and average mode modular converter 43, wherein:
Signal receiving module 41: receive CVBS, find that current line CVBS receives, judge that current automatic gain adjustment mode adopts quick mode or average mode, if the former, send the startup indication to quick mode modular converter 42; If the latter sends the startup indication to average mode modular converter 43.
Quick mode modular converter 42: receive the startup indication that signal receiving module 41 is sent, judge recently that continuously whether the amplitude changing value of the capable CVBS of a is all less than the first thresholding, if begin to adopt average mode to carry out the automatic gain adjustment; Otherwise, continue to adopt quick mode to carry out the automatic gain adjustment.
Average mode modular converter 43: receive the startup indication that signal receiving module 41 is sent, judge recently that continuously the amplitude changing value that whether has the capable CVBS of c at least among the capable CVBS of b is greater than the second thresholding, if begin to adopt quick mode to carry out the automatic gain adjustment; Otherwise, continue to adopt average mode to carry out the automatic gain adjustment.
As shown in Figure 5, in actual applications, quick mode modular converter 42 can comprise: the first amplitude changes determination module 421 and the first conversion judge module 422, wherein:
The first amplitude changes determination module 421: receive the startup indication that signal receiving module 41 is sent, for the every CVBS of delegation among the capable CVBS of nearest N continuous _ Enter, the synchronous head of this row CVBS or the amplitude of color pulse are deducted the synchronous head of previous row CVBS or the amplitude of color pulse, obtain the amplitude changing value of this row CVBS, the amplitude changing value of the every CVBS of delegation among the capable CVBS of nearest N continuous _ Enter is sent to the first conversion judge module 422.
The first conversion judge module 422: receive the amplitude changing value that the first amplitude changes the every CVBS of delegation among the capable CVBS of nearest N continuous _ Enter that determination module 421 sends, judge whether that all changes value is all less than the first thresholding, if begin to adopt average mode to carry out the automatic gain adjustment; Otherwise, continue to adopt quick mode to carry out the automatic gain adjustment.
As shown in Figure 5, in actual applications, average mode modular converter 43 can comprise: the second amplitude changes determination module 431 and the second conversion judge module 432, wherein:
The second amplitude changes determination module 431: receive the startup indication that signal receiving module 41 is sent, for the every CVBS of delegation among the recently continuous capable CVBS of p, calculate the mean value of the amplitude of the recently continuously synchronous head among the capable CVBS of q or color pulse of this row, the synchronous head of this row CVBS or the amplitude of color pulse are deducted this mean value, obtain the amplitude changing value of this row CVBS, the amplitude changing value of the every CVBS of delegation among the nearest continuously capable CVBS of p is sent to the second conversion judge module 432.
The second conversion judge module 432: the recently continuous amplitude changing value of the every CVBS of delegation among the capable CVBS of p that receives that the second amplitude changes that determination module 431 sends, judge whether to have at least N_Leave changing value greater than the second thresholding, if begin to adopt quick mode to carry out the automatic gain adjustment; Otherwise, continue to adopt average mode to carry out the automatic gain adjustment.
The automatic gain adjustment device that the embodiment of the invention provides can be arranged in mobile device.
The above only is preferred embodiment of the present invention, and is in order to limit the present invention, within the spirit and principles in the present invention not all, any modification of making, is equal to replacement, improvement etc., all should be included within the scope of protection of the invention.