System for limiting the magnitude of sampled data
This is a continuation of Ser. No. 08/036,729, filed Mar. 25, 1993, now abandoned. 
    
    
     BACKGROUND AND SUMMARY OF THE INVENTION 
     The present invention relates to a system including both a method and an apparatus for limiting the magnitude of sampled data. In particular, the system relates to limiting the magnitude of data signals, particularly when sampled at low sampling rates, using a digital signal processor. 
     Many techniques may be used for peak limiting signals so that their magnitude does not exceed a predetermined maximum level. Analog techniques for limiting signal magnitude may be implemented in a variety of manners including fast-attack, slow-release, automatic gain controlled (AGC) amplifiers; diode audio frequency clippers; diode radio frequency clippers; and fast-attack, slow-release AGC amplifiers employing delay lines. 
     Unfortunately, limiting the magnitude of sampled data signals in a digital signal processing context is difficult to accurately and easily implement. One intuitive approach is to simply limit each sampled data point to a maximum level. This approach, however, is unacceptable at lower sampling rates as is explained below. 
     It is well known that an analog signal can be adequately digitally represented and processed as long as it is sampled at a rate greater than the Nyquist sampling rate, i.e. at twice the highest frequency component of the sampled signal. Moreover, practical systems often require the lowest possible sampling rate (approaching the Nyquist rate) be used to conserve digital signal processing time. At these lower rates, signals may be sampled only twice a cycle. As a result, at particular points in the signal cycle (i.e., phase) the samples may not exceed the limit level, even though the peak magnitude of the sampled analog signal in fact exceeds the limit level. 
     This problem is illustrated in FIG. 1(a) where an analog input waveform 10 exceeds a magnitude limit level, shown as a dotted line, during the peak portions of each cycle. An ideal band-limited limiter circuit such as that shown in FIG. 1(b) attenuates the input signal 10 so that an ideal waveform 14 would be output to prevent signal distortion. Such an ideal band-limiter is frequently used in radio transmission paths, and a periodic input signal, i.e. a sinusoid, is amplitude limited in an analog limiter 11 to produce a clipped waveform 12. A low-pass filter 13 smooths out the clipped waveform to produce the ideal band-limited output signal 14. 
     In a digital context, if sampling occurs during one cycle at 0°, 90°, 180°, and 270° as indicated by the triangular points on waveform 10, then it is possible to approach this ideal model and generate a properly limited output signal. However, if the data sampling point is phase shifted by 45°, as indicated by the square sample points on input waveform 10, the magnitude of all samples is less the limit level, and the erroneous conclusion is reached that no signal limiting is required. As a result, signals that should be limited may not be limited at low sampling rates. 
     Unfortunately, when the signal is sampled at low sampling rates, it is inevitable that at some point the samples will not be properly limited. Consequently, when the unlimited sampled signal is later reconstructed in a digital to analog converter, the output analog waveform exceeds the desired limit level and exhibits objectionable distortion, especially when the frequency of the analog input signal is at or near a subharmonic of the sample rate. 
     The above example demonstrates clearly that the maximum level of the reconstructed output signal depends unpredictably (and objectionably) upon the phase of the input signal at sampling. One potential solution to these problems is to interpolate the sampled signal to effectively increase sampling to several times the Nyquist sampling rate to provide more samples per signal cycle. The major drawback with this approach is the significant increase in digital signal processing time required to perform the interpolation and then to process the data at the higher sampling rate making this approach impractical. 
     Another approach would be to perform automatic gain control by averaging several samples and computing a time averaged gain constant which is then used to scale every sample. Unfortunately, this solution requires the limiter to work virtually instantaneously to ensure that no portion of the signal exceeds the given magnitude limit. Conventional AGC functions are not fast enough to work instantaneously. 
     The present invention overcomes the limitations and drawbacks of the above described approaches to limiting the magnitude of sampled data signals. Each data input sample, corresponding to a real component of the sample, is used to generate the imaginary component of a complex vector corresponding to the input sample by adding 90° of phase shift to the sample. The magnitude of the complex phasor of the data sample is then calculated by taking the square root of the sum of the squares of the real and imaginary components. If the calculated magnitude of the complex phasor exceeds a preset magnitude limit, then the sample is scaled by a scaling factor, i.e. the ratio of the calculated phasor magnitude to the preset magnitude limit. In this way, the data sample is limited irrespective of where (and when) the sample occurs in the analog input signal cycle. Moreover, the limited sample has the same phase as the input sample, and low sampling rates may be used without the disadvantages noted above. 
     Thus, the present invention provides a method for limiting the magnitude of an input signal where the input signal is sampled and transformed to obtain its component in-phase and quadrature components. The phasor magnitude of the signal sample is determined from those in-phase and quadrature components, and the input sample is limited based on the relationship of the phasor magnitude to a predetermined limit value. Specifically, the limiting step includes scaling the sample input signal using a ratio of the predetermined threshold to the phasor magnitude. 
     The present invention may be used in an audio signal processing environment to limit the magnitude of a digitized analog audio signal. The analog audio signal is sampled at a sampling rate that is low relative to the frequency of the analog audio signal to generate an input sample. The input sample is transformed into its complex real and imaginary components using a Hilbert transform. The magnitude of the complex signal corresponding to the input signal is determined, and that complex magnitude is then compared to a predetermined threshold. If the complex magnitude exceeds that threshold, the input sample is scaled by the ratio of the predetermined threshold to the complex magnitude. The scaled input signal is then converted to analog form. 
     The present invention provides for a signal processing system for processing analog audio frequency signals. A first CODEC converts analog signals into digitized input samples. A digital signal processor receiving the digitized samples includes means for transforming each sampled input signal to obtain its in-phase and quadrature components; means for calculating a complex phasor of the sampled input signal from the in-phase and quadrature components; means for comparing a complex magnitude to a threshold value; and means for limiting the input signal based on the comparison. A second CODEC then converts the limited sample signals, generated by the means for limiting, into an appropriately limited analog output signal. 
     The present invention effectively limits the magnitude of signals at very low sample rates, i.e. approaching the Nyquist sampling rate. By operating at minimum sampling rates, digital signal processing resources are conserved. In addition, a large linear region of operation is provided for the limiter according to the present invention, e.g. approximately 85% of the maximum output level. The remaining margin of 15% is necessary to compensate for overshoot in digital-to-analog conversion of output signals from the digital signal processor. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     The present invention will become more fully understood from the detailed description given hereinbelow with reference to the accompanying drawings which are given by way of illustration only, and thus are not limitive of the present invention, and wherein: 
     FIG. 1(a) is a graph showing the effects of phase changes on limiting the amplitude of a sampled analog input signal; 
     FIG. 1(b) is a block diagram of an ideal band-limited circuit; 
     FIG. 2 is a function block diagram of one embodiment of the present invention; 
     FIGS. 3(a)-3(c) are phasor diagrams illustrating the Hilbert transform and the operation of the present invention; 
     FIG. 4 is a function block diagram of another embodiment of the present invention; 
     FIG. 5 is a flow diagram setting forth the processing steps for implementing a preferred embodiment of the present invention in a digital signal processor; and 
     FIG. 6 is a diagram depicting the processing procedure for implementing the Hilbert transform in the digital processing embodiment of the present invention. 
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT 
     In the following description, for purposes of explanation and not limitation, details are set forth such as particular circuits, certain components, interfaces, techniques, etc. in order to provide a thorough understanding of the present invention. However, it will be apparent to those skilled in the art that the present invention may be practiced in other embodiments set apart from these specific details. In other instances detailed descriptions of well known methods, techniques, devices, and circuits are omitted so as to not obscure the description of the present invention with unnecessary details. 
     Referring to FIG. 2, a general block diagram of the system for limiting the magnitude of a sampled input signal is shown. An input signal X(t) is received in a conventional analog to digital converter 15 which outputs a plurality of discrete, digitized samples X(n) to a limiter 16. Preferably, the rate at which the signal X(t) is sampled is a relatively low sampling rate, i.e. at or just above twice the highest frequency component of the input signal X(t). In the complex number domain, X(n) represents the real component of a complex phasor corresponding to X(n). A Hilbert transformer 18 receives each sampled input signal X(n) and essentially provides a phase shift of 90° to input signal X(n) to generate the quadrature or imaginary component Y(n) of the input sample signal. Basic treatment of a Hilbert transformer may be found in Principles of Communication Systems, Modulation and Noise, Ziemer and Tranter, by Houghton Mifflin Company, 1976, pp. 72-75 which is incorporated herein by reference. 
     Since input sample signal X(n) and Hilbert transform signal Y(n) represent the real and imaginary portions of the complex vector A(n), the magnitude of the complex vector A(n) is determined in a complex vector magnitude generator 20 according to the following equation: ##EQU1## The complex magnitude A(n) is then compared with a predetermined limit value Amax in comparator 22. If the complex vector magnitude exceeds the limit level, then the comparator outputs a scaling ratio defined as Amax/A(n) to scaler 24. Scaler 24 then applies scaling ratio (if necessary) to the real portion of the signal X(n) to generate an appropriately limited output sample signal Lim(n) to a digital to analog converter 26. As a result, the analog output of the digital to analog converter 26 X(t) lim  is appropriately amplitude limited. 
     The operation of the signal limiting system shown in FIG. 2 will now be described in conjunction with FIGS. 3(a)-3(c). FIG. 3(a) illustrates in a phasor diagram the relationship between a complex vector A(n) and its Hilbert transform A&#39;(n). The real components of each vector are plotted on the horizontal axis, and the imaginary components are plotted on the vertical axis. Complex vector A(n) is made up of both real and imaginary parts. The real component b of A(n) corresponds to the magnitude of the input sample X(n) and therefore is known. To determine the magnitude of the imaginary component a, the Hilbert transform A&#39;(n) of A(n) is calculated. As shown in FIG. 4(a), the magnitude of the real component of A&#39;(n) is a. Thus, the magnitude of A(n) is obtained by simply calculating A(n)=√a 2  +b 2 . 
     The limiter of the present invention is based on limiting both the real and imaginary parts of the complex vector corresponding to the input sample, rather than just the real part. As shown in FIG. 3(b), if the sample received from the analog to digital converter 14 is simply limited, only the real portion of the complex vector corresponding to the input sample signal is limited. In other words, if the real portion of the sample exceeds ±Re(max), it is limited to ±Re(max). For the exemplary sample corresponding to phasor A 2  (n), the real component X 2  (n) actually exceeds the limit level, and simply comparing the magnitude of X 2  (n) to the limit would effectively limit the sample. However, in the exemplary sample corresponding to complex vector A 1  (n), the real component X 1  (n) is less than the limit level Re(max) even though the complex vector A 1  (n) has the same magnitude as A 2  (n). If the sample X 1  (n) were not limited, the ultimately reconstructed output analog signal would easily exceed the limit level. This causes the distortion problems noted above and occurs because limiting depends on whether or not the sample is taken at a point where the real portion of an input signal exceeds the limit level. 
     However, if the magnitude of the complex phasor corresponding to the input sample is limited, the real portion of that limited phasor is necessarily limited, irrespective of where in its cycle it is sampled. FIG. 3(c) shows that when the complex magnitude of the example phasors A 1  (n) and A 2  (n), composed of both the real and imaginary portions of corresponding input samples, is compared with the limit value, i.e. radius Amax in the complex domain, both phasor magnitudes actually exceed that limit level. Accordingly, if the phasor magnitude is limited to that radius limit value Amax, the reconstructed analog signal will not exceed the limit value. 
     The present invention may advantageously be used in a preferred embodiment in an audio signal processing environment where audio signals can be effectively processed and limited at relatively low sampling rates. Preferably, the audio signal processing is implemented using a customized digital signal processor which contains a microprocessor, such as the sixteen bit, fixed point TMS320C17 microprocessor available from Texas Instruments operating at a clock speed of 19.2 MHz, which includes read only memory (ROM) and random access memory (RAM) for storing the algorithms and data necessary to implement the digital signal processing functions. 
     FIG. 4 shows an audio signal processing system which employs the present invention and may be used for example in a cellular radio telephone. Output signals from a radio frequency (RF) receiver (not shown) are received in a conventional RF coder-decoder (CODEC) 30 such as model TCM 29C13 available from Texas Instruments which performs a number of processing functions including converting the received analog signal received into digitized sample values. A digital signal processor 32 performs well known audio receiver processing functions as represented in receive processor 34 which receives the digitized signal samples X(n) and performing conventional audio signal processing functions including bandpass filtering in bandpass filter block 36, de-emphasis in function block 38 and signal expansion in expander block 40. Because these signal processing functions are well known and not the subject of the present invention, a detailed description is unnecessary. The expanded audio signal is received at a conventional audio frequency (AF) CODEC 44 also available from Texas Instruments by way of echo suppressor 42 which converts the processed digitized signals into analog form for driving a speaker. 
     Audio signals, such as voice signals from a microphone, are received in the AF CODEC 44 which converts the analog audio signals into digitized samples for processing in a transmit processor 46 by way of echo suppressor 42. The transmit processor 46 performs well known audio signal processing functions including signal compression in compressor 48, preemphasis in block 50, and filtering in filter 54. As noted above, these known signal processing functions are not the focus of the present invention, and therefore further description is unnecessary. The limiter 52 in transmit processor 46 provides the advantageous signal limiting functions according to the present invention and will be described as described below. The limited digitized samples, after filtering in conventional filter 54, are reconstructed into an analog signal in the RF CODEC 30 to generate a modulating input signal at an RF transmitter (not shown). 
     Each of the processing functions in receive processor 34 and transmit processor 46 are implemented via procedures executed by the digital signal processor 32. FIG. 5 shows a flow chart diagram which depicts the specific control procedures implemented by the digital signal processor 32 for limiter 52. Each quantized input sample signal X(n) is input (block 150) and phase shifted by 90° using a Hilbert transform filtering algorithm (described in more detail below) to generate the imaginary component Y(n) of the input sample X(n) using the algorithm Y(n)=[Hilbert transform (X(n))] (block 152). As described above, the magnitude A(n) of a complex vector A(n) corresponding to input sample X(n) is determined in block 154 according to the following: ##EQU2## 
     A decision is made in block 156 to determine whether the calculated magnitude A(n) exceeds a limit valve Amax. If the complex magnitude A(n) does not exceed the limit, then the output signal sample LIM(n) simply equals the input signal sample X(n) in block 160. However, if the complex magnitude does exceed the limit Amax, then LIM(n) is calculated by scaling the input sample X(n) by the ratio of the limit value Amax to the complex magnitude A(n). Thus, X(n) is attenuated in proportion to the amount the complex vector magnitude A(n) exceeds the predetermined limit value Amax. 
     As described above, the Hilbert transform provides a constant phase response of 90° phase shift for all frequencies of the input sample signal X(n). The ideal analog Hilbert transformer has frequency response H a  (ω)=-j sgn(ω) where the function sgn(ω)=l for ω&gt;0, sgn(ω)=0 for ω=0, and sgn(ω)=-1 for ω&lt;0. An ideal discrete-time Hilbert transformer with delay would therefore be defined as the system whose frequency response is ##EQU3## The magnitude response of the ideal Hilbert transformer is unity over the frequency band ω c1  &lt;|ω|&lt;ω c2 , and the phase response is 90° plus the linear phase due to the delay of n o  samples. The above equation defines the periodic frequency response over one period (i.e., |ω|&lt;π/T) and the cutoff frequencies must satisfy the inequalities 0&lt;ω c1  ; ω c2  &lt;π/T. 
     This system has unit sample response ##EQU4## which although theoretically nonrealizable, can be approximated using the model shown in FIG. 6 and described below. 
     The input signal X(n) is processed in an 18th order finite impulse response (FIR) digital filter. The blocks with z -1  represent the delay elements used to implement the filter. Each delayed sample x(n-k) is multipied by a coefficient h(k) and the sum of the products h(k)*x(n-k) is then calculated to determine the output of the filter. The coefficients h(k) are chosen to satisfy, at least approximately, the Hilbert transformer requirements noted above in equation (2). In this particular implementation, the coefficients are arrived at through the use of a Kaiser or I o  -sinh window. For a detailed description reference is made to J. F. Kaiser, &#34;Nonrecursive Digital Filter Design Using the I o  -sinh Window Function,&#34; Proc. 1974 IEEE Int. Symp. on Circuits and Systems which is incorporated herein by reference. This implementation has 90° degrees of phase shift in addition to M/2 samples of delay (M equals the filter order, e.g. 18). Therefore the Hilbert transformer output Y(n) is shifted 90° relative to X(n-M/2), i.e. X(n-9). Thus, the imaginary or quadrature component Y(n) of the input signal X(n) is defined by the equation ##EQU5## for an 18th order FIR filter, (i.e. output at the 18th stage summary). 
     While this particular implementation of the Hilbert transformer has been described in conjunction with the presently preferred embodiment of the present invention, those skilled in the art will of course recognize-that other algorithms could be used to implement the Hilbert transformer. In addition, while the Hilbert transformer described above is presently preferred to produce the imaginary or quadrature components of the input sample signal, other methods which produce the imaginary or quadrature components of the input sample signal could also be used. 
     It should be appreciated that the present invention permits the sampling of the input signal to occur at very low sampling rates approached by the Nyquist sampling rate. For example, if the highest frequency component of the input signal X(t) is 3.4 kHz then the present invention permits the input sample to be sampled at a rate of 8 kHz. While theoretically the signal could be sampled at a minimum value of twice the input frequency or 6.8 kHz, practical systems always provide for some design tolerance. 
     Despite these low sampling rates, the present invention, by calculating the magnitude of the complex phasor corresponding to the input data sample determines independent of the phase of the sample the amount (if any) the signal sample should be limited to prevent subsequent distortion. In addition, the present invention provides a large linear region of operation for the limiter, e.g. approximately 85% of the maximum output level with the remaining margin necessary to compensate for overshoot in subsequent digital-to-analog conversion of signals. Typical practical analog limiter circuits permit only about 70% of maximum output level. As a result, the present invention prevents distortion of the audio signal with minimum attenuation. 
     While the invention has been described in connection with what is presently considered to be the most practical and preferred embodiment, it is to be understood that the invention is not to be limited to the disclosed embodiment, but on the contrary, is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.