The present disclosure relates to the field of information technologies, and in particular, to a method and an apparatus for encoding a stereo phase parameter.
As material living standards of people are increasingly improved, people set a higher requirement on an audio effect. Compared with a monaural audio, a stereo audio has a sense of direction and a sense of distribution for various sound sources, which can improve clarity of audio information, so that the stereo audio can better meet the requirement of people for the audio effect.
Currently, when a stereo audio signal is being acquired, a global parameter is extracted, and stereo phase information is recovered according to the global parameter. The global parameter includes a G_ITD (Global Inter-Channel Time Difference, group delay) and a G_IPD (Global Inter-Channel Phase Difference, group phase).
However, when the stereo phase information is directly recovered by extracting the global parameter, the extracted G_and G_IPD have relatively low accuracy, and original stereo phase information cannot be recovered according to the G_ITD and G_IPD, causing a relatively poor effect of stereo audio phase information.
Embodiments of the present disclosure provide a method and an apparatus for encoding a stereo phase parameter, which can improve an effect of stereo audio phase information.
Technical solutions used in the embodiments of the present disclosure are as follows:
According to a first aspect, an embodiment of the present disclosure provides a method for encoding a stereo phase parameter, where the method includes:
determining a value of the global stereo phase parameter of the current frame;
adjusting the value of the global stereo phase parameter of the current frame according to a determining result of the value of the global stereo phase parameter of the current frame; and
encoding an adjusted value of the global stereo phase parameter of the current frame.
In a first implementation manner of the first aspect, the adjusting the value of the global stereo phase parameter of the current frame according to a determining result of the value of the global stereo phase parameter of the current frame specifically includes:
acquiring inter-channel time differences of sub-bands of the current frame;
calculating an average value of absolute values of the inter-channel time differences of the sub-bands of the current frame according to the inter-channel time differences of the sub-bands of the current frame; and
adjusting the value of the global stereo phase parameter of the current frame according to the determining result of the value of the global stereo phase parameter of the current frame and the average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame.
With reference to the first aspect or the first implementation manner of the first aspect, in a second implementation manner of the first aspect, when the current frame is not the first data frame of a data stream, and before the adjusting the value of the global stereo phase parameter of the current frame according to the determining result of the value of the global stereo phase parameter of the current frame and the average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, the method further includes:
performing inter-frame smoothing processing on the average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, and acquiring a smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame; and
the adjusting the value of the global stereo phase parameter of the current frame according to the determining result of the value of the global stereo phase parameter of the current frame and the average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame specifically includes:
adjusting the value of the global stereo phase parameter of the current frame according to the determining result of the value of the global stereo phase parameter of the current frame and the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame.
With reference to the first aspect, the first implementation manner of the first aspect, or the second implementation manner of the first aspect, in a third implementation manner of the first aspect, the global stereo phase parameter includes a group delay (G_ITD) parameter; and
the adjusting the value of the global stereo phase parameter of the current frame according to the determining result of the value of the global stereo phase parameter of the current frame and the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame includes:
when the determining result of the value of the global stereo phase parameter of the current frame is that a value of the G_ITD parameter is not 0, adjusting the value of the G_ITD parameter of the current frame according to the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame.
With reference to the first aspect, the first implementation manner of the first aspect, the second implementation manner of the first aspect, or the third implementation manner of the first aspect, in a fourth implementation manner of the first aspect, the adjusting the value of the G_ITD parameter of the current frame according to the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame is specifically:
adjusting an absolute value of the value of the G_ITD parameter of the current frame according to a formula |G_ITD′|=fac1×|G_ITD|+fac2×ITD_sm, where |G_ITD′| is an adjusted absolute value of the value of the G_ITD parameter, |G_ITD| is the absolute value of the value of the G_ITD parameter, ITD_sm is the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, fac1 and fac2 are smoothing factors, where fac1>0, fac2>0, and fac1+fac2=1.
With reference to the first aspect, the first implementation manner of the first aspect, the second implementation manner of the first aspect, the third implementation manner of the first aspect, or the fourth implementation manner of the first aspect, in a fifth implementation manner of the first aspect, fac1=0.5.
With reference to the first aspect, the first implementation manner of the first aspect, the second implementation manner of the first aspect, the third implementation manner of the first aspect, the fourth implementation manner of the first aspect, or the fifth implementation manner of the first aspect, in a sixth implementation manner of the first aspect, the global stereo phase parameter includes the group delay (G_ITD) parameter and a group phase (G_IPD) parameter; and
the adjusting the value of the global stereo phase parameter of the current frame according to the determining result of the value of the global stereo phase parameter of the current frame and the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame includes:
when the determining result of the value of the global stereo phase parameter of the current frame is that the value of the G_ITD parameter is 0, adjusting a value of the G_IPD parameter of the current frame according to the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame.
With reference to the first aspect, the first implementation manner of the first aspect, the second implementation manner of the first aspect, the third implementation manner of the first aspect, the fourth implementation manner of the first aspect, the fifth implementation manner of the first aspect, or the sixth implementation manner of the first aspect, in a seventh implementation manner of the first aspect, when the determining result of the value of the global stereo phase parameter of the current frame is that the value of the G_ITD parameter is 0 and the value of the G_IPD parameter of the current frame is not 0, the adjusting a value of the G_IPD parameter of the current frame according to the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame specifically includes:
adjusting an absolute value of the value of the G_IPD parameter according to a formula |G_IPD′|=fac3×|G_IPD|+fac4×IPD_sm, where |G_IPD′| is an adjusted absolute value of the value of the G_IPD parameter; |G_IPD| is the absolute value of the value of the G_IPD parameter; fac3 and fac4 are smoothing factors, where fac3>0, fac4>0 and fac3+fac4=1; and
where FFT_LEN is a transform length, K is a frequency bin value, ITD_sm is the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, and IPD_sm is a smoothed average value of absolute values of inter-channel phase differences of the sub-bands of the current frame.
With reference to the first aspect, the first implementation manner of the first aspect, the second implementation manner of the first aspect, the third implementation manner of the first aspect, the fourth implementation manner of the first aspect, the fifth implementation manner of the first aspect, the sixth implementation manner of the first aspect, or the seventh implementation manner of the first aspect, in an eighth implementation manner of the first aspect, fac3=0.75.
With reference to the first aspect, the first implementation manner of the first aspect, the second implementation manner of the first aspect, the third implementation manner of the first aspect, the fourth implementation manner of the first aspect, the fifth implementation manner of the first aspect, the sixth implementation manner of the first aspect, the seventh implementation manner of the first aspect, or the eighth implementation manner of the first aspect, in a ninth implementation manner of the first aspect, when the determining result of the value of the global stereo phase parameter of the current frame is that the value of the G_ITD parameter is 0 and the value of the G_IPD parameter of the current frame is 0, the adjusting a value of the G_IPD parameter of the current frame according to the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame specifically includes:
using a smoothed average value of absolute values of inter-channel phase differences of the sub-bands of the current frame as an absolute value of the value of G_IPD parameter of the current frame, and using a symbol of a G_IPD parameter of a previous frame of the current frame as a symbol of the G_IPD parameter of the current frame.
With reference to the first aspect, the first implementation manner of the first aspect, the second implementation manner of the first aspect, the third implementation manner of the first aspect, the fourth implementation manner of the first aspect, the fifth implementation manner of the first aspect, the sixth implementation manner of the first aspect, the seventh implementation manner of the first aspect, the eighth implementation manner of the first aspect, or the ninth implementation manner of the first aspect, in a tenth implementation manner of the first aspect, the performing inter-frame smoothing processing on the average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, and acquiring a smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame includes:
performing inter-frame smoothing processing according to a formula ITD_sm(k)=fac5×17ITD_sm(k−1)+fac6×ITD, where ITD_sm(k) is the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, ITD_sm(k−1) is a smoothed average value of absolue values of inter-channel time differences of sub-bands of the previous frame of the current frame, and fac5 and fac6 are smoothing factors, where fac5>0, fac6>0, and fac5+fac6=1.
With reference to the first aspect, the first implementation manner of the first aspect, the second implementation manner of the first aspect, the third implementation manner of the first aspect, the fourth implementation manner of the first aspect, the fifth implementation manner of the first aspect, the sixth implementation manner of the first aspect, the seventh implementation manner of the first aspect, the eighth implementation manner of the first aspect, the ninth implementation manner of the first aspect, or the tenth implementation manner of the first aspect, in an eleventh implementation manner of the first aspect. fac5=0.9844.
According to a first aspect, an embodiment of the present disclosure provides an apparatus for encoding a stereo phase parameter, where the apparatus includes:
an acquisition unit, configured to acquire a global stereo phase parameter of a current frame;
a determining unit, configured to determine a value of the global stereo phase parameter of the current frame acquired by the acquisition unit;
an adjustment unit, configured to adjust the value of the global stereo phase parameter of the current frame according to a determining result of the value of the global stereo phase parameter of the current frame determined by the determining unit; and an encoding unit, configured to encode a value of the global stereo phase parameter of the current frame adjusted by the adjustment unit.
In a first implementation manner of the second aspect, the adjustment unit includes:
an acquisition module, configured to acquire inter-channel time differences of sub-bands of the current frame;
a calculation module, configured to calculate an average value of absolute values of the inter-channel time differences of the sub-bands of the current frame according to the inter-channel time differences of the sub-bands of the current frame acquired by the acquisition module; and an adjustment module, configured to adjust the value of the global stereo phase parameter of the current frame according to the determining result of the value of the global stereo phase parameter of the current frame and the average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame calculated by the calculation module.
With reference to the second aspect or the first implementation manner of the second aspect, in a second implementation manner of the second aspect, the adjustment unit further includes:
a processing module, configured to perform inter-frame smoothing processing on the average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame calculated by the calculation module; where
the acquisition module is further configured to acquire an average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame smoothed by the processing module; and
the adjustment module is further configured to adjust the value of the global stereo phase parameter of the current frame according to the determining result of the value of the global stereo phase parameter of the current frame and the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame acquired by the acquisition module.
With reference to the second aspect, the first implementation manner of the second aspect, or the second implementation manner of the second aspect, in a third implementation manner of the second aspect, the global stereo phase parameter acquired by the acquisition unit includes a group delay (G_ITD) parameter; and
the adjustment module is further configured to: when the determining result of the value of the global stereo phase parameter of the current frame is that a value of the G_ITD parameter is not 0, adjust the value of the G_ITD parameter of the current frame according to the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame acquired by the acquisition module.
With reference to the second aspect, the first implementation manner of the second aspect, the second implementation manner of the second aspect, or the third implementation manner of the second aspect, in a fourth implementation manner of the second aspect, the adjustment module is further configured to adjust an absolute value of the value of the G_ITD parameter of the current frame according to a formula |G_ITD′|=fac1×|G_ITD|+fac2×ITD_sm, where |G_ITD′| is an adjusted absolute value of the value of the G_ITD parameter, |G_ITD| is the absolute value of the value of the G_ITD parameter, ITD_sm is the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, and fac1 and fac2 are smoothing factors where fac1>0, fac2>0, and fac1+fac2=1.
With reference to the second aspect, the first implementation manner of the second aspect, the second implementation manner of the second aspect, the third implementation manner of the second aspect, or the fourth implementation manner of the second aspect, in a fifth implementation manner of the second aspect,
the smoothing factor during adjustment by the adjustment module meets: fac1=0.5.
With reference to the second aspect, the first implementation manner of the second aspect, the second implementation manner of the second aspect, the third implementation manner of the second aspect, the fourth implementation manner of the second aspect, or the fifth implementation manner of the second aspect, in a sixth implementation manner of the second aspect, the global stereo phase parameter acquired by the acquisition unit includes the group delay (G_ITD) parameter and a group phase (G_IPD) parameter; and the adjustment module is further configured to: when the determining result of the value of the global stereo phase parameter of the current frame is that the value of the G_ITD parameter is 0, adjust a value of the G_IPD parameter of the current frame according to the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame acquired by the acquisition module.
With reference to the second aspect, the first implementation manner of the second aspect, the second implementation manner of the second aspect, the third implementation manner of the second aspect, the fourth implementation manner of the second aspect, the fifth implementation manner of the second aspect, or the sixth implementation manner of the second aspect, in a seventh implementation manner of the second aspect, the adjustment module is further configured to: when the determining result of the value of the global stereo phase parameter of the current frame is that the value of the G_ITD parameter is 0 and the value of the G_IPD parameter of the current frame is not 0, adjust an absolute value of the value of the G_IPD parameter according to a formula |G_IPD′|=fac3×|G_IPD|+fac4×IPD_sm, where |G_IPD′| is an adjusted absolute value of the value of the G_IPD parameter; |G_IPD| is the absolute value of the value of the G_IPD parameter; fac3 and fac4 are smoothing factors, where fac3>0, fac4>0, and fac3+fac4=1; and
where FFT_LEN is a transform length, K is a frequency bin value, ITD_sm is the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, and IPD_sm is a smoothed average value of absolute values of inter-channel phase differences of the sub-bands of the current frame.
With reference to the second aspect, the first implementation manner of the second aspect, the second implementation manner of the second aspect, the third implementation manner of the second aspect, the fourth implementation manner of the second aspect, the fifth implementation manner of the second aspect, the sixth implementation manner of the second aspect, or the seventh implementation manner of the second aspect, in an eighth implementation manner of the second aspect, the smoothing factor during adjustment by the adjustment module meets: fac3=0.75.
With reference to the second aspect, the first implementation manner of the second aspect, the second implementation manner of the second aspect, the third implementation manner of the second aspect, the fourth implementation manner of the second aspect, the fifth implementation manner of the second aspect, the sixth implementation manner of the second aspect, the seventh implementation manner of the second aspect, or the eighth implementation manner of the second aspect, in a ninth implementation manner of the second aspect, the adjustment unit further includes:
a configuration module, configured to: when the determining result of the value of the global stereo phase parameter of the current frame is that the value of the G_ITD parameter is 0 and the value of the G_IPD parameter of the current frame is 0, use an average value of absolute values of inter-channel phase differences of the sub-bands of the current frame smoothed by the processing module, as an absolute value of the value of G_IPD parameter of the current frame, and use a symbol of a G_IPD parameter of a previous frame of the current frame as a symbol of the G_IPD parameter of the current frame.
With reference to the second aspect, the first implementation manner of the second aspect, the second implementation manner of the second aspect, the third implementation manner of the second aspect, the fourth implementation manner of the second aspect, the fifth implementation manner of the second aspect, the sixth implementation manner of the second aspect, the seventh implementation manner of the second aspect, the eighth implementation manner of the second aspect, or the ninth implementation manner of the second aspect, in a tenth implementation manner of the second aspect, the processing module is further configured to perform inter-frame smoothing processing according to a formula ITD_sm(k)=fac5×ITD_sm(k−1)+fac6×ITD, where ITD_sm(k) is the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, ITD_sm(k−1) is a smoothed average value of absolute values of inter-channel time differences of sub-bands of the previous frame of the current frame, and fac5 and fac6 are smoothing factors, where fac5>0 fac6>0 , and fac5+fac6=1.
With reference to the second aspect, the first implementation manner of the second aspect, the second implementation manner of the second aspect, the third implementation manner of the second aspect, the fourth implementation manner of the second aspect, the fifth implementation manner of the second aspect, the sixth implementation manner of the second aspect, the seventh implementation manner of the second aspect, the eighth implementation manner of the second aspect, the ninth implementation manner of the second aspect, or the tenth implementation manner of the second aspect, in an eleventh implementation manner of the second aspect,
the smoothing factor during smoothing processing by the processing module meets: fac5=0.9844.
According to the method and the apparatus for encoding a stereo phase parameter that are provided in the embodiments of the present disclosure, first, a global stereo phase parameter of a current frame is acquired; then, a value of the global stereo phase parameter of the current frame is determined, and the value of the global stereo phase parameter of the current frame is adjusted according to a determining result of the value of the global stereo phase parameter of the current frame; and finally, an adjusted value of the global stereo phase parameter of the current frame is encoded. Compared with the existing technology that stereo phase information is directly recovered by extracting a global parameter, in the embodiments of the present disclosure, stereo phase information is recovered by using an adjusted global parameter, which can improve accuracy of the stereo phase information, thereby improving an effect of stereo audio phase information.
To describe the technical solutions in the embodiments of the present disclosure more clearly, the following briefly introduces the accompanying drawings required for describing the embodiments. Apparently, the accompanying drawings in the following description show merely some embodiments of the present disclosure, and a person of ordinary skill in the art may still derive other drawings from these accompanying drawings without creative efforts.
The following clearly describes the technical solutions in the embodiments of the present disclosure with reference to the accompanying drawings in the embodiments of the present disclosure. Apparently, the described embodiments are merely some but not all of the embodiments of the present disclosure. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present disclosure without creative efforts shall fall within the protection scope of the present disclosure.
To make the advantages of the technical solutions of the present disclosure clearer, the following describes the present disclosure in detail with reference to the accompanying drawings and embodiments.
An embodiment of the present disclosure provides a method for encoding a stereo phase parameter, and as shown in
101. A server acquires a global stereo phase parameter of a current frame.
The global stereo phase parameter includes a group delay (G_ITD) and a group phase (G_IPD). In this embodiment of the present disclosure, the group delay (G_ITD) represents a time delay between an audio-left channel and an audio-right channel of a stereo, in a measurement unit of samples. The group phase (G_IPD) represents waveform similarity between the audio-left channel and the audio-right channel of the stereo after time alignment, in a measurement unit of radian whose value range is (−π, π].
102. The server determines a value of the global stereo phase parameter of the current frame.
A determining result of the value of the global stereo phase parameter of the current frame includes: a value of the G_ITD parameter of the current frame is not 0, the value of the G_ITD parameter of the current frame is 0 and a value of the G_IPD parameter of the current frame is not 0, and the value of the G_ITD parameter of the current frame is 0 and the value of the G_IPD parameter of the current frame is 0.
103. The server adjusts the value of the global stereo phase parameter of the current frame according to a determining result of the value of the global stereo phase parameter of the current frame.
In this embodiment of the present disclosure, when the extracted global stereo phase parameters G_ITD and G_IPD of the current frame are less accurate, the server cannot recover original stereo phase information according to the stereo phase parameters, and therefore, cannot recover a stereo audio signal. In this embodiment of the present disclosure, the server adjusts the G_ITD or the G_IPD, which can avoid that stereo phase information is recovered according to the G_ITD and the G_IPD that differ greatly from an original stereo phase parameter, and therefore can improve an effect of stereo audio phase information.
104. The server encodes an adjusted value of the global stereo phase parameter of the current frame.
The server may encode the adjusted value of the global stereo phase parameter of the current frame in a manner of 5-bit (bit) quantizing and encoding, where the first bit is a flag bit of the stereo phase parameter, and the second bit to the fifth bit are values obtained after encoding processing is performed on the adjusted value of the global stereo phase parameter of the current frame. Specifically, when flag=1, the server transmits a quantized value of the G_of the current frame; when flag=0, the server transmits a quantized value of the G_IPD of the current frame.
According to the method for encoding a stereo phase parameter provided in this embodiment of the present disclosure, first, a global stereo phase parameter of a current frame is acquired; then, a value of the global stereo phase parameter of the current frame is determined, and the value of the global stereo phase parameter of the current frame is adjusted according to a determining result of the value of the global stereo phase parameter of the current frame; and finally, an adjusted value of the global stereo phase parameter of the current frame is encoded. Compared with the existing technology that stereo phase information is directly recovered by extracting a global parameter, in this embodiment of the present disclosure, stereo phase information is recovered by using an adjusted global parameter, which can improve accuracy of the stereo phase information, thereby improving an effect of stereo audio phase information.
An embodiment of the present disclosure provides another method for encoding a stereo phase parameter. As shown in
201. A server acquires a global stereo phase parameter of a current frame.
The global stereo phase parameter includes a group delay (G_ITD) and a group phase (G_IPD). In this embodiment of the present disclosure, the group delay (G_ITD) represents a time delay between an audio-left channel and an audio-right channel of a stereo, in a measurement unit of samples. The group phase (G_IPD) represents waveform similarity between the audio-left channel and the audio-right channel of the stereo after time alignment, in a measurement unit of radian whose value range is (−π, π].
202. The server determines a value of the global stereo phase parameter of the current frame.
A determining result of the value of the global stereo phase parameter of the current frame includes: a value of the G_ITD parameter of the current frame is not 0, the value of the G_ITD parameter of the current frame is 0 and a value of the G_IPD parameter of the current frame is not 0, and the value of the G_ITD parameter of the current frame is 0 and the value of the G_IPD parameter of the current frame is 0.
203. The server acquires inter-channel time differences of sub-bands of the current frame.
The sub-bands of the current frame may be divided in advance by the server. For example, the server may divide a frequency band into 12 sub-bands, where each sub-band has a corresponding inter-channel time difference.
In this embodiment of the present disclosure, the inter-channel time difference is used to represent a difference between time when a sound arrives at the left ear and time when a sound arrives at the right ear. When the ITD is a value greater than 0, the time when the sound arrives at the left ear is earlier than the time when the sound arrives at the right ear; when the ITD is a value less than 0, the time when the sound arrives at the left ear is later than the time when the sound arrives at the right ear; when the ITD is equal to 0, the time when the sound arrives at the left ear is the same as the time when the sound arrives at the right ear. In this embodiment of the present disclosure, the ITD may be represented by using a sample. For example, a time interval of the ITD is (−5 ms, 5 ms), in a measurement unit of ms (millisecond, millisecond). After the server performs sampling at a 16kHz bandwidth, a corresponding sample interval is (−80, 80), in a measurement unit of samples.
204. The server calculates an average value of absolute values of the inter-channel time differences of the sub-bands of the current frame according to the inter-channel time differences of the sub-bands of the current frame.
In this embodiment of the present disclosure, the server may calculate the average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame according to a formula
where ITD is the average value of absolute values of the inter-channel time differences of the sub-bands, ITD(b) is an inter-channel time difference of the bth sub-band, where b is an integer greater than or equal to 1 and less than or equal to L, and L is a total quantity of sub-bands.
205. The server performs inter-frame smoothing processing on the average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, and acquires a smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame.
Specifically, step 205 may be that the server performs inter-frame smoothing processing on the average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame according to a formula ITD_sm(k)=fac5×ITD_sm(k−1)+fac6×ITD,, and acquires the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, where ITD_sm(k) is the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, ITD_sm(k−1) is a smoothed average value of absolute values of inter-channel time differences of sub-bands of a previous frame of the current frame, and fac5 and fac6 are smoothing factors, where fac5>0, fac6>0, and fac5+fac6=1.
In this embodiment of the present disclosure, a value of the smoothing factor fac5 may be: fac5=0.9844, and a corresponding smoothing factor fac6 may be: fac6=1−0.9844=0.0156.
In this embodiment of the present disclosure, the server may perform smoothing processing between adjacent data frames of the current frame, so that a situation in which a stereo audio signal changes suddenly when stereo phase information corresponding to the adjacent data frames of the current frame changes suddenly can be avoided, and an effect of a stereo audio can be further improved.
When the determining result of the value of the global stereo phase parameter of the current frame is that the value of the G_ITD parameter of the current frame is not 0, step 206a is performed: The server adjusts the value of the G_ITD parameter of the current frame according to the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame.
Specifically, step 206a may be that when the determining result of the value of the global stereo phase parameter of the current frame is that the value of the G_ITD parameter of the current frame is not 0, the server adjusts an absolute value of the value of the G_ITD parameter of the current frame according to a formula |G_ITD′|=fac1×|G_ITD|+fac2×ITD_sm, where |G_ITD′| is an adjusted absolute value of the value of the G_ITD parameter, |G_ITD| is the absolute value of the value of the G_ITD parameter, ITD_sm is the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, and fac1 and fac2 are smoothing factors where fac1>0, fac2>0, and fac1+fac2=1.
In this embodiment of the present disclosure, a value of the smoothing factor fac1 may be fac1=0.5, and a corresponding smoothing factor fac2 may be fac2=1−0.5=0.5.
When the determining result of the value of the global stereo phase parameter of the current frame is that the value of the G_ITD parameter of the current frame is 0 and the value of the G_IPD parameter of the current frame is not 0, step 206b is performed: The server adjusts an absolute value of the value of the G_IPD parameter according to a formula |G_IPD′|=fac3×|G_IPD|+fac4×IPD_sm, where |G_IPD′| is an adjusted absolute value of the value of the G_IPD parameter; |G_IPD| is the absolute value of the value of the G_IPD parameter; fac3 and fac4 are smoothing factors, where fac3>0 fac4>0, and fac3+fac4=1; and
where FFT_LEN is a transform length, K is a frequency bin value, ITD_sm is the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, and IPD_sm is a smoothed average value of absolute values of inter-channel phase differences of the sub-bands of the current frame.
In this embodiment of the present disclosure, a value of the smoothing factor fac3 may be: fac=0.75, and a corresponding smoothing fact fac4 may be: fac4=1−0.75=0.25.
When the determining result of the value of the global stereo phase parameter of the current frame is that the value of the G_ITD parameter of the current frame is 0 and the value of the G_IPD parameter of the current frame is 0, step 206c is performed: The server uses a smoothed average value of absolute values of inter-channel phase differences of the sub-bands of the current frame as an absolute value of the G_IPD parameter of the current frame, and uses a symbol of a G_IPD parameter of a previous frame of the current frame as a symbol of the G_IPD parameter of the current frame.
In this embodiment of the present disclosure, the server may calculate the smoothed average value of the absolute values of the inter-channel phase differences of the sub-bands of the current frame according to a formula
where FFT_LEN is a transform length, K is a frequency bin value, ITD_sm is the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, and IPD_sm is the smoothed average value of the absolute values of the inter-channel phase differences of the sub-bands of the current frame.
207. The server encodes an adjusted value of the global stereo phase parameter of the current frame.
The server may encode the adjusted value of the global stereo phase parameter of the current frame in a manner of 5-bit (bit) quantizing and encoding, where the first bit is a flag bit of the stereo phase parameter, and the second bit to the fifth bit are values obtained after encoding processing is performed on the adjusted value of the global stereo phase parameter of the current frame. Specifically, when flag=1, the server transmits a quantized value of the G_ITD of the current frame; when flag=0, the server transmits a quantized value of the G_IPD of the current frame.
According to the method for encoding a stereo phase parameter provided in this embodiment of the present disclosure, first, a global stereo phase parameter of a current frame is acquired; then, a value of the global stereo phase parameter of the current frame is determined, and the value of the global stereo phase parameter of the current frame is adjusted according to a determining result of the value of the global stereo phase parameter of the current frame; and finally, an adjusted value of the global stereo phase parameter of the current frame is encoded. Compared with the existing technology that stereo phase information is directly recovered by extracting a global parameter, in this embodiment of the present disclosure, stereo phase information is recovered by using an adjusted global parameter, which can improve accuracy of the stereo phase information, thereby improving an effect of stereo audio phase information.
An embodiment of the present disclosure provides still another method for encoding a stereo phase parameter, which is applicable to adjustment in a case in which values of both a G_parameter and a G_IPD parameter of a current frame are 0. As shown in
301. A server acquires a global stereo phase parameter of a current frame.
The global stereo phase parameter includes a group delay (G_ITD) and a group phase (G_IPD). In this embodiment of the present disclosure, the group delay (G_ITD) represents a time delay between an audio-left channel and an audio-right channel of a stereo, in a measurement unit of samples. The group phase (G_IPD) represents waveform similarity between the audio-left channel and the audio-right channel of the stereo after time alignment, in a measurement unit of radian whose value range is (−π, π].
302. The server determines a value of the global stereo phase parameter of the current frame.
A determining result of the value of the global stereo phase parameter of the current frame includes: a value of the G_ITD parameter of the current frame is not 0, the value of the G_ITD parameter of the current frame is 0 and a value of the G_IPD parameter of the current frame is not 0, and the value of the G_ITD parameter of the current frame is 0 and the value of the G_IPD parameter of the current frame is 0.
303. The server acquires inter-channel time differences of sub-bands of the current frame.
The sub-bands of the current frame may be divided in advance by the server. For example, the server may divide a frequency band into 12 sub-bands, where each sub-band has a corresponding inter-channel time difference.
In this embodiment of the present disclosure, the inter-channel time difference is used to represent a difference between time when a sound arrives at the left ear and time when a sound arrives at the right ear. When the ITD is a value greater than 0, the time when the sound arrives at the left ear is earlier than the time when the sound arrives at the right ear; when the ITD is a value less than 0, the time when the sound arrives at the left ear is later than the time when the sound arrives at the right ear; when the ITD is equal to 0, the time when the sound arrives at the left ear is the same as the time when the sound arrives at the right ear. In this embodiment of the present disclosure, the ITD may be represented by using a sample. For example, a time interval of the ITD is (−5 ms, 5 ms), in a measurement unit of ms (millisecond, millisecond). After the server performs sampling at a 16 kHz bandwidth, a corresponding sample interval is (−80, 80), in a measurement unit of samples.
304. The server calculates an average value of absolute values of the inter-channel time differences of the sub-bands of the current frame according to the inter-channel time differences of the sub-bands of the current frame.
In this embodiment of the present disclosure, the server may calculate the average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame according to a formula
where ITD is the average value of absolute values of the inter-channel time differences of the sub-bands, ITD(b) is an inter-channel time difference of the bth sub-band, where b is an integer greater than or equal to 1 and less than or equal to L, and L is a total quantity of sub-bands.
305. The server performs inter-frame smoothing processing on the average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, and acquires a smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame.
Specifically, step 305 may be that the server performs inter-frame smoothing processing on the average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame according to a formula ITD_sm(k)=fac5×ITD_sm(k−1)+fac6×ITD, and acquires the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, where ITD_sm(k) is the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, ITD_sm(k−1) is a smoothed average value of absolute values of inter-channel time differences of sub-bands of a previous frame of the current frame, and fac5 and fac6 are smoothing factors, where fac5>0, fac6>0, and fac5+fac6=1.
In this embodiment of the present disclosure, a value of the smoothing factor fac5 may be: fac5=0.9844, and a corresponding smoothing factor fac6 may be: fac6=1−0.9844=0.0156.
In this embodiment of the present disclosure, the server may perform smoothing processing between adjacent data frames of the current frame, so that a situation in which a stereo audio signal changes suddenly when stereo phase information corresponding to the adjacent data frames of the current frame changes suddenly can be avoided, and an effect of a stereo audio can be further improved.
306. When a determining result of the value of the global stereo phase parameter of the current frame is that a value of a G_ITD parameter of the current frame is 0 and a value of a G_IPD parameter of the current frame is 0, the server uses a smoothed average value of absolute values of inter-channel phase differences of the sub-bands of the current frame as an absolute value of the G_IPD parameter of the current frame, and uses a symbol of a G_IPD parameter of a previous frame of the current frame as a symbol of the G_IPD parameter of the current frame.
In this embodiment of the present disclosure, the server may calculate the smoothed average value of the absolute values of the inter-channel phase differences of the sub-bands of the current frame according to a formula
where FFT_LEN is a transform length, K is a frequency bin value, ITD_sm is the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, and IPD_sm is the smoothed average value of the absolute values of the inter-channel phase differences of the sub-bands of the current frame.
307. The server encodes an adjusted value of the global stereo phase parameter of the current frame.
The server may encode the adjusted value of the global stereo phase parameter of the current frame in a manner of 5-bit (bit) quantizing and encoding, where the first bit is a flag bit of the stereo phase parameter, and the second bit to the fifth bit are values obtained after encoding processing is performed on the adjusted value of the global stereo phase parameter of the current frame. Specifically, when flag=1, the server transmits a quantized value of the G_ITD of the current frame; when flag=0, the server transmits a quantized value of the G_IPD of the current frame.
According to the method for encoding a stereo phase parameter provided in this embodiment of the present disclosure, first, a global stereo phase parameter of a current frame is acquired; then, a value of the global stereo phase parameter of the current frame is determined, and the value of the global stereo phase parameter of the current frame is adjusted according to a determining result of the value of the global stereo phase parameter of the current frame; and finally, an adjusted value of the global stereo phase parameter of the current frame is encoded. Compared with the existing technology that stereo phase information is directly recovered by extracting a global parameter, in this embodiment of the present disclosure, stereo phase information is recovered by using an adjusted global parameter, which can improve accuracy of the stereo phase information, thereby improving an effect of stereo audio phase information.
An embodiment of the present disclosure provides yet another method for encoding a stereo phase parameter, which is applicable to adjustment in a case in which either a value of a G_ITD parameter of a current frame or a value of a G_IPD parameter of a current frame is 0. As shown in
401. A server acquires a global stereo phase parameter of a current frame.
The global stereo phase parameter includes a group delay (G_ITD) and a group phase (G_IPD). In this embodiment of the present disclosure, the group delay (G_ITD) represents a time delay between an audio-left channel and an audio-right channel of a stereo, in a measurement unit of samples. The group phase (G_IPD) represents waveform similarity between the audio-left channel and the audio-right channel of the stereo after time alignment, in a measurement unit of radian whose value range is (−π, π].
402. The server determines a value of the global stereo phase parameter of the current frame.
A determining result of the value of the global stereo phase parameter of the current frame includes: a value of the G_parameter of the current frame is not 0, the value of the G_ITD parameter of the current frame is 0 and a value of the G_IPD parameter of the current frame is not 0, and the value of the G_ITD parameter of the current frame is 0 and the value of the G_IPD parameter of the current frame is 0.
403. The server acquires inter-channel time differences of sub-bands of the current frame.
The sub-bands of the current frame may be divided in advance by the server. For example, the server may divide a frequency band into 12 sub-bands, where each sub-band has a corresponding inter-channel time difference.
In this embodiment of the present disclosure, the inter-channel time difference is used to represent a difference between time when a sound arrives at the left ear and time when a sound arrives at the right ear. When the ITD is a value greater than 0, the time when the sound arrives at the left ear is earlier than the time when the sound arrives at the right ear; when the ITD is a value less than 0, the time when the sound arrives at the left ear is later than the time when the sound arrives at the right ear; when the ITD is equal to 0, the time when the sound arrives at the left ear is the same as the time when the sound arrives at the right ear. In this embodiment of the present disclosure, the ITD may be represented by using a sample. For example, a time interval of the ITD is (−5 ms, 5 ms), in a measurement unit of ms (millisecond, millisecond). After the server performs sampling at a 16 kHz bandwidth, a corresponding sample interval is (−80, 80), in a measurement unit of samples.
404. The server calculates an average value of absolute values of the inter-channel time differences of the sub-bands of the current frame according to the inter-channel time differences of the sub-bands of the current frame.
In this embodiment of the present disclosure, the server may calculate the average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame according to a formula
where ITD is the average value of absolute values of the inter-channel time differences of the sub-bands, ITD(b) is an inter-channel time difference of the bth sub-band, where b is an integer greater than or equal to 1 and less than or equal to L, and L is a total quantity of sub-bands.
405. The server performs inter-frame smoothing processing on the average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, and acquires a smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame.
Specifically, step 405 may be that the server performs inter-frame smoothing processing on the average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame according to a formula ITD_sm(k)=fac5×ITD_sm(k−1)+fac6×ITD, and acquires the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, where ITD_sm(k) is the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, ITD_sm(k−1) is a smoothed average value of absolute values of inter-channel time differences of sub-bands of a previous frame of the current frame, and fac5 and fac6 are smoothing factors, where fac5>0, fac6>0, and fac5+fac6=1.
In this embodiment of the present disclosure, a value of the smoothing factor fac5 may be: fac5=09844, and a corresponding smoothing factor fac6 may be: fac6=1−0.9844=0.0156.
In this embodiment of the present disclosure, the server may perform smoothing processing between adjacent data frames of the current frame, so that a situation in which a stereo audio signal changes suddenly when stereo phase information corresponding to the adjacent data frames of the current frame changes suddenly can be avoided, and an effect of a stereo audio can be further improved.
When the determining result of the value of the global stereo phase parameter of the current frame is that the value of the G_ITD parameter of the current frame is not 0, step 406a is performed: The server adjusts the value of the G_ITD parameter of the current frame according to the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame.
Specifically, step 406a may be that when the determining result of the value of the global stereo phase parameter of the current frame is that the value of the G_ITD parameter of the current frame is not 0, the server adjusts an absolute value of the value of the G_ITD parameter of the current frame according to a formula |G_ITD′|=fac1×|G_ITD|+fac2×ITD _sm, where |G_ITD′| is an adjusted absolute value of the value of the GITD parameter, |G _ITD| is the absolute value of the value of the G_ITD parameter, ITD_sm is the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, and fac1 and fac2 are smoothing factors where fac1>0 fac2>0 , and fac1+fac2=1.
In this embodiment of the present disclosure, a value of the smoothing factor fac1 may be fac1=0.5, and a corresponding smoothing fac2 may be: fac2=1−0.5=0.5.
When the determining result of the value of the global stereo phase parameter of the current frame is that the value of the G_ITD parameter of the current frame is 0 and the value of the G_IPD parameter of the current frame is not 0, step 406b is performed: The server adjusts an absolute value of the value of the G_IPD parameter according to a formula |G_IPD′|=fac3×|G_IPD|+fac4×IPD_sm, where |G_IPD′| is an adjusted absolute value of the value of the G_IPD parameter; |G_IPD| is the absolute value of the value of G_IPD parameter; fac3 and fac4 are smoothing factors, where fac3>0, fac4>0, and fac3+fac4=1; and
where FFT_LEN is a transform length, K is a frequency bin value, ITD_sm is the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, and IPD_sm is a smoothed average value of absolute values of inter-channel phase differences of the sub-bands of the current frame.
In this embodiment of the present disclosure, a value of the smoothing factor fac3 may be: fac3=0.75, and a corresponding smoothing factor fac4 may be: fac4=1−0.75=0.25.
407. The server encodes an adjusted value of the global stereo phase parameter of the current frame.
The server may encode the adjusted value of the global stereo phase parameter of the current frame in a manner of 5-bit (bit) quantizing and encoding, where the first bit is a flag bit of the stereo phase parameter, and the second bit to the fifth bit are values obtained after encoding processing is performed on the adjusted value of the global stereo phase parameter of the current frame. Specifically, when flag=1, the server transmits a quantized value of the G_ITD of the current frame; when flag=0, the server transmits a quantized value of the G_IPD of the current frame.
According to the method for encoding a stereo phase parameter provided in this embodiment of the present disclosure, first, a global stereo phase parameter of a current frame is acquired; then, a value of the global stereo phase parameter of the current frame is determined, and the value of the global stereo phase parameter of the current frame is adjusted according to a determining result of the value of the global stereo phase parameter of the current frame; and finally, an adjusted value of the global stereo phase parameter of the current frame is encoded. Compared with the existing technology that stereo phase information is directly recovered by extracting a global parameter, in this embodiment of the present disclosure, stereo phase information is recovered by using an adjusted global parameter, which can improve accuracy of the stereo phase information, thereby improving an effect of stereo audio phase information.
An embodiment of the present disclosure provides an apparatus for encoding a stereo phase parameter. An entity of the apparatus may be a server, and as shown in
The acquisition unit 51 is configured to acquire a global stereo phase parameter of a current frame.
The determining unit 52 is configured to determine a value of the global stereo phase parameter of the current frame acquired by the acquisition unit 51.
The adjustment unit 53 is configured to adjust the value of the global stereo phase parameter of the current frame according to a determining result of the value of the global stereo phase parameter of the current frame determined by the determining unit 52.
The encoding unit 54 is configured to encode a value of the global stereo phase parameter of the current frame adjusted by the adjustment unit 53.
Further, the entity of the apparatus for encoding a stereo phase parameter may be a server. As shown in
The processor 61 is configured to acquire a global stereo phase parameter of a current frame.
The processor 61 is further configured to determine a value of the global stereo phase parameter of the current frame.
The processor 61 is further configured to adjust the value of the global stereo phase parameter of the current frame according to a determining result of the value of the global stereo phase parameter of the current frame.
The processor 61 is further configured to encode an adjusted value of the global stereo phase parameter of the current frame.
It should be noted that, for other corresponding descriptions of functional units in the apparatus for encoding a stereo phase parameter provided in this embodiment of the present disclosure, reference may be made to corresponding descriptions in
An embodiment of the present disclosure provides another apparatus for encoding a stereo phase parameter. An entity of the apparatus may be a server, and as shown in
The acquisition unit 71 is configured to acquire a global stereo phase parameter of a current frame.
The determining unit 72 is configured to determine a value of the global stereo phase parameter of the current frame acquired by the acquisition unit 71.
The adjustment unit 73 is configured to adjust the value of the global stereo phase parameter of the current frame according to a determining result of the value of the global stereo phase parameter of the current frame determined by the determining unit 72.
The encoding unit 74 is configured to encode a value of the global stereo phase parameter of the current frame obtained by adjusting by the adjustment unit 73.
The adjustment unit 73 includes an acquisition module 7301, a calculation unit 7302, and an adjustment module 7303.
The acquisition module 7301 is configured to acquire inter-channel time differences of sub-bands of the current frame.
The calculation module 7302 is configured to calculate an average value of absolute values of the inter-channel time differences of the sub-bands of the current frame according to the inter-channel time differences of the sub-bands of the current frame acquired by the acquisition module 7301.
The adjustment module 7303 is configured to adjust the value of the global stereo phase parameter of the current frame according to the determining result of the value of the global stereo phase parameter of the current frame and the average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame calculated by the calculation module 7302.
The adjustment unit 73 further includes a processing module 7304.
The processing module 7304 is configured to perform inter-frame smoothing processing on the average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame calculated by the calculation module 7302.
The acquisition module 7301 is further configured to acquire an average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame smoothed by the processing module 7304.
The adjustment module 7303 is further configured to adjust the value of the global stereo phase parameter of the current frame according to the determining result of the value of the global stereo phase parameter of the current frame and the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame acquired by the acquisition module 7301.
The global stereo phase parameter acquired by the acquisition unit 71 includes a group delay (G_ITD) parameter.
The adjustment module 7303 is further configured to: when the determining result of the value of the global stereo phase parameter of the current frame is that a value of the G_ITD parameter is not 0, adjust the value of the G_ITD parameter of the current frame according to the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame acquired by the acquisition module 7301.
The adjustment module 7303 is further configured to adjust an absolute value of the value of the G_ITD parameter of the current frame according to a formula |G_ITD′|=fac1×|G_ITD|+fac2×ITD_sm, where
|G_ITD′| is an adjusted absolute value of the value of the G_ITD parameter, |G_ITD| is the absolute value of the value of the G_ITD parameter, ITD_sm is the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, and fac1 and fac2 are smoothing factors, where fac1>0, fac2>0, and fac1+fac2=1.
The smoothing factor during adjustment by the adjustment module 7303 meets: fac1=0.5.
The global stereo phase parameter acquired by the acquisition unit 71 includes the group delay (G_ITD) parameter and a group phase (G_IPD) parameter.
The adjustment module 7303 is further configured to: when the determining result of the value of the global stereo phase parameter of the current frame is that the value of the G_ITD parameter is 0, adjust a value of the G_IPD parameter of the current frame according to the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame acquired by the acquisition module 7301.
The adjustment module 7303 is further configured to: when the determining result of the value of the global stereo phase parameter of the current frame is that the value of the G_ITD parameter is 0 and the value of the G_IPD parameter of the current frame is not 0, adjust an absolute value of the value of the G_IPD parameter according to a formula |G_IPD′|=fac3×|G_IPD|+fac4×IPD_sm, where
|G_IPD′| is an adjusted absolute value of the value of the G_IPD parameter; |G_IPD| is the absolute value of the value of the G_IPD parameter; fac3 and fac4 are fac3>0 fac4>0 fac3+fac4 =1 smoothing factors, where fac3>0, fac4>0, and fac3+fac4=1; and
where FFT_LEN is a transform length, K is a frequency bin value, ITD_sm is the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, and IPD_sm is a smoothed average value of absolute values of inter-channel phase differences of the sub-bands of the current frame.
The smoothing factor during adjustment by the adjustment module 7303 meets: fac3=0.75.
The adjustment unit 73 further includes a configuration module 7305.
The configuration module 7305 is configured to: when the determining result of the value of the global stereo phase parameter of the current frame is that the value of the G_ITD parameter is 0 and the value of the G_IPD parameter of the current frame is 0, use an average value of absolute values of inter-channel phase differences of the sub-bands of the current frame smoothed by the processing module 7304, as an absolute value of the G_IPD parameter of the current frame, and use a symbol of a G_IPD parameter of a previous frame of the current frame as a symbol of the G_IPD parameter of the current frame.
The processing module 7304 is further configured to perform inter-frame smoothing processing according to a formula ITD_sm(k)=fac5×ITD_sm(k−1)+fac6×ITD, where
ITD_sm(k) is the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, ITD_sm(k−1) is a smoothed average value of absolute values of inter-channel time differences of sub-bands of the previous frame of the current frame, and fac5 and fac6 are smoothing factors, where fac5>0, fac6>0, and fac5+fac6=1.
The smoothing factor during smoothing processing by the processing module 7304 meets: fac5=0.9844.
Further, the entity of the apparatus for encoding a stereo phase parameter may be a server. As shown in
The processor 81 is configured to acquire a global stereo phase parameter of a current frame.
The processor 81 is further configured to determine a value of the global stereo phase parameter of the current frame.
The processor 81 is further configured to adjust the value of the global stereo phase parameter of the current frame according to a determining result of the value of the global stereo phase parameter of the current frame.
The processor 81 is further configured to encode an adjusted value of the global stereo phase parameter of the current frame.
The processor 81 is further configured to acquire inter-channel time differences of sub-bands of the current frame.
The processor 81 is further configured to calculate an average value of absolute values of the inter-channel time differences of the sub-bands of the current frame according to the inter-channel time differences of the sub-bands of the current frame.
The processor 81 is further configured to adjust the value of the global stereo phase parameter of the current frame according to the determining result of the value of the global stereo phase parameter of the current frame and the average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame.
The processor 81 is further configured to perform inter-frame smoothing processing on the average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame.
The processor 81 is further configured to acquire a smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame.
The processor 81 is further configured to adjust the value of the global stereo phase parameter of the current frame according to the determining result of the value of the global stereo phase parameter of the current frame and the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame.
The global stereo phase parameter acquired by the processor 81 includes a group delay (G_) parameter.
The processor 81 is further configured to: when the determining result of the value of the global stereo phase parameter of the current frame is that a value of the G_ITD parameter is not 0, adjust the value of the G_ITD parameter of the current frame according to the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame.
The processor 81 is further configured to adjust an absolute value of the value of the G_ITD parameter of the current frame according to a formula |G_ITD′|=fac1×|G_ITD|+fac2×ITD_sm, where
|G_ITD′| is an adjusted absolute value of the G_ITD parameter, |G_ITD| is the absolute value of the value of the G_ITD parameter, ITD_sm is the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, and fac1 and fac2 are smoothing factors, where fac1>0, fac2>0, and fac1+fac2=1.
The smoothing factor during adjustment by the processor 81 meets: fac1=0.5.
The global stereo phase parameter acquired by the processor 81 includes the group delay (G_ITD) parameter and a group phase (G_IPD) parameter.
The processor 81 is further configured to: when the determining result of the value of the global stereo phase parameter of the current frame is that the value of the G_ITD parameter is 0, adjust a value of the G_IPD parameter of the current frame according to the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame.
The processor 81 is further configured to: when the determining result of the value of the global stereo phase parameter of the current frame is that the value of the G_ITD parameter is 0 and the value of the G_IPD parameter of the current frame is not 0, adjust an absolute value of the value of the G_IPD parameter according to a formula |G_IPD′|=fac3×|G_IPD|+fac4×IPD_sm, where
|G_IPD′| is an adjusted absolute value of the value of the G_IPD parameter; |G13 IPD| is the absolute value of the value of the G_IPD parameter; fac3 and fac4 are smoothing factors, where fac3>0, fac4>0, and fac3+fac4=1; and
where FFT—LEN is a transofrm length, K is a frequency bin value, ITD_sm is the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, and IPD_sm is a smoothed average value of absolute values of inter-channel phase differences of the sub-bands of the current frame.
The smoothing factor during adjustment by the processor 81 meets: fac3=0.75.
The processor 81 is further configured to: when the determining result of the value of the global stereo phase parameter of the current frame is that the value of the G_ITD parameter is 0 and the value of the G_IPD parameter of the current frame is 0, use a smoothed average value of absolute values of inter-channel phase differences of the sub-bands of the current frame as an absolute value of the G_IPD parameter of the current frame, and use a symbol of a G_IPD parameter of a previous frame of the current frame as a symbol of the G_IPD parameter of the current frame.
The processor 81 is further configured to perform inter-frame smoothing processing according to a formula ITD_sm(k)=fac5×ITD_sm(k−1)+fac6×ITD, where
ITD_sm(k) is the smoothed average value of the absolute values of the inter-channel time differences of the sub-bands of the current frame, ITD_sm(k−1) is a smoothed average value of absolute values of inter-channel time differences of sub-bands of the previous frame of the current frame, and fac5 and fac6 are smoothing factors, where fac5>0, fac6>0, and fac5+fac6=1.
The smoothing factor during smoothing processing by the processor 81 meets: fac5=0.9844. It should be noted that, for other corresponding descriptions of functional units in the apparatus for encoding a stereo phase parameter provided in this embodiment of the present disclosure, reference may be made to corresponding descriptions in
The apparatus for encoding a stereo phase parameter provided in embodiments of the present disclosure can implement the foregoing provided method embodiments. For detailed function implementation, reference may be made to descriptions in the method embodiments, and details are not repeatedly described herein. The method and the apparatus for encoding a stereo phase parameter that are provided in the embodiments of the present disclosure are applicable to recovering stereo phase information, but are not limited thereto.
A person of ordinary skill in the art may understand that all or some of the processes of the methods in the embodiments may be implemented by a computer program instructing relevant hardware. The program may be stored in a computer-readable storage medium. When the program runs, the processes of the methods in the embodiments are performed. The foregoing storage medium may include: a magnetic disk, an optical disc, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM).
The foregoing descriptions are merely specific implementation manners of the present disclosure, but are not intended to limit the protection scope of the present disclosure. Any variation or replacement readily figured out by a person skilled in the art within the technical scope disclosed in the present disclosure shall fall within the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.
Number | Date | Country | Kind |
---|---|---|---|
201310632664.5 | Nov 2013 | CN | national |
This application is a continuation of International Patent Application No. PCT/CN2014/074673, filed on Apr. 2, 2014, which claims priority to Chinese Patent Application No. 201310632664.5, filed on Nov. 29, 2013, both of which are hereby incorporated by reference in their entireties.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2014/074673 | Apr 2014 | US |
Child | 15154655 | US |