The present disclosure relates generally to speech and audio coding and decoding and, more particularly, to an encoder and decoder for processing an audio signal including generic audio and speech frames.
Many audio signals may be classified as having more speech like characteristics or more generic audio characteristics typical of music, tones, background noise, reverberant speech, etc. Codecs based on source-filter models that are suitable for processing speech signals do not process generic audio signals as effectively. Such codecs include Linear Predictive Coding (LPC) codecs like Code Excited Linear Prediction (CELP) coders. Speech coders tend to process speech signals well even at low bit rates. Conversely, generic audio processing systems such as frequency domain transform codecs do not process speech signals very well. It is well known to provide a classifier or discriminator to determine, on a frame-by-frame basis, whether an audio signal is more or less speech-like and to direct the signal to either a speech codec or a generic audio codec based on the classification. An audio signal processor capable of processing different signal types is sometimes referred to as a hybrid core codec. In some cases the hybrid codec may be variable rate, i.e., it may code different types of frames at different bit rates. For example, the generic audio frames which are coded using the transform domain are coded at higher bit rates and the speech-like frames are coded at lower bit rates.
The transitioning between the processing of generic audio frames and speech frames using speech and generic audio mode, respectively, is known to produce discontinuities. Transition from a CELP domain frame to a Transform domain frame has been shown to produce discontinuity in the form of an audio gap. The transition from transform domain to CELP domain results in audible discontinuities which have an adverse effect on the audio quality. The main reason for the discontinuity is the improper initialization of the various states of the CELP codec.
To circumvent this issue of state update, prior art codecs such as AMRWB+ and EVRCWB use LPC analysis even in the audio mode and code the residual in the transform domain. The synthesized output is generated by passing the time domain residual obtained using the inverse transform through a LPC synthesis filter. This process by itself generates the LPC synthesis filter state and the ACB excitation state. However, the generic audio signals typically do not conform to the LPC model and hence spending bits on the LPC quantization may result in loss of performance for the generic audio signals. Therefore a need exists for an encoder and decoder for processing an audio signal including generic audio and speech frames that improves audio quality during transitions between coding and decoding techniques.
Skilled artisans will appreciate that elements in the figures are illustrated for simplicity and clarity and have not necessarily been drawn to scale. For example, the dimensions and/or relative positioning of some of the elements in the figures may be exaggerated relative to other elements to help to improve understanding of various embodiments of the present invention. Also, common but well-understood elements that are useful or necessary in a commercially feasible embodiment are often not depicted in order to facilitate a less obstructed view of these various embodiments of the present invention. It will further be appreciated that certain actions and/or steps may be described or depicted in a particular order of occurrence while those skilled in the art will understand that such specificity with respect to sequence is not actually required. Those skilled in the art will further recognize that references to specific implementation embodiments such as “circuitry” may equally be accomplished via either on general purpose computing apparatus (e.g., CPU) or specialized processing apparatus (e.g., DSP) executing software instructions stored in non-transitory computer-readable memory. It will also be understood that the terms and expressions used herein have the ordinary technical meaning as is accorded to such terms and expressions by persons skilled in the technical field as set forth above except where different specific meanings have otherwise been set forth herein.
In order to alleviate the above-mentioned need, an encoder and decoder for processing an audio signal including generic audio and speech frames are provided herein. During operation, two encoders are utilized by the speech coder, and two decoders are utilized by the speech decoder. The two encoders and decoders are utilized to process speech and non-speech (generic audio) respectively. During a transition between generic audio and speech, parameters that are needed by the speech decoder for decoding frame of speech are generated by processing the preceding generic audio (non-speech) frame for the necessary parameters. Because necessary parameters are obtained by the speech coder/decoder, the discontinuities associated with prior-art techniques are reduced when transitioning between generic audio frames and speech frames.
Turning now to the drawings, where like numerals designate like components,
The less speech-like frames are referred to herein as generic audio frames. The hybrid core codec 100 comprises a mode selector 110 that processes frames of an input audio signal s(n), where n is the sample index. The mode selector may also get input from a rate determiner which determines the rate for the current frame. The rate may then control the type of encoding method used. The frame lengths may comprise 320 samples of audio when the sampling rate is 16 kHz samples per second, which corresponds to a frame time interval of 20 milliseconds, although many other variations are possible.
In
In
In
As shown in
The subsequent decoded audio for frame m+1 may in this manner behave as it would if the previous frame m had been decoded by decoder 230. The decoded frame is then sent to state generator 160 where the parameters used by speech coder 130 are determined. This is accomplished, in part, by state generator 160 determining values for one or more of the following, through the use of the respective filter inverse function:
Values for at least one of the above parameters are passed to speech encoder 130 where they are used as initialization states for encoding a subsequent speech frame.
While the previous discussion exemplified the use of the invention with a single filter state F(z), we will now consider the case of a practical system in which state generators 160, 260 may include determining filter memory states for one or more of the following:
Re-sampling filter state memory
Values for at least one of the above parameters are passed from state generators 160, 260 to the speech encoder 130 or speech decoder 230, where they are used as initialization states for encoding or decoding a respective subsequent speech frame.
The quantized spectral, or LP, parameters are also conveyed locally to an LPC synthesis filter 605 that has a corresponding transfer function 1/Aq(z). LPC synthesis filter 605 also receives a combined excitation signal u(n) from a first combiner 610 and produces an estimate of the input signal ŝp(n) based on the quantized spectral parameters Aq and the combined excitation signal u(n). Combined excitation signal u(n) is produced as follows. An adaptive codebook code-vector cT is selected from an adaptive codebook (ACB) 603 based on an index parameter T. The adaptive codebook code-vector cT is then weighted based on a gain parameter β and the weighted adaptive codebook code-vector is conveyed to first combiner 610. A fixed codebook code-vector ck is selected from a fixed codebook (FCB) 604 based on an index parameter k. The fixed codebook code-vector ck is then weighted based on a gain parameter γ and is also conveyed to first combiner 610. First combiner 610 then produces combined excitation signal u(n) by combining the weighted version of adaptive codebook code-vector cT with the weighted version of fixed codebook code-vector ck.
LPC synthesis filter 605 conveys the input signal estimate ŝp(n) to a second combiner 612. Second combiner 612 also receives input signal sp(n) and subtracts the estimate of the input signal ŝp(n) from the input signal s(n). The difference between input signal sp(n) and input signal estimate ŝp(n) is applied to a perceptual error weighting filter 606, which filter produces a perceptually weighted error signal e(n) based on the difference between ŝp(n) and sp(n) and a weighting function W(z). Perceptually weighted error signal e(n) is then conveyed to squared error minimization/parameter quantization block 607. Squared error minimization/parameter quantization block 607 uses the error signal e(n) to determine an optimal set of codebook-related parameters T, β, k, and γ that produce the best estimate ŝp(n) of the input signal sp(n).
As shown, adaptive codebook 603, synthesis filter 605, and perceptual error weighting filter 606, all have inputs from state generator 160. As discussed above, these elements 603, 605, and 606 will obtain original parameters (initial states) for a first frame of speech from state generator 160, based on a prior non-speech audio frame.
The output of the synthesis filter 707, which may be referred as the output of the CELP decoder, is de-emphasized by filter 709 and then the de-emphasized signal is passed through a 12.8 kHz to 16 kHz up sampling filter (5/4 up sampling filter 711). The bandwidth of the synthesized output thus generated is limited to 6.4 kHz. To generate an 8 kHz bandwidth output, the signal from 6.4 kHz to 8 kHz is generated using a 0 bit bandwidth extension. The AMRWB type codec is mainly designed for wideband input (8 kHz bandwidth, 16 kHz sampling rate), however, the basic structure of AMRWB shown in
The generic audio mode of the preferred embodiment uses a transform domain/frequency domain codec. The MDCT is used as a preferred transform. The structure of the generic audio mode may be like the transform domain layer of ITU-T Recommendation G.718 or G.718 super-wideband extensions. Unlike G.718, where in the input to the transform domain is the error signal from the lower layer, the input to the transform domain is the input audio signal. Furthermore, the transform domain part directly codes the MDCT of the input signal instead of coding the MDCT of the LPC residual of the input speech signal.
As mentioned, during a transition from generic audio coding to speech coding, parameters and state memories that are needed by the speech decoder for decoding a first frame of speech are generated by processing the preceding generic audio (non-speech) frame. In the preferred embodiment, the speech codec is derived from an AMR-WB type codec wherein the down-sampling of the input speech to 12.8 kHz is performed. The generic audio mode codec may not have any down sampling, pre-emphasis, and LPC analysis, so for encoding the frame following the audio frame, the encoder of the AMR-WB type codec may require initialization of the following parameters and state memories:
The state of the down sampling filter and pre-emphasis filter are needed by the encoder only and hence may be obtained by just continuing to process the audio input through these filters even in the generic audio mode. Generating the states which are needed only by the encoder 130 is simple as the speech part encoder modules which update these states can also be executed in the audio coder 140. Since the complexity of the audio mode encoder 140 is typically lower than the complexity of the speech mode encoder 130, the state processing in the encoder during the audio mode does to affect the worst case complexity.
The following states are also needed by decoder 230, and are provided by state generator 260.
1. Linear prediction coefficients for interpolation and generation of the synthesis filter state memory. This is provided by circuitry 611 and input to synthesis filter 707.
2. The adaptive codebook state memory. This is produced by circuitry 613 and output to adaptive codebook 703.
3. De-emphasis filter state memory. This is produced by circuitry 609 and input into de-emphasis filter 709.
4. LPC synthesis filter state memory. This is output by LPC analysis circuitry 603 and input into synthesis filter 707.
5. Up sampling filter state memory. This is produced by circuitry 607 and input to up-sampling filter 711.
The audio output ŝa(n) is down-sampled by a 4/5 down sampling filter to produce a down sampled signal ŝa(nd). The down-sampling filter may be an IIR filter or an FIR filter. In the preferred embodiment, a linear time FIR low pass filter is used as the down-sampling filter, as given by:
where bi are the FIR filter coefficients. This adds delay to the generic audio output. The last L samples as ŝa(nd) forms the state of the up sampling filter, where L is the length of the up-sampling filter. The up-sampling filter used in the speech mode to up-sample the 12.8 kHz CELP decoder output to 16 kHz. For this case, the state memory translation involves a simple copy of the down-sampling filter memory to the up-sampling filter. In this respect, the up-sampling filter state is initialized for frame m+1 as if the output of the decoded frame m had originated from the coding method of frame m+1, when in fact a different coding method for coding frame m was used.
The down sampled output ŝa(nd) is then passed through a pre-emphasis filter given by:
P(z)=1−γz−1,
where γ is a constant (typically 0.6≦γ≦0.9), to generate a pre-emphasized signal ŝap(nd). In the coding method for frame m+1, the pre-emphasis is performed at the encoder and the corresponding inverse (de-emphasis),
is performed at the decoder. In this case, the down-sampled input to the pre-emphasis filter for the reconstructed audio from frame m is used to represent the previous outputs of the de-emphasis filter, and therefore, the last sample of ŝa(nd) is used as the de-emphasis filter state memory. This is conceptually similar to the re-sampling filters in that the state of the de-emphasis filter for frame m+1 is initialized to a state as if the decoding of frame m had been processed using the same decoding method as frame m+1, when in fact they are different.
Next, the last p samples of ŝap(nd) are similarly used as the state of the LPC synthesis filter for the next speech mode frame, where p is the order of the LPC synthesis filter. The LPC analysis is performed on pre-emphasized output to generate “quantized” LPC of the previous frame,
and where the corresponding LPC synthesis filter is given by:
In the speech mode, the synthesis/weighting filter coefficients of different subframes are generated by interpolation of the previous frame and the current frame LPC coefficients. For the interpolation purposes, if the previous frame is an audio mode frame, the LPC filter coefficients Aq(z) obtained by performing LPC analysis of the ŝap(nd) are now used as the LP parameters of the previous frame. Again, this is similar to the previous state updates, wherein the output of frame m is “back-propagated” to produce the state memory for use by the speech decoder of frame m+1.
Finally, for speech mode to work properly we need to update the ACB state of the system. The excitation for the audio frame can be obtained by a reverse processing. The reverse processing is the “reverse” of a typical processing in a speech decoder wherein the excitation is passed through a LPC inverse (i.e. synthesis) filter to generate an audio output. In this case, the audio output ŝap(nd) is passed through a LPC analysis filter Aq(z) to generate a residue signal. This residue is used for the generation of the adaptive codebook state.
While CELP encoder 130 is conceptually useful, it is generally not a practical implementation of an encoder where it is desirable to keep computational complexity as low as possible. As a result,
Encoder 800 may be substituted for encoder 130. To better understand the relationship between encoder 800 and encoder 130, it is beneficial to look at the mathematical derivation of encoder 800 from encoder 130. For the convenience of the reader, the variables are given in terms of their z-transforms.
From
E(z)=W(z)(S(z)−Ŝz)). (1)
From this expression, the weighting function W(z) can be distributed and the input signal estimate ŝ(n) can be decomposed into the filtered sum of the weighted codebook code-vectors:
The term W(z)S(z) corresponds to a weighted version of the input signal. By letting the weighted input signal W(z)S(z) be defined as Siv(z)=W(z)S(z) and by further letting weighted synthesis filter 803/804 of encoder 130 now be defined by a transfer function H(z)=W(z)/Aq(z). In case the input audio signal is down sampled and pre-emphasized, then the weighting and error generation is performed on the down sampled speech input. However, a de-emphasis filter D(z), need to be added to the transfer function, thus H(z)=W(z)·D(z)/Aq(z) Equation 2 can now be rewritten as follows:
E(z)=Sw(z)−H(z)(βCr(z)+γCk(z)). (3)
By using z-transform notation, filter states need not be explicitly defined. Now proceeding using vector notation, where the vector length L is a length of a current subframe, Equation 3 can be rewritten as follows by using the superposition principle:
e=s
w
−H(βcr+γck)−hzir, (4)
where:
H is the L×L zero-state weighted synthesis convolution matrix formed from an impulse response of a weighted synthesis filter h(n), such as synthesis filters 803 and 804, and corresponding to a transfer function Hzs(z) or H(z), which matrix can be represented as:
hzir is a L×1 zero-input response of H(z) that is due to a state from a previous input,
sw is the L×1 perceptually weighted input signal,
β is the scalar adaptive codebook (ACB) gain,
cγ is the L×1 ACB code-vector in response to index T,
γ is the scalar fixed codebook (FCB) gain, and
ck is the L×1 FCB code-vector in response to index k.
By distributing H, and letting the input target vector xw=sw−hzir, the following expression can be obtained:
e=x
w
−βHc
τ
−γHc
k. (6)
Equation 6 represents the perceptually weighted error (or distortion) vector e(n) produced by a third combiner 807 of encoder 130 and coupled by combiner 807 to a squared error minimization/parameter block 808.
From the expression above, a formula can be derived for minimization of a weighted version of the perceptually weighted error, that is, ∥e∥2, by squared error minimization/parameter block 808. A norm of the squared error is given as:
ε=∥e∥2=∥xw−βHcτ−γHck∥2. (7)
Due to complexity limitations, practical implementations of speech coding systems typically minimize the squared error in a sequential fashion. That is, the ACB component is optimized first (by assuming the FCB contribution is zero), and then the FCB component is optimized using the given (previously optimized) ACB component. The ACB/FCB gains, that is, codebook-related parameters β and γ, may or may not be re-optimized, that is, quantized, given the sequentially selected ACB/FCB code-vectors CT and ck.
The theory for performing the sequential search is as follows. First, the norm of the squared error as provided in Equation 7 is modified by setting γ=0, and then expanded to produce:
ε=∥xw−βHcτ∥2=xwTxw−2βxwTHcτβ2cτTHTHcτ. (8)
Minimization of the squared error is then determined by taking the partial derivative of ε with respect to β and setting the quantity to zero:
This yields an (sequentially) optimal ACB gain:
Substituting the optimal ACB gain back into Equation 8 gives:
where T* is a sequentially determined optimal ACB index parameter, that is, an ACB index parameter that minimizes the bracketed expression. Since xw is not dependent on T, Equation 11 can be rewritten as follows:
Now, by letting yτ equal the ACB code-vector CT filtered by weighted synthesis filter 803, that is, yτ=Hcτ, Equation 13 can be simplified to:
and likewise, Equation 10 can be simplified to:
Thus Equations 13 and 14 represent the two expressions necessary to determine the optimal ACB index T and ACB gain β in a sequential manner. These expressions can now be used to determine the optimal FCB index and gain expressions. First, from
ε=∥x2−γHck∥2. (15)
where γHck is a filtered and weighted version of FCB code-vector ck, that is, FCB code-vector ck filtered by weighted synthesis filter 804 and then weighted based on FCB gain parameter γ. Similar to the above derivation of the optimal ACB index parameter T*, it is apparent that:
where k* is the optimal FCB index parameter, that is, an FCB index parameter that maximizes the bracketed expression. By grouping terms that are not dependent on k, that is, by letting d2T=x2TH and Φ=HTH, Equation 16 can be simplified to:
in which the optimal FCB gain γ is given as:
Like encoder 130, encoder 800 requires initialization states supplied from state generator 160. This is illustrated in
So far we have discussed the switching from audio mode to speech mode when the speech mode codec is AMR-WB codec. The ITU-T G.718 codec and can similarly be used as a speech mode codec in the hybrid codec. The G.718 codec classifies the speech frame into four modes:
a. Voiced Speech Frame;
b. Unvoiced Speech Frame;
c. Transition Speech Frame; and
d. Generic Speech Frame.
The Transition speech frame is a voiced frame following the voiced transition frame. The Transition frame minimizes its dependence on the previous frame excitation. This helps in recovering after a frame error when a voiced transition frame is lost. To summarize, the transform domain frame output is analyzed in such a way to obtain the excitation and/or other parameters of the CELP domain codec. The parameters and excitation should be such that they should be able to generate the same transform domain output when these parameters are processed by the CELP decoder. The decoder of the next frame which is a CELP (or time domain) frame uses the state generated by the CELP decoder processing of the parameters obtained during analysis of the transform domain output.
To decrease the effect of state update on the subsequent voiced speech frame during audio to speech mode switching, it may be preferable to code the voiced speech frame following an audio frame as a transition speech frame.
It can be observed that in the preferred embodiment of the hybrid codec, where the down-sampling/up-sampling is performed only in the speech mode, the first L output samples generated by the speech mode during audio to speech transition are also generated by the audio mode. (Note that audio codec was delayed by the length of the down sampling filter). The state update discussed above provides a smooth transition. To further reduce the discontinuities, the L audio mode output samples can be overlapped and added with the first L speech mode audio samples.
In some situations, it is required that the decoding should also be performed at the encoder side. For example, in a multi-layered codec (G.718), the error of the first layer is coded by the second layer and hence the decoding has to be performed at the encoder side.
The logic flow begins at step 1101 where generic audio frames are encoded with a first encoder (encoder 140). Filter states are determined by state generator 160 from a generic audio frame (step 1103). A second encoder (speech coder 130) is then initialized with the filter states (step 1105). Finally, at step 1107 speech frames are encoded with the second encoder that was initialized with the filter states.
The logic flow begins at step 1201 generic audio frames are decoded with a first decoder (encoder 221). Filter states are determined by state generator 260 from a generic audio frame (step 1203). A second decoder (speech decoder 230) is then initialized with the filter states (step 1205). Finally, at step 1207 speech frames are decoded with the second decoder that was initialized with the filter states.
While the invention has been particularly shown and described with reference to a particular embodiment, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention. For example, although many states/parameters were described above being generated by circuitry 260 and 360, one or ordinary skill in the art will recognize that fewer or more parameters may be generated than those shown. Another example may entail a second encoder/decoder method that may use an alternative transform coding algorithm, such as on based on a discreet Fourier transform (DFT) or a fast implementation thereof. Other coding methods are anticipated as well, since there are no real limitations except that the reconstructed audio from a previous frame is used as input to the encoder/decoder state state generators. Furthermore, state update of a CELP type speech encoder/decoder are presented, however, it may also be possible to use another type of encoder/decoder for processing of the frame m+1. It is intended that such changes come within the scope of the following claims: