Examples of methods and apparatus are here provided which are capable of performing a low complexity pitch detection procedure, e.g., for long term postfiltering, LTPF, encoding.
For example, examples are capable of selecting a pitch lag for an information signal, e.g. audio signal, e.g., for performing LTPF.
Transform-based audio codecs generally introduce inter-harmonic noise when processing harmonic audio signals, particularly at low delay and low bitrate. This inter-harmonic noise is generally perceived as a very annoying artefact, significantly reducing the performance of the transform-based audio codec when subjectively evaluated on highly tonal audio material.
Long Term Post Filtering (LTPF) is a tool for transform-based audio coding that helps at reducing this inter-harmonic noise. It relies on a post-filter that is applied on the time-domain signal after transform decoding. This post-filter is essentially an infinite impulse response (IIR) filter with a comb-like frequency response controlled by two parameters: a pitch lag and a gain.
For better robustness, the post-filter parameters (a pitch lag and/or a gain per frame) are estimated at the encoder-side and encoded in a bitstream when the gain is non-zero. The case of the zero gain is signalled with one bit and corresponds to an inactive post-filter, used when the signal does not contain a harmonic part.
LTPF was first introduced in the 3GPP EVS standard [1] and later integrated to the MPEG-H 3D-audio standard [2]. Corresponding patents are [3] and [4].
A pitch detection algorithm estimates one pitch lag per frame. It is usually performed at a low sampling rate (e.g. 6.4 kHz) in order to reduce the complexity. It should ideally provide an accurate, stable and continuous estimation.
When used for LTPF encoding, it is most important to have a continuous pitch contour, otherwise some instability artefacts could be heard in the LTPF filtered output signal. Not having a true fundamental frequency F0 (for example by having a multiple of it) is of less importance, because it does not result in severe artefacts but instead results in a slight degradation of the LTPF performance.
Another important characteristic of a pitch detection algorithm is its computational complexity. When implemented in an audio codec targeting low power devices or even ultra-low power devices, its computational complexity should be as low as possible.
There is an example of a LTPF encoder that can be found in the public domain. It is described in the 3GPP EVS standard [1]. This implementation is using a pitch detection algorithm described in Sec. 5.1.10 of the standard specifications. This pitch detection algorithm has a good performance and works nicely with LTPF because it gives a very stable and continuous pitch contour. Its main drawback is however its relatively high complexity.
Even though they were never used for LTPF encoding, other existing pitch detection algorithms could in theory be used for LTPF. One example is YIN [6], a pitch detection algorithm often recognized as one of the most accurate. YIN is however very complex, even significantly more than the one in [1].
Another example worth mentioning is the pitch detection algorithm used in the 3GPP AMR-WB standard [7], which has a significantly lower complexity than the one in [1], but also worse performance, it particularly gives a less stable and continuous pitch contour. Conventional technology comprises the following disclosures:
[1] 3GPP TS 26.445; Codec for Enhanced Voice Services (EVS); Detailed algorithmic description.
[2] ISO/IEC 23008-3:2015; Information technology—High efficiency coding and media delivery in heterogeneous environments—Part 3: 3D audio.
[3] Ravelli et al. “Apparatus and method for processing an audio signal using a harmonic post-filter.” U.S. Patent Application No. 2017/0140769 A1. 18 May 2017.
[4] Markovic et al. “Harmonicity-dependent controlling of a harmonic filter tool.” U.S. Patent Application No. 2017/0133029 A1. 11 May 2017.
[5] ITU-T G.718: Frame error robust narrow-band and wideband embedded variable bit-rate coding of speech and audio from 8-32 kbit/s.
[6] De Cheveigné, Alain, and Hideki Kawahara. “YIN, a fundamental frequency estimator for speech and music.” The Journal of the Acoustical Society of America 111.4 (2002): 1917-1930.
[7] 3GPP TS 26.190; Speech codec speech processing functions; Adaptive Multi-Rate-Wideband (AMR-WB) speech codec; Transcoding functions.
There are some cases, however, for which the pitch lag estimation should be ameliorated. Current low complexity pitch detection algorithms (like the one in [7]) have a performance which is not satisfactory for LTPF, particularly for complex signals, like polyphonic music. The pitch contour can be very unstable, even during stationary tones. This is due to jumps between the local maxima of the weighted autocorrelation function.
Therefore, there is the need of obtaining pitch lag estimations which better adapt to complex signals, with the same or lower complexity than conventional technology.
According to an embodiment, an apparatus for encoding an information signal including a plurality of frames may have: a first estimator configured to obtain a first estimate, the first estimate being an estimate of a pitch lag for a current frame, wherein the first estimate is obtained as the lag that maximizes a first correlation function associated to the current frame; a second estimator configured to obtain a second estimate, the second estimate being another estimate of a pitch lag for the current frame, wherein the second estimator is conditioned by the pitch lag selected at the previous frame so as to obtain the second estimate for the current frame, wherein the second estimator is configured to obtain the second estimate by searching the lag which maximizes a second correlation function in a second subinterval which contains the pitch lag selected for the previous frame, a selector configured to choose a selected value by performing a selection between the first estimate and the second estimate on the basis of a first and a second correlation measurements, wherein the selector is configured to perform a comparison between: a downscaled version of a first normalized autocorrelation measurement associated to the current frame and obtained at a lag corresponding to the first estimate; and a second normalized autocorrelation measurement associated to the current frame and obtained at a lag corresponding to the second estimate, so as to select the first estimate when the second normalized autocorrelation measurement is less than the downscaled version of the first normalized autocorrelation measurement, and/or to select the second estimate when the second normalized autocorrelation measurement is greater than the downscaled version of the first normalized autocorrelation measurement.
According to another embodiment, a system may have an encoder side and a decoder side, the encoder side including the inventive apparatus, the decoder side including a long term postfiltering tool controlled on the basis of the pitch lag estimate selected by the selector.
According to another embodiment, a method for determining a pitch lag for a signal divided into frames may have the steps of: performing a first estimation for a current frame to obtain first estimate as the lag that maximizes a first correlation function associated to the current frame; performing a second estimation for the current frame obtained by searching for the lag which maximizes a second correlation function in a second subinterval which contains the pitch lag selected for the previous frame, wherein performing the second estimation is obtained on the basis of the result of a selecting step performed at the previous frame; and selecting between the first estimate obtained at the first estimation and the second estimate obtained at the second estimation on the basis of a first and a second normalized autocorrelation measurements, wherein selecting includes performing a comparison between: a downscaled version of the first normalized autocorrelation measurement, associated to the current frame and obtained at a lag corresponding to the first estimate; the second normalized autocorrelation measurement, associated to the current frame and obtained at a lag corresponding to the second estimate; and selecting the first estimate when the second normalized autocorrelation measurement is less than the downscaled version of the first normalized autocorrelation measurement, and/or selecting the second estimate when the second normalized autocorrelation measurement is greater than the downscaled version of the first normalized autocorrelation measurement.
According to another embodiment, a method for encoding a bitstream for a signal divided into frames may have the steps of: performing the inventive method for determining a pitch lag; and encoding data useful for performing LTPF at the decoder, the data useful for performing LTPF including the selected value.
Another embodiment may have non-transitory digital storage medium having a computer program stored thereon to perform any of the inventive methods when said computer program is run by a computer.
In accordance to examples, there is provided an apparatus for encoding an information signal including a plurality of frames, the apparatus comprising:
characterized in that the selector is configured to:
In accordance to examples, there is provided an apparatus for encoding an information signal into a bitstream (63) including a plurality of frames, the apparatus (60a) comprising:
In accordance to examples, there is provided an apparatus for encoding an information signal including a plurality of frames, the apparatus comprising:
In accordance to examples, the selector is configured to perform a comparison between:
In accordance to examples, the selector is configured to perform a comparison between:
In accordance to examples, the selector is configured to:
so as to select the first estimate when the second correlation measurement is less than the downscaled version of the first correlation measurement, and/or
to select the second estimate when the second correlation measurement is greater than the downscaled version of the first correlation measurement.
In accordance to examples, at least one of the first and second correlation measurement is an autocorrelation measurement and/or a normalized autocorrelation measurement.
A transform coder to generate a representation of the information signal or a processed version thereof may be implemented.
In accordance to examples, the second estimator is configured to:
In accordance to examples, the second subinterval contains lags within a distance less than a pre-defined lag number threshold from the pitch lag selected for the previous frame.
In accordance to examples, the second estimator is configured to:
In accordance to examples, the first estimator is configured to:
In accordance to examples, the first correlation function is restricted to lags in a first subinterval.
In accordance to examples, the first subinterval contains a number of lags greater than the second subinterval, and/or at least some of the lags in the second subinterval are comprised in the first subinterval.
In accordance to examples, the first estimator) is configured to:
In accordance to examples, at least one of the second and first correlation function is an autocorrelation function and/or a normalized autocorrelation function.
In accordance to examples, the first estimator is configured to obtain the first estimate T1 by performing at least some of the following operations:
w(k) being a weighting function, kmin and kmax being associated to a minimum lag and a maximum lag, R being an autocorrelation measurement value estimated on the basis of the information signal or a processed version thereof and N being the frame length.
In accordance to examples, the second estimator is configured to obtain the second estimate T2 by performing:
with k′min=max (kmin, Tprev−δ), k′max=min (kmax, Tprev+δ), Tprev being the selected estimate in the preceding frame, and δ is a distance from Tprev, kmin and kmax being associated to a minimum lag and a maximum lag.
In accordance to examples, the selector is configured to perform a selection of the pitch lag estimate Tcurr in terms of
with T1 being the first estimate, T2 being the second estimate, x being a value of the information signal or a processed version thereof, normcorr(x, N, T) being the normalized correlation measurement of the signal x of length N at lag T, α being a downscaling coefficient.
In accordance to examples, there is provided, downstream to the selector, a long term postfiltering, LTPF, tool for controlling a long term postfilter at a decoder apparatus.
In accordance to examples, the information signal is an audio signal.
In accordance to examples, the apparatus is configured to obtain the first correlation measurement as a measurement of harmonicity of the current frame and the second correlation measurement as a measurement of harmonicity of the current frame restricted to a subinterval defined for the previous frame.
In accordance to examples, the apparatus is configured to obtain the first and second correlation measurements using the same correlation function up to a weighting function.
In accordance to examples, the apparatus is configured to obtain the first correlation measurement as the normalized version of the first estimate up to a weighting function.
In accordance to examples, the apparatus is configured to obtain the second correlation measurement as the normalized version of the second estimate.
In accordance to examples, there is provided a system comprising an encoder side and a decoder side, the encoder side being as above, the decoder side comprising a long term postfiltering tool controlled on the basis of the pitch lag estimate selected by the selector.
In accordance to examples, there is provided a method for determining a pitch lag for a signal divided into frames, comprising:
In accordance to examples, the method may comprise using the selected lag for long term postfiltering, LTPF.
In accordance to examples, the method may comprise using the selected lag for packet lost concealment, PLC.
In accordance to examples, there is provided a method for determining a pitch lag for a signal divided into frames, comprising:
characterized in that selecting includes performing a comparison between:
wherein at least one of the first and second correlation measurement is an autocorrelation measurement and/or a normalized autocorrelation measurement.
In accordance to examples, there is provided a method for encoding a bitstream for a signal divided into frames, comprising:
wherein selecting includes performing a comparison between:
the method further comprising encoding data useful for performing LTPF at the decoder the selected value.
In accordance to examples, there is provided a program comprising instructions which, when executed by a processor, cause the processor to perform any of the methods above or below.
Embodiments of the present invention will be detailed subsequently referring to the appended drawings, in which:
a-5d show a diagrams of correlation functions.
Examples of low-complexity pitch detection procedures, systems, and apparatus, e.g., for LTPF encoding and/or decoding, are disclosed.
An information signal may be described in the time domain, TD, as a succession of samples (e.g., x(n)) acquired at different discrete time instants (n). The TD representation may comprise a plurality of frames, each associated to a plurality of samples. The frames may be seen in a sequence one after the other one, so that a current frame is temporally before a subsequent frame and is temporally after a previous frame. It is possible to operate iteratively, so that operations performed on the previous frame are repeated for the current frame.
During an iteration associated to a current frame, it is possible to perform at least for some operations (e.g., a second estimate) which are conditioned by the selection performed at the previous iteration associated to the previous frame. Therefore, the history of the signal at the previous frame is taken into account, e.g., for selecting the pitch lag to be used by the decoder for performing long term postfiltering (LTPF).
The final estimate (selected value) 19 may also be input to a register 19′ and be used, when performing an iteration on the subsequent frame, as an input 19″ (Tprev) to the second estimator 12 regarding a previously operated selection. For each frame 13, the second estimator 12 obtains the second estimate 16 on the basis of the previously final estimate 19″ for the previous frame.
Subsequently, at step S104, the frames are updated: the frame that was the “current frame” becomes the “previous frame”, while a new (subsequent) frame becomes the new “current frame”. After the update, the method may be iterated.
Operations of the first estimator 11 which may be used, in examples, for providing a first estimate 14 on the basis of the current frame 13 are here discussed. The method 30 is shown in
An input signal x(n) at sampling rate F is resampled to a lower sampling rate F1 (e.g. F1=12.8 kHz). The resampling can be implemented using e.g. a classic upsampling+low-pass+downsampling approach. The present step is optional in some examples.
The resampled signal is then high-pass filtered using e.g. a 2-order IIR filter with 3 dB-cutoff at 50 Hz. The resulting signal is noted x1(n). The present step is optional in some examples.
The signal x1 (n) is further downsampled by a factor of 2 using e.g. a 4-order FIR low-pass filter followed by a decimator. The resulting signal at sampling rate F2=F1/2 (e.g. F2=6.4 kHz) is noted x2 (n). The present step is optional in some examples.
An autocorrelation process may be performed. For example, an autocorrelation may be processed on x2 (n) by
with N is the frame size. Tmin and Tmax are the minimum and maximum values for retrieving the pitch lag (e.g. Tmin=32 and Tmax=228). Tmin and Tmax may therefore constitute the extremities of a first interval where the first estimate (pitch lag of the current frame) is to be found.
The autocorrelation may be weighted in order to emphasize the lower pitch lags
Rw(T)=R(T)w(T), T=Tmin, . . . , Tmax
with w(T) is a decreasing function (e.g., a monotonically decreasing function), given e.g. by
The first estimate T1 is the value that maximizes the weighted autocorrelation:
The first estimate T1 may be provided as output 14 of the first estimator 11. This may be an estimate of pitch lag for the present frame.
R (T) (or its weighted version Rw(T)) is an example of a first correlation function whose maximum value is associated to the first pitch lag estimate 14 (T1).
Operations of the second estimator 12 (and/or step S102) which may be used, in examples, for providing a second estimate 16 on the basis of the current frame 13 and the previously selected (output) estimate 19″ (pitch lag obtained for the previous frame) are here discussed. The method 40 is shown in
With reference to
According to examples, at step S42, autocorrelation values within the subinterval 52 are calculated, e.g., by the second measurer 22.
According to examples, at step S42, the maximum value among the results of the autocorrelation is retrieved. The second estimate T2 is the value that maximizes the autocorrelation in the neighborhood of the pitch lag of the current frame among the lags within the second subinterval centered in the previously selected value 19″, e.g.:
where Tprev is the final pitch lag 51 (19″) as previously selected (by the selector 17) and δ the constant (e.g. δ=4) which defines the subinterval 52. The value T2 may be provided as output 16 of the second estimator 12.
Notably, the first estimate 14 and the second estimate 16 may be significantly different from each other.
R (T) (whose domain is here restricted between Tprev−δ and Tprev+δ) is an example of a second correlation function whose maximum value is associated to the second pitch lag estimate 16 (T2).
The first measurer 21 and/or the second measurer 22 may perform correlation measurements. The first measurer 21 and/or the second measurer 22 may perform autocorrelation measurements. The correlation and/or autocorrelation measurements may be normalized. An example, is here provided. normcorr(T) may be the normalized correlation of the signal x at pitch lag T
Therefore, the first correlation measurement 23 may be normcorr(T1), where T1 is the first estimate 14, and the second correlation measurement 25 may be normcorr(T2), where T2 is the second estimate 16.
Notably, first correlation measurement 23 is the normalized value of R(T1) (or Rw(T1)), while the second correlation measurement 25 is the normalized value of R(T2).
It is now possible to give an example of how to compare the correlation for performing the selection. As example is provided by the following formula:
αnormcorr(T1) may be seen as a pitch lag selection threshold 24: if normcorr(T2)≤αnormcorr(T1), the selector chooses T1, otherwise the selector chooses T2. The value Tbest (or an information associated thereto) may be therefore the selected output value 19 (as either T1 or T2) and provided to the decoder (e.g., for LTPF) and that will be used, as 19″, by the second estimator 12 for obtaining the second estimate 16.
The method 40, associated to the method 30, increases the performances with respect to a technique only based on the method 30.
With small additional complexity, it is possible to significantly improve the performance by making the pitch contour more stable and continuous.
The method 40 finds a second maximum for the autocorrelation function. It is not the global maximum like in the method 30, but a local maximum in the neighbourhood of the pitch lag of the previous frame. This second pitch lag, if selected, produces a smooth and continuous pitch contour. We however don't select this second pitch lag in all cases. If there is an expected change in the fundamental frequency for example, it is better to keep the global maximum.
The final selection is whether to select the first pitch lag T1 (14) found with method 30 or the second pitch lag T2 (16) found with method 40. This decision is based on a measure of periodicity. We choose the normalized correlation as measure of periodicity. It is 1 if the signal is perfectly periodic and 0 if it is aperiodic. The second pitch lag T2 is then chosen if its corresponding normalized correlation is higher than the normalized correlation of the first pitch lag T1, scaled by a parameter α. This parameter α<1 makes the decision even smoother by selecting T2 (16) even when its normalized correlation is slightly below the normalized correlation of the first pitch lag T1 ( 14 ).
Reference is made to
An example of first estimation is shown in
It is based on the fact that the auto-correlation of a harmonic signal (with some given pitch) contains peaks at the position of the pitch-lag and all multiples of this pitch-lag.
To avoid selecting a peak corresponding to a multiple of the pitch-lag, the auto-correlation function is weighted, as in
The global maximum of the weighted autocorrelation is then assumed to correspond to the pitch-lag of the signal.
In general, the first estimation taken alone works satisfactorily: it gives the correct pitch in the great majority of frames.
The first estimation has also the advantage of a relatively low complexity if the number of lags of the autocorrelation function (first subinterval) is relatively low.
There are five peaks: the first peak 53 corresponds to the pitch-lag, and the other ones correspond to multiples 53′ of this pitch-lag.
Taking the global maximum of the (non-weighted) autocorrelation would give in this case the wrong pitch-lag: it would choose a multiple of it, in this case 4 times the correct pitch-lag.
However, the global maximum of the weighted autocorrelation (
The first estimation works in several cases. However, there are some cases where it produces an unstable estimate.
One of this cases is a polyphonic music signal which contains a mix of several tones with different pitches. In this case, it is difficult to extract a single pitch from a multi-pitch signal. The first estimator 11 could in that case estimate in one frame the pitch of one of the tones (or even maybe a multiple of it), and in the next frame possibly the pitch of another tone (or a multiple of it). So even if the signal is stable (the pitch of the different tones does not change from one frame to the next), the pitch detected by the first estimation can be unstable (the pitch changes significantly from one frame to the next).
This unstable behaviour is a major problem for LTPF. When the pitch is used for LTPF, it is most important to have a continuous pitch contour, otherwise some artefacts could be heard in the LTPF filtered output signal.
In this case, the first three peaks 54′, 54″, and 54′″ have a very close amplitude. So very slight changes between the two consecutive frames can significantly change the global maximum and the estimated pitch-lag.
The solution adopted in the present invention solves these instability problems.
The present solution selects, besides the pitch lag associated to the peak in the frame, a pitch-lag which is close to the pitch-lag of the previous frame.
For example,
To do so, a second estimation is performed (e.g., by the second estimator 12) by estimating a second pitch-lag T2 which maximizes the autocorrelation function around a subinterval 52 the pitch-lag of the previous frame (Tprev−δ, Tprev+δ). In the case of
However, we don't want to select in all cases this second pitch-lag T2. We want to select either the first pitch-lag T1 or the second pitch-lag T2 based on some criteria. This criteria is based on the normalized correlation (NC), e.g., as measured by the selector 17, which is generally considered a good measure of how periodic is a signal at some particular pitch-lag (a NC of 0 means not periodic at all, a NC of 1 means perfectly periodic).
There are then several cases:
the NC of both estimates T1 and T2 are close and we may choose in that case the estimate which produces a stable decision (i.e., the second estimate T2) even if it has slightly worse NC. The parameter α (α<1) is used for that case: it allows selecting the second estimate T2 even if it has slightly lower NC. The tuning of this parameter α allows us to bias the selection towards the first estimate T1 or the second estimate T2: a lower value means the second estimate would be selected more often (=the decision would be more stable). 0.85 (or a value between 0.8 and 0.9) is a good trade-off: it selects the second estimate T2 often enough so that the decision is stable enough for LTPF.
The additional steps provided on top of the first estimation (second estimation and selection) have a very low complexity. Therefore, the proposed invention has low complexity.
The encoder 60a may generate, using a transform coder 62, a frequency domain representation 63a (or a processed version thereof) of the information signal 61 and provide it to the decoder 60b in the bitstream 63. The decoder 60b may comprise a transform decoder for obtaining outputs signal 64a.
The encoder 60a may generate, using a detection unit 65, data useful for performing LTPF at the decoder 60b. These data may comprise a pitch lag estimate (e.g., 19) and/or a gain information. These data may be encoded in the bitstream 63 as data 63b in control fields. The data 63b (which may comprise the final estimate 19 of the pitch lag) may be prepared by a LTPF coder 66 (which, in some examples, may decide whether to encode the data 63b). These data may be used by an LTPF decoder 67 which may apply them to the output signal 64a from the transform decoder 64 to obtain the outputs signal 68.
Examples of the calculations of the LTPF parameters (or other types of parameters) are here provided.
An example of preparing the information for the LTPF is provided in the next subsections.
An example of (optional) resampling technique is here discussed (other techniques may be used).
The input signal at sampling rate fs may be resampled to a fixed sampling rate of 12.8 kHz. The resampling is performed using an upsampling+low-pass-filtering+downsampling approach that can be formulated as follows
with └ ┘ indicating a trucked value (rounded to the integer below), x(n) is the input signal, x12.8(n) is the resampled signal at 12.8 kHz,
is the upsampling factor and h6.4 is the impulse response of a FIR low-pass filter given by
An example, of tab_resamp_filter is provided in the following table:
An example of (optional) high-pass filter technique is here discussed (other techniques may be used).
The resampled signal may be high-pass filtered using a 2-order IIR filter whose transfer function may be given by
An example of pitch detection technique is here discussed (other techniques may be used).
The signal x12.8(n) may be (optionally) downsampled by a factor of 2 using
with h2={0.1236796411180537, 0.2353512128364889, 0.2819382920909148, 0.2353512128364889, 0.1236796411180537}.
The autocorrelation of x6.4(n) may be computed by
with kmin=17 and kmax=114 are the minimum and maximum lags which define the first subinterval (other values for kmin and kmax may be provided).
The autocorrelation may be weighted using
R6.4w(k)=R6.4(k)w(k) for k=kmin . . . kmax
with w(k) is defined as follows
The first estimate 14 of the pitch lag T1 may be the lag that maximizes the weighted autocorrelation
The second estimate 16 of the pitch lag T2 may be the lag that maximizes the non-weighted autocorrelation in the neighborhood of the pitch lag (19″) estimated in the previous frame
with k′min=max (kmin, Tprev−4), k′max=min (kmax, Tprev+4) and Tprev is the final pitch lag estimated in the previous frame (and its selection therefore conditioned by the previously selected pitch lag).
The final estimate 19 of the pitch lag in the current frame 13 may then be given by
with normcorr(x, L, T) is the normalized correlation of the signal x of length L at lag T
Each normalized correlation 23 or 25 may be at least one of the measurements obtained by the signal first or second measurer 21 or 22.
In some examples, the first bit of the LTPF bitstream signals the presence of the pitch-lag parameter in the bitstream. It is obtained by
(Instead of 0.6, a different threshold, e.g., between 0.4 and 0.8, or 0.5 and 0.7, or 0.55 and 0.65 could be used, for example.)
If pitch_present is 0, no more bits are encoded, resulting in a LTPF bitstream of only one bit.
If pitch_present is 1, two more parameters are encoded, one pitch-lag parameter encoded on 9 bits, and one bit to signal the activation of LTPF. In that case, the LTPF bitstream is composed by 11 bits.
An example for obtaining an LTPF pitch lag parameters is here discussed (other techniques may be used).
The integer part of the LTPF pitch lag parameter may be given by
The fractional part of the LTPF pitch lag may then be given by
and h4 is the impulse response of a FIR low-pass filter given by
tab_ltpf_interp_R may be, for example:
If pitch_fr<0 then both pitch_int and pitch_fr are modified according to
pitch_int=pitch_int−1
pitch_fr=pitch_fr+4
Finally, the pitch lag parameter index is given by
A normalized correlation is first computed as follows
and hi is the impulse response of a FIR low-pass filter given by
with tab_ltpf_interp_x12k8 is given by:
The LTPF activation bit is then set according to:
with mem_ltpf_active is the value of ltpf_active in the previous frame (it is 0 if pitch_present=0 in the previous frame), mem_nc is the value of nc in the previous frame (it is 0 if pitch_present=0 in the previous frame), pitch=pitch_int+pitch_fr/4 and mem_pitch is the value of pitch in the previous frame (it is 0 if pitch_present=0 in the previous frame).
The decoded signal in the frequency domain (FD), e.g., after MDCT (Modified Discrete Cosine Transformation) synthesis, MDST (Modified Discrete Sine Transformation) synthesis, or a synthesis based on another transformation, may be postfiltered in the time-domain using a IIR filter whose parameters may depend on LTPF bitstream data “pitch_index” and “ltpf_active”. To avoid discontinuity when the parameters change from one frame to the next, a transition mechanism may be applied on the first quarter of the current frame.
In examples, an LTPF IIR filter can be implemented using
where {circumflex over (x)}(n) is the filter input signal (i.e. the decoded signal after MDCT synthesis) and (n) is the filter output signal.
The integer part pint and the fractional part pfr of the LTPF pitch lag may be computed as follows. First the pitch lag at 12.8 kHz is recovered using
The pitch lag may then be scaled to the output sampling rate fs and converted to integer and fractional parts using
where fs is the sampling rate.
The filter coefficients cnum(k) and cden (k, pfr) may be computed as follows
and gain_ltpf and gain_ind may be obtained according to
and the tables tab_ltpf_num_fs[gain_ind] [k] and tab_ltpf_den_fs[pfr] [k] are predetermined.
Examples of tab_ltpf num_fs[gain_ind] [k] are here provided (instead of “fs”, the sampling rate is indicated):
Examples of tab_ltpf_den_fs[pfr][k] are here provided (instead of “fs”, the sampling rate is indicated):
With reference to the transition handling, five different cases are considered.
First case: ltpf_active=0 and mem_ltpf_active=0
Second case: ltpf_active=1 and mem_ltpf_active=0
Third case: ltpf_active=0 and mem_ltpf_active=1
with cnummem, cdenmem, pintmem and pfrmem are the filter parameters computed in the previous frame.
Fourth case: ltpf_active=1 and mem_ltpf active=1 and pint=pintmem and pfr=pfrmem
Fifth case: ltpf_active=1 and mem_ltpf_active=1 and (pint≠pintmem or pfr≠pfrmem
with Nf being the number of samples in one frame.
As may be understood, the solution according to the examples above are transparent to the decoder. There is no need for signalling to the decoder, for example, that the first estimate or the second estimate has been selected.
Accordingly, there is no increased payload in the bitstream 63.
Further, there is no need for modifying the decoders to adapt to the new processed performed at the encoder. The decoder does not need to know that the present invention has been implemented. Therefore, the invention permits to increase the compatibility with the legacy systems.
The pitch lag Tbest (19) as obtained by the apparatus 10, 60a, or 110 above may be used, at the decoder (e.g., 60b) for implementing a packet loss concealment (PLC) (also known as error concealment). PLC is used in audio codecs to conceal lost or corrupted packets during the transmission from the encoder to the decoder. In conventional technology, PLC may be performed at the decoder side and extrapolate the decoded signal either in the transform-domain or in the time-domain.
The pitch lag may be the main parameter used in pitch-based PLC. This parameter can be estimated at the encoder-side and encoded into the bitstream. In this case, the pitch lag of the last good frames are used to conceal the current lost frame.
A corrupted frame does not provide a correct audible output and shall be discarded.
For each decoded frame at the decoder, its validity may be verified. For example, each frame may have a field carrying a cyclical redundancy code (CRC) which is verified by performing predetermined operations provided by a predetermined algorithm. The procedure may be repeated to verify whether the calculated result corresponds to the value on the CRC field. If a frame has not been properly decoded (e.g., in view of interference in the transmission), it is assumed that some errors have affected the frame. Therefore, if the verification provides a result of incorrect decoding, the frame is held non-properly decoded (invalid, corrupted).
When a frame is acknowledged as non-properly decoded, a concealment strategy may be used to provide an audible output: otherwise, something like an annoying audible hole could be heard. Therefore, it is needed to find some form of frame which “fills the gap” kept open by the non-properly decoded frame. The purpose of the frame loss concealment procedure is to conceal the effect of any unavailable or corrupted frame for decoding.
A frame loss concealment procedure may comprise concealment methods for the various signal types. Best possible codec performance in error-prone situations with frame losses may be obtained through selecting the most suitable method. One of the packet loss concealment methods may be, for example, TCX Time Domain Concealment.
The TCX Time Domain Concealment method is a pitch-based PLC technique operating in the time domain. It is best suited for signals with a dominant harmonic structure. An example of the procedure is as follow: the synthesized signal of the last decoded frames is inverse filtered with the LP filter as described in Section 8.2.1 to obtain the periodic signal as described in Section 8.2.2. The random signal is generated by a random generator with approximately uniform distribution in Section 8.2.3. The two excitation signals are summed up to form the total excitation signal as described in Section 8.2.4, which is adaptively faded out with the attenuation factor described in Section 8.2.6 and finally filtered with the LP filter to obtain the synthesized concealed time signal. If LTPF has been used in the last good frame, the LTPF may also be applied on the synthesized concealed time signal as described in Section 8.3. To get a proper overlap with the first good frame after a lost frame, the time domain alias cancelation signal is generated in Section 8.2.5.
The TCX Time Domain Concealment method is operating in the excitation domain. An autocorrelation function may be calculated on 80 equidistant frequency domain bands. Energy is pre-emphasized with the fixed pre-emphasis factor μ
The autocorrelation function is lag windowed using the following window
before it is transformed to time domain using an inverse evenly stacked DFT. Finally a Levinson Durbin operation may be used to obtain the LP filter, ac(k), for the concealed frame. An example is provided below:
The LP filter may be calculated only in the first lost frame after a good frame and remains in subsequently lost frames.
The last
decoded time samples are first pre-emphasized with the pre-emphasis factor from Section 8.2.1 using the filter
H
pre-emph(z)=1−μ−1
to obtain the signal xpre(k), where Tc is the pitch lag value pitch_int or pitch_int+1 if pitch_fr>0. The values pitch_int and pitch_fr are the pitch lag values transmitted in the bitstream.
The pre-emphasized signal, xprev(k), is further filtered with the calculated inverse LP filter to obtain the prior excitation signal exc′p(k). To construct the excitation signal, excp(k), for the current lost frame, exc′p(k) is repeatedly copied with Tc as follows
excp(k)=exc′p(E−Tc+k), for k=0 . . . N−1
where E corresponds to the last sample in exc′p(k). If the stability factor θ is lower than 1, the first pitch cycle of exc′p(k) is first low pass filtered with an 11-tap linear phase FIR (finite impulse response) filter described in the table below
The gain of pitch, g′p, may be calculated as follows
If pitch_fr=0 then gp=g′p. Otherwise, a second gain of pitch, g″p, may be calculated as follows
and gp=max (g′p, g″p). If g″p>g′p then Tc is reduced by one for further processing. Finally, gp is bounded by 0≤gp≤1.
The formed periodic excitation, excp(k), is attenuated sample-by-sample throughout the frame starting with one and ending with an attenuation factor, α, to obtain
(k). The gain of pitch is calculated only in the first lost frame after a good frame and is set to a for further consecutive frame losses.
The random part of the excitation may be generated with a random generator with approximately uniform distribution as follows
excn,FB(k)=extract(excn,FB(k−1)·12821+16831), for k=0 . . . N−1
where excn,FB(−1) is initialized with 24607 for the very first frame concealed with this method and extract( )extracts the 16 LSB of the value. For further frames, excn,FB(−1) is stored and used as next excn,FB(−1).
To shift the noise more to higher frequencies, the excitation signal is high pass filtered with an 11-tap linear phase FIR filter described in the table below to get excn,HP(k).
To ensure that the noise may fade to full band noise with the fading speed dependently on the attenuation factor a, the random part of the excitation, excn(k), is composed via a linear interpolation between the full band, excn,FB(k), and the high pass filtered version, excn,HP(k), as
excn(k)=(1−β)·excn,FB(k)+β·excn,HP(k), for k=0 . . . N−1
where β=1 for the first lost frame after a good frame and
β=β_1·α
for the second and further consecutive frame losses, where β_1 is β of the previous concealed frame.
For adjusting the noise level, the gain of noise, g′n, is calculated as
If Tc=pitch_int after Section 8.2.2, then gn=g′n. Otherwise, a second gain of noise, g″n, is calculated as in the equation above, but with Tc being pitch_int. Following, gn=min (g′n, g″n).
For further processing, gn is first normalized and then multiplied by (1.1−0.75 gp) to get .
The formed random excitation, excn(k), is attenuated uniformly with , from the first sample to sample five and following sample-by-sample throughout the frame starting with and ending with ·α to obtain (k). The gain of noise, gn, is calculated only in the first lost frame after a good frame and is set to gn·α for further consecutive frame losses.
The random excitation, (k), is added to the periodic excitation, (k), to form the total excitation signal exct(k). The final synthesized signal for the concealed frame is obtained by filtering the total excitation with the LP filter from Section 8.2.1 and post-processed with the de-emphasis filter.
To get a proper overlap-add in the case the next frame is a good frame, the time domain alias cancelation part, xTDAC(k), may be generated. For that, N−Z additional samples are created the same as described above to obtain the signal x(k) for k=0 . . . 2N−Z. On that, the time domain alias cancelation part is created by the following steps:
Zero filling the synthesized time domain buffer x(k)
Windowing {circumflex over (x)}(k) with the MDCT window wN(k)
(k)=wN(k)·{circumflex over (x)}(k), 0≤k<2N
Reshaping from 2N to N
Reshaping from N to 2N
Windowing ŷ(k) with the flipped MDCT (Modified Discrete Cosine Transformation) (or MDST, Modified Discrete Sine Transformation, in other examples) window wN(k)
x
TDAC(k)=wN(2N−1−k)·{circumflex over (y)}(k), 0≤k<2N
The constructed signal fades out to zero. The fade out speed is controlled by an attenuation factor, α, which is dependent on the previous attenuation factor, α_1, the gain of pitch, gp, calculated on the last correctly received frame, the number of consecutive erased frames, nbLostCmpt, and the stability, θ. The following procedure may be used to compute the attenuation factor, α
The factor θ (stability of the last two adjacent scalefactor vectors scf_2(k) and scf_3(k)) may be obtained, for example, as:
where scf_2(k) and scf_1(k) are the scalefactor vectors of the last two adjacent frames. The factor θ is bounded by 0≤θ<1, with larger values of θ corresponding to more stable signals. This limits energy and spectral envelope fluctuations. If there are no two adjacent scalefactor vectors present, the factor θ is set to 0.8.
To prevent rapid high energy increase, the spectrum is low pass filtered with Xs(0)=Xs(0)·0.2 and Xs(1)=Xs(1)·0.5.
At step S102′, the validity of the frame is checked (for example with CRC, parity, etc.). If the invalidity of the frame is acknowledged, concealment is performed (see below).
Otherwise, if the frame is held valid, at step S103′ it is checked whether pitch information is encoded in the frame. In some examples, the pitch information is encoded only if the harmonicity has been acknowledged as being over a particular threshold (which may indicate, for example, harmonicity sufficiently high for performing LTPF and/or PLC, for example).
If at S103′ it is acknowledged that the pitch information is actually encoded, then the pitch information is decoded and stored at step S104′. Otherwise, the cycle ends and a new frame may be decoded at S101′.
Subsequently, at step S105′, it is checked whether the LTPF is enabled. If it is verified that the LTPF is enabled, then LTPF is performed at step S106. Otherwise, the LTPF is skipped; the cycle ends; and a new frame may be decoded at S101′.
With reference to the concealment, the latter may be subdivided into steps. At step S107′, it is verified whether the pitch information of the previous frame (or a pitch information of one of the previous frames) is stored in the memory (i.e., it is at disposal).
If it is verified that the searched pitch information is stored, then error concealment may be performed at step S108. MDCT (or MDST) frame resolution repetition with signal scrambling, and/or TCX time domain concealment, and/or phase ECU may be performed.
Otherwise, if at S107′ it is verified that no fresh pitch information is stored (as a consequence that the decoder had not transmitted the pitch lag, for example) a different concealment technique, per se known and not implying the use of a pitch information provided by the encoder, may be used at step S109′. Some of these techniques may be based on estimating the pitch information and/or other harmonicity information at the decoder. In some examples, no concealment technique may be performed in this case.
After having performed the concealment, the cycle ends and a new frame may be decoded at S101′.
It is to be noted that the pitch lag used by the PLC is the value 19 (tbest) prepared by the apparatus 10 and/or 60b, on the basis of the selection between the estimations T1 and T2, as discussed above.
In examples, the systems 110 and 120 may be the same device.
Depending on certain implementation requirements, examples may be implemented in hardware. The implementation may be performed using a digital storage medium, for example a floppy disk, a Digital Versatile Disc (DVD), a Blu-Ray Disc, a Compact Disc (CD), a Read-only Memory (ROM), a Programmable Read-only Memory (PROM), an Erasable and Programmable Read-only Memory (EPROM), an Electrically Erasable Programmable Read-Only Memory (EEPROM) or a flash memory, having electronically readable control signals stored thereon, which cooperate (or are capable of cooperating) with a programmable computer system such that the respective method is performed. Therefore, the digital storage medium may be computer readable.
Generally, examples may be implemented as a computer program product with program instructions, the program instructions being operative for performing one of the methods when the computer program product runs on a computer. The program instructions may for example be stored on a machine readable medium.
Other examples comprise the computer program for performing one of the methods described herein, stored on a machine readable carrier. In other words, an example of method is, therefore, a computer program having a program instructions for performing one of the methods described herein, when the computer program runs on a computer.
A further example of the methods is, therefore, a data carrier medium (or a digital storage medium, or a computer-readable medium) comprising, recorded thereon, the computer program for performing one of the methods described herein. The data carrier medium, the digital storage medium or the recorded medium are tangible and/or non-transitionary, rather than signals which are intangible and transitory.
A further example comprises a processing unit, for example a computer, or a programmable logic device performing one of the methods described herein.
A further example comprises a computer having installed thereon the computer program for performing one of the methods described herein.
A further example comprises an apparatus or a system transferring (for example, electronically or optically) a computer program for performing one of the methods described herein to a receiver. The receiver may, for example, be a computer, a mobile device, a memory device or the like. The apparatus or system may, for example, comprise a file server for transferring the computer program to the receiver.
In some examples, a programmable logic device (for example, a field programmable gate array) may be used to perform some or all of the functionalities of the methods described herein. In some examples, a field programmable gate array may cooperate with a microprocessor in order to perform one of the methods described herein. Generally, the methods may be performed by any appropriate hardware apparatus.
While this invention has been described in terms of several advantageous embodiments, there are alterations, permutations, and equivalents which fall within the scope of this invention. It should also be noted that there are many alternative ways of implementing the methods and compositions of the present invention. It is therefore intended that the following appended claims be interpreted as including all such alterations, permutations, and equivalents as fall within the true spirit and scope of the present invention.
Number | Date | Country | Kind |
---|---|---|---|
17201091.0 | Nov 2017 | EP | regional |
This application is a continuation of copending International Application No. PCT/EP2018/080195, filed Nov. 5, 2018, which is incorporated herein by reference in its entirety, and additionally claims priority from European Application No. EP 17201091.0, filed Nov. 10, 2017, which is also incorporated herein by reference in its entirety.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/EP2018/080195 | Nov 2018 | US |
Child | 16869000 | US |