The present invention relates to encoding of sound signals (for example speech and audio signals) using an embedded (or layered) coding structure.
More specifically, but not exclusively, in an embedded codec where linear prediction based coding is used in the lower (or core) layers and transform coding used in the upper layers, a spectral mask is computed based on a spectrum related to the input sound signal and applied to the transform coefficients in order to reduce the quantization noise of the transform-based upper layers.
In embedded coding, also known as layered coding, the sound signal is encoded in a first layer to produce a first bit stream, and then the error between the original sound signal and the encoded signal (synthesis sound signal) from the first layer is further encoded to produce a second bit stream. This can be repeated for more layers by encoding the error between the original sound signal and the synthesis sound signal from all preceding layers. The bit streams of all layers are concatenated for transmission. The advantage of layered coding is that parts of the bit stream (corresponding to upper layers) can be dropped in the network (e.g. in case of congestion) while still being able to decode the encoded sound signal at the receiver depending on the number of received layers. Layered coding is also useful in multicast applications where the encoder produces the bit stream of all layers and the network decides to send different bit rates to different end points depending on the available bit rate within each link.
Embedded or layered coding can be also useful to improve the quality of widely used existing codecs while still maintaining interoperability with these codecs. Adding layers to the standard codec lower (or core) layer can improve the quality and even increase the encoded audio signal bandwidth. An example is the recently standardized ITU-T Recommendation G.729.1 in which the lower (or core) layer is interoperable with the widely used narrowband ITU-T Recommendation G.729 operating at 8 kbit/s. The upper layers of ITU-T Recommendation G.729.1 produce bit rates up to 32 kbit/s (with wideband signal starting from 14 kbit/s). Current standardization work aims at adding mode layers to produce super wideband (14 kHz bandwidth) and stereo extensions. Another example is Recommendation G.718 recently approved by ITU-T [1] for encoding wideband signals at 8, 12, 16, 24, and 32 kbit/s. This codec was previously known as EV-VBR codec and was undertaken by Q9/16 in ITU-T. In the following description, reference to EV-VBR shall mean reference to ITU-T Recommendation G.718. The EV-VBR codec is also envisaged to be extended to encode super wideband and stereo signals at higher bit rates. As a non-limitative example, the EV-VBR codec will be used in the non-restrictive, illustrative embodiments of the present invention since the technique disclosed in the present disclosure is now part of ITU-T Recommendation G.718.
The requirements for embedded codecs usually comprise good quality in case of both speech and audio signals. Since speech can be encoded at relatively low bit rate using a model-based approach, the lower layer (or first two lower layers) is encoded using a speech specific technique and the error signal for the upper layers is encoded using a more generic audio coding technique. This approach delivers a good speech quality at low bit rates and a good audio quality as the bit rate increases. In the EV-VBR codec (and also in ITU-T Recommendation G.729.1), the two lower layers are based on the ACELP (algebraic code-excited linear prediction) technique which is suitable for encoding speech signals. In the upper layers, transform-based coding suitable for audio signals is used to encode the error signal (the difference between the input sound signal and the output (synthesized sound signal) from the two lower layers). In the upper layers, the well known MDCT transform is used, where the error signal is transformed into the frequency domain using windows with 50% overlap. The MDCT coefficients can be quantized using several techniques, for example scalar quantization with Hoffman coding, vector quantization, or any other technique. In the EV-VBR codec, algebraic vector quantization (AVQ) is used to quantize the MDCT coefficients among other techniques.
The spectrum quantizer has to quantize a range of frequencies with a maximum amount of bits. Usually the amount of bits is not high enough to quantize perfectly all frequency bins. The frequency bins with highest energy are quantized first (where the weighted spectral error is higher), then the remaining frequency bins are quantized, if possible. When the amount of available bits is not sufficient, the lowest energy frequency bins are only roughly quantized and the quantization of these lowest energy frequency bins may vary from one frame to the other. This rough quantization leads to an audile quantization noise especially between 2 kHz and 4 kHz. Accordingly, there is a need for a technique for reducing the quantization noise caused by a lack of bits to quantize all energy frequency bins in the spectrum or by too large a quantization step.
According to the present invention, there is provided a method for coding an input sound signal in at least one lower layer and at least one upper layer of an embedded codec, the method comprising: in the at least one lower layer, (a) coding the input sound signal to produce coding parameters, wherein coding the input sound signal comprises producing a synthesized sound signal; computing an error signal as a difference between the input sound signal and the synthesized sound signal; calculating a spectral mask from a spectrum related to the input sound signal; in the at least one upper layer, (a) coding the error signal to produce coding coefficients, (b) applying the spectral mask to the coding coefficients, and (c) quantizing the masked coding coefficients; wherein applying the spectral mask to the coding coefficients reduces the quantization noise produced upon quantizing the coding coefficients.
The present invention also relates to a method for reducing a quantization noise produced during coding of an error signal in at least one upper layer of an embedded codec, wherein coding the error signal comprises producing coding coefficients and quantizing the coding coefficients, and wherein the method comprises: providing a spectral mask; and in the at least one upper layer, applying the spectral mask to the coding coefficients prior to quantizing the coding coefficients.
Also in according with the present invention, there is provided a device for coding an input sound signal in at least one lower layer and at least one upper layer of an embedded codec, the device comprising: in the at least one lower layer, (a) means for coding the input sound signal to produce coding parameters, wherein the sound signal coding means produces a synthesized sound signal; means for computing an error signal as a difference between the input sound signal and the synthesized sound signal; means for calculating a spectral mask from a spectrum related to the input sound signal; in the at least one upper layer, (a) means for coding the error signal to produce coding coefficients, (b) means for applying the spectral mask to the coding coefficients, and (c) means for quantizing the masked coding coefficients; wherein applying the spectral mask to the coding coefficients reduces the quantization noise produced upon quantizing the coding coefficients.
The present invention further relates to a device for coding an input sound signal in at least one lower layer and at least one upper layer of an embedded codec, the device comprising: in the at least one lower layer, (a) a sound signal codec for coding the input sound signal to produce coding parameters, wherein the sound signal sound signal codec produces a synthesized sound signal; a subtractor for computing an error signal as a difference between the input sound signal and the synthesized sound signal; a calculator of a spectral mask from a spectrum related to the input sound signal; in the at least one upper layer, (a) a coder of the error signal to produce coding coefficients, (b) a modifier of the coding coefficients by applying the spectral mask to the coding coefficients, and (c) a quantizer of the masked coding coefficients; wherein applying the spectral mask to the coding coefficients reduces the quantization noise produced upon quantizing the coding coefficients.
Still further in accordance with the present invention, there is provided a device for reducing a quantization noise produced during coding of an error signal in at least one upper layer of an embedded codec, wherein coding the error signal comprises producing coding coefficients and quantizing the coding coefficients, and wherein the device comprises: a spectral mask; and in the at least one upper layer, a modifier of the coding coefficients by applying the spectral mask to the coding coefficients prior to quantizing the coding coefficients.
The foregoing and other objects, advantages and features of the present invention will become more apparent upon reading of the following non-restrictive description of illustrative embodiments thereof, given by way of example only with reference to the accompanying drawings.
In the appended drawings;
In the following non-restrictive description, a technique to reduce the quantization noise caused by a lack of bits to quantize all energy frequency bins in the spectrum or by too large a quantization step is disclosed. More specifically, to reduce the quantization noise, a spectral mask is computed and applied to transform coefficients before quantization. The spectral mask is generated in relation with a spectrum related to the input sound signal. The spectral mask corresponds to a set of scaling factors applied to the transform coefficients before the quantization process. The spectral mask is computed in such a manner that the scaling factors are larger (close to 1) in the region of the maxima of the spectrum of the input sound signal and smaller (as low as 0.15) in the region of the minima of the spectrum of the input sound signal. The reason is that the quantization noise resulting from the upper layers in the case of input speech signals is usually located between formants. These formants need to be identified to create the appropriate spectral mask. By lowering the value of the energy of the frequency bins in the spectral regions corresponding to the minima of the spectrum of the input sound signal (between the formants in the case of speech signals), the resulting quantization noise will be lowered when the amount of bits available is insufficient for full quantization.
This procedure results in a better quality in the case of speech signals, when the lower (or core) layers are quantized using a speech-specific coding technique and the upper layers are quantized using transform-based techniques.
In summary, the disclosed technique forces the quantizer to use its bit budget in the region of the formants instead of between them. To achieve this goal, a first step uses the spectrum of the input sound signal available at the encoder in the lower layers or the spectral response of a mask filter derived, for example, from LP (linear prediction) parameters also available at the encoder in the lower layers to identify a formant shape. In a second step, maxima and minima inside the spectrum of the input sound signal are identified (corresponding to spectral peaks and valleys). In a third step, the maxima and minima location information is used to generate a spectral mask. In a fourth step, the currently calculated spectral mask, which may be a newly calculated spectral mask or an updated version of previously calculated spectral mask(s), is applied to the transform (for example MDCT) coefficients (or spectral error to be quantized) to reduce the quantization noise due to spectral error between formants.
Referring to
In the lower layer or layers, i.e. in the at least one lower layer, the spectrum, for example the power spectrum of the input sound signal 101 in the log domain is computed through a log power spectrum calculator 102. The input sound signal 101 is also coded through a speech specific codec 103 to produce coding parameters 113. The speech specific coded 103 also produces a synthesized sound signal 105.
A subtractor 104 then computes an error signal 106 as the difference between the input sound signal 101 and the synthesized sound signal 105 from the lower layer(s), more specifically from the speech specific codec 103.
In the upper layer or layers, i.e. in the at least one upper layer, a transform is used. More specifically, the transform calculator 107 applies a transform to the error signal 106.
A spectral mask calculator 108 then computes a spectral mask 110 based on the power spectrum 114 of the input sound signal 101 in the log domain as calculated by the log power spectrum calculator 102.
A transform modifier and quantizer 111 (a) applies the spectral mask 110 to the transform coefficients 109 as calculated by the transform calculator 107 and (b) then quantizes the masked transform coefficients.
A bit stream 112 is finally constructed, for example through a multiplexer, and comprises the lower layer(s) including coding parameters 113 from the speech specific codec 103 and the upper layer(s) including the transform coefficients 110 as masked and quantized by the transform modifier and quantizer 111.
Referring to
In the lower layer or layers, i.e. in the at least one lower layer, a resampler 202 resamples the input sound signal 201, originally sampled at a first input sampling frequency usually of 16 kHz, at a second sampling frequency of 12.8 kHz. The spectrum, for example the power spectrum of the resampled sound signal 203 in the log domain is computed through a log power spectrum calculator 204. The resampled sound signal 203 is also coded through a speech specific ACELP codec 205 to produce coding parameters 219.
The speech specific ACELP coded 205 also produces a synthesized sound signal 206. This synthesized sound signal 206 from the lower layer(s), i.e. from the speech specific ACELP codec 205 is resampled back at the first input sampling frequency (usually 16 kHz) by a resampler 207.
A subtractor 208 then computes an error signal 209 corresponding to the difference between the original sound signal 201 and the resampled, synthesized sound signal 210 from the lower layer(s), more specifically from the speech specific ACELP codec 205 and resampler 207.
In the upper layer(s), the error signal 209 is first weighted with a perceptual weighting filter 211 (similar to the perceptual weighting filter used in ACELP), and is then transformed using MDCT (Modified Discrete Cosine Transform) in a calculator 212 to produce MDCT coefficients 215.
A spectral mask calculator 213 then computes a spectral mask 216 based on the power spectrum 214 of the resampled input signal 203 in the log domain as calculated by the log power spectrum calculator 204.
A MDCT modifier and quantizer 217 applies the spectral mask 216 as calculated by the spectral mask calculator 213 to the MDCT coefficients 215 from the MDCT calculator 212 and quantizes the masked MDCT coefficients 216.
A bit stream 218 is finally constructed, for example through a multiplexer, and comprises the lower layer(s) including coding parameters 219 from the speech specific ACELP codec 205 and the upper layer(s) including the MDCT coefficients 220 as masked and quantized through the MDCT modifier and quantizer 217.
In the following description, two non-restrictive illustrative embodiments are disclosed to illustrate the computation of the spectral mask applied to the frequency bins before quantization. It is within the scope of the present invention to use any other suitable methods for calculating the spectral mask without departing from the scope of the present invention. These two illustrative embodiments will be explained in the context of the EV-VBR codec. In the ACELP two lower layers, the EV-VBR codec operates at an internal sampling frequency of 12.8 kHz. This EV-VBR codec also uses 20 ms frames corresponding to 256 samples at a sampling frequency of 12.8 kHz.
In the illustrative embodiment as illustrated in
In the spectral analyser 702, a discrete Fourier Transform is used to perform the spectral analysis and spectrum energy estimation in view of calculating the power spectrum of the input sound signal 701. The frequency analysis is done twice per frame using a 256-points Fast Fourier Transform (FFT) with a 50 percent overlap as illustrated in
where LFFT=256 is the size of the FFT (Fast Fourier Transform) analysis. It should be pointed out that only half the window is computed and stored since it is symmetric (from 0 to LFFT/2).
Let s′(n) denote the input sound signal with index 0 corresponding to the first sample in the frame. The windowed signal for both spectral analysis are obtained using the following relation:
x
w
(1)(n)=wFFT(n)s′(n),n=0, . . . , LFFT−1
x
w
(2)(n)=wFFT(n)s′(n+LFFT/2),n=0, . . . , LFFT−1 (2)
where s′(0) is the first sample in the current frame.
FFT is performed on both windowed signals as follows to obtain two sets of spectral parameters per frame:
where N is the number of samples per frame.
The output of the FFT gives the real and imaginary parts of the power spectrum denoted by XR(k), k=0 to 128, and XI(k), k=1 to 127. Note that XR (0) corresponds to the spectrum at 0 Hz (DC) and XR(128) corresponds to the power spectrum at 6400 Hz (EV-VBR uses a 12.8 kHz internal sampling frequency). The power spectrum at these points is only real valued and usually ignored in the subsequent analysis.
After FFT analysis, a calculator 703 of the energy per critical band in the log domain divides the resulting spectrum into critical frequency bands using the intervals having the following upper limits [2] (20 bands in the frequency range 0-6400 Hz):
The 256-point FFT results in a frequency resolution of 50 Hz (6400/128). Thus after ignoring the DC component of the spectrum, the number of frequency bins per critical band is MCB={2, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 6, 6, 8, 9, 11, 14, 18, 21}, respectively.
The calculator 703 computes the average energies of the critical bands using the following relation:
where XR(k) and XI(k) are, respectively, the real and imaginary parts of the kth frequency bin and ji is the index of the first bin in the ith critical band given by ji={1, 3, 5, 7, 9, 11, 13, 16, 19, 22, 26, 30, 35, 41, 47, 55, 64, 75, 89, 107}.
A calculator 704 computes the energies of the frequency bins in the log domain, EBIN(k), using the following relation:
E
BIN(k)=XR2(k)+XI2(k),k=0, . . . , 127 (5)
To compute the spectral mask, the formants in the spectrum need to be located, which is performed by first determining the maxima and minima of the power spectrum of the input sound signal 701 in the log domain.
The calculator 704 determines the energy of each frequency bin in the log domain using the following relation:
Bin(k)=10 log(0.5(EBIN(0)(k)+EBIN(1)(k))),k=0, . . . , 127 (6)
where EBIN(0)(k) and EBIN(1)(k) are the energy per frequency bin from both spectral analysis. Similarly, the calculator 703 averages the energy of each critical band from the spectral analysis and converted to the log domain.
To simplify the formant search, the spectral mask calculator 213 comprises a low-pass filter 705 to first low-pass filter the energies of the frequency bins in the log domain using the following relation:
BinLP(n)=0.15Bin(n−2)+0.15Bin(n−1)+0.4Bin(n)+0.15Bin(n+1)+0.15Bin(n+2) (7)
The spectral mask calculator 213 also comprises a maxima and minima finder 706 that computes the maximum dynamic between critical bands in the log domain. The variation of this maximum dynamic between critical bands will be used later as a part of a threshold to determine or not the presence of a maximum or a minimum.
Dynamicband=max(lg_band(n)n=0n=20)−min(lg_band(n)n=0n=20) (8)
where max(lg_band(n)n=0n=20) is the maximum average energy in a critical frequency band, and min(lg_band(n)n=0n=20) is the minimum average energy in a critical frequency band.
Starting at 1.5 kHz the algorithm used in the maxima and minima finder 706 tries to find the different positions of the maxima and the minima in the power spectrum of the input sound signal 701, i.e. in the low-pass filtered energies of the frequency bins from the low-pass filter 705. The position of a maximum (or a minimum) is found by the maxima and minima finder 706 when the bin is greater than the 2nd previous bin and the 2nd next bin. This precaution helps to prevent to declare as a maximum (minimum) only local variation.
When a maximum and a minimum are found, the algorithm used in the maxima and minima finder 706 validates that the difference between this maximum and minimum is greater than 15% of the above mentioned maximum dynamic observed between critical bands. If this is the case, two different spectral masks are applied for the maximum and the minimum position as illustrated in
The spectral mask calculator 213 finally comprises a spectral mask sub-calculator 707 to determine that the spectral mask in the spectral region corresponding to the maximum has the following values centered at 1.0 on the position of the maximum:
facmax[5]={0.45,0.75,1.0,0.75,0.45} (11)
The frequency mask sub-calculator 707 determines that the spectral mask in the spectral region corresponding to the minimum has the following value centered at 0.15 on the position of the minimum:
facmin[5]={0.75,0.35,0.15,0.35,0.75} (12)
The spectral mask of the other frequency bins is not changed and remains the same as the past frame. The idea of not changing the entire spectral mask helps to stabilize the quantized frequency bins. The spectral masks for the low energy frequency bins remain low until a new maximum appears in those spectral regions.
After the above operations, the spectral mask is applied to the MDCT coefficients by the MDCT modifier 2171 in such a manner that the spectral error located around a maximum is nearly not attenuated and the spectral error located around a minimum is pushed down.
Because the resolution of the FFT is only 50 Hz, the MDCT modifier 2171 applies the spectral mask for 1 FFT bin to 2 MDCT coefficients as follow:
If more bits are available, it is possible to remove the quantized frequency bins from the MDCTcoeff input and quantize in the MDCT quantizer 2172 the new signal or simply quantize the unquantized frequency bins. Depending of the bit rate available for this second stage of quantization, it could be necessary to use a second spectral mask based on the previous spectral mask. The second weighting stage is defined as follow:
Pushing down a lot of the error frequency bins helps to concentrate the available bit rate where the formants are present in the weighted input sound signal. In subjective listening tests, this technique gave a 0.15 improvement in the mean opinion score (MOS), which is a significant improvement.
As shown in the embodiment of
In the embodiment of
A simpler approach is to compute the spectral mask as a scaled version of the power spectrum of the mask filter. This can be done by finding the maximum of the power spectrum of the mask filter in the log domain and scaling it such that the maximum becomes 1. The spectral mask then is given by the scaled power spectrum of the mask filter in the log domain. Since the mask filter is derived from the LP filter parameters determined on the basis of the input sound signal 701, the power spectrum of the mask filter is also representative of the power spectrum of the input sound signal 701.
To design the mask filter from which the spectral mask is derived, it is first verified that this filter doesn't exhibit strong spectral tilt. The reason is to have all formants weighted with a value close to 1. In the EV-VBR codec, the LP filter is computed based on a pre-emphasized signal. Thus the filter already doesn't have a pronounced spectral tilt. In a first example, the mask filter is a weighted version of the synthesis filter, given by the relation:
H(z)=1/A(z/γ) (15)
where γ is a factor having a value lower than 1. In a second example, the filter is given by the relation:
H(z)=A(z/γ2)/A(z) (16)
As described above, the power spectrum of the filter H(z) can be found by computing the FFT of the impulse response of the mask filter.
The LP filter in the EV-VBR codec is computed 4 times per 20 ms frame (using interpolation). In this case, the impulse response can be computed in calculator 802 based on the LP filter corresponding to the center of the frame. An alternative implementation is to compute the impulse response for each 5 ms subframe and then average all the impulse responses.
These two alternatives are more efficient on speech content. They can be used in music content too; however, if a mechanism is used in the codec to classify frames as speech or music frames, these two alternative can be inactivated in case of music frames.
Although the present invention has been described hereinabove by way of non-restrictive illustrative embodiments thereof, these embodiments can be modified at will within the scope of the appended claims without departing from the spirit and nature of the subject invention.
Filing Document | Filing Date | Country | Kind | 371c Date |
---|---|---|---|---|
PCT/CA08/01700 | 9/25/2008 | WO | 00 | 5/20/2010 |
Number | Date | Country | |
---|---|---|---|
60960431 | Sep 2007 | US |