Method and Device for Decoding Signal

0Associated
Cases 
0Associated
Defendants 
0Accused
Products 
0Forward
Citations 
0
Petitions 
1
Assignment
First Claim
1. A method for decoding an audio signal, comprising:
 obtaining, by a decoder, an average quantity of allocated bits per spectral coefficient of a subband of a current frame of the audio signal, wherein the subband includes a plurality of spectral coefficients;
obtaining, by the decoder, a noise filling gain for the subband when the average quantity of allocated bits per spectral coefficient is less than a classification threshold;
reconstructing, by the decoder and according to the noise filling gain, at least some of the spectral coefficients to generate reconstructed spectral coefficients;
obtaining, by the decoder, a frequency domain signal according to the reconstructed spectral coefficients; and
generating a time domain signal based on the frequency domain signal.
1 Assignment
0 Petitions
Accused Products
Abstract
A method and device for decoding a signal, where the method includes: obtaining an average quantity of allocated bits per spectral coefficient of a subband of a current frame of the audio signal, wherein the subband includes a plurality of spectral coefficients; obtaining a noise filling gain for the subband when the average quantity of allocated bits per spectral coefficient is less than a classification threshold; reconstructing, according to the noise filling gain, at least some of the spectral coefficients to generate reconstructed spectral coefficients when the average quantity of allocated bits per spectral coefficient is less than a classification threshold; obtaining a frequency domain signal according to the reconstructed spectral coefficients; and generating a time domain signal based on the frequency domain signal. Therefore, a subband with unsaturated bit allocation in a frequency domain signal may be obtained by classification, thereby improving signal decoding quality.
0 Citations
No References
No References
20 Claims
 1. A method for decoding an audio signal, comprising:
obtaining, by a decoder, an average quantity of allocated bits per spectral coefficient of a subband of a current frame of the audio signal, wherein the subband includes a plurality of spectral coefficients; obtaining, by the decoder, a noise filling gain for the subband when the average quantity of allocated bits per spectral coefficient is less than a classification threshold; reconstructing, by the decoder and according to the noise filling gain, at least some of the spectral coefficients to generate reconstructed spectral coefficients; obtaining, by the decoder, a frequency domain signal according to the reconstructed spectral coefficients; and generating a time domain signal based on the frequency domain signal.  View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10)
 11. A decoder for decoding an audio signal, comprising:
a nontransitory memory for storing computerexecutable instructions; and a processor coupled to the nontransitory memory, wherein the processor is configured to execute the computerexecutable instructions to; obtain an average quantity of allocated bits per spectral coefficient of a subband of a current frame of the audio signal, wherein the subband includes a plurality of spectral coefficients; obtain a noise filling gain for the subband when the average quantity of allocated bits per spectral coefficient is less than a classification threshold; reconstruct, according to the noise filling gain, at least some of the spectral coefficients to generate reconstructed spectral coefficients; obtain a frequency domain signal according to the reconstructed spectral coefficients; and generate a time domain signal based on the frequency domain signal.  View Dependent Claims (12, 13, 14, 15, 16, 17, 18, 19, 20)
1 Specification
This application is a continuation of U.S. patent application Ser. No. 16/256,421 filed on Jan. 24, 2019, which is a continuation of U.S. patent application Ser. No. 15/787,563 filed on Oct. 18, 2017, now U.S. Pat. No. 10,236,002, which is a continuation of U.S. patent application Ser. No. 15/451,866 filed on Mar. 7, 2017, now U.S. Pat. No. 9,830,914, which is a continuation of U.S. patent application Ser. No. 14/730,524 filed on Jun. 4, 2015, now U.S. Pat. No. 9,626,972, which is a continuation of International Patent Application No. PCT/CN2013/080082 filed on Jul. 25, 2013, which claims priority to Chinese Patent Application No. 201210518020.9 filed on Dec. 6, 2012 and Chinese Patent Application No. 201310297982.0 filed on Jul. 16, 2013. All of the aforementioned patent applications are hereby incorporated by reference in their entireties.
Embodiments of the present disclosure relate to the field of electronics, and in particular, to a method and device for decoding a signal.
In an existing frequency domain codec algorithm, a quantity of bits that can be allocated is insufficient when a bit rate is low. In this case, bits are allocated only to relatively important spectral coefficients, and the allocated bits are used to encode the relatively important spectral coefficients during encoding. However, no bit is allocated for a spectral coefficient (that is, a less important spectral coefficient) except the relatively important spectral coefficients, and the less important spectral coefficient is not encoded. For the spectral coefficients for which bits are allocated, because a quantity of bits that can be allocated is insufficient, there are a part of spectral coefficients with insufficient allocated bits. During encoding, there are no sufficient bits to encode the spectral coefficients with insufficient allocated bits, for example, only a small number of spectral coefficients in a subband are encoded.
Corresponding to an encoder, only the relatively important spectral coefficients are decoded at a decoder, and a less important spectral coefficient that has not been obtained by means of decoding is filled with a value of 0. If no processing is performed on a spectral coefficient that has not been obtained by means of decoding, a decoding effect is severely affected. For example, for decoding of an audio signal, an audio signal that is finally output sounds “an empty feeling” or “a sound of water” or the like, which severely affects auditory quality. Therefore, the spectral coefficient that has not been obtained by means of decoding needs to be restored using a noise filling method in order to output a signal of better quality. In an example (that is, a noise filling example) of restoring the spectral coefficient that has not been obtained by means of decoding, a spectral coefficient obtained by means of decoding may be saved in an array, and a spectral coefficient in the array is replicated to a location of a spectral coefficient in a subband for which no bit is allocated. The spectral coefficient that has not been obtained by means of decoding is restored by replacing the spectral coefficient that has not been obtained by means of decoding with a saved spectral coefficient that has been obtained by means of decoding.
In the foregoing solution to restoring a spectral coefficient that has not been obtained by means of decoding, only a spectral coefficient that has not been obtained by means of decoding and is in a subband for which no bit is allocated is restored, and quality of a decoded signal is not good enough.
Embodiments of the present disclosure provide a method and device for decoding a signal, which can improve signal decoding quality.
According to a first aspect, a method for decoding a signal is provided, where the method includes obtaining spectral coefficients of subbands from a received bitstream by means of decoding, classifying subbands in which the spectral coefficients are located into a subband with saturated bit allocation and a subband with unsaturated bit allocation, performing noise filling on a spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation in order to restore the spectral coefficient that has not been obtained by means of decoding, and obtaining a frequency domain signal according to the spectral coefficients obtained by means of decoding and the restored spectral coefficient.
With reference to the first aspect, in a first implementation manner of the first aspect, classifying subbands in which the spectral coefficients are located into a subband with saturated bit allocation and a subband with unsaturated bit allocation may include comparing an average quantity of allocated bits per spectral coefficient with a first threshold, where an average quantity of allocated bits per spectral coefficient of one subband is a ratio of a quantity of bits allocated for the one subband to a quantity of spectral coefficients in the one subband, and using a subband whose average quantity of allocated bits per spectral coefficient is greater than or equal to the first threshold as a subband with saturated bit allocation, and using a subband whose average quantity of allocated bits per spectral coefficient is less than the first threshold as a subband with unsaturated bit allocation.
With reference to the first aspect or the first implementation manner of the first aspect, in a second implementation manner of the first aspect, performing noise filling on a spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation may include comparing the average quantity of allocated bits per spectral coefficient with a second threshold, where an average quantity of allocated bits per spectral coefficient of one subband is a ratio of a quantity of bits allocated for the one subband to a quantity of spectral coefficients in the one subband, calculating a harmonic parameter of a subband whose average quantity of allocated bits per spectral coefficient is greater than or equal to the second threshold, where the harmonic parameter represents harmonic strength or weakness of a frequency domain signal, and performing, based on the harmonic parameter, noise filling on the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation.
With reference to the second implementation manner of the first aspect, in a third implementation manner of the first aspect, calculating a harmonic parameter of a subband whose average quantity of allocated bits per spectral coefficient is greater than or equal to the second threshold may include calculating at least one parameter of, a peaktoaverage ratio, a peak envelope ratio, sparsity of a spectral coefficient obtained by means of decoding, a bit allocation variance of an entire frame, an average envelope ratio, an averagetopeak ratio, an envelope peak ratio, and an envelope average ratio that are of the subband whose average quantity of allocated bits per spectral coefficient is greater than or equal to the second threshold, and using one of the calculated at least one parameter or using, in a combining manner, the calculated parameter as the harmonic parameter.
With reference to the second or the third implementation manner of the first aspect, in a fourth implementation manner of the first aspect, performing, based on the harmonic parameter, noise filling on the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation may include calculating, according to an envelope of the subband with unsaturated bit allocation and a spectral coefficient obtained by means of decoding, a noise filling gain of the subband with unsaturated bit allocation, calculating the peaktoaverage ratio of the subband whose average quantity of allocated bits per spectral coefficient is greater than or equal to the second threshold and obtaining a global noise factor based on the peaktoaverage ratio, correcting the noise filling gain based on the harmonic parameter and the global noise factor in order to obtain a target gain, and using the target gain and a weighted value of noise to restore the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation.
With reference to the fourth implementation manner of the first aspect, in a fifth implementation manner of the first aspect, performing, based on the harmonic parameter, noise filling on the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation may further include calculating a peaktoaverage ratio of the subband with unsaturated bit allocation and comparing the peaktoaverage ratio with a third threshold, and for a subband, whose peaktoaverage ratio is greater than the third threshold, with unsaturated bit allocation, after a target gain is obtained, using a ratio of an envelope of the subband with unsaturated bit allocation to a maximum amplitude of a spectral coefficient, obtained by means of decoding, in the subband with unsaturated bit allocation to correct the target gain.
With reference to the fourth implementation manner of the first aspect, in a sixth implementation manner of the first aspect, correcting the noise filling gain based on the harmonic parameter and the global noise factor in order to obtain a target gain may include comparing the harmonic parameter with a fourth threshold, obtaining the target gain using gain_{T}=fac*gain*norm/peak when the harmonic parameter is greater than or equal to the fourth threshold, and obtaining the target gain using gain_{T}=fac′*gain and fac′=fac+step when the harmonic parameter is less than the fourth threshold, where gain_{T }is the target gain, fac is the global noise factor, norm is the envelope of the subband with unsaturated bit allocation, peak is a maximum amplitude of the spectral coefficient, obtained by means of decoding, in the subband with unsaturated bit allocation, and step is a step by which the global noise factor changes according to a frequency.
With reference to the fourth implementation manner or the sixth implementation manner of the first aspect, in a seventh implementation manner of the first aspect, performing, based on the harmonic parameter, noise filling on the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation may further include performing interframe smoothing processing on the restored spectral coefficient after the spectral coefficient that has not been obtained by means of decoding is restored.
With reference to the first aspect or the first implementation manner of the first aspect, in an eighth implementation manner of the first aspect, performing noise filling on a spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation includes comparing the average quantity of allocated bits per spectral coefficient with 0, where an average quantity of allocated bits per spectral coefficient of one subband is a ratio of a quantity of bits allocated for the one subband to a quantity of spectral coefficients in the one subband, calculating a harmonic parameter of a subband whose average quantity of allocated bits per spectral coefficient is not equal to 0, where the harmonic parameter represents harmonic strength or weakness of a frequency domain signal, and performing, based on the harmonic parameter, noise filling on the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation.
With reference to the eighth implementation manner of the first aspect, in a ninth implementation manner of the first aspect, calculating a harmonic parameter of a subband whose average quantity of allocated bits per spectral coefficient is not equal to 0 includes calculating at least one parameter of, a peaktoaverage ratio, a peak envelope ratio, sparsity of a spectral coefficient obtained by means of decoding, a bit allocation variance of an entire frame, an average envelope ratio, an averagetopeak ratio, an envelope peak ratio, and an envelope average ratio that are of the subband whose average quantity of allocated bits per spectral coefficient is not equal to 0, and using one of the calculated at least one parameter or using, in a combining manner, the calculated parameter as the harmonic parameter.
With reference to the ninth implementation manner of the first aspect, in a tenth implementation manner of the first aspect, performing, based on the harmonic parameter, noise filling on the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation includes calculating, according to an envelope of the subband with unsaturated bit allocation and a spectral coefficient obtained by means of decoding, a noise filling gain of the subband with unsaturated bit allocation, calculating the peaktoaverage ratio of the subband whose average quantity of allocated bits per spectral coefficient is not equal to 0 and obtaining a global noise factor based on the peaktoaverage ratio, correcting the noise filling gain based on the harmonic parameter and the global noise factor in order to obtain a target gain, and using the target gain and a weighted value of noise to restore the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation.
With reference to the tenth implementation manner of the first aspect, in an eleventh implementation manner of the first aspect, performing, based on the harmonic parameter, noise filling on the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation further includes calculating a peaktoaverage ratio of the subband with unsaturated bit allocation and comparing the peaktoaverage ratio with a third threshold, and for a subband, whose peaktoaverage ratio is greater than the third threshold, with unsaturated bit allocation, after a target gain is obtained, using a ratio of an envelope of the subband with unsaturated bit allocation to a maximum amplitude of a spectral coefficient, obtained by means of decoding, in the subband with unsaturated bit allocation to correct the target gain.
With reference to the tenth implementation manner of the first aspect, in a twelfth implementation manner of the first aspect, correcting the noise filling gain based on the harmonic parameter and the global noise factor in order to obtain a target gain includes comparing the harmonic parameter with a fourth threshold, obtaining the target gain using gain_{T}=fac*gain*norm/peak when the harmonic parameter is greater than or equal to the fourth threshold, and obtaining the target gain using gain_{T}=fac′*gain and fac′=fac+step when the harmonic parameter is less than the fourth threshold, where gain_{T }is the target gain, fac is the global noise factor, norm is the envelope of the subband with unsaturated bit allocation, peak is a maximum amplitude of the spectral coefficient, obtained by means of decoding, in the subband with unsaturated bit allocation, and step is a step by which the global noise factor changes according to a frequency.
With reference to the tenth implementation manner or the twelfth implementation manner of the first aspect, in a thirteenth implementation manner of the first aspect, performing, based on the harmonic parameter, noise filling on the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation further includes after the spectral coefficient that has not been obtained by means of decoding is restored, performing interframe smoothing processing on the restored spectral coefficient.
According to a second aspect, a device for decoding a signal is provided, where the device includes a decoding unit configured to obtain spectral coefficients of subbands from a received bitstream by means of decoding, a classifying unit configured to classify subbands in which the spectral coefficients are located into a subband with saturated bit allocation and a subband with unsaturated bit allocation, where the subband with saturated bit allocation refers to a subband in which allocated bits can be used to encode all spectral coefficients in the subband, and the subband with unsaturated bit allocation refers to a subband in which allocated bits can be used to encode only a part of spectral coefficients in the subband, and a subband for which no bit is allocated, a restoring unit configured to perform noise filling on a spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation in order to restore the spectral coefficient that has not been obtained by means of decoding, and an output unit configured to obtain a frequency domain signal according to the spectral coefficients obtained by means of decoding and the restored spectral coefficient.
With reference to the second aspect, in a first implementation manner of the second aspect, the classifying unit may include a comparing component configured to compare an average quantity of allocated bits per spectral coefficient with a first threshold, where the average quantity of allocated bits per spectral coefficient is a ratio of a quantity of bits allocated for each subband to a quantity of spectral coefficients in each subband, and a classifying component configured to classify a subband whose average quantity of allocated bits per spectral coefficient is greater than or equal to the first threshold as a subband with saturated bit allocation, and classify a subband whose average quantity of allocated bits per spectral coefficient is less than the first threshold as a subband with unsaturated bit allocation.
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 restoring unit may include a calculating component configured to compare the average quantity of allocated bits per spectral coefficient with a second threshold, and calculate a harmonic parameter of a subband whose average quantity of allocated bits per spectral coefficient is greater than or equal to the second threshold, where an average quantity of allocated bits per spectral coefficient of one subband is a ratio of a quantity of bits allocated for the one subband to a quantity of spectral coefficients in the one subband, and the harmonic parameter represents harmonic strength or weakness of a frequency domain signal, and a filling component configured to perform, based on the harmonic parameter, noise filling on the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation in order to restore the spectral coefficient that has not been obtained by means of decoding.
With reference to the second implementation manner of the second aspect, in a third implementation manner of the second aspect, calculating component may calculate the harmonic parameter using the following operations of calculating at least one parameter of a peaktoaverage ratio, a peak envelope ratio, sparsity of a spectral coefficient obtained by means of decoding, and a bit allocation variance of an entire frame that are of the subband whose average quantity of allocated bits per spectral coefficient is greater than or equal to the second threshold, and using one of the calculated at least one parameter or using, in a combining manner, the calculated parameter as the harmonic parameter.
With reference to the second implementation manner or the third implementation manner of the second aspect, in a fourth implementation manner of the second aspect, the filling component may include a gain calculating module configured to calculate, according to an envelope of the subband with unsaturated bit allocation and a spectral coefficient obtained by means of decoding, a noise filling gain of the subband with unsaturated bit allocation, calculate the peaktoaverage ratio of the subband whose average quantity of allocated bits per spectral coefficient is greater than or equal to the second threshold and obtain a global noise factor based on a peaktoaverage ratio of the subband with saturated bit allocation, and correct the noise filling gain based on the harmonic parameter and the global noise factor in order to obtain a target gain, and a filling module configured to use the target gain and a weighted value of noise to restore the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation.
With reference to the fourth implementation manner of the second aspect, in a fifth implementation manner of the second aspect, the filling component further includes a correction module configured to calculate a peaktoaverage ratio of the subband with unsaturated bit allocation and compare the peaktoaverage ratio with a third threshold, and for a subband, whose peaktoaverage ratio is greater than the third threshold, with unsaturated bit allocation, after a target gain is obtained, use a ratio of an envelope of the subband with unsaturated bit allocation to a maximum amplitude of a spectral coefficient, obtained by means of decoding, in the subband with unsaturated bit allocation to correct the target gain in order to obtain a corrected target gain, where the filling module uses the corrected target gain and the weighted value of noise to restore the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation.
With reference to the fourth implementation manner or the fifth implementation manner of the second aspect, in a sixth implementation manner of the second aspect, the gain calculating module may correct, using the following operations, the noise filling gain based on the harmonic parameter and the global noise factor, comparing the harmonic parameter with a fourth threshold, obtaining the target gain using gain_{T}=fac*gain*norm/peak when the harmonic parameter is greater than or equal to the fourth threshold, and obtaining the target gain using gain_{T}=fac′*gain and fac′=fac+step when the harmonic parameter is less than the fourth threshold, where gain_{T }is the target gain, fac is the global noise factor, norm is the envelope of the subband with unsaturated bit allocation, peak is a maximum amplitude of the spectral coefficient, obtained by means of decoding, in the subband with unsaturated bit allocation, and step is a step by which the global noise factor changes according to a frequency.
With reference to the fourth implementation manner or the fifth implementation manner or the sixth implementation manner of the second aspect, in a seventh implementation manner of the second aspect, the filling component further includes an interframe smoothing module configured to perform interframe smoothing processing on the restored spectral coefficient to obtain a spectral coefficient on which smoothing processing has been performed after the spectral coefficient that has not been obtained by means of decoding is restored, where the output unit is configured to obtain the frequency domain signal according to the spectral coefficients obtained by means of decoding and the spectral coefficient on which smoothing processing has been performed.
With reference to the second aspect or the first implementation manner of the second aspect, in an eighth implementation manner of the second aspect, the restoring unit includes a calculating component configured to compare the average quantity of allocated bits per spectral coefficient with 0, and calculate a harmonic parameter of a subband whose average quantity of allocated bits per spectral coefficient is not equal to 0, where an average quantity of allocated bits per spectral coefficient of one subband is a ratio of a quantity of bits allocated for the one subband to a quantity of spectral coefficients in the one subband, and the harmonic parameter represents harmonic strength or weakness of a frequency domain signal, and a filling component configured to perform, based on the harmonic parameter, noise filling on the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation in order to restore the spectral coefficient that has not been obtained by means of decoding.
With reference to the eighth implementation manner of the second aspect, in a ninth implementation manner of the second aspect, the calculating component calculates the harmonic parameter using the following operations calculating at least one parameter of a peaktoaverage ratio, a peak envelope ratio, sparsity of a spectral coefficient obtained by means of decoding, a bit allocation variance of an entire frame, an average envelope ratio, an averagetopeak ratio, an envelope peak ratio, and an envelope average ratio that are of the subband whose average quantity of allocated bits per spectral coefficient is not equal to 0, and using one of the calculated at least one parameter or using, in a combining manner, the calculated parameter as the harmonic parameter.
With reference to the ninth implementation manner of the second aspect, in a tenth implementation manner of the second aspect, the filling component includes a gain calculating module configured to calculate, according to an envelope of the subband with unsaturated bit allocation and a spectral coefficient obtained by means of decoding, a noise filling gain of the subband with unsaturated bit allocation, calculate the peaktoaverage ratio of the subband whose average quantity of allocated bits per spectral coefficient is not equal to 0 and obtain a global noise factor based on the peaktoaverage ratio, and correct the noise filling gain based on the harmonic parameter and the global noise factor in order to obtain a target gain, and a filling module configured to use the target gain and a weighted value of noise to restore the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation.
With reference to the tenth implementation manner of the second aspect, in an eleventh implementation manner of the second aspect, the filling component further includes a correction module configured to calculate a peaktoaverage ratio of the subband with unsaturated bit allocation and compare the peaktoaverage ratio with a third threshold, and for a subband, whose peaktoaverage ratio is greater than the third threshold, with unsaturated bit allocation, after a target gain is obtained, use a ratio of an envelope of the subband with unsaturated bit allocation to a maximum amplitude of a spectral coefficient, obtained by means of decoding, in the subband with unsaturated bit allocation to correct the target gain in order to obtain a corrected target gain, where the filling module uses the corrected target gain and the weighted value of noise to restore the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation.
With reference to the tenth implementation manner of the second aspect, in a twelfth implementation manner of the second aspect, the gain calculating module corrects, using the following operations, the noise filling gain based on the harmonic parameter and the global noise factor comparing the harmonic parameter with a fourth threshold, obtaining the target gain using gain_{T}=fac*gain*norm/peak when the harmonic parameter is greater than or equal to the fourth threshold, and obtaining the target gain using gain_{T}=fac′*gain and fac′=fac+step when the harmonic parameter is less than the fourth threshold, where gain_{T }is the target gain, fac is the global noise factor, norm is the envelope of the sub band with unsaturated bit allocation, peak is a maximum amplitude of the spectral coefficient, obtained by means of decoding, in the subband with unsaturated bit allocation, and step is a step by which the global noise factor changes according to a frequency.
With reference to the tenth implementation manner or the twelfth implementation manner of the second aspect, in a thirteenth implementation manner of the second aspect, the filling component further includes an interframe smoothing module configured to perform interframe smoothing processing on the restored spectral coefficient to obtain a spectral coefficient on which smoothing processing has been performed, after the spectral coefficient that has not been obtained by means of decoding is restored, where the output unit is configured to obtain the frequency domain signal according to the spectral coefficients obtained by means of decoding and the spectral coefficient on which smoothing processing has been performed.
According to the embodiments of the present disclosure, a subband with unsaturated bit allocation in spectral coefficients may be obtained by means of classification, and a spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation is restored instead of merely restoring a spectral coefficient that has not been obtained by means of decoding and is in a subband with no bit allocated, thereby improving signal decoding quality.
To describe the technical solutions in some of the embodiments of the present disclosure more clearly, the following briefly introduces the accompanying drawings describing some of the embodiments. 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. The described embodiments are 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.
The present disclosure provides a frequency domain decoding method. An encoder groups spectral coefficients into subbands and allocates encoding bits for each subband. Spectral coefficients in the subband are quantized according to bits allocated for each subband in order to obtain an encoding bitstream. When a bit rate is low and a quantity of bits that can be allocated is insufficient, the encoder allocates bits only to a relatively important spectral coefficient. For the subbands, allocated bits have different cases allocated bits may be used to encode all spectral coefficients in a subband, allocated bits may be used to encode only a part of spectral coefficients in a subband, or no bit is allocated for a subband. When allocated bits may be used to encode all spectral coefficients in a subband, a decoder can directly obtain all the spectral coefficients in the subband by means of decoding. When no bit is allocated for the subband, the decoder cannot obtain a spectral coefficient of the subband by means of decoding and restores, using a noise filling method, a spectral coefficient that has not been obtained by means of decoding. When allocated bits can be used to encode only a part of spectral coefficients in a subband, the decoder may restore a part of spectral coefficients in the subband, and a spectral coefficient that has not been obtained by means of decoding (that is, a spectral coefficient not encoded by the encoder) is restored using noise filling.
The technical solutions for decoding a signal in the embodiments of the present disclosure may be applied to various communications systems, for example, a Global System for Mobile Communications (GSM), a Code Division Multiple Access (CDMA) system, Wideband Code Division Multiple Access (WCDMA), a general packet radio service (GPRS), and Long Term Evolution (LTE). Communications systems or devices to which the technical solutions for decoding a signal in the embodiments of the present disclosure are applied do not constitute a limitation on the present disclosure.
The method 100 for decoding a signal includes the following steps.
Step 110: Obtain spectral coefficients of subbands from a received bitstream by means of decoding.
Step 120: Classify subbands in which the spectral coefficients are located into a subband with saturated bit allocation and a subband with unsaturated bit allocation, where the subband with saturated bit allocation refers to a subband in which allocated bits can be used to encode all spectral coefficients in the subband, and the subband with unsaturated bit allocation refers to a subband in which allocated bits can be used to encode only a part of spectral coefficients in the subband, and a subband for which no bit is allocated.
Step 130: Perform noise filling on a spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation to restore the spectral coefficient that has not been obtained by means of decoding.
Step 140: Obtain a frequency domain signal according to the spectral coefficients obtained by means of decoding and the restored spectral coefficient.
In step 110, obtaining spectral coefficients of subbands from a received bitstream by means of decoding may include obtaining the spectral coefficients from the received bitstream by means of decoding, and grouping the spectral coefficients into the subbands. The spectral coefficients may be spectral coefficients of the following classes of signals such as an image signal, a data signal, an audio signal, a video signal, and a text signal. The spectral coefficients may be acquired using various decoding methods. A specific signal class and decoding method does not constitute a limitation on the present disclosure.
An encoder groups the spectral coefficients into the subbands and allocates encoding bits for each subband. After using a subband classification method the same as that of the encoder to obtain the spectral coefficients by means of decoding, a decoder groups, according to frequencies of spectral coefficients, the spectral coefficients obtained by means of decoding into the subbands.
In an example, a frequency band in which the spectral coefficients are located may be evenly grouped into multiple subbands, and then the spectral coefficients are grouped, according to a frequency of each spectral coefficient, into the subbands in which the frequencies are located. In addition, the spectral coefficients may be grouped into subbands of a frequency domain according to various existing or future classification methods, and then various processing is performed.
In step 120, the subbands in which the spectral coefficients are located are classified into a subband with saturated bit allocation and a subband with unsaturated bit allocation, where the subband with saturated bit allocation refers to a subband in which allocated bits can be used to encode all spectral coefficients in the subband, and the subband with unsaturated bit allocation refers to a subband in which allocated bits can be used to encode only a part of spectral coefficients in the subband, and a subband for which no bit is allocated. When bit allocation of a spectral coefficient is saturated, even if more bits are allocated for the spectral coefficient, quality of a signal obtained by means of decoding is not remarkably improved.
In an example, it may be learned, according to an average quantity of allocated bits per spectral coefficient in a subband, whether bit allocation of the subband is saturated. Further, the average quantity of allocated bits per spectral coefficient is compared with a first threshold, where the average quantity of allocated bits per spectral coefficient is a ratio of a quantity of bits allocated for each subband to a quantity of spectral coefficients in each subband, that is, an average quantity of allocated bits per spectral coefficient of one subband is a ratio of a quantity of bits allocated for the one subband to a quantity of spectral coefficients in the one subband, a subband whose average quantity of allocated bits per spectral coefficient is greater than or equal to the first threshold is used as a subband with saturated bit allocation and a subband whose average quantity of allocated bits per spectral coefficient is less than the first threshold is used as a subband with unsaturated bit allocation. In an example, the average quantity of allocated bits per spectral coefficient in a subband may be obtained by dividing a quantity of bits allocated for the subband by a quantity of spectral coefficients in the subband. The first threshold may be preset, or may be easily obtained, for example, by an experiment. For an audio signal, the first threshold may be 1.5 bits/spectral coefficient.
In step 130, noise filling is performed on the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation in order to restore the spectral coefficient that has not been obtained by means of decoding. The subband with unsaturated bit allocation includes a subband whose spectral coefficient has no allocated bit and a subband for which bits is allocated but the allocated bits are insufficient. Various noise filling methods may be used to restore the spectral coefficient that has not been obtained by means of decoding.
In other approaches, only a spectral coefficient that has not been obtained by means of decoding and is in a subband for which no bit is allocated is restored, and a spectral coefficient that has not been obtained by means of decoding and exists due to insufficient bit allocation in a subband for which bits are allocated is not restored. In addition, the spectral coefficients obtained by means of decoding are generally not much related to the spectral coefficient that has not been obtained by means of decoding, and it is difficult to obtain a good decoding effect directly by performing replication. In this embodiment of the present disclosure, a new noise filling method is put forward, that is, noise filling is performed based on a harmonic parameter harm of a subband whose quantity of bits is greater than or equal to a second threshold. Further, the average quantity of allocated bits per spectral coefficient is compared with the second threshold, where the average quantity of allocated bits per spectral coefficient is the ratio of the quantity of bits allocated for each subband to the quantity of spectral coefficients in each subband, that is, an average quantity of allocated bits per spectral coefficient of one subband is a ratio of a quantity of bits allocated for the one subband to a quantity of spectral coefficients in the one subband, a harmonic parameter of a subband whose average quantity of allocated bits per spectral coefficient is greater than or equal to the second threshold is calculated, where the harmonic parameter represents harmonic strength or weakness of a frequency domain signal, and noise filling is performed, based on the harmonic parameter, on the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation. The second threshold may be preset, and the second threshold is less than or equal to the foregoing first threshold and may be another threshold such as 1.3 bits/spectral coefficient. The harmonic parameter harm is used to represent the harmonic strength or weakness of a frequency domain signal. In a case in which harmonicity of a frequency domain signal is strong, there are a relatively large quantity of spectral coefficients with a value of 0 in the spectral coefficients obtained by means of decoding, and noise filling does not need to be performed on these spectral coefficients with the value of 0. Therefore, if noise filling is differentially performed, based on the harmonic parameter, on the spectral coefficient (that is, a spectral coefficient with the value of 0) that has not been obtained by means of decoding, an error of noise filling performed on the spectral coefficients, obtained by means of decoding, with the value of 0 may be avoided, thereby improving signal decoding quality.
The harmonic parameter harm of the subband whose average quantity of allocated bits per spectral coefficient is greater than or equal to the second threshold may be represented by one or more of a peaktoaverage ratio (that is, a ratio of a peak value to an average amplitude), a peak envelope ratio, sparsity of a spectral coefficient obtained by means of decoding, a bit allocation variance of an entire frame, an average envelope ratio, an averagetopeak ratio (that is, a ratio of an average amplitude to a peak value), an envelope peak ratio, and an envelope average ratio that are of the subband. A manner of calculating a harmonic parameter is briefly described herein in order to disclose the present disclosure with more details.
A peaktoaverage ratio sharp of a subband may be calculated using the following formula (1):
where peak is a maximum amplitude of a spectral coefficient that is obtained by means of decoding and in a subband whose index is sfm, size_sfm is a quantity of spectral coefficients in the subband sfm or a quantity of spectral coefficients that are obtained by means of decoding and in the subband sfm, and mean is a sum of amplitudes of all spectral coefficients. A peak envelope ratio PER of a subband may be calculated using the following formula (2):
where peak is the maximum amplitude of the spectral coefficient that is obtained by means of decoding and in the subband sfm, and norm[sfm] is an envelope of the spectral coefficient that is obtained by means of decoding and in the subband sfm. Sparsity spar of a subband is used to represent whether spectral coefficients in the subband are centrally distributed at several frequency bins or are sparsely distributed in the entire subband, and the sparsity may be calculated using the following formula (3):
where num_de_coef is a quantity of spectral coefficients that are obtained by means of decoding and in a subband, pos_max is a highest frequency location of spectral coefficients that are obtained by means of decoding and in the subband, and pos_min is a lowest frequency location of the spectral coefficients that are obtained by means of decoding and in the subband. A bit allocation variance var of an entire frame may be calculated using the following formula (4):
where last_sfm represents a highest frequency subband for which bits are allocated in the entire frame, bit[sfm] represents a quantity of bits allocated for the subband sfm, bit[sfm1] represents a quantity of bits allocated for a subband sfm1, and total_bit represents a total quantity of bits allocated for all subbands. Larger values of the peaktoaverage ratio sharp, the peak envelope ratio PER, the sparsity spar, and the bit allocation variance var indicate stronger harmonicity of a frequency domain signal, on the contrary, smaller values of the peaktoaverage ratio sharp, the peak envelope ratio PER, the sparsity spar, and the bit allocation variance (var) indicate weaker harmonicity of the frequency domain signal. In addition, the four harmonic parameters may be used in a combining manner to represent harmonic strength or weakness. In practice, an appropriate combining manner may be selected according to a requirement. Typically, weighted summation may be performed on two or more of the four parameters and an obtained sum is used as a harmonic parameter. Therefore, the harmonic parameter may be calculated using the following operations of calculating at least one parameter of the peaktoaverage ratio, the peak envelope ratio, the sparsity of a spectral coefficient obtained by means of decoding, and the bit allocation variance of an entire frame that are of the subband whose average quantity of allocated bits per spectral coefficient is greater than or equal to the second threshold, and using one of the calculated at least one parameter or using, in a combining manner, the calculated parameter as the harmonic parameter. It should be noted that a parameter of another definition form may further be used in addition to the four parameters provided that the parameter of another definition form can represent harmonicity of a frequency domain signal.
As described above, after the harmonic parameter is obtained, noise filling is performed, based on the harmonic parameter, on the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation, which is described below in detail with reference to
In step 140, the frequency domain signal is obtained according to the spectral coefficients obtained by means of decoding and the restored spectral coefficient. After the spectral coefficients obtained by means of decoding are obtained by means of decoding and the spectral coefficient that has not been obtained by means of decoding is restored, a frequency domain signal in an entire frequency band is obtained, and an output signal of a time domain is obtained by performing processing such as frequency domain inverse transformation, for example, inverse fast Fourier transform (IFFT). In practice, an engineering person skilled in the art understands a solution to how an output signal of a time domain is obtained according to a spectral coefficient, and details are not described herein again.
In the foregoing method for decoding a signal in this embodiment of the present disclosure, a subband with unsaturated bit allocation in subbands of a frequency domain signal is obtained by means of classification, and a spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation is restored, thereby improving signal decoding quality. In addition, in a case in which a spectral coefficient that has not been obtained by means of decoding is restored based on a harmonic parameter, an error of noise filling performed on spectral coefficients, obtained by means of decoding, with a value of 0 may be avoided, thereby further improving signal decoding quality.
The noise filling processing 200 includes the following steps.
Step 210: Calculate, according to an envelope of a subband with unsaturated bit allocation and a spectral coefficient obtained by means of decoding, a noise filling gain of the subband with unsaturated bit allocation.
Step 220: Calculate a peaktoaverage ratio of a subband whose average quantity of allocated bits per spectral coefficient is greater than or equal to a second threshold and obtain a global noise factor based on a peaktoaverage ratio of the subband with saturated bit allocation.
Step 230: Correct the noise filling gain based on a harmonic parameter and the global noise factor to obtain a target gain.
Step 240: Set the target gain and a weighted value of noise to restore a spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation.
In step 210, for the subband sfm with unsaturated bit allocation, a noise filling gain of the subband sfm with unsaturated bit allocation may be calculated according to the following formula (5) or (6):
where norm[sfm] is the envelope of the spectral coefficient that has been obtained by means of decoding and is in the subband (an index is sfm) with unsaturated bit allocation, coef[i] is the, i^{th }spectral coefficient that has been obtained by means of decoding and is in a subband with unsaturated bit allocation, and size_sfm is a quantity of spectral coefficients in the subband sfm with unsaturated bit allocation or a quantity of spectral coefficients that has been obtained by means of decoding and is in the subband sfm.
In step 220, the global noise factor may be calculated based on the peaktoaverage ratio sharp of the subband with saturated bit allocation (referring to the foregoing description with reference to formula (1). Further, an average value of the peaktoaverage ratio sharp may be calculated, and a multiple of a reciprocal of the average value is used as the global noise factor fac.
In step 230, the noise filling gain is corrected based on the harmonic parameter and the global noise factor to obtain the target gain gain_{T}. In an example, the target gain gain_{T }may be obtained according to the following formula (7):
gain_{T}=fac×harm×gain formula (7),
where fac is the global noise factor, harm is the harmonic parameter, and gain is the noise filling gain. In another example, it may also be that harmonic strength or weakness is determined first, and then the target gain gain_{T }is obtained in a different manner according to the harmonic strength or weakness. For example, the harmonic parameter is compared with a fourth threshold.
When the harmonic parameter is greater than or equal to the fourth threshold, the target gain gain_{T }is obtained using the following formula (8):
gain_{T}=fac*gain*norm[sfm]/peak formula (8)
When the harmonic parameter is less than the fourth threshold, the target gain gain_{T }is obtained using the following formula (9):
gain_{T}=fac′*gain,fac′=fac+step formula (9),
where fac is the global noise factor, norm[sfm] is the envelope of the subband sfm with unsaturated bit allocation, peak is a maximum amplitude of the spectral coefficient, obtained by means of decoding, in the subband with unsaturated bit allocation, and step is a step by which the global noise factor changes according to a frequency. The global noise factor increases from a low frequency to a high frequency according to the step, and the step may be determined according to a highest frequency subband for which bits are allocated, or the global noise factor. The fourth threshold may be preset, or may be set to a different value in practice according to a different signal feature.
In step 240, the target gain and the weighted value of noise are used to restore the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation. In an example, the target gain and the weighted value of noise may be used to obtain filling noise, and the filling noise is used to perform noise filling on the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation to restore a frequency domain signal that has not been obtained by means of decoding. The noise may be noise, such as random noise, of any type. It should be noted that, the noise may further be used first herein to fill the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation, and then the target gain is exerted on the filling noise in order to restore the spectral coefficient that has not been obtained by means of decoding. In addition, after noise filling is performed on the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation (that is, the spectral coefficient that has not been obtained by means of decoding is restored), interframe smoothing processing may further be performed on a restored spectral coefficient to achieve a better decoding effect.
In foregoing steps of
In addition, an abnormal subband with a large peaktoaverage ratio may exist in the subband with unsaturated bit allocation, and a target gain of the abnormal subband may further be corrected in order to obtain a target gain that is more suitable for the abnormal subband. Further, a peaktoaverage ratio of a spectral coefficient of the subband whose average quantity of allocated bits per spectral coefficient is greater than or equal to the second threshold may be calculated, and the peaktoaverage ratio is compared with a third threshold, and for a subband whose peaktoaverage ratio is greater than the third threshold, after a target gain is obtained in step 230, a ratio (norm[sfm]/peak) of an envelope of the subband with unsaturated bit allocation to a maximum signal amplitude of the subband with unsaturated bit allocation may be used to correct the target gain of the subband whose peaktoaverage ratio is greater than the third threshold. The third threshold may be preset according to a requirement.
A flow of a method for decoding a signal provided in an embodiment of the present disclosure includes obtaining spectral coefficients of subbands from a received bitstream by means of decoding, classifying subbands in which the spectral coefficients are located into a subband with saturated bit allocation and a subband with unsaturated bit allocation, performing noise filling on a spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation in order to restore the spectral coefficient that has not been obtained by means of decoding, and obtaining a frequency domain signal according to the spectral coefficients obtained by means of decoding and the restored spectral coefficient.
In another embodiment of the present disclosure, classifying subbands in which the spectral coefficients are located into a subband with saturated bit allocation and a subband with unsaturated bit allocation may include comparing an average quantity of allocated bits per spectral coefficient with a first threshold, where an average quantity of allocated bits per spectral coefficient of one subband is a ratio of a quantity of bits allocated for the one subband to a quantity of spectral coefficients in the one subband, and using a subband whose average quantity of allocated bits per spectral coefficient is greater than or equal to the first threshold as a subband with saturated bit allocation, and using a subband whose average quantity of allocated bits per spectral coefficient is less than the first threshold as a subband with unsaturated bit allocation.
In another embodiment of the present disclosure, performing noise filling on a spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation may include comparing the average quantity of allocated bits per spectral coefficient with 0, where an average quantity of allocated bits per spectral coefficient of one subband is a ratio of a quantity of bits allocated for the one subband to a quantity of spectral coefficients in the one subband, calculating a harmonic parameter of a subband whose average quantity of allocated bits per spectral coefficient is not equal to 0, where the harmonic parameter represents harmonic strength or weakness of a frequency domain signal, and performing, based on the harmonic parameter, noise filling on the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation.
In another embodiment of the present disclosure, calculating a harmonic parameter of a subband whose average quantity of allocated bits per spectral coefficient is not equal to 0 may include calculating at least one parameter of a peaktoaverage ratio, a peak envelope ratio, sparsity of a spectral coefficient obtained by means of decoding, a bit allocation variance of an entire frame, an average envelope ratio, an averagetopeak ratio, an envelope peak ratio, and an envelope average ratio that are of the subband whose average quantity of allocated bits per spectral coefficient is not equal to 0, and using one of the calculated at least one parameter or using, in a combining manner, the calculated parameter as the harmonic parameter.
In another embodiment of the present disclosure, performing, based on the harmonic parameter, noise filling on the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation may include calculating, according to an envelope of the subband with unsaturated bit allocation and a spectral coefficient obtained by means of decoding, a noise filling gain of the subband with unsaturated bit allocation, calculating the peaktoaverage ratio of the subband whose average quantity of allocated bits per spectral coefficient is not equal to 0 and obtaining a global noise factor based on the peaktoaverage ratio, correcting the noise filling gain based on the harmonic parameter and the global noise factor in order to obtain a target gain, and using the target gain and a weighted value of noise to restore the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation.
In another embodiment of the present disclosure, performing, based on the harmonic parameter, noise filling on the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation may further include calculating a peaktoaverage ratio of the subband with unsaturated bit allocation and comparing the peaktoaverage ratio with a third threshold, and for a subband, whose peaktoaverage ratio is greater than the third threshold, with unsaturated bit allocation, after a target gain is obtained, using a ratio of an envelope of the subband with unsaturated bit allocation to a maximum amplitude of a spectral coefficient, obtained by means of decoding, in the subband with unsaturated bit allocation to correct the target gain.
In another embodiment of the present disclosure, correcting the noise filling gain based on the harmonic parameter and the global noise factor in order to obtain a target gain may include comparing the harmonic parameter with a fourth threshold, obtaining the target gain using gain_{T}=fac*gain*norm/peak when the harmonic parameter is greater than or equal to the fourth threshold, and obtaining the target gain using gain_{T}=fac′*gain and fac′=fac+step when the harmonic parameter is less than the fourth threshold, where gain_{T }is the target gain, fac is the global noise factor, norm is the envelope of the subband with unsaturated bit allocation, peak is a maximum amplitude of the spectral coefficient, obtained by means of decoding, in the subband with unsaturated bit allocation, and step is a step by which the global noise factor changes according to a frequency.
In another embodiment of the present disclosure, performing, based on the harmonic parameter, noise filling on the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation may further include performing interframe smoothing processing on the restored spectral coefficient after the spectral coefficient that has not been obtained by means of decoding is restored.
As shown in
The decoding unit 310 may receive a bitstream of various classes of signals and use various decoding methods to perform decoding in order to obtain the spectral coefficients obtained by means of decoding. A signal class and a decoding method do not constitute a limitation on the present disclosure. In an example of grouping subbands, the decoding unit 310 may evenly group a frequency band in which the spectral coefficients are located into multiple subbands, and then the spectral coefficients are grouped, according to a frequency of each spectral coefficient, into the subbands in which the frequencies are located.
The classifying unit 320 may classify subbands in which the spectral coefficients are located into a subband with saturated bit allocation and a subband with unsaturated bit allocation. In an example, the classifying unit 320 may perform classification according to an average quantity of allocated bits per spectral coefficient in a subband. Further, the classifying unit 320 may include a comparing component configured to compare an average quantity of allocated bits per spectral coefficient with a first threshold, where the average quantity of allocated bits per spectral coefficient is a ratio of a quantity of bits allocated for each subband to a quantity of spectral coefficients in each subband, that is, an average quantity of allocated bits per spectral coefficient of one subband is a ratio of a quantity of bits allocated for the one subband to a quantity of spectral coefficients in the one subband, and a classifying component configured to classify a subband whose average quantity of allocated bits per spectral coefficient is greater than or equal to the first threshold as a subband with saturated bit allocation, and classify a subband whose average quantity of allocated bits per spectral coefficient is less than the first threshold as a subband with unsaturated bit allocation. As previously described, the average quantity of allocated bits per spectral coefficient in a subband may be obtained by grouping a quantity of bits allocated for the subband by a quantity of spectral coefficients in the subband. The first threshold may be preset, or may be easily obtained by an experiment.
The restoring unit 330 may perform noise filling on the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation in order to restore the spectral coefficient that has not been obtained by means of decoding. The subband with unsaturated bit allocation may include a subband for which no bit is allocated and a subband for which bits is allocated but bit allocation is unsaturated. Various noise filling methods may be used to restore the spectral coefficient that has not been obtained by means of decoding. In this embodiment of the present disclosure, the restoring unit 330 may perform noise filling based on a harmonic parameter harm of a subband whose quantity of bits is greater than or equal to a second threshold. Further, as shown in
As previously described, the calculating component 410 may calculate the harmonic parameter using the following operations of calculating at least one parameter of a peaktoaverage ratio, a peak envelope ratio, sparsity of a spectral coefficient obtained by means of decoding, a bit allocation variance of an entire frame, an average envelope ratio, an averagetopeak ratio, an envelope peak ratio, and an envelope average ratio that are of the subband whose average quantity of allocated bits per spectral coefficient is greater than or equal to the second threshold, and using one of the calculated at least one parameter or using, in a combining manner, the calculated parameter as the harmonic parameter. For a method for calculating the harmonic parameter, reference may be made to the foregoing descriptions that are made with reference to formula (1) to formula (4), and details are not described herein again.
As previously described, after the calculating component 410 obtains the harmonic parameter, the filling component 420 performs, based on the harmonic parameter, noise filling on the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation, which is described below in detail.
The output unit 340 may obtain the frequency domain signal according to the spectral coefficients obtained by means of decoding and the restored spectral coefficient. After the spectral coefficients obtained by means of decoding are obtained by means of decoding and the restoring unit 330 restores the spectral coefficient that has not been obtained by means of decoding, spectral coefficients in an entire frequency band are obtained, and an output signal of a time domain is obtained by performing processing such as transformation, for example, IFFT. In practice, an engineering person skilled in the art understands a solution to how an output signal of a time domain is obtained according to a frequency domain signal, and details are not described herein again.
In the foregoing device for decoding a signal in this embodiment of the present disclosure, a classifying unit 320 obtains a subband with unsaturated bit allocation from subbands of a frequency domain signal by means of classification, and a restoring unit 330 restores a spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation, thereby improving signal decoding quality. In addition, in a case in which the spectral coefficient that has not been obtained by means of decoding is restored based on a harmonic parameter obtained by a calculating component 410 by means of calculation, an error of noise filling performed on spectral coefficients, obtained by means of decoding, with a value of 0 may be avoided, thereby further enhancing signal decoding quality.
The following further describes operations performed by the filling component 420 in
The gain calculating module 421 may use either the foregoing formula (5) or (6) to calculate the noise filling gain of the subband with unsaturated bit allocation, use a multiple of a reciprocal of an average value of a peaktoaverage ratio sharp (referring to descriptions with reference to formula (1) in the foregoing) of the subband with saturated bit allocation as a global noise factor fac, and correct the noise filling gain based on the harmonic parameter and the global noise factor in order to obtain a target gain gain_{T}. In an example of obtaining the target gain gain_{T}, the gain calculating module 421 may perform the following operations of comparing the harmonic parameter with a fourth threshold, obtaining the target gain using the foregoing formula (8) when the harmonic parameter is greater than or equal to the fourth threshold, and obtaining the target gain using the foregoing formula (9) when the harmonic parameter is less than the fourth threshold. In addition, the gain calculating module 421 may also directly use the foregoing formula (7) to obtain the target gain.
In another embodiment, the filling component 420 further includes a correction module 423 configured to calculate a peaktoaverage ratio of the subband with unsaturated bit allocation and compare the peaktoaverage ratio with a third threshold, and for a subband, whose peaktoaverage ratio is greater than the third threshold, with unsaturated bit allocation, after a target gain is obtained, use a ratio of an envelope of the subband with unsaturated bit allocation to a maximum amplitude of a spectral coefficient, obtained by means of decoding, in the subband with unsaturated bit allocation to correct the target gain in order to obtain a corrected target gain. The filling module uses the corrected target gain to restore the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation. A purpose is to correct an abnormal subband with a large peaktoaverage ratio in the subband with unsaturated bit allocation in order to obtain a more appropriate target gain.
In addition to performing noise filling in the foregoing manner, the filling module 422 may further first use noise to fill the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation, and then exert the target gain on the filled noise in order to restore the spectral coefficient that has not been obtained by means of decoding.
It should be noted that structural classification in
The methods disclosed in the foregoing embodiments of the present disclosure may be applied to the decoding processor 503, or implemented by the decoding processor 503. The decoding processor 503 may be an integrated circuit chip, which has a signal processing capability. In an implementation process, the steps in the foregoing methods may be implemented using an integrated logic circuit of hardware in the decoding processor 503 or instructions in a form of software. These instructions may be implemented and controlled by working with the processing unit 504. The foregoing decoding processor may be a general purpose processor, a digital signal processor (DSP), an applicationspecific integrated circuit (ASIC), a field programmable gate array (FPGA) or another programmable logic device, a discrete gate or a transistor logic device, or a discrete hardware component. The foregoing decoding processor may implement or execute methods, steps, and logical block diagrams disclosed in the embodiments of the present disclosure. The general purpose processor may be a microprocessor, or the processor may also be any conventional processor, translator, or the like. Steps of the methods disclosed with reference to the embodiments of the present disclosure may be directly executed and accomplished by a decoding processor embodied as hardware, or may be executed and accomplished using a combination of hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art, such as a RAM, a flash memory, a ROM, a programmable ROM (PROM), an electricallyerasable PROM (EEPROM), or a register. The storage medium is located in the memory 505. The decoding processor 503 reads information from the memory 505, and completes the steps of the foregoing methods in combination with the hardware.
For example, the device 300 for decoding a signal in
Further, the memory 505 stores an instruction that enables the processing unit 504 or the decoding processor 503 to implement the following operations of obtaining spectral coefficients of subbands from a received bitstream by means of decoding, classifying subbands in which the spectral coefficients are located into a subband with saturated bit allocation and a subband with unsaturated bit allocation, where the subband with saturated bit allocation refers to a subband in which allocated bits can be used to encode all spectral coefficients in the subband, and the subband with unsaturated bit allocation refers to a subband in which allocated bits can be used to encode only a part of spectral coefficients in the subband, and a subband for which no bit is allocated, performing noise filling on a spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation in order to restore the spectral coefficient that has not been obtained by means of decoding, and obtaining a frequency domain signal according to the spectral coefficients obtained by means of decoding and the restored spectral coefficient.
In the foregoing apparatus 500 in this embodiment of the present disclosure, a subband with unsaturated bit allocation is obtained by classification from subbands in a frequency domain signal, and a spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation is restored, thereby improving signal decoding quality.
A device for decoding a signal provided in an embodiment of the present disclosure may include a decoding unit configured to obtain spectral coefficients of subbands from a received bitstream by means of decoding, a classifying unit configured to classify subbands in which the spectral coefficients are located into a subband with saturated bit allocation and a subband with unsaturated bit allocation, a restoring unit configured to perform noise filling on a spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation in order to restore the spectral coefficient that has not been obtained by means of decoding, and an output unit configured to obtain a frequency domain signal according to the spectral coefficients obtained by means of decoding and the restored spectral coefficient.
In an embodiment of the present disclosure, the classifying unit may include a comparing component configured to compare an average quantity of allocated bits per spectral coefficient with a first threshold, where an average quantity of allocated bits per spectral coefficient of one subband is a ratio of a quantity of bits allocated for the one subband to a quantity of spectral coefficients in the one subband, and a classifying component configured to classify a subband whose average quantity of allocated bits per spectral coefficient is greater than or equal to the first threshold as a subband with saturated bit allocation, and classify a subband whose average quantity of allocated bits per spectral coefficient is less than the first threshold as a subband with unsaturated bit allocation.
In an embodiment of the present disclosure, the restoring unit may include a calculating component configured to compare the average quantity of allocated bits per spectral coefficient with 0, and calculate a harmonic parameter of a subband whose average quantity of allocated bits per spectral coefficient is not equal to 0, where an average quantity of allocated bits per spectral coefficient of one subband is a ratio of a quantity of bits allocated for the one subband to a quantity of spectral coefficients in the one subband, and the harmonic parameter represents harmonic strength or weakness of a frequency domain signal, and a filling component configured to perform, based on the harmonic parameter, noise filling on the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation in order to restore the spectral coefficient that has not been obtained by means of decoding.
In an embodiment of the present disclosure, the calculating component may calculate the harmonic parameter using the following operations of calculating at least one parameter of a peaktoaverage ratio, a peak envelope ratio, sparsity of a spectral coefficient obtained by means of decoding, a bit allocation variance of an entire frame, an average envelope ratio, an averagetopeak ratio, an envelope peak ratio, and an envelope average ratio that are of the subband whose average quantity of allocated bits per spectral coefficient is not equal to 0, and using one of the calculated at least one parameter or using, in a combining manner, the calculated parameter as the harmonic parameter.
In an embodiment of the present disclosure, the filling component may include a gain calculating module configured to calculate, according to an envelope of the subband with unsaturated bit allocation and a spectral coefficient obtained by means of decoding, a noise filling gain of the subband with unsaturated bit allocation, calculate the peaktoaverage ratio of the subband whose average quantity of allocated bits per spectral coefficient is not equal to 0 and obtain a global noise factor based on the peaktoaverage ratio, and correct the noise filling gain based on the harmonic parameter and the global noise factor in order to obtain a target gain, and a filling module configured to use the target gain and a weighted value of noise to restore the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation.
In an embodiment of the present disclosure, the filling component may further include a correction module configured to calculate a peaktoaverage ratio of the subband with unsaturated bit allocation and comparing the peaktoaverage ratio with a third threshold, and for a subband, whose peaktoaverage ratio is greater than the third threshold, with unsaturated bit allocation, after a target gain is obtained, use a ratio of an envelope of the subband with unsaturated bit allocation to a maximum amplitude of a spectral coefficient, obtained by means of decoding, in the subband with unsaturated bit allocation to correct the target gain in order to obtain a corrected target gain, where the filling module uses the corrected target gain and the weighted value of noise to restore the spectral coefficient that has not been obtained by means of decoding and is in the subband with unsaturated bit allocation.
In an embodiment of the present disclosure, the gain calculating module may correct, using the following operations, the noise filling gain based on the harmonic parameter and the global noise factor, comparing the harmonic parameter with a fourth threshold, obtaining the target gain using gain_{T}=fac*gain*norm/peak when the harmonic parameter is greater than or equal to the fourth threshold, and obtaining the target gain using gain_{T}=fac′*gain and fac′=fac+step when the harmonic parameter is less than the fourth threshold, where gain_{T }is the target gain, fac is the global noise factor, norm is the envelope of the subband with unsaturated bit allocation, peak is a maximum amplitude of the spectral coefficient, obtained by means of decoding, in the subband with unsaturated bit allocation, and step is a step by which the global noise factor changes according to a frequency.
In an embodiment of the present disclosure, the filling component may further include an interframe smoothing module configured to perform interframe smoothing processing on the restored spectral coefficient to obtain a spectral coefficient on which smoothing processing has been performed after the spectral coefficient that has not been obtained by means of decoding is restored, where the output unit is configured to obtain the frequency domain signal according to the spectral coefficients obtained by means of decoding and the spectral coefficient on which smoothing processing has been performed.
A person of ordinary skill in the art may be aware that, in combination with the examples described in the embodiments disclosed in this specification, units and algorithm steps may be implemented by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are performed by hardware or software depends on particular applications and design constraint conditions of the technical solutions. A person skilled in the art may use different methods to implement the described functions for each particular application, but it should not be considered that the implementation goes beyond the scope of the present disclosure.
It may be clearly understood by a person skilled in the art that, for the purpose of convenient and brief description, for a detailed working process of the foregoing device, unit, part, and module, refer to a corresponding process in the foregoing method embodiments, and details are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus, and method may be implemented in other manners. For example, the described apparatus embodiment is merely exemplary. For example, the unit division is merely logical function division and may be other division in actual implementation. For example, a plurality of units or components may be combined or integrated into another system, or some features may be ignored or not performed.
In addition, functional units in the embodiments of the present disclosure may be integrated into one processing unit, or each of the units may exist alone physically, or two or more units are integrated into one unit.
When the functions are implemented in the form of a software functional unit and sold or used as an independent product, the functions may be stored in a computerreadable storage medium. Based on such an understanding, the technical solutions of the present disclosure essentially, or the part contributing to the other approaches, or some of the technical solutions may be implemented in a form of a software product. The software product is stored in a storage medium, and includes several instructions for instructing a computer device (which may be a personal computer, a server, or a network device) to perform all or some of the steps of the methods described in the embodiments of the present disclosure. The foregoing storage medium includes any medium that can store program code, such as a universal serial bus (USB) flash drive, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disc.
The foregoing descriptions are merely example 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.