Technical Field
This invention relates to digital code conversion and, more particularly, to eliminating the accumulation of distortion in multiple code conversions.
Background of the Invention
Over the past several years there has been, and continues to be, a tremendous amount of activity in the area of efficient encoding of speech. A large number of digital coding algorithms are being investigated for a wide variety of applications. For an evolving digital telephone network, a most important application is the possible replacement of 64,000 bit-per-second (b/s) PCM signal (8 bits per time slot, repeated at an 8 kHz rate) with other coding algorithms for telephone--both in the public switched and private line networks. The reason, of course, is to achieve bandwidth compression. The dilemma for telephony planners is easily posed but not so easily answered--should such a network evolve toward a coding algorithm more efficient than 64 kb/s PCM and, if so, which algorithm is preferable? A number of different digital coding algorithms and related techniques have been proposed heretofore, namely: Adaptive Differential PCM (ADPCM); Sub-Band Coding (SBC); Time Domain Harmonic Scaling (TDHS); vocoder-driven Adaptive Transform Coding (ATC), etc.
For a realistic mix of input speech and voiceband data, the ADPCM approach appears to be the most promising. One form of adaptive differential PCM coding is disclosed, for example, in my copending application Ser. No. 343,355, filed Jan. 27, 1982 now U.S. Pat. No. 4,437,087 and can be considered a benchmark since a single encoding with this coder at 32 kb/s is near to being subjectively equivalent to 64 kb/s .mu. 255 PCM. In some networks it is possible to have multiple conversions from 64 kb/s PCM-to-32 kb/s ADPCM-to-64 kb/s PCM. In these applications, it is important to eliminate accumulation of distortion in the multiple PCM-to-ADPCM-to-PCM code conversions.
An attempt towards this goal is described in an article by Hideyo Murakami entitled, "A Low Noise ADPCM-LOG PCM Code Converter", 1979 International Symposium on Circuits and Systems Proceedings, IEEE catalog No. 79 CH1421-7 CAS, pages 969-970. However, this arrangement assumes a uniform ADPCM quantizer and distortion could result in those applications in which a non-uniform quantizer is employed.
Summary of the Invention
The accumulation of distortion in multiple digital code conversions is eliminated, in accordance with an aspect of the invention, by including in a coder for converting digital signals from a first code to a second code arrangement for controllably modifying the first-to-second code conversion in accordance with prescribed criteria dependent on the first and second coding methods. More specifically, based on a preliminary conversion from the first code to the second code and on the first coding method, for example, .mu.-law PCM, the second code sample value for example, ADPCM, are modified in accordance with the prescribed criteria so that a next subsequent coder will ultimately select the same second code sample as selected by the first coder for transmission. The prescribed criteria includes, in accordance with an aspect of the invention, selecting between a preliminary second code sample value and its adjacent values by evaluating at least one second-to-first code conversion quantization error value. In one example, the prescribed criteria includes a first criterion of determining whether the preliminary second code value and either of the second code values adjacent to the preliminary value would generate the same first code value after converting from the second code to the first code and a second criterion of determining whether the quantizing error generated from converting from the second code to the first code is greater for the preliminary second code value or for an adjacent second code value meeting the first criterion requirements. If the quantizing error is greater for the preliminary value, the second code value is modified in the first coder to be the adjacent second code value that met the first criterion requirement. If the quantizing errors are equal, then the more positive of the preliminary second code sample value and the adjacent second code sample value that met the first criterion is selected as the coder second code output sample value.
Brief Description of the Drawing
The invention will be more fully understood from the following detailed description of an illustrative embodiment taken in connection with the appended figures in which:
FIG. 1 shows in simplified block diagram form a code converter including an embodiment of the invention;
FIGS. 2 and 3 depict a flow chart describing the operation of the coder of the invention;
FIG. 4 illustrates in graphical form an unscaled nonuniform quantizer characteristic useful in describing the invention; and
FIGS. 5 and 6 show a flow chart describing operation of the decoder of the invention.
Detailed Description
FIG. 1 illustrates in simplified block diagram form coder 100 including an aspect of the invention which receives input samples s.sub.PCM of a first code, for example, .mu.225 PCM and encodes the same into a second code, for example, n-bit differential PCM. The second code signal is transmitted over transmission facility 102 to decoder 101. Decoder 101 converts the second code signal into a signal in the first code, namely r'.sub.PCM. For purposes of illustration, a 4-bit differential PCM signal (n=4) shall be assumed. This 4-bit differential signal in conjunction with applicant's ADPCM coding algorithm provides very reliable, robust transmission for both speech and higher speed, voiceband data (e.g., 4800 b/s)--as well, of course, for lower speed data and tone signals. However, it is to be understood that the invention is in no way limited to this 4-bit differential transmission and n could be any other number, e.g., n=2, n=3, n=5, etc. If the input PCM samples were always representative of encoded speech, then a 2-bit differential PCM signal (i.e., n=2) should prove adequate for many applications.
Accordingly, PCM input samples are supplied to inverse PCM quantizer (Q.sub.PCM).sup.-1 10 which converts the PCM samples, for example, .mu.225 PCM, to multi-bit linear PCM samples in well-known fashion. The multi-bit (e.g., 13-16 bits) linear PCM samples (s) are delivered to algebraic adder or difference circuit 11. It is noted that samples s are not limited to PCM and could also be PAM samples. Alternatively, the linear PCM samples may result from the direct encoding of an input speech signal or voiceband data to linear PCM. And, of course, other non-uniform signals such as an A-law PCM signal may also first have to be converted to its linear PCM counterpart. Such conversions are known in the art and comprise no part of the present invention.
Adaptive predictor 12 provides a predicted signal estimate (s.sub.e) which is a prediction or an estimate of sample s. Ths predicted signal estimate (s) is inverted in inverter 13 to obtain -s.sub.e, which is delivered to the other input of the adder circuit 11. Accordingly, adder 11 provides at its output a difference signal (d) that is the algebraic addition of the two inputs thereto, namely, s-s.sub.e. Adaptive predictors which may be advantageously employed herein are disclosed in my copending application Ser. No. 343,355 cited above and copending application Ser. No. 368,394, filed Apr. 14, 1982.
Difference signal d is coupled to the input of the dynamic locking quantizer (DLQ) including an aspect of the invention. The DLQ comprises a 16 level (for n=4) non-uniform ADPCM quantizer 14 of scale factor .DELTA.. One example of a non-uniform ADPCM quantizer characteristic is shown in FIG. 4. It is noted, however, that the invention is not dependent on the specific type of ADPCM quantizer characteristic. As will be appreciated by those skilled in the art, ADPCM quantizer 14 not only provides the desired quantization, but it also serves to PCM encode the input signal; the quantizing and encoding are carried out in one-and-the-same operation. The 4-bit output signal (I) represents the quantized and PCM encoded form of the difference sample d. Such quantizer arrangements are known in the art. Quantizer 14 also includes, in accordance with an aspect of the invention, an arrangement to be described in detail hereinafter for controllably modifying the PCM to ADPCM code conversion in accordance with the prescribed criteria to eliminate accumulation of distortion in subsequent conversions from PCM to ADPCM. To this end, difference signal d and predicted signal s.sub.e are supplied to quantizer 14.
The 4-bit PCM output (I) is delivered to inverse ADPCM quantizer (Q.sub.ADPCM).sup.-1 15 which, as the designation implies, performs an operation that is essentially the inverse of the operation of ADPCM quantizer 14. That is, inverse ADPCM quantizer 15 receives the 4-bit differential PCM signal (I) and provides at its output signal d.sub.q. This d.sub.q signal is the quantized version of difference signal d. Signal d.sub.q is coupled to the input of ADPCM Q adaptation circuit 16 and to adder 17. The s.sub.e output of adaptive predictor 12 is also coupled to an input of adder 17 and to ADPCM quantizer 14. Adder 17 adds the d.sub.q and s.sub.e signals to generate at its output reconstructed signal r which is in linear PCM form. Reconstructed signal r is delivered to adaptive predictor 12, which in response thereto serves to generate the next predicted signal for comparison with the next linear PCM sample. The adaptive predictor 12 uses reconstructed signal sample r and a few previous samples to arrive at prediction s.sub.e which is the weighted sum of m input samples (e.g., m=4).
ADPCM Q adaptation circuit 16 receives quantized difference signal d.sub.q and the 4-bit output I and serves to develop therefrom adaptive scale factor .DELTA.. This scale factor (.DELTA.) is then delivered to ADPCM quantizer 14 and inverse quantizer 15. Adaptive scale factor .DELTA. serves to scale the Q.sub.ADPCM and (Q.sub.ADPCM).sup.-1 characteristics to match the power of input difference signal d. ADPCM Q adaptation circuit 16 controls the speed of adaption of the scale factor .DELTA.; a fast speed of adaptation is provided when the input linear PCM signal represents speech, with a very slow (almost constant) speed of adaptation for input PCM encoded voiceband data or tones as described in my copending application Ser. No. 343,355 cited above.
The 4-bit differential PCM signal (I) is transmitted, in typical time-division multiplexed fashion, over the digital transmission facility 102 and is delivered to the input of inverse ADPCM quantizer 115. This input signal is designated I', the prime indicating that it is close to and yet, perhaps, not identical with the signal I due to transmission errors. Similarly, the other letter symbols used in decoder 101 are primed to indicate that they are close to but perhaps not identical with the similarly designated symbols or signals of coder 100. Inverse ADPCM quantizer 115 is identical to ADPCM inverse quantizer 15 and it serves to provide at its output the quantized signal d.sub.q '. Again, as before d.sub.q ' represents the quantized version of the difference signal d, with the prime indicating a possible variation from signal d.sub.q due to transmission errors. The quantized signal d.sub.q ' is coupled to the input of ADPCM Q adaptation circuit 116 and adder 117. The input differential PCM signal I' is also coupled to the input of ADPCM Q adaptation circuit 116; this circuit is identical to ADPCM Q adaptation circuit 16 of coder 100. The output of ADPCM Q adaptation circuit 116 is the adaptive scale factor .DELTA.' which is delivered to the inverse ADPCM quantizer 115 for the same purpose as previously described. ADPCM quantizer 115 and ADPCM Q adaptation 116 form inverse dynamic locking quantizer DLQ.sup.-1 which performs the function of generating d.sub.q '. Adaptive predictor 112 serves to generate predicted signal s.sub.e ' which is coupled to the other input of adder 117. Adaptive predictor 112 is identical to adaptive predictor 12 of coder 100. Adder 117 serves to digitally add input signals d.sub.q ' and s.sub.e ' to produce reconstructed signal r' which is a close quantized version of the original input signal s. Reconstructed signal r' is delivered to the input of adaptive predictor 112 and to output modification unit 118 for generating a modified version of reconstructed signal r', namely, r'.sub.out. As will be described in more detail hereinafter modification unit 118 includes an arrangement for modifying, if necessary, reconstructed signal r' in accordance with prescribed criteria when received differential PCM signal I' is the most positive or most negative ADPCM quantizer step. This ensures that a next subsequent coder will choose the same ADPCM quantizer step. "Modified" reconstructed signal r'.sub.out is then PCM quantized via PCM output quantizer 119 for use as directed.
Coder 100 and decoder 101 are shown in FIG. 1 in block diagram form to facilitate clarity of description. However, coder 100 and decoder 101 are implemented, in this example, in a digital signal processor (DSP), i.e., a programmable integrated circuit for signal processing. Any one of a number of digital signal processing units known in the art may be employed for this purpose. One such DSP unit is described in several articles in The Bell System Technical Journal, Vol. 60, No. 7, Part 2, dated September 1981 and is manufactured by Western Electric Company.
Accordingly, coder 100 including an aspect of the invention is realized by programming a DSP unit. Operation of coder 100, in accordance with an aspect of the invention, is described in conjunction with the digital program flow chart of FIGS. 2 and 3.
FIGS. 2 and 3 when connected A--A, B--B and C--C form a flow chart of a program routine for converting digital signals from a first code, e.g., .mu.-law PCM, to a second code, e.g., ADPCM. Accordingly, the DSP is initialized via 201. Thereafter, received PCM samples s.sub.PCM are converted in operational block 202 to linear PCM samples s. Then, the predictor output estimate s.sub.e is computed via operational block 203. As noted above, details of the predictor computation are described in my copending application Ser. No. 343,355. Operational block 204 causes the computation of difference signal d, which comprises the algebraic combination of linear samples s and predicted estimate -s.sub.e, namely, d=s-s.sub.e. Difference signal d is quantized via operational block 205, for example, in accordance with the ADPCM quantizer characteristic of FIG. 4, to obtain a preliminary 4-bit differential PCM output I.sub.0. Output I.sub.0 is tested in conditional branch point 206 to determine whether it is the most negative most quantizer step value, in this example, step -8 of FIG. 4. If the test result is NO, control is transferred to conditional branch point 207. If the test result in step 206 is YES, control is transferred to operational block 208 which sets the 4-bit differential PCM value I=I.sub.0. Thereafter, control is transferred to operational block 209 of FIG. 3. Similarly, conditional branch point 207 tests to determine if I.sub.0 is the most positive ADPCM quantizer step, in this example, step 7 of FIG. 4. If the test result is NO, control is transferred to operational block 210. However, if the test result in step 207 is YES, operational block 208 again sets I=I.sub.0 and control is thereafter transferred to operational block 209. Steps 206, 207 and 208 are used when the ADPCM quantizer 14 (FIG. 1) generates an output I that is on the so-called saturated portion of the quantizer characteristic. Any possible distortion accumulation from subsequent code conversions is eliminated in decoder 101 in the saturated portion of the quantizer characteristic as described below.
If the results of the tests in steps 206 and 207 are NO, then the ADPCM output I is not in saturation and any possible accumulation of distortion in subsequent code conversion stages is eliminated in accordance with an aspect of the invention as described hereinafter. To this end, operational block 210 causes the ADPCM quantizer steps adjacent I.sub.0 to be computed, namely, I.sub.(-1) =I.sub.0 -1 and I.sub.(+1) =I.sub.0 +1 . Operational block 211 causes each of ADPCM quantizer steps I.sub.k, k=-1, 0, +1 to be inverse ADPCM quantized to generate corresponding values d.sub.qk, k=-1, 0, +1. Then, reconstructed signals r.sub.k =s.sub.e +d.sub.qk, k=-1, 0, +1 are computed. The reconstructed signals r.sub.k, k=-1, 0, +1, are PCM quantized and inverse PCM quantized to generated corresponding values r.sub.qk, k=-1, 0, +1. Thereafter, quantizing error values X.sub.k =r.sub.k -r.sub. qk are generated for k=-1, 0, +1. Values r.sub.qk correspond to linear PCM signals s.sub.k which would be generated in response to ADPCM values I, being transmitted via 102, decoded in decoder 101, again PCM quantized via 119, transmitted to a subsequent coder 100 and inverse PCM quantized via 10 to linear PCM samples s.sub.k.
Conditional branch point 212 tests whether r.sub.q(-1) =r.sub.q0. If the test result is NO, control is transferred to conditional branch point 213. If the test result is YES, conditional branch point 214 tests whether X.sub.(-1) <X.sub.0. If this test result in step 214 is NO, control is transferr to conditional branch point 213. If the step 214 test result is YES, operational block 215 sets I=I.sub.(-1) and control is transferred to operational block 209. Conditional branch point 213 tests whether r.sub.q(+1) =r.sub.q0. If this test result is NO, control is transferred to operational block 216. If the step 213 test result is YES, conditional branch point 217 tests whether X.sub.(+1) .ltoreq.X.sub.0. If the test result in step 217 is NO, control is transferred to operational block 216. If the test result in step 217 is YES, operational block 218 sets I=I.sub.(+1) and control is transferred to operational block 209. Operational block 216 sets I=I.sub.0.
In summary, program steps 205-208 and 210-218 are included in ADPCM quantizer 14 FIG. 1 for generating ADPCM output I, in accordance with an aspect of the invention, to eliminate distortion in subsequent code conversions, i.e., PCM-to-ADPCM-to-PCM. Specifically, steps 210 through 218 are employed to determine in accordance with the prescribed criteria including a first criterion of determining whether preliminary ADPCM value I.sub.0 and either of its adjacent values I.sub.(-1) or I.sub.(+1) would generate the same PCM value, namely, r'.sub.PCM or alternately r'.sub.q which corresponds to linear PCM samples s a subsequent coder 100, and a second criterion of determining whether the quantizing error X=.vertline.r-r.sub.q .vertline. generated from converting the ADPCM sample to PCM is greater for preliminary value I.sub.0 or either adjacent value I.sub.(-1) or I.sub.(+1) which meets the requirement for the first criterion. When the quantizing error associated with I.sub.0 and either I.sub.(-1) or I.sub.(+1) that met the first criterion is equal, then the more positive value is selected for the ADPCM output sample I.
The prescribed criteria is, for example, generating a preliminary ADPCM value I.sub.0 (step 205), obtaining the adjacent ADPCM quantizer step values I.sub.(-1) and I.sub.(+1) (step 210), generating for I.sub.(-1), I.sub.0 and I.sub.(+1) a corresponding linear PCM value that a subsequent code converter would generate if I.sub.(-1), I.sub.0 or I.sub.(+1) were decoded via decoder 101 converted to PCM, transmitted to a subsequent coder and inverse PCM quantized to linear form in the subsequent coder (step 211) to yield r.sub.q(-1), r.sub.q0 and r.sub.q(+1). Then, the linear PCM value r.sub.q(-1) is checked against r.sub.q0 (step 212); if r.sub.q(-1) is not equal to r.sub.q0 the linear PCM value r.sub.q(+1) is checked against r.sub.q0 (step 213); if r.sub.q(+1) is not equal to r.sub.q0 I=I.sub.0 (step 216). If the linear PCM value r.sub.q(-r) =r.sub.q0, the magnitude of the difference between the reconstructed signal r.sub.(- 1) and the subsequent converted linear PCM value r.sub.q(-1), i.e., quantizing error X.sub.(-1) is compared to quantizing error X.sub.0 and if X.sub.(-1) <X.sub.0 (step 214) then I=I.sub.(-1). Similarly, if X.sub.(-1) is not less than X.sub.0 and r.sub.q(+1) =r.sub.q0 (step 213) the quantizing error value X.sub.(+1) is compared to X.sub.0 and if X.sub.(+1) .ltoreq.X.sub.0, I=I.sub.(+1), otherwwise I=I.sub.0.
Operational block 209 causes I to be inverse quantized to find value d.sub.q and, then, the 4-bit differential PCM output I is outputted. Operational block 219 causes reconstructed signal r to be computed by adder 17, namely, r=s.sub.e +d.sub.q. Scale factor .DELTA. is updated in operational block 220 in known fashion. It is noted, however, that certain values of scale factor .DELTA. may need to be excluded from use for proper operation of the invention. This is realized by simply excluding those values. Lastly, the adaptive predictor coefficients are updated in operational block 221. Once 221 is completed, the coder waits in block 222 for the next input sample and, then, the entire process is repeated again.
Operation of decoder 101 in generating a reconstructed .mu.-law PCM signal r'.sub.PCM from received ADPCM signal I' is described below in conjunction with the digital program flow chart shown in FIGS. 5 and 6.
FIGS. 5 and 6 when connected D--D, E--E and F--F form a flow chart of a program routine illustrating operation of decoder 101. Accordingly, a DSP unit is initialized via 501 and, thereafter, predictor output estimate s.sub.e ' is generated by operational block 502 in essentially the same manner as step 203 of FIG. 2. Operational block 503 relates to the reception and decoding of the 4-bit differential PCM signal I', followed by the generation or "finding" of the inverse quantized version of I' or the quantized version of difference signal, d.sub.q ' in similar fashion to step 209 of FIG. 2. Operational block 505 causes reconstructed signal r' to be computed in similar fashion to step 219 of FIG. 3. Operational block 505 causes reconstructed signal r' to be computed in similar fashion to step 219 of FIG. 3. Similarly, operational block 506 causes ADPCM quantizer scale factor .DELTA.' to be updated, also in similar fashion to step 220 of FIG. 3. Adaptive predictor coefficients are updated in operational block 507 in a manner similar to step 221 of FIG. 3.
Conditional branch point 508 tests to determine whether I' is the most negative ADPCM quantizer step, in this example, step -8. If the test result is YES, control is transferred to operational block 509. If the test result in step 508 is NO, conditional branch point 510 tests to determine whether I' is the most positive ADPCM quantizer step. If the step 510 test result is YES, control is transferred to operational block 509. If the step 510 test result is NO, I' is not on the saturated portion of the ADPCM quantizer characteristic and any possible distortion accumulation was eliminated, in accordance with an aspect of the invention in coder 100. Additionally, control is transferred to operational block 511 and since no modification is necessary r'.sub.out is set to be equal to reconstructed signal r'. Thereafter, control is transferred to operational block 512 of FIG. 6.
Operational block 509 causes reconstructed signal r' to be PCM quantized, e.g., .mu.225 PCM and then to be inverse PCM quantized to obtain linear PCM samples, namely, r'.sub.q =(Q.sub.PCM).sup.-1 [Q.sub.PCM (r')]. Again r'.sub.q is equivalent to a linear PCM sample s which a next coder 100 would generate from a PCM sample generated from reconstructed signal r'. Additionally, operational block 509 determine or "finds" .DELTA..sub.PCM which is the PCM quantization interval or "step size" corresponding to r'.sub.q.
Operational block 513 (FIG. 6) causes Y=(r'-r'.sub.q).sign (I') to be computed. Value Y is the difference between the reconstructed signal r' generated in decoder 101 in response to I' and a linear PCM sample r'.sub.q which a subsequent coder 100 would generate after inverse PCM quantizing a received PCM version of r', this difference then being multiplied by the algebraic sign of I'. This value Y is used to determine whether reconstructed signal r' is sufficiently different from the value r'.sub.q which a subsequent coder would generate to require modification. Conditional branch point 514 tests to determine whether I' is on the most positive ADPCM quantizer step, in this example, step 7. If the test result is NO, I' on the most negative ADPCM quantizer step, in this example, step -8, and control is transferred to operational block 515. If the step 514 test result is YES, control is transferred to operational block 516 and Y.sub.MAX =[ol(7)-dl(7)]..DELTA.' is computed for positive step 7 of the ADPCM quantizer characteristic used in this example, where ol(7) is the output level for step 7 and dl(7) is the decision level for step 7 of the ADPCM quantizer characteristic shown in FIG. 4. Y.sub.MAX is the maximum value of the difference between reconstructed signal r' and signal r'.sub.q allowable before r' must be modified. Thereafter, control is transferred to conditional branch point 517.
Operational block 515 causes Y.sub.MAX =[dl(-7)-ol(-8)]..DELTA.' to be generated for the most negative step, i.e., step -8, of the ADPCM quantizer characteristic used in this example as shown in FIG. 4.
Conditional branch point 517 tests to determine if Y>Y.sub.MAX. If the test result is NO, Y is less than Y'.sub.MAX and no modification of reconstructed signal r' is necessary. Accordingly, operational block 519 sets r'.sub.out =r' and control is transferred to operational block 512. If the test result of step 517 is YES, the difference between r' and r'.sub.q is too great and reconstructed signal r' requires modification. Accordingly, operational block 518 causes r'.sub.out =r'+(.DELTA..sub.PCM /2).sign (I') to be generated, in accordance with an aspect of the invention. Thus, it is seen that if differential PCM value I' is on the most positive or most negative ADPCM quantizer characteristic step and the difference between the reconstructed signal r' generated in decoder 101 and the linear PCM value r'.sub.q that would be generated by a subsequent coder is greater than a prescribed value, the value of r' is controllably modified by a prescribed positive value if I' is on the most positive ADPCM quantizer characteristic step or by a prescribed negative value if I' is on the most negative ADPCM quantizer characteristic step.
Operational block 512 causes r'.sub.out to be PCM quantized for transmission. For example r'.sub.PCM =Q.sub.PCM (r'.sub.out), where r'.sub.PCM is a .mu.225 PCM sample value. Thereafter, decoder 101 waits in operational block 520 for the next ADPCM input sample I' and, then, the entire decoder process is repeated.
The above arrangements are only examples of embodiments of the invention. It will be apparent to those skilled in the art that various changes in form and detail may be made without departing from the spirit or scope of the invention. Indeed, other than .mu.-law PCM and ADPCM code schemes may be used. Moreover, although the illustrative embodiment employs an ADPCM quantizer characteristic that has the decision levels (dl) midway between output levels (ol), the invention is equally applicable to more general relationships between the decision levels and the output levels. Indeed, either quantizer may have any non-uniform or uniform characteristic. Additionally, the first-to-second code converter need not be an ADPCM coder; other coding techniques which employ a quantizer for converting a first code to a second code could also be used. Examples include, but are not limited to, Differential PCM (DPCM) with a fixed quantizer and adaptive PCM (APCM) with no prediction.