Patent Description:
This application relates to the audio processing field, and in particular, to a delay estimation method and apparatus.

Compared with a mono signal, thanks to directionality and spaciousness, a multi-channel signal (such as a stereo signal) is favored by people. The multi-channel signal includes at least two mono signals. For example, the stereo signal includes two mono signals, namely, a left channel signal and a right channel signal. Encoding the stereo signal may be performing time-domain downmixing processing on the left channel signal and the right channel signal of the stereo signal to obtain two signals, and then encoding the obtained two signals. The two signals are a primary channel signal and a secondary channel signal. The primary channel signal is used to represent information about correlation between the two mono signals of the stereo signal. The secondary channel signal is used to represent information about a difference between the two mono signals of the stereo signal.

A smaller delay between the two mono signals indicates a stronger primary channel signal, higher coding efficiency of the stereo signal, and better encoding and decoding quality. On the contrary, a greater delay between the two mono signals indicates a stronger secondary channel signal, lower coding efficiency of the stereo signal, and worse encoding and decoding quality. To ensure a better effect of a stereo signal obtained through encoding and decoding, the delay between the two mono signals of the stereo signal, namely, an inter-channel time difference (ITD, Inter-channel Time Difference), needs to be estimated. The two mono signals are aligned by performing delay alignment processing is performed based on the estimated inter-channel time difference, and this enhances the primary channel signal.

A typical time-domain delay estimation method includes: performing smoothing processing on a cross-correlation coefficient of a stereo signal of a current frame based on a cross-correlation coefficient of at least one past frame, to obtain a smoothed cross-correlation coefficient, searching the smoothed cross-correlation coefficient for a maximum value, and determining an index value corresponding to the maximum value as an inter-channel time difference of the current frame. A smoothing factor of the current frame is a value obtained through adaptive adjustment based on energy of an input signal or another feature. The cross-correlation coefficient is used to indicate a degree of cross correlation between two mono signals after delays corresponding to different inter-channel time differences are adjusted. The cross-correlation coefficient may also be referred to as a cross-correlation function.

A uniform standard (the smoothing factor of the current frame) is used for an audio coding device, to smooth all cross-correlation values of the current frame. This may cause some cross-correlation values to be excessively smoothed, and/or cause other cross-correlation values to be insufficiently smoothed.

<CIT> discloses a method for determining an inter-channel time difference of a multi-channel audio signal having at least two channels. A determination is made at a number of consecutive time instances, inter-channel correlation based on a cross-correlation function involving at least two different channels of the multi-channel audio signal. Each value of the inter-channel correlation is associated with a corresponding value of the inter-channel time difference. An adaptive inter-channel correlation threshold is adaptively determined based on adaptive smoothing of the inter-channel correlation in time. A current value of the inter-channel correlation is then evaluated in relation to the adaptive inter-channel correlation threshold to determine whether the corresponding current value of the inter-channel time difference is relevant. Based on the result of this evaluation, an updated value of the inter-channel time difference is determined.

<CIT> discloses a method for stereo coding includes: converting a stereo left channel signal and a right channel signal in time domain to frequency domain to form left a channel signal and a right channel signal in frequency domain; down-mixing the left channel signal and the right channel signal in frequency domain to generate a mono-channel down-mix signal and transmitting quantized and coded down-mix signal bits; extracting spatial parameters of the left channel signal and the right channel signal in frequency domain; estimating the group delay and group phase between the stereo left channel and the right channel using the left channel signal and the right channel signal in frequency domain; quantizing and coding the group delay, the group phase and spatial parameters so as to obtain a high quality stereo coding capability in low code-rate.

To resolve a problem that an inter-channel time difference estimated by an audio coding device is inaccurate due to excessive smoothing or insufficient smoothing performed on a cross-correlation value of a cross-correlation coefficient of a current frame by the audio coding device, embodiments of this application provide a delay estimation method and apparatus.

The words "first", "second" and similar words mentioned in this specification do not mean any order, quantity or importance, but are used to distinguish between different components. Likewise, "one", "a/an", or the like is not intended to indicate a quantity limitation either, but is intended to indicate existing at least one. "Connection", "link" or the like is not limited to a physical or mechanical connection, but may include an electrical connection, regardless of a direct connection or an indirect connection.

In this specification, "a plurality of" refers to two or more than two. The term "and/or" describes an association relationship for describing associated objects and represents that three relationships may exist. The character "/" generally indicates an "or" relationship between the associated objects.

<FIG> is a schematic structural diagram of a stereo encoding and decoding system in time domain according to an example embodiment of this application. The stereo encoding and decoding system includes an encoding component <NUM> and a decoding component <NUM>.

The encoding component <NUM> is configured to encode a stereo signal in time domain. Optionally, the encoding component <NUM> may be implemented by using software, may be implemented by using hardware, or may be implemented in a form of a combination of software and hardware. This is not limited in this embodiment.

The encoding a stereo signal in time domain by the encoding component <NUM> includes the following steps:.

The stereo signal is collected by a collection component and sent to the encoding component <NUM>. Optionally, the collection component and the encoding component <NUM> may be disposed in a same device or in different devices.

The preprocessed left channel signal and the preprocessed right channel signal are two signals of the preprocessed stereo signal.

Optionally, the preprocessing includes at least one of high-pass filtering processing, pre-emphasis processing, sampling rate conversion, and channel conversion. This is not limited in this embodiment.

The stereo parameter used for time-domain downmixing processing is used to perform time-domain downmixing processing on the left channel signal obtained after delay alignment processing and the right channel signal obtained after delay alignment processing.

(<NUM>) Perform, based on the stereo parameter used for time-domain downmixing processing, time-domain downmixing processing on the left channel signal and the right channel signal that are obtained after delay alignment processing, to obtain a primary channel signal and a secondary channel signal.

Time-domain downmixing processing is used to obtain the primary channel signal and the secondary channel signal.

After the left channel signal and the right channel signal that are obtained after delay alignment processing are processed by using a time-domain downmixing technology, the primary channel signal (Primary channel, or referred to as a middle channel (Mid channel) signal), and the secondary channel (Secondary channel, or referred to as a side channel (Side channel) signal) are obtained.

The primary channel signal is used to represent information about correlation between channels, and the secondary channel signal is used to represent information about a difference between channels. When the left channel signal and the right channel signal that are obtained after delay alignment processing are aligned in time domain, the secondary channel signal is the weakest, and in this case, the stereo signal has a best effect.

Reference is made to a preprocessed left channel signal L and a preprocessed right channel signal R in an nth frame shown in <FIG>. The preprocessed left channel signal L is located before the preprocessed right channel signal R. In other words, compared with the preprocessed right channel signal R, the preprocessed left channel signal L has a delay, and there is an inter-channel time difference <NUM> between the preprocessed left channel signal L and the preprocessed right channel signal R. In this case, the secondary channel signal is enhanced, the primary channel signal is weakened, and the stereo signal has a relatively poor effect.

The decoding component <NUM> is configured to decode the stereo encoded bitstream generated by the encoding component <NUM> to obtain the stereo signal.

Optionally, the encoding component <NUM> is connected to the decoding component <NUM> wiredly or wirelessly, and the decoding component <NUM> obtains, through the connection, the stereo encoded bitstream generated by the encoding component <NUM>. Alternatively, the encoding component <NUM> stores the generated stereo encoded bitstream into a memory, and the decoding component <NUM> reads the stereo encoded bitstream in the memory.

Optionally, the decoding component <NUM> may be implemented by using software, may be implemented by using hardware, or may be implemented in a form of a combination of software and hardware. This is not limited in this embodiment.

The decoding the stereo encoded bitstream to obtain the stereo signal by the decoding component <NUM> includes the following several steps:.

Optionally, the encoding component <NUM> and the decoding component <NUM> may be disposed in a same device, or may be disposed in different devices. The device may be a mobile terminal that has an audio signal processing function, such as a mobile phone, a tablet computer, a laptop portable computer, a desktop computer, a Bluetooth speaker, a pen recorder, or a wearable device; or may be a network element that has an audio signal processing capability in a core network or a radio network. This is not limited in this embodiment.

For example, referring to <FIG>, an example in which the encoding component <NUM> is disposed in a mobile terminal <NUM>, and the decoding component <NUM> is disposed in a mobile terminal <NUM>. The mobile terminal <NUM> and the mobile terminal <NUM> are independent electronic devices with an audio signal processing capability, and the mobile terminal <NUM> and the mobile terminal <NUM> are connected to each other by using a wireless or wired network is used in this embodiment for description.

Optionally, the mobile terminal <NUM> includes a collection component <NUM>, the encoding component <NUM>, and a channel encoding component <NUM>. The collection component <NUM> is connected to the encoding component <NUM>, and the encoding component <NUM> is connected to the channel encoding component <NUM>.

Optionally, the mobile terminal <NUM> includes an audio playing component <NUM>, the decoding component <NUM>, and a channel decoding component <NUM>. The audio playing component <NUM> is connected to the decoding component <NUM>, and the decoding component <NUM> is connected to the channel encoding component <NUM>.

After collecting the stereo signal by using the collection component <NUM>, the mobile terminal <NUM> encodes the stereo signal by using the encoding component <NUM> to obtain the stereo encoded bitstream. Then, the mobile terminal <NUM> encodes the stereo encoded bitstream by using the channel encoding component <NUM> to obtain a transmit signal.

The mobile terminal <NUM> sends the transmit signal to the mobile terminal <NUM> by using the wireless or wired network.

After receiving the transmit signal, the mobile terminal <NUM> decodes the transmit signal by using the channel decoding component <NUM> to obtain the stereo encoded bitstream, decodes the stereo encoded bitstream by using the decoding component <NUM> to obtain the stereo signal, and plays the stereo signal by using the audio playing component <NUM>.

For example, referring to <FIG>, this embodiment is described by using an example in which the encoding component <NUM> and the decoding component <NUM> are disposed in a same network element <NUM> that has an audio signal processing capability in a core network or a radio network.

Optionally, the network element <NUM> includes a channel decoding component <NUM>, the decoding component <NUM>, the encoding component <NUM>, and a channel encoding component <NUM>. The channel decoding component <NUM> is connected to the decoding component <NUM>, the decoding component <NUM> is connected to the encoding component <NUM>, and the encoding component <NUM> is connected to the channel encoding component <NUM>.

After receiving a transmit signal sent by another device, the channel decoding component <NUM> decodes the transmit signal to obtain a first stereo encoded bitstream, decodes the stereo encoded bitstream by using the decoding component <NUM> to obtain a stereo signal, encodes the stereo signal by using the encoding component <NUM> to obtain a second stereo encoded bitstream, and encodes the second stereo encoded bitstream by using the channel encoding component <NUM> to obtain a transmit signal.

The another device may be a mobile terminal that has an audio signal processing capability, or may be another network element that has an audio signal processing capability. This is not limited in this embodiment.

Optionally, the encoding component <NUM> and the decoding component <NUM> in the network element may transcode a stereo encoded bitstream sent by the mobile terminal.

Optionally, in this embodiment, a device on which the encoding component <NUM> is installed is referred to as an audio coding device. In actual implementation, the audio coding device may also have an audio decoding function. This is not limited in this embodiment.

Optionally, in this embodiment, only the stereo signal is used as an example for description. In this application, the audio coding device may further process a multi-channel signal, where the multi-channel signal includes at least two channel signals.

Several nouns in the embodiments of this application are described below.

A multi-channel signal of a current frame is a frame of multi-channel signals used to estimate a current inter-channel time difference. The multi-channel signal of the current frame includes at least two channel signals. Channel signals of different channels may be collected by using different audio collection components in the audio coding device, or channel signals of different channels may be collected by different audio collection components in another device. The channel signals of different channels are transmitted from a same sound source.

For example, the multi-channel signal of the current frame includes a left channel signal L and a right channel signal R. The left channel signal L is collected by using a left channel audio collection component, the right channel signal R is collected by using a right channel audio collection component, and the left channel signal L and the right channel signal R are from a same sound source.

Referring to <FIG>, an audio coding device is estimating an inter-channel time difference of a multi-channel signal of an nth frame, and the nth frame is the current frame.

A previous frame of the current frame is a first frame that is located before the current frame, for example, if the current frame is the nth frame, the previous frame of the current frame is an (n - <NUM>)th frame.

Optionally, the previous frame of the current frame may also be briefly referred to as the previous frame.

A past frame is located before the current frame in time domain, and the past frame includes the previous frame of the current frame, first two frames of the current frame, first three frames of the current frame, and the like. Referring to <FIG>, if the current frame is the nth frame, the past frame includes: the (n - <NUM>)th frame, the (n - <NUM>)th frame,. , and the first frame.

Optionally, in this application, at least one past frame may be M frames located before the current frame, for example, eight frames located before the current frame.

A next frame is a first frame after the current frame. Referring to <FIG>, if the current frame is the nth frame, the next frame is an (n + <NUM>)th frame.

A frame length is duration of a frame of multi-channel signals. Optionally, the frame length is represented by a quantity of sampling points, for example, a frame length N = <NUM> sampling points.

A cross-correlation coefficient is used to represent a degree of cross correlation between channel signals of different channels in the multi-channel signal of the current frame under different inter-channel time differences. The degree of cross correlation is represented by using a cross-correlation value. For any two channel signals in the multi-channel signal of the current frame, under an inter-channel time difference, if two channel signals obtained after delay adjustment is performed based on the inter-channel time difference are more similar, the degree of cross correlation is stronger, and the cross-correlation value is greater, or if a difference between two channel signals obtained after delay adjustment is performed based on the inter-channel time difference is greater, the degree of cross correlation is weaker, and the cross-correlation value is smaller.

An index value of the cross-correlation coefficient corresponds to an inter-channel time difference, and a cross-correlation value corresponding to each index value of the cross-correlation coefficient represents a degree of cross correlation between two mono signals that are obtained after delay adjustment and that are corresponding to each inter-channel time difference.

Optionally, the cross-correlation coefficient (cross-correlation coefficients) may also be referred to as a group of cross-correlation values or referred to as a cross-correlation function. This is not limited in this application.

Referring to <FIG>, when a cross-correlation coefficient of a channel signal of an ath frame is calculated, cross-correlation values between the left channel signal L and the right channel signal R are separately calculated under different inter-channel time differences.

For example, when the index value of the cross-correlation coefficient is <NUM>, the inter-channel time difference is -N/<NUM> sampling points, and the inter-channel time difference is used to align the left channel signal L and the right channel signal R to obtain the cross-correlation value k0;.

A maximum value in k0 to kN is searched, for example, k3 is maximum. In this case, it indicates that when the inter-channel time difference is (-N/<NUM> + <NUM>) sampling points, the left channel signal L and the right channel signal R are most similar, in other words, the inter-channel time difference is closest to a real inter-channel time difference.

It should be noted that this embodiment is only used to describe a principle that the audio coding device determines the inter-channel time difference by using the cross-correlation coefficient. In actual implementation, the inter-channel time difference may not be determined by using the foregoing method.

<FIG> is a flowchart of a delay estimation method according to an example embodiment of this application. The method includes the following several steps.

Step <NUM>: Determine a cross-correlation coefficient of a multi-channel signal of a current frame.

Step <NUM>: Determine a delay track estimation value of the current frame based on buffered inter-channel time difference information of at least one past frame.

Optionally, the at least one past frame is consecutive in time, and a last frame in the at least one past frame and the current frame are consecutive in time. In other words, the last past frame in the at least one past frame is a previous frame of the current frame. Alternatively, the at least one past frame is spaced by a predetermined quantity of frames in time, and a last past frame in the at least one past frame is spaced by a predetermined quantity of frames from the current frame. Alternatively, the at least one past frame is inconsecutive in time, a quantity of frames spaced between the at least one past frame is not fixed, and a quantity of frames between a last past frame in the at least one past frame and the current frame is not fixed. A value of the predetermined quantity of frames is not limited in this embodiment, for example, two frames.

In this embodiment, a quantity of past frames is not limited. For example, the quantity of past frames is <NUM>, <NUM>, and <NUM>.

The delay track estimation value is used to represent a predicted value of an inter-channel time difference of the current frame. In this embodiment, a delay track is simulated based on the inter-channel time difference information of the at least one past frame, and the delay track estimation value of the current frame is calculated based on the delay track.

Optionally, the inter-channel time difference information of the at least one past frame is an inter-channel time difference of the at least one past frame, or an inter-channel time difference smoothed value of the at least one past frame.

An inter-channel time difference smoothed value of each past frame is determined based on a delay track estimation value of the frame and an inter-channel time difference of the frame.

Step <NUM>: Determine an adaptive window function of the current frame.

Optionally, the adaptive window function is a raised cosine-like window function. The adaptive window function has a function of relatively enlarging a middle part and suppressing an edge part.

Optionally, adaptive window functions corresponding to frames of channel signals are different.

The adaptive window function is represented by using the following formulas:.

loc_weight_win(k) is used to represent the adaptive window function, where k = <NUM>, <NUM>,. , A * L_NCSHIFT_DS; A is a preset constant greater than or equal to <NUM>, for example, A = <NUM>; TRUNC indicates rounding a value, for example, rounding a value of A * L_NCSHIFT_DS/<NUM> in the formula of the adaptive window function; L_NCSHIFT_DS is a maximum value of an absolute value of an inter-channel time difference; win_width is used to represent a raised cosine width parameter of the adaptive window function; and win_bias is used to represent a raised cosine height bias of the adaptive window function.

Optionally, the maximum value of the absolute value of the inter-channel time difference is a preset positive number, and is usually a positive integer greater than zero and less than or equal to a frame length, for example, <NUM>, <NUM>, or <NUM>.

Optionally, a maximum value of the inter-channel time difference or a minimum value of the inter-channel time difference is a preset positive integer, and the maximum value of the absolute value of the inter-channel time difference is obtained by taking an absolute value of the maximum value of the inter-channel time difference, or the maximum value of the absolute value of the inter-channel time difference is obtained by taking an absolute value of the minimum value of the inter-channel time difference.

For example, the maximum value of the inter-channel time difference is <NUM>, the minimum value of the inter-channel time difference is -<NUM>, and the maximum value of the absolute value of the inter-channel time difference is <NUM>, which is obtained by taking an absolute value of the maximum value of the inter-channel time difference and is also obtained by taking an absolute value of the minimum value of the inter-channel time difference.

For another example, the maximum value of the inter-channel time difference is <NUM>, the minimum value of the inter-channel time difference is -<NUM>, and the maximum value of the absolute value of the inter-channel time difference is <NUM>, which is obtained by taking an absolute value of the maximum value of the inter-channel time difference.

For another example, the maximum value of the inter-channel time difference is <NUM>, the minimum value of the inter-channel time difference is -<NUM>, and the maximum value of the absolute value of the inter-channel time difference is <NUM>, which is obtained by taking an absolute value of the minimum value of the inter-channel time difference.

It can be learned from the formula of the adaptive window function that the adaptive window function is a raised cosine-like window with a fixed height on both sides and a convexity in the middle. The adaptive window function includes a constant-weight window and a raised cosine window with a height bias. A weight of the constant-weight window is determined based on the height bias. The adaptive window function is mainly determined by two parameters: the raised cosine width parameter and the raised cosine height bias.

Reference is made to a schematic diagram of an adaptive window function shown in <FIG>. Compared with a wide window <NUM>, a narrow window <NUM> means that a window width of a raised cosine window in the adaptive window function is relatively small, and a difference between a delay track estimation value corresponding to the narrow window <NUM> and an actual inter-channel time difference is relatively small. Compared with the narrow window <NUM>, the wide window <NUM> means that the window width of the raised cosine window in the adaptive window function is relatively large, and a difference between a delay track estimation value corresponding to the wide window <NUM> and the actual inter-channel time difference is relatively large. In other words, the window width of the raised cosine window in the adaptive window function is positively correlated with the difference between the delay track estimation value and the actual inter-channel time difference.

The raised cosine width parameter and the raised cosine height bias of the adaptive window function are related to inter-channel time difference estimation deviation information of a multi-channel signal of each frame. The inter-channel time difference estimation deviation information is used to represent a deviation between a predicted value of an inter-channel time difference and an actual value.

Reference is made to a schematic diagram of a relationship between a raised cosine width parameter and inter-channel time difference estimation deviation information shown in <FIG>. If an upper limit value of the raised cosine width parameter is <NUM>, a value of the inter-channel time difference estimation deviation information corresponding to the upper limit value of the raised cosine width parameter is <NUM>. In this case, the value of the inter-channel time difference estimation deviation information is relatively large, and a window width of a raised cosine window in an adaptive window function is relatively large (refer to the wide window <NUM> in <FIG>). If a lower limit value of the raised cosine width parameter of the adaptive window function is <NUM>, a value of the inter-channel time difference estimation deviation information corresponding to the lower limit value of the raised cosine width parameter is <NUM>. In this case, the value of the inter-channel time difference estimation deviation information is relatively small, and the window width of the raised cosine window in the adaptive window function is relatively small (refer to the narrow window <NUM> in <FIG>).

Reference is made to a schematic diagram of a relationship between a raised cosine height bias and inter-channel time difference estimation deviation information shown in <FIG>. If an upper limit value of the raised cosine height bias is <NUM>, a value of the inter-channel time difference estimation deviation information corresponding to the upper limit value of the raised cosine height bias is <NUM>. In this case, the smoothed inter-channel time difference estimation deviation is relatively large, and a height bias of a raised cosine window in an adaptive window function is relatively large (refer to the wide window <NUM> in <FIG>). If a lower limit value of the raised cosine height bias is <NUM>, a value of the inter-channel time difference estimation deviation information corresponding to the lower limit value of the raised cosine height bias is <NUM>. In this case, the value of the inter-channel time difference estimation deviation information is relatively small, and the height bias of the raised cosine window in the adaptive window function is relatively small (refer to the narrow window <NUM> in <FIG>).

Step <NUM>: Perform weighting on the cross-correlation coefficient based on the delay track estimation value of the current frame and the adaptive window function of the current frame, to obtain a weighted cross-correlation coefficient.

The weighted cross-correlation coefficient may be obtained through calculation by using the following calculation formula: <MAT>.

c_weight(x) is the weighted cross-correlation coefficient; c(x) is the cross-correlation coefficient; loc_weight_win is the adaptive window function of the current frame; TRUNC indicates rounding a value, for example, rounding reg_prv_corr in the formula of the weighted cross-correlation coefficient, and rounding a value of A * L_NCSHIFT_DS/<NUM>; reg_prv_corr is the delay track estimation value of the current frame; and x is an integer greater than or equal to zero and less than or equal to <NUM> * L_NCSHIFT_DS.

The adaptive window function is the raised cosine-like window, and has the function of relatively enlarging a middle part and suppressing an edge part. Therefore, when weighting is performed on the cross-correlation coefficient based on the delay track estimation value of the current frame and the adaptive window function of the current frame, if an index value is closer to the delay track estimation value, a weighting coefficient of a corresponding cross-correlation value is greater, and if the index value is farther from the delay track estimation value, the weighting coefficient of the corresponding cross-correlation value is smaller. The raised cosine width parameter and the raised cosine height bias of the adaptive window function adaptively suppress the cross-correlation value corresponding to the index value, away from the delay track estimation value, in the cross-correlation coefficient.

Step <NUM>: Determine an inter-channel time difference of the current frame based on the weighted cross-correlation coefficient.

The determining an inter-channel time difference of the current frame based on the weighted cross-correlation coefficient includes: searching for a maximum value of the cross-correlation value in the weighted cross-correlation coefficient; and determining the inter-channel time difference of the current frame based on an index value corresponding to the maximum value.

Optionally, the searching for a maximum value of the cross-correlation value in the weighted cross-correlation coefficient includes: comparing a second cross-correlation value with a first cross-correlation value in the cross-correlation coefficient to obtain a maximum value in the first cross-correlation value and the second cross-correlation value; comparing a third cross-correlation value with the maximum value to obtain a maximum value in the third cross-correlation value and the maximum value; and in a cyclic order, comparing an ith cross-correlation value with a maximum value obtained through previous comparison to obtain a maximum value in the ith cross-correlation value and the maximum value obtained through previous comparison. It is assumed that i = i + <NUM>, and the step of comparing an ith cross-correlation value with a maximum value obtained through previous comparison is continuously performed until all cross-correlation values are compared, to obtain a maximum value in the cross-correlation values, where i is an integer greater than <NUM>.

Optionally, the determining the inter-channel time difference of the current frame based on an index value corresponding to the maximum value includes: using a sum of the index value corresponding to the maximum value and the minimum value of the inter-channel time difference as the inter-channel time difference of the current frame.

The cross-correlation coefficient can reflect a degree of cross correlation between two channel signals obtained after a delay is adjusted based on different inter-channel time differences, and there is a correspondence between an index value of the cross-correlation coefficient and an inter-channel time difference. Therefore, an audio coding device can determine the inter-channel time difference of the current frame based on an index value corresponding to a maximum value of the cross-correlation coefficient (with a highest degree of cross correlation).

In conclusion, according to the delay estimation method provided in this embodiment, the inter-channel time difference of the current frame is predicted based on the delay track estimation value of the current frame, and weighting is performed on the cross-correlation coefficient based on the delay track estimation value of the current frame and the adaptive window function of the current frame. The adaptive window function is the raised cosine-like window, and has the function of relatively enlarging the middle part and suppressing the edge part. Therefore, when weighting is performed on the cross-correlation coefficient based on the delay track estimation value of the current frame and the adaptive window function of the current frame, if an index value is closer to the delay track estimation value, a weighting coefficient is greater, avoiding a problem that a first cross-correlation coefficient is excessively smoothed, and if the index value is farther from the delay track estimation value, the weighting coefficient is smaller, avoiding a problem that a second cross-correlation coefficient is insufficiently smoothed. In this way, the adaptive window function adaptively suppresses a cross-correlation value corresponding to the index value, away from the delay track estimation value, in the cross-correlation coefficient, thereby improving accuracy of determining the inter-channel time difference in the weighted cross-correlation coefficient. The first cross-correlation coefficient is a cross-correlation value corresponding to an index value, near the delay track estimation value, in the cross-correlation coefficient, and the second cross-correlation coefficient is a cross-correlation value corresponding to an index value, away from the delay track estimation value, in the cross-correlation coefficient.

Steps <NUM> to <NUM> in the embodiment shown in <FIG> are described in detail below.

First, that the cross-correlation coefficient of the multi-channel signal of the current frame is determined in step <NUM> is described.

A maximum value Tmax of the inter-channel time difference and a minimum value Tmin of the inter-channel time difference usually need to be preset, so as to determine a calculation range of the cross-correlation coefficient. Both the maximum value Tmax of the inter-channel time difference and the minimum value Tmin of the inter-channel time difference are real numbers, and Tmax > Tmin. Values of Tmax and Tmin are related to a frame length, or values of Tmax and Tmin are related to a current sampling frequency.

Optionally, a maximum value L_NCSHIFT_DS of an absolute value of the inter-channel time difference is preset, to determine the maximum value Tmax of the inter-channel time difference and the minimum value Tmin of the inter-channel time difference. For example, the maximum value Tmax of the inter-channel time difference = L_NCSHIFT_DS, and the minimum value Tmin of the inter-channel time difference = -L_NCSHIFT_DS.

The values of Tmax and Tmin are not limited in this application. For example, if the maximum value L_NCSHIFT_DS of the absolute value of the inter-channel time difference is <NUM>, Tmax = <NUM>, and Tmin = -<NUM>.

In an implementation, an index value of the cross-correlation coefficient is used to indicate a difference between the inter-channel time difference and the minimum value of the inter-channel time difference. In this case, determining the cross-correlation coefficient based on the left channel time domain signal and the right channel time domain signal of the current frame is represented by using the following formulas:.

In a case of Tmin ≤ <NUM> and <NUM> < Tmax,.

In a case of Tmin ≤ <NUM> and Tmax ≤ <NUM>,
when <MAT> <MAT>.

In a case of Tmin ≥ <NUM> and Tmax ≥ <NUM>,
when <MAT> <MAT>.

N is a frame length, x̃L(j) is the left channel time domain signal of the current frame, x̃R(j) is the right channel time domain signal of the current frame, c(k) is the cross-correlation coefficient of the current frame, k is the index value of the cross-correlation coefficient, k is an integer not less than <NUM>, and a value range of k is [<NUM>, Tmax - Tmin].

It is assumed that Tmax = <NUM>, and Tmin = -<NUM>. In this case, the audio coding device determines the cross-correlation coefficient of the current frame by using the calculation manner corresponding to the case that Tmin ≤ <NUM> and <NUM> < Tmax. In this case, the value range of k is [<NUM>, <NUM>].

In another implementation, the index value of the cross-correlation coefficient is used to indicate the inter-channel time difference. In this case, determining, by the audio coding device, the cross-correlation coefficient based on the maximum value of the inter-channel time difference and the minimum value of the inter-channel time difference is represented by using the following formulas:.

N is a frame length, x̃L(j) is the left channel time domain signal of the current frame, x̃R(j) is the right channel time domain signal of the current frame, c(i) is the cross-correlation coefficient of the current frame, i is the index value of the cross-correlation coefficient, and a value range of i is [Tmin, Tmax].

It is assumed that Tmax = <NUM>, and Tmin = -<NUM>. In this case, the audio coding device determines the cross-correlation coefficient of the current frame by using the calculation formula corresponding to Tmin ≤ <NUM> and <NUM> < Tmax. In this case, the value range of i is [-<NUM>, <NUM>].

Second, the determining a delay track estimation value of the current frame in step <NUM> is described.

In a first implementation, delay track estimation is performed based on the buffered inter-channel time difference information of the at least one past frame by using a linear regression method, to determine the delay track estimation value of the current frame.

This implementation is implemented by using the following several steps:.

A buffer stores inter-channel time difference information of M past frames.

Optionally, the inter-channel time difference information is an inter-channel time difference. Alternatively, the inter-channel time difference information is an inter-channel time difference smoothed value.

Optionally, inter-channel time differences that are of the M past frames and that are stored in the buffer follow a first in first out principle. To be specific, a buffer location of an inter-channel time difference that is buffered first and that is of a past frame is in the front, and a buffer location of an inter-channel time difference that is buffered later and that is of a past frame is in the back.

In addition, for the inter-channel time difference that is buffered later and that is of the past frame, the inter-channel time difference that is buffered first and that is of the past frame moves out of the buffer first.

Optionally, in this embodiment, each data pair is generated by using inter-channel time difference information of each past frame and a corresponding sequence number.

A sequence number is referred to as a location of each past frame in the buffer. For example, if eight past frames are stored in the buffer, sequence numbers are <NUM>, <NUM>, <NUM>, <NUM>, <NUM>, <NUM>, <NUM>, and <NUM> respectively.

For example, the generated M data pairs are: {(x<NUM>, y<NUM>), (x<NUM>, y<NUM>), (x<NUM>, y<NUM>). , and (xM-<NUM>, yM-<NUM>)}. (xr, yr) is an (r + <NUM>)th data pair, and xr is used to indicate a sequence number of the (r + <NUM>)th data pair, that is, xr = r; and yr is used to indicate an inter-channel time difference that is of a past frame and that is corresponding to the (r + <NUM>)th data pair, where r = <NUM>, <NUM>,. , and (M - <NUM>).

<FIG> is a schematic diagram of eight buffered past frames. A location corresponding to each sequence number buffers an inter-channel time difference of one past frame. In this case, eight data pairs are: {(x<NUM>, y<NUM>), (x<NUM>, y<NUM>), (x<NUM>, y<NUM>). , and (x<NUM>, y<NUM>)}. In this case, r = <NUM>, <NUM>, <NUM>, <NUM>, <NUM>, <NUM>, <NUM>, and <NUM>.

(<NUM>) Calculate a first linear regression parameter and a second linear regression parameter based on the M data pairs.

In this embodiment, it is assumed that yr in the data pairs is a linear function that is about xr and that has a measurement error of εr. The linear function is as follows: <MAT>
α is the first linear regression parameter, β is the second linear regression parameter, and εr is the measurement error.

The linear function needs to meet the following condition: A distance between the observed value yr (inter-channel time difference information actually buffered) corresponding to the observation point xr and an estimation value α + β * xr calculated based on the linear function is the smallest, to be specific, minimization of a cost function Q (α, β) is met.

The cost function Q (α, β) is as follows: <MAT>.

To meet the foregoing condition, the first linear regression parameter and the second linear regression parameter in the linear function need to meet the following: <MAT> <MAT> <MAT> <MAT> <MAT> and <MAT>
xr is used to indicate the sequence number of the (r + <NUM>)th data pair in the M data pairs, and yr is inter-channel time difference information of the (r + <NUM>)th data pair.

(<NUM>) Obtain the delay track estimation value of the current frame based on the first linear regression parameter and the second linear regression parameter.

An estimation value corresponding to a sequence number of an (M + <NUM>)th data pair is calculated based on the first linear regression parameter and the second linear regression parameter, and the estimation value is determined as the delay track estimation value of the current frame. A formula is as follows: <MAT> where
reg_prv_corr represents the delay track estimation value of the current frame, M is the sequence number of the (M + <NUM>)th data pair, and α + β * M is the estimation value of the (M + <NUM>)th data pair.

For example, M = <NUM>. After α and β are determined based on the eight generated data pairs, an inter-channel time difference in a ninth data pair is estimated based on α and β, and the inter-channel time difference in the ninth data pair is determined as the delay track estimation value of the current frame, that is, reg_prv_corr = α + β * <NUM>.

Optionally, in this embodiment, only a manner of generating a data pair by using a sequence number and an inter-channel time difference is used as an example for description. In actual implementation, the data pair may alternatively be generated in another manner. This is not limited in this embodiment.

In a second implementation, delay track estimation is performed based on the buffered inter-channel time difference information of the at least one past frame by using a weighted linear regression method, to determine the delay track estimation value of the current frame.

This step is the same as the related description in step (<NUM>) in the first implementation, and details are not described herein in this embodiment.

(<NUM>) Calculate a first linear regression parameter and a second linear regression parameter based on the M data pairs and weighting coefficients of the M past frames.

Optionally, the buffer stores not only the inter-channel time difference information of the M past frames, but also stores the weighting coefficients of the M past frames. A weighting coefficient is used to calculate a delay track estimation value of a corresponding past frame.

Optionally, a weighting coefficient of each past frame is obtained through calculation based on a smoothed inter-channel time difference estimation deviation of the past frame. Alternatively, a weighting coefficient of each past frame is obtained through calculation based on an inter-channel time difference estimation deviation of the past frame.

The linear function needs to meet the following condition: A weighting distance between the observed value yr (inter-channel time difference information actually buffered) corresponding to the observation point xr and an estimation value α + β * xr calculated based on the linear function is the smallest, to be specific, minimization of a cost function Q (α, β) is met.

The cost function Q (α, β) is as follows: <MAT>
wr is a weighting coefficient of a past frame corresponding to an rth data pair.

To meet the foregoing condition, the first linear regression parameter and the second linear regression parameter in the linear function need to meet the following: <MAT> <MAT> <MAT> <MAT> <MAT> <MAT> and <MAT>
xr is used to indicate a sequence number of the (r + <NUM>)th data pair in the M data pairs, yr is inter-channel time difference information in the (r + <NUM>)th data pair, wr is a weighting coefficient corresponding to the inter-channel time difference information in the (r + <NUM>)th data pair in at least one past frame.

It should be noted that in this embodiment, description is provided by using an example in which a delay track estimation value is calculated only by using the linear regression method or in the weighted linear regression manner. In actual implementation, the delay track estimation value may alternatively be calculated in another manner. This is not limited in this embodiment. For example, the delay track estimation value is calculated by using a B-spline (B-spline) method, or the delay track estimation value is calculated by using a cubic spline method, or the delay track estimation value is calculated by using a quadratic spline method.

Third, the determining an adaptive window function of the current frame in step <NUM> is described.

In this embodiment, two manners of calculating the adaptive window function of the current frame are provided. In a first manner, the adaptive window function of the current frame is determined based on a smoothed inter-channel time difference estimation deviation of a previous frame. In this case, inter-channel time difference estimation deviation information is the smoothed inter-channel time difference estimation deviation, and the raised cosine width parameter and the raised cosine height bias of the adaptive window function are related to the smoothed inter-channel time difference estimation deviation. In a second manner, the adaptive window function of the current frame is determined based on the inter-channel time difference estimation deviation of the current frame. In this case, the inter-channel time difference estimation deviation information is the inter-channel time difference estimation deviation, and the raised cosine width parameter and the raised cosine height bias of the adaptive window function are related to the inter-channel time difference estimation deviation.

The two manners are separately described below.

This first manner is implemented by using the following several steps:.

Because accuracy of calculating the adaptive window function of the current frame by using a multi-channel signal near the current frame is relatively high, in this embodiment, description is provided by using an example in which the adaptive window function of the current frame is determined based on the smoothed inter-channel time difference estimation deviation of the previous frame of the current frame.

Optionally, the smoothed inter-channel time difference estimation deviation of the previous frame of the current frame is stored in the buffer.

This step is represented by using the following formulas: <MAT> and <MAT> where <MAT> <MAT> win_width1 is the first raised cosine width parameter, TRUNC indicates rounding a value, L_NCSHIFT_DS is the maximum value of the absolute value of the inter-channel time difference, A is a preset constant, and A is greater than or equal to <NUM>.

xh_width1 is an upper limit value of the first raised cosine width parameter, for example, <NUM> in <FIG>; x1_width1 is a lower limit value of the first raised cosine width parameter, for example, <NUM> in <FIG>; yh_dist1 is a smoothed inter-channel time difference estimation deviation corresponding to the upper limit value of the first raised cosine width parameter, for example, <NUM> corresponding to <NUM> in <FIG>; yl_dist1 is a smoothed inter-channel time difference estimation deviation corresponding to the lower limit value of the first raised cosine width parameter, for example, <NUM> corresponding to <NUM> in <FIG>.

smooth_dist_reg is the smoothed inter-channel time difference estimation deviation of the previous frame of the current frame, and xh_width1, xl_width1, yh_dist1, and y1_dist1 are all positive numbers.

Optionally, in the foregoing formula, b_width1 = xh_width1 - a_width1 * yh_dist1 may be replaced with_width1 = x1_width1 - a_width1 * yl_dist1.

Optionally, in this step, width_par1 = min(width_par1, xh_width1), and width_par1 = max(width_par1, xl_width1), where min represents taking of a minimum value, and max represents taking of a maximum value. To be specific, when width_par1 obtained through calculation is greater than xh_width1, width_par1 is set to xh_width1; or when width_par1 obtained through calculation is less than xl_width1, width_par1 is set to xl_width1.

In this embodiment, when width_par1 is greater than the upper limit value of the first raised cosine width parameter, width_par1 is limited to be the upper limit value of the first raised cosine width parameter; or when width_par1 is less than the lower limit value of the first raised cosine width parameter, width_par1 is limited to the lower limit value of the first raised cosine width parameter, so as to ensure that a value of width_par1 does not exceed a normal value range of the raised cosine width parameter, thereby ensuring accuracy of a calculated adaptive window function.

(<NUM>) Calculate a first raised cosine height bias based on the smoothed inter-channel time difference estimation deviation of the previous frame of the current frame.

This step is represented by using the following formula: <MAT> where <MAT> and <MAT>.

win_bias1 is the first raised cosine height bias; xh_bias1 is an upper limit value of the first raised cosine height bias, for example, <NUM> in <FIG>; xl_bias1 is a lower limit value of the first raised cosine height bias, for example, <NUM> in <FIG>; yh_dist2 is a smoothed inter-channel time difference estimation deviation corresponding to the upper limit value of the first raised cosine height bias, for example, <NUM> corresponding to <NUM> in <FIG>; yl_dist2 is a smoothed inter-channel time difference estimation deviation corresponding to the lower limit value of the first raised cosine height bias, for example, <NUM> corresponding to <NUM> in <FIG>; smooth_dist_reg is the smoothed inter-channel time difference estimation deviation of the previous frame of the current frame; and yh_dist2, yl _dist2, xh_bias1, and x1_bias1 are all positive numbers.

Optionally, in the foregoing formula, b_bias1 = xh_bias1 - a_bias1 * yh_dist2 may be replaced with b_bias1 = xl_bias1 - a_bias1 * yl_dist2.

Optionally, in this embodiment, win_bias1 = min(win_bias1, xh_bias1), and win_bias1 = max(win_bias1, xl_bias1). To be specific, when win_bias1 obtained through calculation is greater than xh_bias1, win_bias1 is set to xh_bias1; or when win_bias1 obtained through calculation is less than xl_bias1, win_bias1 is set to xl_bias1.

Optionally, yh_dist2 = yh_dist1, and yl_dist2 = yl_dist1.

(<NUM>) Determine the adaptive window function of the current frame based on the first raised cosine width parameter and the first raised cosine height bias.

The first raised cosine width parameter and the first raised cosine height bias are brought into the adaptive window function in step <NUM> to obtain the following calculation formulas:.

loc_weight_win(k) is used to represent the adaptive window function, where k = <NUM>, <NUM>,. , A * L_NCSHIFT_DS; A is the preset constant greater than or equal to <NUM>, for example, A = <NUM>, L_NCSHIFT_DS is the maximum value of the absolute value of the inter-channel time difference; win_width1 is the first raised cosine width parameter; and win_bias1 is the first raised cosine height bias.

In this embodiment, the adaptive window function of the current frame is calculated by using the smoothed inter-channel time difference estimation deviation of the previous frame, so that a shape of the adaptive window function is adjusted based on the smoothed inter-channel time difference estimation deviation, thereby avoiding a problem that a generated adaptive window function is inaccurate due to an error of the delay track estimation of the current frame, and improving accuracy of generating an adaptive window function.

Optionally, after the inter-channel time difference of the current frame is determined based on the adaptive window function determined in the first manner, the smoothed inter-channel time difference estimation deviation of the current frame may be further determined based on the smoothed inter-channel time difference estimation deviation of the previous frame of the current frame, the delay track estimation value of the current frame, and the inter-channel time difference of the current frame.

Optionally, the smoothed inter-channel time difference estimation deviation of the previous frame of the current frame in the buffer is updated based on the smoothed inter-channel time difference estimation deviation of the current frame.

Optionally, after the inter-channel time difference of the current frame is determined each time, the smoothed inter-channel time difference estimation deviation of the previous frame of the current frame in the buffer is updated based on the smoothed inter-channel time difference estimation deviation of the current frame.

Optionally, updating the smoothed inter-channel time difference estimation deviation of the previous frame of the current frame in the buffer based on the smoothed inter-channel time difference estimation deviation of the current frame includes: replacing the smoothed inter-channel time difference estimation deviation of the previous frame of the current frame in the buffer with the smoothed inter-channel time difference estimation deviation of the current frame.

The smoothed inter-channel time difference estimation deviation of the current frame is obtained through calculation by using the following calculation formulas: <MAT> and <MAT>.

smooth_dist_reg_update is the smoothed inter-channel time difference estimation deviation of the current frame; γ is a first smoothing factor, and <NUM> < γ < <NUM>, for example, γ = <NUM>; smooth_dist_reg is the smoothed inter-channel time difference estimation deviation of the previous frame of the current frame; reg_prv_corr is the delay track estimation value of the current frame; and cur_itd is the inter-channel time difference of the current frame.

In this embodiment, after the inter-channel time difference of the current frame is determined, the smoothed inter-channel time difference estimation deviation of the current frame is calculated. When an inter-channel time difference of a next frame is to be determined, an adaptive window function of the next frame can be determined by using the smoothed inter-channel time difference estimation deviation of the current frame, thereby ensuring accuracy of determining the inter-channel time difference of the next frame.

Optionally, after the inter-channel time difference of the current frame is determined based on the adaptive window function determined in the foregoing first manner, the buffered inter-channel time difference information of the at least one past frame may be further updated.

In an update manner, the buffered inter-channel time difference information of the at least one past frame is updated based on the inter-channel time difference of the current frame.

In another update manner, the buffered inter-channel time difference information of the at least one past frame is updated based on an inter-channel time difference smoothed value of the current frame.

Optionally, the inter-channel time difference smoothed value of the current frame is determined based on the delay track estimation value of the current frame and the inter-channel time difference of the current frame.

For example, based on the delay track estimation value of the current frame and the inter-channel time difference of the current frame, the inter-channel time difference smoothed value of the current frame may be determined by using the following formula: <MAT>.

cur_itd_smooth is the inter-channel time difference smoothed value of the current frame, φ is a second smoothing factor, reg_prv_corr is the delay track estimation value of the current frame, and cur_itd is the inter-channel time difference of the current frame. φ is a constant greater than or equal to <NUM> and less than or equal to <NUM>.

The updating the buffered inter-channel time difference information of the at least one past frame includes: adding the inter-channel time difference of the current frame or the inter-channel time difference smoothed value of the current frame to the buffer.

Optionally, for example, the inter-channel time difference smoothed value in the buffer is updated. The buffer stores inter-channel time difference smoothed values corresponding to a fixed quantity of past frames, for example, the buffer stores inter-channel time difference smoothed values of eight past frames. If the inter-channel time difference smoothed value of the current frame is added to the buffer, an inter-channel time difference smoothed value of a past frame that is originally located in a first bit (a head of a queue) in the buffer is deleted. Correspondingly, an inter-channel time difference smoothed value of a past frame that is originally located in a second bit is updated to the first bit. By analogy, the inter-channel time difference smoothed value of the current frame is located in a last bit (a tail of the queue) in the buffer.

Reference is made to a buffer updating process shown in <FIG>. It is assumed that the buffer stores inter-channel time difference smoothed values of eight past frames. Before an inter-channel time difference smoothed value <NUM> of the current frame is added to the buffer (that is, the eight past frames corresponding to the current frame), an inter-channel time difference smoothed value of an (i - <NUM>)th frame is buffered in a first bit, and an inter-channel time difference smoothed value of an (i - <NUM>)th frame is buffered in a second bit,. , and an inter-channel time difference smoothed value of an (i - <NUM>)th frame is buffered in an eighth bit.

If the inter-channel time difference smoothed value <NUM> of the current frame is added to the buffer, the first bit (which is represented by a dashed box in the figure) is deleted, a sequence number of the second bit becomes a sequence number of the first bit, a sequence number of the third bit becomes the sequence number of the second bit,. , and a sequence number of the eighth bit becomes a sequence number of a seventh bit. The inter-channel time difference smoothed value <NUM> of the current frame (an ith frame) is located in the eighth bit, to obtain eight past frames corresponding to a next frame.

Optionally, after the inter-channel time difference smoothed value of the current frame is added to the buffer, the inter-channel time difference smoothed value buffered in the first bit may not be deleted, instead, inter-channel time difference smoothed values in the second bit to a ninth bit are directly used to calculate an inter-channel time difference of a next frame. Alternatively, inter-channel time difference smoothed values in the first bit to a ninth bit are used to calculate an inter-channel time difference of a next frame. In this case, a quantity of past frames corresponding to each current frame is variable. A buffer update manner is not limited in this embodiment.

In this embodiment, after the inter-channel time difference of the current frame is determined, the inter-channel time difference smoothed value of the current frame is calculated. When a delay track estimation value of the next frame is to be determined, the delay track estimation value of the next frame can be determined by using the inter-channel time difference smoothed value of the current frame. This ensures accuracy of determining the delay track estimation value of the next frame.

Optionally, if the delay track estimation value of the current frame is determined based on the foregoing second implementation of determining the delay track estimation value of the current frame, after the buffered inter-channel time difference smoothed value of the at least one past frame is updated, a buffered weighting coefficient of the at least one past frame may be further updated. The weighting coefficient of the at least one past frame is a weighting coefficient in the weighted linear regression method.

In the first manner of determining the adaptive window function, the updating the buffered weighting coefficient of the at least one past frame includes: calculating a first weighting coefficient of the current frame based on the smoothed inter-channel time difference estimation deviation of the current frame; and updating a buffered first weighting coefficient of the at least one past frame based on the first weighting coefficient of the current frame.

In this embodiment, for related descriptions of buffer updating, refer to <FIG>. Details are not described again herein in this embodiment.

The first weighting coefficient of the current frame is obtained through calculation by using the following calculation formulas: <MAT> <MAT> and <MAT>.

wgt_par1 is the first weighting coefficient of the current frame, smooth_dist_reg_update is the smoothed inter-channel time difference estimation deviation of the current frame, xh_wgt is an upper limit value of the first weighting coefficient, xl_wgt is a lower limit value of the first weighting coefficient, yh_dist1' is a smoothed inter-channel time difference estimation deviation corresponding to the upper limit value of the first weighting coefficient, yl_dist1' is a smoothed inter-channel time difference estimation deviation corresponding to the lower limit value of the first weighting coefficient, and yh_dist1', yl_dist1', xh_wgt1, and xl_wgt1 are all positive numbers.

Optionally, wgt_par1 = min(wgt_par1, xh_wgt1), and wgt_par1 = max(wgt_par1, xl_wgt1).

Optionally, in this embodiment, values of yh_dist1', yl_dist1', xh_wgt1, and xl_wgt1 are not limited. For example, xl_wgt1 = <NUM>, xh_wgt1 = <NUM>, yl_dist1' = <NUM>, and yh_dist1' = <NUM>.

Optionally, in the foregoing formula, b_wgt1 = xl_wgt1 - a_wgt1 * yh_dist1' may be replaced with b_wgt1 = xh_wgt1 - a_wgt1 * yl_dist1'.

In this embodiment, xh_wgt1 > xl_wgt1, and yh_dist1' < yl_dist1'.

In this embodiment, when wgt_par1 is greater than the upper limit value of the first weighting coefficient, wgt_par1 is limited to be the upper limit value of the first weighting coefficient; or when wgt_par1 is less than the lower limit value of the first weighting coefficient, wgt_par1 is limited to the lower limit value of the first weighting coefficient, so as to ensure that a value of wgt_par1 does not exceed a normal value range of the first weighting coefficient, thereby ensuring accuracy of the calculated delay track estimation value of the current frame.

In addition, after the inter-channel time difference of the current frame is determined, the first weighting coefficient of the current frame is calculated. When the delay track estimation value of the next frame is to be determined, the delay track estimation value of the next frame can be determined by using the first weighting coefficient of the current frame, thereby ensuring accuracy of determining the delay track estimation value of the next frame.

In the second manner, an initial value of the inter-channel time difference of the current frame is determined based on the cross-correlation coefficient; the inter-channel time difference estimation deviation of the current frame is calculated based on the delay track estimation value of the current frame and the initial value of the inter-channel time difference of the current frame; and the adaptive window function of the current frame is determined based on the inter-channel time difference estimation deviation of the current frame.

Optionally, the initial value of the inter-channel time difference of the current frame is a maximum value that is of a cross-correlation value in the cross-correlation coefficient and that is determined based on the cross-correlation coefficient of the current frame, and an inter-channel time difference determined based on an index value corresponding to the maximum value.

Optionally, determining the inter-channel time difference estimation deviation of the current frame based on the delay track estimation value of the current frame and the initial value of the inter-channel time difference of the current frame is represented by using the following formula: <MAT>.

dist_reg is the inter-channel time difference estimation deviation of the current frame, reg_prv_corr is the delay track estimation value of the current frame, and cur_itd_init is the initial value of the inter-channel time difference of the current frame.

Based on the inter-channel time difference estimation deviation of the current frame, determining the adaptive window function of the current frame is implemented by using the following steps.

This step may be represented by using the following formulas: <MAT> and <MAT> where <MAT> and <MAT>.

win_width2 is the second raised cosine width parameter, TRUNC indicates rounding a value, L_NCSHIFT_DS is a maximum value of an absolute value of an inter-channel time difference, A is a preset constant, A is greater than or equal to <NUM>, A * L_NCSHIFT_DS + <NUM> is a positive integer greater than zero, xh_width2 is an upper limit value of the second raised cosine width parameter, xl_width2 is a lower limit value of the second raised cosine width parameter, yh_dist3 is an inter-channel time difference estimation deviation corresponding to the upper limit value of the second raised cosine width parameter, yldist3 is an inter-channel time difference estimation deviation corresponding to the lower limit value of the second raised cosine width parameter, dist_reg is the inter-channel time difference estimation deviation, xh_width2, xl_width2, yh_dist3, and yl_dist3 are all positive numbers.

Optionally, in this step, b_width2 = xh_width2 - a_width2 * yh_dist3 may be replaced with b_width2 = xl_width2 - a _width2 * yl_dist3.

Optionally, in this step, width_par2 = min(width_par2, xh_width2), and width_par2 = max(width_par2, xl_width2), where min represents taking of a minimum value, and max represents taking of a maximum value. To be specific, when width_par2 obtained through calculation is greater than xh_width2, width_par2 is set to xh_width2; or when width_par2 obtained through calculation is less than xl_width2, width_par2 is set to xl_width2.

In this embodiment, when width_par2 is greater than the upper limit value of the second raised cosine width parameter, width_par2 is limited to be the upper limit value of the second raised cosine width parameter; or when width_par2 is less than the lower limit value of the second raised cosine width parameter, width_par2 is limited to the lower limit value of the second raised cosine width parameter, so as to ensure that a value of width_par2 does not exceed a normal value range of the raised cosine width parameter, thereby ensuring accuracy of a calculated adaptive window function.

(<NUM>) Calculate a second raised cosine height bias based on the inter-channel time difference estimation deviation of the current frame.

This step may be represented by using the following formula: <MAT> where <MAT> and <MAT>.

win_bias2 is the second raised cosine height bias, xh_bias2 is an upper limit value of the second raised cosine height bias, xl_bias2 is a lower limit value of the second raised cosine height bias, yh_dist4 is an inter-channel time difference estimation deviation corresponding to the upper limit value of the second raised cosine height bias, yl_dist4 is an inter-channel time difference estimation deviation corresponding to the lower limit value of the second raised cosine height bias, dist_reg is the inter-channel time difference estimation deviation, and yh_dist4, yl _dist4, xh_bias2, and xl_bias2 are all positive numbers.

Optionally, in this step, b_bias2 = xh_bias2 - a_bias2 * yh_dist4 may be replaced with b_bias2 = xl_bias2 - a_bias2 * yl_dist4.

Optionally, in this embodiment, win_bias2 = min(win_bias2, xh_bias2), and win_bias2 = max(win_bias2, xl_bias2). To be specific, when win_bias2 obtained through calculation is greater than xh_bias2, win_bias2 is set to xh_bias2; or when win_bias2 obtained through calculation is less than xl_bias2, win_bias2 is set to xl_bias2.

Optionally, yh_dist4 = yh_dist3, and yl_dist4 = yl_dist3.

(<NUM>) The audio coding device determines the adaptive window function of the current frame based on the second raised cosine width parameter and the second raised cosine height bias.

The audio coding device brings the second raised cosine width parameter and the second raised cosine height bias into the adaptive window function in step <NUM> to obtain the following calculation formulas:.

loc_weight_win(k) is used to represent the adaptive window function, where k = <NUM>, <NUM>,. , A * L_NCSHIFT_DS; A is the preset constant greater than or equal to <NUM>, for example, A = <NUM>, L_NCSHIFT_DS is the maximum value of the absolute value of the inter-channel time difference; win_width2 is the second raised cosine width parameter; and win_bias2 is the second raised cosine height bias.

In this embodiment, the adaptive window function of the current frame is determined based on the inter-channel time difference estimation deviation of the current frame, and when the smoothed inter-channel time difference estimation deviation of the previous frame does not need to be buffered, the adaptive window function of the current frame can be determined, thereby saving a storage resource.

Optionally, after the inter-channel time difference of the current frame is determined based on the adaptive window function determined in the foregoing second manner, the buffered inter-channel time difference information of the at least one past frame may be further updated. For related descriptions, refer to the first manner of determining the adaptive window function. Details are not described again herein in this embodiment.

Optionally, if the delay track estimation value of the current frame is determined based on the second implementation of determining the delay track estimation value of the current frame, after the buffered inter-channel time difference smoothed value of the at least one past frame is updated, a buffered weighting coefficient of the at least one past frame may be further updated.

In the second manner of determining the adaptive window function, the weighting coefficient of the at least one past frame is a second weighting coefficient of the at least one past frame.

Updating the buffered weighting coefficient of the at least one past frame includes: calculating a second weighting coefficient of the current frame based on the inter-channel time difference estimation deviation of the current frame; and updating a buffered second weighting coefficient of the at least one past frame based on the second weighting coefficient of the current frame.

Calculating the second weighting coefficient of the current frame based on the inter-channel time difference estimation deviation of the current frame is represented by using the following formulas: <MAT> <MAT> and <MAT>.

wgt_par2 is the second weighting coefficient of the current frame, dist_reg is the inter-channel time difference estimation deviation of the current frame, xh_wgt2 is an upper limit value of the second weighting coefficient, xl_wgt2 is a lower limit value of the second weighting coefficient, yh_dist2' is an inter-channel time difference estimation deviation corresponding to the upper limit value of the second weighting coefficient, yl _dist2' is an inter-channel time difference estimation deviation corresponding to the lower limit value of the second weighting coefficient, and yh_dist2', yl_dist2', xh_wgt2, and xl_wgt2 are all positive numbers.

Optionally, wgt_par2 = min(wgt_par2, xh_wgt2), and wgt_par2 = max(wgt_par2, xl_wgt2).

Optionally, in this embodiment, values of yh_dist2', yl_dist2', xh_wgt2, and xl_wgt2 are not limited. For example, xl_wgt2 = <NUM>, xh_wgt2 = <NUM>, yl_dist2' = <NUM>, and yh_dist2' = <NUM>.

Optionally, in the foregoing formula, b_wgt2 = xl_wgt2 - a_wgt2 * yh_dist2' may be replaced with b_wgt2 = xh_wgt2 - a_wgt2 * yl_dist2'.

In this embodiment, xh_wgt2 > x2_wet1, and yh_dist2' < yl_dist2'.

In this embodiment, when wgt_par2 is greater than the upper limit value of the second weighting coefficient, wgt_par2 is limited to be the upper limit value of the second weighting coefficient; or when wgt_par2 is less than the lower limit value of the second weighting coefficient, wgt_par2 is limited to the lower limit value of the second weighting coefficient, so as to ensure that a value of wgt_par2 does not exceed a normal value range of the second weighting coefficient, thereby ensuring accuracy of the calculated delay track estimation value of the current frame.

In addition, after the inter-channel time difference of the current frame is determined, the second weighting coefficient of the current frame is calculated. When the delay track estimation value of the next frame is to be determined, the delay track estimation value of the next frame can be determined by using the second weighting coefficient of the current frame, thereby ensuring accuracy of determining the delay track estimation value of the next frame.

Optionally, in the foregoing embodiments, the buffer is updated regardless of whether the multi-channel signal of the current frame is a valid signal. For example, the inter-channel time difference information of the at least one past frame and/or the weighting coefficient of the at least one past frame in the buffer are/is updated.

Optionally, the buffer is updated only when the multi-channel signal of the current frame is a valid signal. In this way, validity of data in the buffer is improved.

The valid signal is a signal whose energy is higher than preset energy, and/or belongs to preset type, for example, the valid signal is a speech signal, or the valid signal is a periodic signal.

In this embodiment, a voice activity detection (Voice Activity Detection, VAD) algorithm is used to detect whether the multi-channel signal of the current frame is an active frame. If the multi-channel signal of the current frame is an active frame, it indicates that the multi-channel signal of the current frame is the valid signal. If the multi-channel signal of the current frame is not an active frame, it indicates that the multi-channel signal of the current frame is not the valid signal.

In a manner, it is determined, based on a voice activation detection result of the previous frame of the current frame, whether to update the buffer.

When the voice activation detection result of the previous frame of the current frame is the active frame, it indicates that it is of great possibility that the current frame is the active frame. In this case, the buffer is updated. When the voice activation detection result of the previous frame of the current frame is not the active frame, it indicates that it is of great possibility that the current frame is not the active frame. In this case, the buffer is not updated.

Optionally, the voice activation detection result of the previous frame of the current frame is determined based on a voice activation detection result of a primary channel signal of the previous frame of the current frame and a voice activation detection result of a secondary channel signal of the previous frame of the current frame.

If both the voice activation detection result of the primary channel signal of the previous frame of the current frame and the voice activation detection result of the secondary channel signal of the previous frame of the current frame are active frames, the voice activation detection result of the previous frame of the current frame is the active frame. If the voice activation detection result of the primary channel signal of the previous frame of the current frame and/or the voice activation detection result of the secondary channel signal of the previous frame of the current frame are/is not active frames/an active frame, the voice activation detection result of the previous frame of the current frame is not the active frame.

In another manner, it is determined, based on a voice activation detection result of the current frame, whether to update the buffer.

When the voice activation detection result of the current frame is an active frame, it indicates that it is of great possibility that the current frame is the active frame. In this case, the audio coding device updates the buffer. When the voice activation detection result of the current frame is not an active frame, it indicates that it is of great possibility that the current frame is not the active frame. In this case, the audio coding device does not update the buffer.

Optionally, the voice activation detection result of the current frame is determined based on voice activation detection results of a plurality of channel signals of the current frame.

If the voice activation detection results of the plurality of channel signals of the current frame are all active frames, the voice activation detection result of the current frame is the active frame. If a voice activation detection result of at least one channel of channel signal of the plurality of channel signals of the current frame is not the active frame, the voice activation detection result of the current frame is not the active frame.

It should be noted that, in this embodiment, description is provided by using an example in which the buffer is updated by using only a criterion about whether the current frame is the active frame. In actual implementation, the buffer may alternatively be updated based on at least one of unvoicing or voicing, period or aperiodic, transient or non-transient, and speech or non-speech of the current frame.

For example, if both the primary channel signal and the secondary channel signal of the previous frame of the current frame are voiced, it indicates that there is a great probability that the current frame is voiced. In this case, the buffer is updated. If at least one of the primary channel signal and the secondary channel signal of the previous frame of the current frame is unvoiced, there is a great probability that the current frame is not voiced. In this case, the buffer is not updated.

Optionally, based on the foregoing embodiments, an adaptive parameter of a preset window function model may be further determined based on a coding parameter of the previous frame of the current frame. In this way, the adaptive parameter in the preset window function model of the current frame is adaptively adjusted, and accuracy of determining the adaptive window function is improved.

The coding parameter is used to indicate a type of a multi-channel signal of the previous frame of the current frame, or the coding parameter is used to indicate a type of a multi-channel signal of the previous frame of the current frame in which time-domain downmixing processing is performed, for example, an active frame or an inactive frame, unvoicing or voicing, periodic or aperiodic, transient or non-transient, or speech or music.

The adaptive parameter includes at least one of an upper limit value of a raised cosine width parameter, a lower limit value of the raised cosine width parameter, an upper limit value of a raised cosine height bias, a lower limit value of the raised cosine height bias, a smoothed inter-channel time difference estimation deviation corresponding to the upper limit value of the raised cosine width parameter, a smoothed inter-channel time difference estimation deviation corresponding to the lower limit value of the raised cosine width parameter, a smoothed inter-channel time difference estimation deviation corresponding to the upper limit value of the raised cosine height bias, and a smoothed inter-channel time difference estimation deviation corresponding to the lower limit value of the raised cosine height bias.

Optionally, when the audio coding device determines the adaptive window function in the first manner of determining the adaptive window function, the upper limit value of the raised cosine width parameter is the upper limit value of the first raised cosine width parameter, the lower limit value of the raised cosine width parameter is the lower limit value of the first raised cosine width parameter, the upper limit value of the raised cosine height bias is the upper limit value of the first raised cosine height bias, and the lower limit value of the raised cosine height bias is the lower limit value of the first raised cosine height bias. Correspondingly, the smoothed inter-channel time difference estimation deviation corresponding to the upper limit value of the raised cosine width parameter is the smoothed inter-channel time difference estimation deviation corresponding to the upper limit value of the first raised cosine width parameter, the smoothed inter-channel time difference estimation deviation corresponding to the lower limit value of the raised cosine width parameter is the smoothed inter-channel time difference estimation deviation corresponding to the lower limit value of the first raised cosine width parameter, the smoothed inter-channel time difference estimation deviation corresponding to the upper limit value of the raised cosine height bias is the smoothed inter-channel time difference estimation deviation corresponding to the upper limit value of the first raised cosine height bias, and the smoothed inter-channel time difference estimation deviation corresponding to the lower limit value of the raised cosine height bias is the smoothed inter-channel time difference estimation deviation corresponding to the lower limit value of the first raised cosine height bias.

Optionally, when the audio coding device determines the adaptive window function in the second manner of determining the adaptive window function, the upper limit value of the raised cosine width parameter is the upper limit value of the second raised cosine width parameter, the lower limit value of the raised cosine width parameter is the lower limit value of the second raised cosine width parameter, the upper limit value of the raised cosine height bias is the upper limit value of the second raised cosine height bias, and the lower limit value of the raised cosine height bias is the lower limit value of the second raised cosine height bias. Correspondingly, the smoothed inter-channel time difference estimation deviation corresponding to the upper limit value of the raised cosine width parameter is the smoothed inter-channel time difference estimation deviation corresponding to the upper limit value of the second raised cosine width parameter, the smoothed inter-channel time difference estimation deviation corresponding to the lower limit value of the raised cosine width parameter is the smoothed inter-channel time difference estimation deviation corresponding to the lower limit value of the second raised cosine width parameter, the smoothed inter-channel time difference estimation deviation corresponding to the upper limit value of the raised cosine height bias is the smoothed inter-channel time difference estimation deviation corresponding to the upper limit value of the second raised cosine height bias, and the smoothed inter-channel time difference estimation deviation corresponding to the lower limit value of the raised cosine height bias is the smoothed inter-channel time difference estimation deviation corresponding to the lower limit value of the second raised cosine height bias.

Optionally, in this embodiment, description is provided by using an example in which the smoothed inter-channel time difference estimation deviation corresponding to the upper limit value of the raised cosine width parameter is equal to the smoothed inter-channel time difference estimation deviation corresponding to the upper limit value of the raised cosine height bias, and the smoothed inter-channel time difference estimation deviation corresponding to the lower limit value of the raised cosine width parameter is equal to the smoothed inter-channel time difference estimation deviation corresponding to the lower limit value of the raised cosine height bias.

Optionally, in this embodiment, description is provided by using an example in which the coding parameter of the previous frame of the current frame is used to indicate unvoicing or voicing of the primary channel signal of the previous frame of the current frame and unvoicing or voicing of the secondary channel signal of the previous frame of the current frame.

(<NUM>) Determine the upper limit value of the raised cosine width parameter and the lower limit value of the raised cosine width parameter in the adaptive parameter based on the coding parameter of the previous frame of the current frame.

Unvoicing or voicing of the primary channel signal of the previous frame of the current frame and unvoicing or voicing of the secondary channel signal of the previous frame of the current frame are determined based on the coding parameter. If both the primary channel signal and the secondary channel signal are unvoiced, the upper limit value of the raised cosine width parameter is set to a first unvoicing parameter, and the lower limit value of the raised cosine width parameter is set to a second unvoicing parameter, that is, xh_width = xh_width_uv, and xl_width = xl_width_uv.

If both the primary channel signal and the secondary channel signal are voiced, the upper limit value of the raised cosine width parameter is set to a first voicing parameter, and the lower limit value of the raised cosine width parameter is set to a second voicing parameter, that is, xh_width = xh_width_v, and xl_width = xl_width_v.

If the primary channel signal is voiced, and the secondary channel signal is unvoiced, the upper limit value of the raised cosine width parameter is set to a third voicing parameter, and the lower limit value of the raised cosine width parameter is set to a fourth voicing parameter, that is, xh_width = xh_width_v2, and xl_width = xl_width_v2.

If the primary channel signal is unvoiced, and the secondary channel signal is voiced, the upper limit value of the raised cosine width parameter is set to a third unvoicing parameter, and the lower limit value of the raised cosine width parameter is set to a fourth unvoicing parameter, that is, xh_width = xh_width_uv2, and xl_width = xl_width_uv2.

The first unvoicing parameter xh_width_uv, the second unvoicing parameter xl_width_uv, the third unvoicing parameter xh_width_uv2, the fourth unvoicing parameter xl_width_uv2, the first voicing parameter xh_width_v, the second voicing parameter xl_width_v, the third voicing parameter xh_width_v2, and the fourth voicing parameter xl_width_v2 are all positive numbers, where xh_width_v < xh_width_v2 < xh_width_uv2 < xh_width_uv, and xl_width_uv < xl_width_uv2 < xl_width_v2 < xl_width_v.

Values of xh_width_v, xh_width_v2, xh_width_uv2, xh_width_uv, xl_width_uv, xl_width_uv2, xl_width_v2, and xl_width_v are not limited in this embodiment. For example, xh_width_v = <NUM>, xh_width_v2 = <NUM>, xh_width_uv2 = <NUM>, xh_width_uv = <NUM>, xl_width_uv = <NUM>, xl_width_uv2 = <NUM>, xl_width_v2 = <NUM>, and xl_width_v = <NUM>.

Optionally, at least one parameter of the first unvoicing parameter, the second unvoicing parameter, the third unvoicing parameter, the fourth unvoicing parameter, the first voicing parameter, the second voicing parameter, the third voicing parameter, and the fourth voicing parameter is adjusted by using the coding parameter of the previous frame of the current frame.

For example, that the audio coding device adjusts at least one parameter of the first unvoicing parameter, the second unvoicing parameter, the third unvoicing parameter, the fourth unvoicing parameter, the first voicing parameter, the second voicing parameter, the third voicing parameter, and the fourth voicing parameter based on the coding parameter of a channel signal of the previous frame of the current frame is represented by using the following formulas: <MAT> <MAT> <MAT> and <MAT>.

fach_uv, fach_v, fach_v2, fach_uv2, xh_width_init, and xl_width_init are positive numbers determined based on the coding parameter.

In this embodiment, values of fach_uv, fach_v, fach_v2, fach_uv2, xh_width_init, and xl_width_init are not limited. For example, fach_uv = <NUM>, fach_v = <NUM>, fach_v2 = <NUM>, fach_uv2 = <NUM>, xh_width_init = <NUM>, and xl_width_init = <NUM>.

(<NUM>) Determine the upper limit value of the raised cosine height bias and the lower limit value of the raised cosine height bias in the adaptive parameter based on the coding parameter of the previous frame of the current frame.

Unvoicing or voicing of the primary channel signal of the previous frame of the current frame and unvoicing or voicing of the secondary channel signal of the previous frame of the current frame are determined based on the coding parameter. If both the primary channel signal and the secondary channel signal are the unvoiced, the upper limit value of the raised cosine height bias is set to a fifth unvoicing parameter, and the lower limit value of the raised cosine height bias is set to a sixth unvoicing parameter, that is, xh_bias = xh_bias_uv, and xl_bias = xl_bias_uv.

If both the primary channel signal and the secondary channel signal are voiced, the upper limit value of the raised cosine height bias is set to a fifth voicing parameter, and the lower limit value of the raised cosine height bias is set to a sixth voicing parameter, that is, xh_bias = xh_bias_v, and xl_bias = xl_bias_v.

If the primary channel signal is voiced, and the secondary channel signal is unvoiced, the upper limit value of the raised cosine height bias is set to a seventh voicing parameter, and the lower limit value of the raised cosine height bias is set to an eighth voicing parameter, that is, xh_bias = xh_bias_v2, and xl_bias = xl_bias_v2.

If the primary channel signal is unvoiced, and the secondary channel signal is voiced, the upper limit value of the raised cosine height bias is set to a seventh unvoicing parameter, and the lower limit value of the raised cosine height bias is set to an eighth unvoicing parameter, that is, xh_bias = xh_bias_uv2, and xl_bias = xl_bias_uv2.

The fifth unvoicing parameter xh_bias_uv, the sixth unvoicing parameter xl_bias_uv, the seventh unvoicing parameter xh_bias_uv2, the eighth unvoicing parameter xl_bias_uv2, the fifth voicing parameter xh_bias_v, the sixth voicing parameter xl_bias_v, the seventh voicing parameter xh_bias_v2, and the eighth voicing parameter xl_bias_v2 are all positive numbers, where xh_bias_v < xh_bias_v2 < xh_bias_uv2 < xh_bias_uv, xl_bias_v < xl_bias_v2 < xl_bias_uv2 < xl_bias_uv, xh_bias is the upper limit value of the raised cosine height bias, and xl_bias is the lower limit value of the raised cosine height bias.

In this embodiment, values of xh_bias_v, xh_bias_v2, xh_bias_uv2, xh_bias_uv, xl_bias_v, xl_bias_v2, xl_bias_uv2, and xl_bias_uv are not limited. For example, xh_bias_v = <NUM>, xl_bias_v = <NUM>, xh_bias_v2 = <NUM>, xl_bias_v2 = <NUM>, xh_bias_uv = <NUM>, xl_bias_uv = <NUM>, xh_bias_uv2 = <NUM>, and xl_bias_uv2 = <NUM>.

Optionally, at least one of the fifth unvoicing parameter, the sixth unvoicing parameter, the seventh unvoicing parameter, the eighth unvoicing parameter, the fifth voicing parameter, the sixth voicing parameter, the seventh voicing parameter, and the eighth voicing parameter is adjusted based on the coding parameter of a channel signal of the previous frame of the current frame.

For example, the following formula is used for representation: <MAT> <MAT> <MAT> <MAT>.

fach_uv', fach_v', fach_v2', fach_uv2', xh_bias_init, and xl_bias_init are positive numbers determined based on the coding parameter.

In this embodiment, values of fach_uv', fach_v', fach_v2', fach_uv2', xh_bias_init, and xl_bias_init are not limited. For example, fach_v' = <NUM>, fach_v2' = <NUM>, fach_uv2' = <NUM>, fach_uv' = <NUM>, xh_bias_init = <NUM>, and xl_bias_init = <NUM>.

(<NUM>) Determine, based on the coding parameter of the previous frame of the current frame, the smoothed inter-channel time difference estimation deviation corresponding to the upper limit value of the raised cosine width parameter, and the smoothed inter-channel time difference estimation deviation corresponding to the lower limit value of the raised cosine width parameter in the adaptive parameter.

The unvoiced and voiced primary channel signals of the previous frame of the current frame and the unvoiced and voiced secondary channel signals of the previous frame of the current frame are determined based on the coding parameter. If both the primary channel signal and the secondary channel signal are unvoiced, the smoothed inter-channel time difference estimation deviation corresponding to the upper limit value of the raised cosine width parameter is set to a ninth unvoicing parameter, and the smoothed inter-channel time difference estimation deviation corresponding to the lower limit value of the raised cosine width parameter is set to a tenth unvoicing parameter, that is, yh_dist = yh_dist_uv, and yl_dist = yl_dist_uv.

If both the primary channel signal and the secondary channel signal are voiced, the smoothed inter-channel time difference estimation deviation corresponding to the upper limit value of the raised cosine width parameter is set to a ninth voicing parameter, and the smoothed inter-channel time difference estimation deviation corresponding to the lower limit value of the raised cosine width parameter is set to a tenth voicing parameter, that is, yh_dist = yh_dist_v, and yl_dist = yl_dist_v.

If the primary channel signal is voiced, and the secondary channel signal is unvoiced, the smoothed inter-channel time difference estimation deviation corresponding to the upper limit value of the raised cosine width parameter is set to an eleventh voicing parameter, and the smoothed inter-channel time difference estimation deviation corresponding to the lower limit value of the raised cosine width parameter is set to a twelfth voicing parameter, that is, yh_dist = yh_dist_v2, and yl_dist = yl_dist_v2.

If the primary channel signal is unvoiced, and the secondary channel signal is voiced, the smoothed inter-channel time difference estimation deviation corresponding to the upper limit value of the raised cosine width parameter is set to an eleventh unvoicing parameter, and the smoothed inter-channel time difference estimation deviation corresponding to the lower limit value of the raised cosine width parameter is set to a twelfth unvoicing parameter, that is, yh_dist = yh_dist_uv2, and yl_dist = yl_dist_uv2.

The ninth unvoicing parameter yh_dist_uv, the tenth unvoicing parameter yl_dist_uv, the eleventh unvoicing parameter yh_dist_uv2, the twelfth unvoicing parameter yl_dist_uv2, the ninth voicing parameter yh_dist_v, the tenth voicing parameter yl_dist_v, the eleventh voicing parameter yh_dist _v2, and the twelfth voicing parameter yl_dist_v2 are all positive numbers, where yh_dist_v < yh_dist_v2 < yh_dist_uv2 < yh_dist_uv, and yl_dist_uv < yl_dist_uv2 < yl_dist_v2 < yl_dist_v.

In this embodiment, values of yh_dist_v, yh_dist_v2, yh_dist_uv2, yh_dist_uv, yl_dist_uv, yl_dist_uv2, yl_dist_v2, and yl_dist_v are not limited.

Optionally, at least one parameter of the ninth unvoicing parameter, the tenth unvoicing parameter, the eleventh unvoicing parameter, the twelfth unvoicing parameter, the ninth voicing parameter, the tenth voicing parameter, the eleventh voicing parameter, and the twelfth voicing parameter is adjusted by using the coding parameter of the previous frame of the current frame.

fach_uv", fach_v", fach_v2", fach_uv2", yh_dist_init, and yl_dist_init are positive numbers determined based on the coding parameter, and values of the parameters are not limited in this embodiment.

In this embodiment, the adaptive parameter in the preset window function model is adjusted based on the coding parameter of the previous frame of the current frame, so that an appropriate adaptive window function is determined adaptively based on the coding parameter of the previous frame of the current frame, thereby improving accuracy of generating an adaptive window function, and improving accuracy of estimating an inter-channel time difference.

Optionally, based on the foregoing embodiments, before step <NUM>, time-domain preprocessing is performed on the multi-channel signal.

Optionally, the multi-channel signal of the current frame in this embodiment of this application is a multi-channel signal input to the audio coding device, or a multi-channel signal obtained through preprocessing after the multi-channel signal is input to the audio coding device.

Optionally, the multi-channel signal input to the audio coding device may be collected by a collection component in the audio coding device, or may be collected by a collection device independent of the audio coding device, and is sent to the audio coding device.

Optionally, the multi-channel signal input to the audio coding device is a multi-channel signal obtained after through analog-to-digital (Analog to Digital, A/D) conversion. Optionally, the multi-channel signal is a pulse code modulation (Pulse Code Modulation, PCM) signal.

A sampling frequency of the multi-channel signal may be <NUM>, <NUM>, <NUM>, <NUM>, <NUM>, or the like. This is not limited in this embodiment.

For example, the sampling frequency of the multi-channel signal is <NUM>. In this case, duration of a frame of multi-channel signals is <NUM>, and a frame length is denoted as N, where N = <NUM>, in other words, the frame length is <NUM> sampling points. The multi-channel signal of the current frame includes a left channel signal and a right channel signal, the left channel signal is denoted as xL(n), and the right channel signal is denoted as xR(n), where n is a sampling point sequence number, and n = <NUM>, <NUM>, <NUM>,. , and (N - <NUM>).

Optionally, if high-pass filtering processing is performed on the current frame, a processed left channel signal is denoted as xL_HP(n), and a processed right channel signal is denoted as xR_HP(n), where n is a sampling point sequence number, and n = <NUM>, <NUM>, <NUM>,. , and (N - <NUM>).

<FIG> is a schematic structural diagram of an audio coding device according to an example embodiment of this application. In this embodiment of this application, the audio coding device may be an electronic device that has an audio collection and audio signal processing function, such as a mobile phone, a tablet computer, a laptop portable computer, a desktop computer, a Bluetooth speaker, a pen recorder, and a wearable device, or may be a network element that has an audio signal processing capability in a core network and a radio network. This is not limited in this embodiment.

The audio coding device includes a processor <NUM>, a memory <NUM>, and a bus <NUM>.

The processor <NUM> includes one or more processing cores, and the processor <NUM> runs a software program and a module, to perform various function applications and process information.

The memory <NUM> is connected to the processor <NUM> by using the bus <NUM>. The memory <NUM> stores an instruction necessary for the audio coding device.

The processor <NUM> is configured to execute the instruction in the memory <NUM> to implement the delay estimation method provided in the method embodiments of this application.

In addition, the memory <NUM> may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a programmable read-only memory (PROM), a read-only memory (ROM), a magnetic memory, a flash memory, a magnetic disk, or an optic disc.

The memory <NUM> is further configured to buffer inter-channel time difference information of at least one past frame and/or a weighting coefficient of the at least one past frame.

Optionally, the audio coding device includes a collection component, and the collection component is configured to collect a multi-channel signal.

Optionally, the collection component includes at least one microphone. Each microphone is configured to collect one channel of channel signal.

Optionally, the audio coding device includes a receiving component, and the receiving component is configured to receive a multi-channel signal sent by another device.

Optionally, the audio coding device further has a decoding function.

It may be understood that <FIG> shows merely a simplified design of the audio coding device. In another embodiment, the audio coding device may include any quantity of transmitters, receivers, processors, controllers, memories, communications units, display units, play units, and the like. This is not limited in this embodiment.

Optionally, this application provides a computer readable storage medium. The computer readable storage medium stores an instruction. When the instruction is run on the audio coding device, the audio coding device is enabled to perform the delay estimation method provided in the foregoing embodiments.

<FIG> is a block diagram of a delay estimation apparatus according to an embodiment of this application. The delay estimation apparatus may be implemented as all or a part of the audio coding device shown in <FIG> by using software, hardware, or a combination thereof. The delay estimation apparatus may include a cross-correlation coefficient determining unit <NUM>, a delay track estimation unit <NUM>, an adaptive function determining unit <NUM>, a weighting unit <NUM>, and an inter-channel time difference determining unit <NUM>.

The cross-correlation coefficient determining unit <NUM> is configured to determine a cross-correlation coefficient of a multi-channel signal of a current frame.

The delay track estimation unit <NUM> is configured to determine a delay track estimation value of the current frame based on buffered inter-channel time difference information of at least one past frame.

The adaptive function determining unit <NUM> is configured to determine an adaptive window function of the current frame.

The weighting unit <NUM> is configured to perform weighting on the cross-correlation coefficient based on the delay track estimation value of the current frame and the adaptive window function of the current frame, to obtain a weighted cross-correlation coefficient.

The inter-channel time difference determining unit <NUM> is configured to determine an inter-channel time difference of the current frame based on the weighted cross-correlation coefficient.

Optionally, the adaptive function determining unit <NUM> is further configured to:.

Optionally, the apparatus further includes: a smoothed inter-channel time difference estimation deviation determining unit <NUM>.

The smoothed inter-channel time difference estimation deviation determining unit <NUM> is configured to calculate a smoothed inter-channel time difference estimation deviation of the current frame based on the smoothed inter-channel time difference estimation deviation of the previous frame of the current frame, the delay track estimation value of the current frame, and the inter-channel time difference of the current frame.

Optionally, the apparatus further includes an adaptive parameter determining unit <NUM>.

The adaptive parameter determining unit <NUM> is configured to determine an adaptive parameter of the adaptive window function of the current frame based on a coding parameter of the previous frame of the current frame.

Optionally, the delay track estimation unit <NUM> is further configured to:
perform delay track estimation based on the buffered inter-channel time difference information of the at least one past frame by using a linear regression method, to determine the delay track estimation value of the current frame.

Optionally, the delay track estimation unit <NUM> is further configured to:
perform delay track estimation based on the buffered inter-channel time difference information of the at least one past frame by using a weighted linear regression method, to determine the delay track estimation value of the current frame.

Optionally, the apparatus further includes an update unit <NUM>.

The update unit <NUM> is configured to update the buffered inter-channel time difference information of the at least one past frame.

Optionally, the buffered inter-channel time difference information of the at least one past frame is an inter-channel time difference smoothed value of the at least one past frame, and the update unit <NUM> is configured to:.

Optionally, the update unit <NUM> is further configured to:
determine, based on a voice activation detection result of the previous frame of the current frame or a voice activation detection result of the current frame, whether to update the buffered inter-channel time difference information of the at least one past frame.

Optionally, the update unit <NUM> is further configured to:
update a buffered weighting coefficient of the at least one past frame, where the weighting coefficient of the at least one past frame is a coefficient in the weighted linear regression method.

Optionally, when the adaptive window function of the current frame is determined based on a smoothed inter-channel time difference of the previous frame of the current frame, the update unit <NUM> is further configured to:.

Optionally, when the adaptive window function of the current frame is determined based on the smoothed inter-channel time difference estimation deviation of the current frame, the update unit <NUM> is further configured to:.

Optionally, the update unit <NUM> is further configured to:
when the voice activation detection result of the previous frame of the current frame is an active frame or the voice activation detection result of the current frame is an active frame, update the buffered weighting coefficient of the at least one past frame.

For related details, refer to the foregoing method embodiments.

Optionally, the foregoing units may be implemented by a processor in the audio coding device by executing an instruction in a memory.

It may be clearly understood by a person of ordinary skill in the art that, for ease and brief description, for a detailed working process of the foregoing apparatus and units, refer to a corresponding process in the foregoing method embodiments, and details are not described herein again.

In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the described apparatus embodiments are merely examples. For example, the unit division may merely be logical function division and may be other division in actual implementation.

Claim 1:
A delay estimation method, wherein the method comprises:
determining a cross-correlation coefficient of a multi-channel signal of a current frame, wherein the multi-channel signal of the current frame includes at least two channel signals, wherein the at least two channel signals are collected by using different audio collection components, wherein the at least two channel signals are transmitted from a same sound device;
determining a delay track estimation value of the current frame based on buffered inter-channel time difference information of at least one past frame;
determining an adaptive window function of the current frame;
performing weighting on the cross-correlation coefficient based on the delay track estimation value of the current frame and the adaptive window function of the current frame, to obtain a weighted cross-correlation coefficient;
determining an inter-channel time difference of the current frame based on the weighted cross-correlation coefficient; and
performing delay alignment processing on two channles of the at least two channel signals based on the inter-channel time difference.