Correlation detector
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention relates to a correlation detector for outputting a degree of autocorrelation of a digital signal obtained by sampling and quantizing an analog signal, where a degree of autocorrelation corresponds to the number of consecutive samples which have a substantially identical quantized level. 
     2. Related Background Art 
     A correlation detector for detecting a degree of correlation of an input signal has generally a circuit structure such as shown in FIG. 7. An input signal is sampled by a sampling pulse having a frequency F, and a presence/absence of autocorrelation between data of the input signal at one timing and at a timing immediately before the one timing is detected by an autocorrelation detector circuit 1. A presence of &#34;autocorrelation&#34; between two data samples means that two data samples have a substantially identical quantized level. An absence of autocorrelation between them means that they have different quantized levels. In accordance with the detection results, an autocorrelation counter 2 counts the number r of consecutive autocorrelated data items (i.e. the number r of consecutive samples having a substantially identical quantized level) before one timing of the input signal. A value D0 corresponding to the output r of the autocorrelation counter 2 is outputted as a correlation value. 
     The operation of the conventional correlation detector shown in FIG. 7 will be described. The autocorrelation detector circuit (SREL) 1 is supplied with an input signal IN sampled at a clock ck such as shown in FIG. 6A. A presence/absence of autocorrelation between data of the input signal at one timing and at a timing immediately before the one timing is detected, and the detection result is outputted as a correlation presence/absence signal f (FIG. 6B) which is inputted to the autocorrelation counter 2. The length of the H level of the signal f is outputted as the count signal r (FIG. 6D) from the autocorrelation counter 2 which is inputted to an encoder 5. The encoder 5 outputs D0=0 for 0≦r≦1, D0=1 for 2≦r≦4, and D0=2 for 5≦r (see FIG. 6E). 
     A clock signal CK is shown in FIG. 6C. There is a one clock delay when D0 is outputted. Therefore, the input signal IN is delayed by one clock to obtain a delayed input signal IND (FIG. 6F) which is compared with the signal D0. At a timing α1 of the signal IND, three consecutive autocorrelated data items are present before the timing α1, and so r=3 at α1. Five consecutive autocorrelated data items are present before a timing α2, and so r=5 at α2. The signal r is inputted to the encoder 5 which outputs a value corresponding to the value r. In this case, D0=1 at α1, and D0=2 at α2. 
     An output D0 of the conventional correlation detector is a value corresponding to the value r which is the number of consecutive autocorrelated data items before one timing of the input signal, and is not the number of consecutive autocorrelated data items after one timing of the input signal. Therefore, a correlation value obtained by the conventional correlation detector is not natural from the viewpoint of senses. 
     SUMMARY OF THE INVENTION 
     It is an object of the present invention to provide a correlation detector capable of obtaining a more correct and natural correlation value. 
     According to one aspect of the present invention solving the above problem, there is provided a correlation detector for outputting a correlation detector outputs a correlation value representative of autocorrelation in accordance with a sum (r+ra) of the number r of consecutive autocorrelated data items before one timing and the number ra of consecutive autocorrelated data items after the one timing. 
     According to another aspect of the present invention, there is provided a correlation detector including: 
     an autocorrelation detector circuit for receiving an input signal sampled by a sampling pulse having a frequency F and outputting a signal representative of a presence/absence of autocorrelation between data of the input signal at one timing and data at a timing immediately before the one timing; 
     an autocorrelation counter receiving an output of the autocorrelation detector circuit and counting and outputting the number r of consecutive autocorrelated data items before the one timing; 
     an encoder for receiving an output of the autocorrelation counter and outputting a value D0 determined in correspondence with the number r; 
     n comparators for receiving an output of the autocorrelation counter, comparing the number r with predetermined values r1, r2, . . . , rn, and outputting signals e1, e2, . . . , en indicating timings when the number r becomes equal to the values r1, r2, . . . , rn; 
     n time counters for receiving the outputs of the n comparators and outputting signals c1, c2, . . . , cn representative of the count period starting in response to the signals e1, e2, . . . , en and terminating after predetermined periods of T1, T2, . . . , Tn; 
     a memoryread/write controller for receiving the outputs of the n time counters and outputting a write gate signal NW causing a period t0 to be always a write period, causing periods t1, t2, . . . , tn to be a write period only when the signals e1, e2, . . . en are generated, and causing a period t(n+1) to be always a read period, the periods t0, t1, t2, . . . , tn, t(n+1) being obtained by dividing a 1/F period into (n+2) periods or more; 
     a memory data controller for receiving an output of the encoder, outputting the value during the period t0, and outputting predetermined values D1, D2, . . . , Dn during the periods t1, t2, . . . , tn; 
     an address counter for counting a clock having the frequency F and outputting a count Ac; 
     a memory address controller for receiving an output of the address counter and outputting values Ac+A0, Ac A1, Ac+A2, . . . , Ac+An, and Ac+A(n+1) obtained by adding the count Ac to predetermined values A0, A1, A2, . . . , An, and A(n+1); 
     a memory whose read/write is controlled by the outputs of the memoryread/write controller, the memory data controller, and the memory address controller; and 
     a sampler for sampling and outputting an output of the memory during the memory read period. 
     The correlation detector of this invention outputs a correlation value representative of autocorrelation in accordance with a sum (r+ra) of the number r of consecutive autocorrelated data items before one timing and the number ra of consecutive autocorrelated data items after the one timing. 
     For example, referring to FIG. 6F, eight consecutive autocorrelated data items are present during the period α, and the periods α1 and α2 belong to the same group. According to the present invention, a degree of autocorrelation is more natural from the viewpoint of senses if it is determined basing upon the number f of consecutive autocorrelated data items before one timing, than if it is determined basing upon the number r=ra of consecutive autocorrelated data items before and after the one timing. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a block diagram showing the structure of a correlation detector according to an embodiment of the present invention. 
     FIGS. 2A through 2T show waveforms making up a timing chart explaining the operation of the correlation detector shown in FIG. 1. 
     FIG. 3A through 3O show waveforms making up a timing chart explaining the operation of the correlation detector shown in FIG. 1. 
     FIG. 4 is a block diagram showing the structure of a modification of a correlation detector according to the invention. 
     FIGS. 5A through 5G show waveforms making up a timing chart explaining the operation of the correlation detector shown in FIG. 4. 
     FIGS. 6A through 6F show waveforms making up a timing chart explaining the operation of a conventional correlation detector. 
     FIG. 7 is a block diagram showing the structure of a conventional correlation for detecting a degree of correlation of an input signal. 
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     An embodiment of the present invention will be described with reference to the accompanying drawings. 
     FIG. 1 is a block diagram showing the structure of a correlation detector according to an embodiment of the present invention. 
     The operation of the correlation detector shown in FIG. 1 will be described with reference to the timing charts shown in FIGS. 2A-2T and 3A-3O. In the following description, it is assumed N=2. 
     An address counter 6 is supplied with a clock ck having a frequency F, and outputs a count Ac. An autocorrelation detector circuit 1 is supplied with an input signal IN sampled at a clock ck such as shown in FIG. 6C, and outputs a signal f representative of a presence/absence of autocorrelation between data of the input signal at one timing and at a timing immediately before the one timing. This signal f is inputted to an autocorrelation counter 2 which counts the H level length of the signal f and outputs a count r. 
     The count r of the autocorrelation counter 2 is supplied to a comparator (COMP) 3A which outputs an L level signal e1 only when the count r is r=r1 (=2). The signal e1 is inputted to a time counter 4A which outputs an H level signal cl only during a T1 (=2/F) period starting from the rising edge of the signal e1. The signal r is also supplied to a comparator 3B which outputs an L level signal e2 only when the count r is r=r2 (=5). The signal e2 is inputted to a time counter 4B which outputs an H level signal c2 only during a T2 (=5/F) period starting from the rising edge of the signal e2. 
     The output signals c1 and c2 of the time counters 4A and 4B are inputted to a memory read/write control circuit 7. While the signal c1 takes the H level, the period t1 during a 1/F period takes the L level, and while the signal c2 takes the H level, the period t2 during the 1/F period takes the L level. The period t0 during the 1/F period always takes the L level irrespective of the level of the signals c1 and c2. As a result, a signal NW is outputted from the memory read/write circuit 7. A portion p of the signal NW is shown enlarged in FIG. 3A. As indicated at NWL in FIG. 3, the periods t0 and t2 take the L level. 
     The output r of the autocorrelation counter 2 is also supplied to an encoder 5 which outputs a signal D0=0 for 0≦r≦1, D0=1 for 2≦r≦4, and D0=2 for 5≦r. The signal D0 is supplied to a memory data controller 8 which outputs one of &#34;0, 1, 2&#34; (D0) during the period t0 in the 1/F period, outputs always &#34;1&#34; (D1) during the period t1 in the 1/F period irrespective of the value of D0, and outputs always &#34;2&#34; (D2) during the period t2 in the 1/F period irrespective of the value of D0. As a result, an output D of the memory data controller 8 becomes as shown in FIG. 2R. The portion p of the signal D is shown enlarged in FIG. 3B at DL. It can be seen from FIG. 3B that &#34;2&#34; (D0) is outputted during the period t0, &#34;1&#34; (D1) is outputted during the period t1, and &#34;2&#34; (D2) is outputted during the period t2. 
     An output Ac of the address counter 6 is supplied to a memory address controller 9 which outputs a signal A=&#34;Ac-1&#34; (Ac+A0) during the t0 period in the 1/F period, A=&#34;Ac-4&#34; (Ac+A1) during the t1 period in the 1/F period, A=&#34;Ac-7&#34; (Ac+A2) during the t2 period in the 1/F period, and A=&#34;Ac-10&#34; (Ac+A3) during the t3 period in the 1/F period. The portion p of the signal A is shown in FIG. 3C at AL. Since Ac=14, &#34;13&#34; (Ac+A0) is outputted during the period t0, &#34;10&#34; (Ac+A1) is outputted during the period t1, &#34;7&#34; (Ac+A2) is outputted during the period t2, and &#34;4&#34; (Ac+A3) is outputted during the period t3. 
     The outputs of the memory read/write controller 7, memory data controller 8, and memory address controller are supplied to a memory 10 to control the memory read/write. 
     An output of the correlation detector can be obtained by sampling an output of the memory 10 during the memory read period t3. 
     If there are r consecutive autocorrelated data items before one timing of an input signal and ra consecutive autocorrelated data items after the timing, the correlation detector performs the above-described operation and outputs a value of r+ra. The reason why the correlation detector outputs this value will be given below. 
     The correspondence between the output Ac of the address counter and the input signal IN is assumed to be that shown in FIGS. 3D and 3E. Assuming that the memory address is Am=Ac, the correspondence between the memory address Am and the memory data Dm becomes as shown in FIGS. 3F and 3G. 
     FIG. 3I also shows the correspondence between the memory address Am and memory data Dm&#39; when the output D0 of the encoder 5 is written in the memory during the period t0 in the 1/F period. This correspondence is similar to a conventional correlation detector. 
     As understood from a comparison between the memory data Dm and memory data Dm&#39; shown in FIGS. 3G and 3I, the memory data is necessarily Dm=&#34;1&#34; at the memory addresses Am=&#34;2&#34; and &#34;3&#34;. Similarly, the memory data is necessarily Dm=&#34;2&#34; at the memory addresses Am=&#34;6&#34;, &#34;7&#34;, &#34;8&#34;, &#34;9&#34;, and &#34;10&#34;. 
     In order to compensate for such discrepancy, according to the present invention, data in the memory is rewritten by using the periods t1 and t2 in the 1/F period. 
     During the periods at Ac=6 and 7, in response to the output c1 of the time counter 4A, memory data Dm=&#34;1&#34; is written in the memory at the memory addresses Am=&#34;2&#34; and &#34;3&#34; during the period t1 in the 1/F period. During the periods at Ac=10 and 11, Dm=&#34;1&#34; is written in the memory at the memory addresses &#34;6&#34; and &#34;7&#34;. 
     Similarly, during the periods at Ac=&#34;13&#34;, &#34;14&#34;, &#34;15&#34;, &#34;16&#34;, and &#34;17&#34;, in response to the output c2 of the time counter 4B, Dm=&#34;2&#34; is written in the memory at the memory addresses Am=&#34;6&#34;, &#34;7&#34;, &#34;8&#34;, &#34;9&#34;, and &#34;10&#34; during the period t2 in the 1/F period. 
     In reading the memory data Dm, the memory address Am is moved back more than a maximum value (in this case, &#34;7&#34; addresses) of moving back the memory address Am for the data rewrite. In this embodiment, the memory address Am is moved back by &#34;10&#34; addresses for reading the memory data Dm. Memory data at an address moved back to &#34;10&#34; addresses is not rewritten again. Therefore, the correspondence between Am and Dm becomes as shown in FIG. 3, and a value corresponding to an expected correlation value can be read. 
     As described above, the output r of the autocorrelation counter is compared with the predetermined values r1 (=2) and r2 (=5) by the two comparators which output signals e1 and e2 indicating timings when the output r becomes equal to the values r1 and r2. The output signals e1 and e2 of the two comparators are supplied to the two time counters which output signals c1 and c2 representative of the count period starting in response to the signals e1 and e2 and terminating after the predetermined periods of T1 (=2/F) and T2 (=5/F). The memory addresses are moved back by preset addresses A1 (-4) and A2 (-7) during the periods indicated by the signal c1 and c2, preset data D1 (=1) is written in the memory for the signal c1, and preset data D2 (=2) is written in the memory for the signal c2. In this manner, a correlation value corresponding to a value of r+ra can be obtained if there are r consecutive autocorrelated data items before one timing of an input signal and ra consecutive autocorrelated data items after the timing. 
     FIG. 4 is a block diagram showing the structure of a modification of a correlation detector according to the invention. 
     This modification is a quantization error eliminator which is constituted by a correlation detector (REL) 100 having the structure shown in FIG. 1, low-pass filters (LPF) 101 to 103, and a selector (SEL) 104. 
     The operation of the quantization error eliminator will be described with reference to the timing chart of FIG. 5. 
     An input signal A is supplied to the correlation detector 100 which outputs a correlation value as a signal B. This signal B is delayed by a predetermined time Td for compensating for the delay time Td of the filter, and outputted as a signal C. The input signal A is also supplied to the three low-pass filters 101 to 103 and filtered. The low-pass filter 101 is a through-filter having no cut-off frequency, the low-pass filter 102 has a cut-off frequency of 10 kHz, and the low-pass filter 103 has a cut-off frequency of 1 kHz. 
     The outputs D, E, and F of the low-pass filters 101 to 103 are supplied to the selector 104 and selectively outputted therefrom in response to the output signal C of the correlation detector 100. As indicated at G in FIG. 5, the output signal of the selector 100 shows that it has been subjected to filtering to the extent corresponding to the length of a flat portion. Specifically, since it is considered that the longer the flat portion, the greater the quantization distortion, a through-output of the filter 101 is selected if the correlation value is &#34;0&#34;, an output of the filter 102 is selected if the correlation value is &#34;1&#34;, and an output of the filter 103 is selected if the correlation value is &#34;2&#34;. 
     As described above, in the correlation detector of the invention, the output r of the autocorrelation counter is compared with predetermined values r1, r2, . . . , rn by n comparators which output signals e1, e2, . . . , en indicating timings when the output r becomes equal to the values r1, r2, . . . , rn. The output signals e1, e2, . . . , en of the n comparators are supplied to n time counters which output signals c1, c2, . . . , cn representative of the count period starting in response to said signals e1, e2, . . . , en and terminating after predetermined periods of T1, T2, . . . , Tn. The memory addresses are moved back by preset addresses A1, A2, . . . , An during the periods indicated by the signal c1, c2, . . . , cn, preset data D1, D2, . . . , Dn are written in the memory for the signals c1, c2, . . . , cu. In this manner, a correlation value corresponding to a value of r+ra can be obtained if there are r consecutive autocorrelated data items before one timing of an input signal and ra consecutive autocorrelated data items after the timing. 
     As described above, the correlation detector of this invention can obtain a more natural and precise correlation value.