Not applicable.
Not applicable.
Embodiments of the present invention relate to communications technologies, and in particular, to a method and an apparatus for generating a sideband residual signal.
A method for generating a stereophonic residual in the prior art includes: downmixing a signal input by a first sound channel with a signal input by a second sound channel to obtain a monophonic signal and a sideband signal; encoding the monophonic signal by using a monophonic encoding method; decoding the encoded signal to obtain a local decoded signal of the monophonic signal; extracting a stereophonic parameter from the signal input by the first sound channel and the signal input by the second sound channel, where the stereophonic parameter reflects a ratio of energy of the first sound channel to energy of the second sound channel; generating a sideband predication signal by using the local decoded signal and the stereophonic parameter; generating a sideband residual signal according to the sideband signal and the sideband predication signal; and then encoding the monophonic signal and the sideband residual signal.
In the method for generating a sideband residual signal in the prior art, the signal input by the first sound channel and the signal input by the second sound channel, which may be obtained by decoding at a decoding end, are related to the local decoded signal and the sideband residual signal. However, the local decoded signal and the sideband residual signal are encoded signals, and a quantization error exists in an encoding process. This quantization error is evenly allocated to the signal of the first sound channel and the signal of the second sound channel. When there is a larger difference between the energy of the signal of the first sound channel and the energy of the signal of the second sound channel of the stereophonic signal, a monophonic quantization error has a greater impact on a channel of signal whose energy is smaller, which reduces the quality of a signal that is generated according to the sideband residual signal.
Embodiments of the present invention provide a method and an apparatus for generating a sideband residual signal to solve a problem in the prior art that a monophonic quantization error has a greater impact on a channel of signal whose energy is smaller when a quantization error is evenly allocated to a first sound channel and a second sound channel.
An embodiment of the present invention provides a method for generating a sideband residual signal, where the method includes: comparing energy of a first signal input by a first sound channel with energy of a second signal input by a second sound channel; if the energy of the first signal is greater than the energy of the second signal, generating a sideband residual signal by allocating a monophonic quantization error to the first signal; and if the energy of the first signal is smaller than the energy of the second signal, generating a sideband residual signal by allocating a monophonic quantization error to the second signal.
An embodiment of the present invention further provides an apparatus for generating a sideband residual signal, where the apparatus includes: a comparing unit configured to compare energy of a first signal input by a first sound channel with energy of a second signal input by a second sound channel; and a processing unit connected to the comparing unit and configured to: in the case that the comparing unit determines that the energy of the first signal is greater than the energy of the second signal, generate a sideband residual signal by allocating a monophonic quantization error to the first signal; or in the case that the comparing unit determines that the energy of the first signal is smaller than the energy of the second signal, generate a sideband residual signal by allocating a monophonic quantization error to the second signal.
By using the method and apparatus for generating a sideband residual signal according to embodiments of the present invention, the energy of the first signal is compared with the energy of the second signal, and the monophonic quantization error is allocated to a signal whose energy is greater. In this way, it may be avoided that the monophonic quantization error has a greater impact on a signal whose energy is smaller, which improves the quality of a signal whose energy is smaller and is generated according to the sideband residual signal.
To illustrate the technical solutions in the embodiments of the present invention or in the prior art more clearly, the accompanying drawings required for describing the embodiments or the prior art are briefly introduced in the following. Apparently, the accompanying drawings in the following descriptions merely show some embodiments of the present invention, and persons of ordinary skill in the art may still derive other drawings from these accompanying drawings without creative efforts.
To make the objectives, technical solutions, and advantages of the embodiments of the present invention more comprehensible, the technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the embodiments to be described are merely a part rather than all of the embodiments of the present invention. All other embodiments obtained by persons of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
Step 102: Generate a sideband residual signal by allocating a monophonic quantization error to the first signal.
Step 103: Generate a sideband residual signal by allocating a monophonic quantization error to the second signal.
In
By using the method for generating a sideband residual signal according to this embodiment of the present invention, the energy of the first signal is compared with the energy of the second signal, and the monophonic quantization error is allocated to a signal whose energy is greater. In this way, it may be avoided that the monophonic quantization error has a greater impact on a signal whose energy is smaller, which improves the quality of a signal whose energy is smaller and is generated according to the sideband residual signal.
Step 102: Generate a sideband residual signal by allocating a monophonic quantization error to the first signal.
Step 103: Generate a sideband residual signal by allocating a monophonic quantization error to the second signal.
Step 104: Generate a sideband residual signal by evenly allocating a monophonic quantization error to the first signal and the second signal.
Before step 101 or step 101′, a step of obtaining a quantized value CLD_Q of a stereophonic parameter CLD may further be included. Specifically, after the stereophonic parameter CLD is obtained, the CLD is quantized, and the quantized value CLD_Q is obtained. A quantization method may be a scale quantization method or another quantization method.
Step 101 or step 101′ may specifically include comparing the CLD_Q with 1. That is, the energy of the first signal may be compared with the energy of the second signal by comparing the CLD_Q with 1. Specifically, if the CLD_Q is greater than 1, the energy of the first signal input by the first sound channel is greater than the energy of the second signal input by the second sound channel. If the CLD_Q is smaller than 1, the energy of the first signal input by the first sound channel is smaller than the energy of the second signal input by the second sound channel, and if the CLD_Q is equal to 1, the energy of the first signal input by the first sound channel is equal to the energy of the second signal input by the second sound channel.
In this embodiment of the present invention, the first signal may be a signal input by a left sound channel, and the first sound channel may be the left sound channel; and the second signal may be a signal input by a right sound channel, and the second sound channel may be the right sound channel. Alternatively, the first signal may be a signal input by a right sound channel, and the first channel may be the right sound channel; and the second signal may be a signal input by a left sound channel, and the second sound channel may be the left sound channel.
The method provided in the third embodiment of the present invention includes Step 201: Obtain a local decoded signal Md of a monophonic signal, a sideband signal S, and a CLD_Q, where the monophonic signal, the sideband signal S, and the CLD_Q are generated according to signals S1 and S2.
Specifically, the signal S1 input by a first sound channel may be downmixed with the signal S2 input by a second sound channel to obtain a monophonic signal M and a sideband signal S, where M=(S1+S2)/2 and S=(S1−S2)/2.
The monophonic signal M is encoded by using a monophonic encoding method, and the encoded signal is decoded to obtain a local decoded signal Md of the monophonic signal. The monophonic signal may be encoded or decoded based on an encoding and decoding method specified in the G.711.1 or G.722 standard of the ITU Telecommunication Standardization Sector (ITU-T).
A stereophonic parameter CLD is extracted from the signal S1 input by the first sound channel and the signal S2 input by the second sound channel. The signals S1 and S2 are divided into several sub-bands N(band) according to a frequency through time-frequency conversion or by using a sub-band filter. Energy C1 and C2 of each sub-band of the first sound channel and the second sound channel are calculated:
where 1(k) indicates a value of a signal amplitude of a sub-band of the first sound channel, and r(k) indicates a value of a signal amplitude of a sub-band of the second sound channel. Alternatively, to reduce calculation complicity in time-frequency conversion performed on the signals S1 and S2, the monophonic signal M and the sideband signal S may be used to calculate the energy of each sub-band of the first sound channel and the second sound channel, and then a CLD is obtained. In this way,
where m(k) indicates a value of a signal amplitude of the monophonic signal M, and s(k) indicates a value of a signal amplitude of the sideband signal S.
The obtained CLD is a ratio of energy of each sub-band of the first sound channel to energy of each sub-band of the second sound channel CLD(band)=10*log 10(C1(band)/C2(band)).
The obtained CLD is quantized as a CLD_Q, and the CLD_Q is transmitted to a decoding end.
A sideband predication signal Spred is generated by using the local decoded signal Md and the CLD, where Spred=Md*(c−1)/(c+1), where c=10CLD_Q/20.
Step 202: Compare energy of the signal S1 with energy of the signal S2 according to the CLD_Q. If the energy of the signal S1 is greater than the energy of the signal S2, execute step 203. If the energy of the signal S1 is smaller than the energy of the signal S2, execute step 204, and if the energy of the signal S1 is equal to the energy of the signal S2, execute step 205.
Step 203: Generate a sideband residual signal by allocating a monophonic quantization error to the signal S1, where the generated sideband residual signal is Sres=Md−S2−Md*(c−1)/(c+1).
Step 204: Generate a sideband residual signal by allocating a monophonic quantization error to the signal S2, where the generated sideband residual signal is Sres=S1−Md−Md*(c−1)/(c+1).
Step 205: Generate a sideband residual signal by evenly allocating a monophonic quantization error to the signals S1 and S2, where the generated sideband residual signal is Sres=S−Md*(c−1)/(c+1).
Step 203, step 204, and step 205 are three branch steps corresponding to three results generated after the judgment is performed in step 202.
Through step 201 to step 205, a sideband residual signal is generated. After being encoded, the generated sideband residual signal may also be input with an encoded monophonic signal and the CLD_Q to a unit that is used for stream multiplexing.
In this embodiment of the present invention, the CLD_Q is used to compare the first sound channel with the second sound channel, and an additional bit does not need to be used to transfer comparison information so long as a same operation is performed at the decoding end. In this way, signals decoded at the decoding end are as follows When the CLD_Q is greater than 1, S1d=Md+(Sres+Spred)=2Md−S2, and S2d=Md−(Sres+Spred)=S2. S2d is irrelevant to Md and Sres, while S1d is relevant to Md, that is, the quantization error is allocated to the signal input by the first sound channel.
When the CLD_Q is smaller than 1, S1d=Md+(Sres+Spred)=S1, and S2d=Md−(Sres+Spred)=2Md−S1. S1d is irrelevant to Md and Sres, while S2d is relevant to Md, that is, the quantization error is allocated to the signal input by the second sound channel.
When the CLD_Q is equal to 1, S1d=Md+(Sres+Spred)=Md+S, and S2d=Md−(Sres+Spred)=Md−S. S1d is relevant to Md, and S2d is relevant to Md, that is, the quantization error is evenly allocated to the signal input by the first sound channel and the signal input by the second sound channel.
S1d indicates a signal that is decoded and is input by the first sound channel, and S2d indicates a signal that is decoded and is input by the second sound channel.
In step 201, energy of the signal S1 may also be directly compared with energy of the signal S2, without the need of comparing the CLD_Q with 1, to determine the energy of the signal S1 and the energy of the signal S2.
It can be seen from the foregoing embodiments that, when energy of the signal S1 is greater than energy of the signal S2, a monophonic quantization error is allocated to the signal S1. When the energy of the signal S1 is smaller than the energy of the signal S2, the monophonic quantization error is allocated to the signal S2, and when the energy of the signal S1 is equal to the energy of the signal S2, the monophonic quantization error is evenly allocated to the signal S1 and the signal S2. In this way, it can be ensured that a smaller quantization error is introduced for a signal whose energy is smaller, so that the quality of a signal whose energy is smaller and is generated according to a residual signal may be improved.
In the embodiment shown in
The embodiment shown in
The second processing subunit 122 is specifically configured to: in the case that the comparing unit 11 determines that the energy of the first signal S1 is smaller than the energy of the second signal S2, generate a sideband residual signal according to the quantized value CLD_Q that is obtained by the quantized value obtaining unit 14, the signals S1 and Md that are obtained by the signal obtaining unit 13, and a formula Sres=S1−Md−Md*(c−1)/(c+1).
The third processing subunit 123 is specifically configured to: in the case that the comparing unit 11 determines that the energy of the first signal S1 is equal to the energy of the second signal S2, generate a sideband residual signal according to the quantized value CLD_Q that is obtained by the quantized value obtaining unit 14, the signals S and Md that are obtained by the signal obtaining unit 13, and a formula Sres=S−Md*(c−1)/(c+1).
In
By using the apparatus for generating a sideband residual signal according to the embodiments of the present invention, the comparing unit compares the energy of the first signal with the energy of the second signal, and the processing unit allocates the monophonic quantization error to a signal whose energy is greater. In this way, it may be avoided that the monophonic quantization error has a greater impact on a signal whose energy is smaller, which improves the quality of a signal whose energy is smaller and is generated according to the sideband residual signal.
Persons of ordinary skill in the art may understand that all or part of the steps of the methods in the embodiments may be implemented by a program instructing relevant hardware. The program may be stored in a computer readable storage medium. When the program is run, the foregoing steps of the methods in the embodiments are performed. The storage medium may be any medium capable of storing program codes, such as read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
Finally, it should be noted that the foregoing embodiments are merely intended for describing the technical solutions of the present invention rather than limiting the present invention. Although the present invention is described in detail with reference to the foregoing embodiments, persons of ordinary skill in the art should understand that they may still make modifications to the technical solutions described in the foregoing embodiments or make equivalent substitutions to some technical features of the technical solutions, as long as these modifications or substitutions do not cause the essence of corresponding technical solutions to depart from the spirit and scope of the technical solutions in the embodiments of the present invention.
Number | Date | Country | Kind |
---|---|---|---|
201010200923.3 | Jun 2010 | CN | national |
This application is a continuation of U.S. patent application Ser. No. 13/708,611, filed on Dec. 7, 2012, which is a continuation of International Application No. PCT/CN2011/075014, filed on May 31, 2011, which claims priority to Chinese Patent Application No. 201010200923.3, filed on Jun. 10, 2010, The aforementioned patent applications are hereby incorporated by reference in their entireties.
Number | Date | Country | |
---|---|---|---|
Parent | 13708611 | Dec 2012 | US |
Child | 14811438 | US | |
Parent | PCT/CN2011/075014 | May 2011 | US |
Child | 13708611 | US |