Audio Coding Method and Apparatus
20210390968 · 2021-12-16
Inventors
Cpc classification
G10L19/06
PHYSICS
G10L19/12
PHYSICS
International classification
G10L19/12
PHYSICS
G10L19/025
PHYSICS
Abstract
A method comprises determining a first modification weight according to linear spectral frequency (LSF) differences of the current frame and LSF differences of a previous frame of the current frame when a signal characteristic of the current frame meets a preset modification condition, modifying the linear predictive parameter of the current frame according to the determined first modification weight, and coding the current frame according to the modified linear predictive parameter.
Claims
1. An audio coding method comprising: determining a first modification weight according to linear spectral frequency (LSF) differences of an audio frame and LSF differences of a previous audio frame of the audio frame when the audio frame is not a transition frame; modifying a linear predictive parameter of the audio frame according to the first modification weight to generate a modified linear predictive parameter of the audio frame; and coding the audio frame according to the modified linear predictive parameter.
2. The audio coding method of claim 1, wherein the first modification weight satisfies the following formula:
3. The audio coding method of claim 1, further comprising modifying the linear predictive parameter of the audio frame according to the following formula:
L[i]=(1−w[i])*L_old[i]+w[i]*L_new[i], wherein w[i] is the first modification weight, wherein L[i] is the modified linear predictive parameter, wherein L_new[i] is the linear predictive parameter of the audio frame, wherein L_old[i] is a linear predictive parameter of the previous audio frame, wherein a value of i ranges from 0 to M−1, and wherein M is an order of the linear predictive parameter of the audio frame and the linear predictive parameter of the previous audio frame.
4. The audio coding method of claim 1, wherein the audio frame is not the transition frame when the following conditions are not satisfied: a spectrum tilt frequency of the previous audio frame is greater than a first spectrum tilt frequency threshold and a coding type of the audio frame is transient; and the spectrum tilt frequency of the previous audio frame is greater than the first spectrum tilt frequency threshold and a spectrum tilt frequency of the audio frame is less than a second spectrum tilt frequency threshold; and the spectrum tilt frequency of the previous audio frame is less than a third spectrum tilt frequency threshold and a coding type of the previous audio frame is voiced.
5. An audio coding method, comprising: determining, when a signal characteristic of an audio frame and a signal characteristic of a previous audio frame of the audio frame satisfy a preset modification condition, a first modification weight according to linear spectral frequency (LSF) differences of the audio frame and LSF differences of the previous audio frame; determining, when the signal characteristic of the audio frame and the signal characteristic of the previous audio frame do not satisfy the preset modification condition, a preset modification weight value as a second modification weight, wherein the preset modification weight value is greater than 0 and is less than or equal to 1; modifying a linear predictive parameter of the audio frame according to the first modification weight or the second modification weight to generate a modified linear predictive parameter of the audio frame; and coding the audio frame according to the modified linear predictive parameter.
6. The audio coding method of claim 5, wherein the signal characteristic of the audio frame and the signal characteristic of the previous audio frame do not satisfy the preset modification condition when: a spectrum tilt frequency of the previous audio frame is greater than a first spectrum tilt frequency threshold and a coding type of the audio frame is transient; the spectrum tilt frequency of the previous audio frame is greater than the first spectrum tilt frequency threshold and a spectrum tilt frequency of the audio frame is less than a second spectrum tilt frequency threshold; or the spectrum tilt frequency of the previous audio frame is less than a third spectrum tilt frequency threshold, a coding type of the previous audio frame is voiced, and the spectrum tilt frequency of the audio frame is greater than a fourth spectrum tilt frequency threshold.
7. The audio coding method of claim 5, wherein the signal characteristic of the audio frame and the signal characteristic of the previous audio frame satisfy the preset modification condition when following conditions are not satisfied: a spectrum tilt frequency of the previous audio frame is greater than a first spectrum tilt frequency threshold and a coding type of the audio frame is transient; the spectrum tilt frequency of the previous audio frame is greater than the first spectrum tilt frequency threshold and a spectrum tilt frequency of the audio frame is less than a second spectrum tilt frequency threshold; and the spectrum tilt frequency of the previous audio frame is less than a third spectrum tilt frequency threshold and a coding type of the previous audio frame is voiced.
8. An audio coding apparatus, comprising: a memory configured to store instructions; and a processor coupled to the memory and configured to execute the instructions to cause the audio coding apparatus to be configured to: determine a first modification weight according to linear spectral frequency (LSF) differences of an audio frame and LSF differences of a previous audio frame when the audio frame is not a transition frame; modify a linear predictive parameter of the audio frame according to the first modification weight to generate a modified linear predictive parameter of the audio frame; and code the audio frame according to the modified linear predictive parameter.
9. The audio coding apparatus of claim 8, wherein the processor is further configured to execute the instructions to cause the audio coding apparatus to be configured to determine the first modification weight according to the LSF differences of the audio frame and the LSF differences of the previous audio frame using the following formula:
10. The audio coding apparatus of claim 8, wherein the processor is further configured to execute the instructions to cause the audio coding apparatus to be configured to modify the linear predictive parameter of the audio frame to generate the modified linear predictive parameter using the following formula:
L[i]=(1−w[i])*L_old[i]+w[i]*L_new[i], wherein w[i] is the first modification weight, wherein L[i] is the modified linear predictive parameter of the audio frame, wherein L_new[i] is the linear predictive parameter of the audio frame, wherein L_old[i] is a linear predictive parameter of the previous audio frame, wherein a value of i ranges from 0 to M−1, and wherein M is an order of the linear predictive parameter of the audio frame and the linear predictive parameter of the previous audio frame.
11. The audio coding apparatus of claim 8, wherein the audio frame is not the transition frame when the following conditions are not satisfied: a spectrum tilt frequency of the previous audio frame is greater than a first spectrum tilt frequency threshold and a coding type of the audio frame is transient; and the spectrum tilt frequency of the previous audio frame is greater than the first spectrum tilt frequency threshold and a spectrum tilt frequency of the audio frame is less than a second spectrum tilt frequency threshold; and the spectrum tilt frequency of the previous audio frame is less than a third spectrum tilt frequency threshold and a coding type of the previous audio frame is voiced.
12. An audio coding apparatus, comprising: a memory configured to store instructions; and a processor coupled to the memory and configured to execute the instructions to cause the audio coding apparatus to be configured to: determine a first modification weight according to linear spectral frequency (LSF) differences of an audio frame and LSF differences of a previous audio frame when a signal characteristic of the audio frame and a signal characteristic of the previous audio frame satisfy a preset modification condition; determine a preset modification weight value as a second modification weight when the signal characteristic of the audio frame and the signal characteristic of the previous audio frame do not satisfy the preset modification condition, wherein the preset modification weight value is greater than 0 and is less than or equal to 1; modify a linear predictive parameter of the audio frame according to the first modification weight or the second modification weight to generate a modified linear predictive parameter of the audio frame; and code the audio frame according to the modified linear predictive parameter.
13. The audio coding apparatus of claim 12, wherein the signal characteristic of the audio frame and the signal characteristic of the previous audio frame do not satisfy the preset modification condition when: a spectrum tilt frequency of the previous audio frame is greater than a first spectrum tilt frequency threshold and a coding type of the audio frame is transient; the spectrum tilt frequency of the previous audio frame is greater than the first spectrum tilt frequency threshold and a spectrum tilt frequency of the audio frame is less than a second spectrum tilt frequency threshold; or the spectrum tilt frequency of the previous audio frame is less than a third spectrum tilt frequency threshold, a coding type of the previous audio frame is voiced, and the spectrum tilt frequency of the audio frame is greater than a fourth spectrum tilt frequency threshold.
14. The audio coding apparatus of claim 12, wherein the signal characteristic of the audio frame and the signal characteristic of the previous audio frame of the audio frame satisfy the preset modification condition when the following conditions are not satisfied: a spectrum tilt frequency of the previous audio frame is greater than a first spectrum tilt frequency threshold and a coding type of the audio frame is transient; the spectrum tilt frequency of the previous audio frame is greater than the first spectrum tilt frequency threshold and a spectrum tilt frequency of the audio frame is less than a second spectrum tilt frequency threshold; and the spectrum tilt frequency of the previous audio frame is less than a third spectrum tilt frequency threshold and a coding type of the previous audio frame is voiced.
15. The audio coding method of claim 1, wherein the linear predictive parameter is a linear predictive coding (LPC) coefficient.
16. The audio coding method of claim 1, wherein the linear predictive parameter is a linear spectral pair (LSP) coefficient.
17. The audio coding method of claim 5, wherein the linear predictive parameter is a linear predictive coding (LPC) coefficient.
18. The audio coding method of claim 5, wherein the linear predictive parameter is a linear spectral pair (LSP) coefficient.
19. The audio coding apparatus of claim 8, wherein the linear predictive parameter is a linear predictive coding (LPC) coefficient.
20. The audio coding apparatus of claim 8, wherein the linear predictive parameter is a linear spectral pair (LSP) coefficient.
Description
BRIEF DESCRIPTION OF DRAWINGS
[0028] To describe the technical solutions in the embodiments of the present disclosure more clearly, the following briefly introduces the accompanying drawings required for describing the embodiments. 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.
[0029]
[0030]
[0031]
[0032]
[0033]
DESCRIPTION OF EMBODIMENTS
[0034] 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 merely a part rather than 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.
[0035] Referring to
[0036] Step 101: For each audio frame in audio, when a signal characteristic of the audio frame and a signal characteristic of a previous audio frame meet a preset modification condition, an electronic device determines a first modification weight according to LSF differences of the audio frame and LSF differences of the previous audio frame. When the signal characteristic of the audio frame and the signal characteristic of the previous audio frame do not meet the preset modification condition, the electronic device determines a second modification weight, where the preset modification condition is used to determine that the signal characteristic of the audio frame is similar to the signal characteristic of the previous audio frame.
[0037] Step 102: The electronic device modifies a linear predictive parameter of the audio frame according to the determined first modification weight or the determined second modification weight.
[0038] The linear predictive parameter may include an LPC, an LSP, an ISP, an LSF, or the like.
[0039] Step 103: The electronic device codes the audio frame according to a modified linear predictive parameter of the audio frame.
[0040] In this embodiment, for each audio frame in audio, when the signal characteristic of the audio frame and the signal characteristic of the previous audio frame meet the preset modification condition, the electronic device determines the first modification weight according to LSF differences of the audio frame and LSF differences of the previous audio frame. When the signal characteristic of the audio frame and the signal characteristic of the previous audio frame do not meet the preset modification condition, the electronic device determines a second modification weight. The electronic device modifies a linear predictive parameter of the audio frame according to the determined first modification weight or the determined second modification weight and codes the audio frame according to a modified linear predictive parameter of the audio frame. In this way, different modification weights are determined according to whether the signal characteristic of the audio frame is similar to the signal characteristic of the previous audio frame and the linear predictive parameter of the audio frame is modified so that a spectrum between audio frames is steadier. In addition, different modification weights are determined according to whether the signal characteristic of the audio frame is similar to the signal characteristic of the previous audio frame and a second modification weight that is determined when the signal characteristics are not similar may be as close to 1 as possible so that an original spectrum feature of the audio frame is kept as much as possible when the signal characteristic of the audio frame is not similar to the signal characteristic of the previous audio frame, and therefore auditory quality of the audio obtained after coded information of the audio is decoded is better.
[0041] Specific implementation of how the electronic device determines whether the signal characteristic of the audio frame and the signal characteristic of the previous audio frame meet the preset modification condition in step 101 is related to specific implementation of the modification condition. A description is provided below using an example.
[0042] In a possible implementation manner, the modification condition may include, if the audio frame is not a transition frame, determining, by the electronic device, that the signal characteristic of the audio frame and the signal characteristic of the previous audio frame meet the preset modification condition may include the audio frame is not a transition frame, where the transition frame includes a transition frame from a non-fricative to a fricative or a transition frame from a fricative to a non-fricative. Determining, by an electronic device, that the signal characteristic of the audio frame and the signal characteristic of the previous audio frame do not meet the preset modification condition may include the audio frame is a transition frame.
[0043] In a possible implementation manner, determining whether the audio frame is the transition frame from a fricative to a non-fricative may be implemented by determining whether a spectrum tilt frequency of the previous audio frame is greater than a first spectrum tilt frequency threshold, and whether a coding type of the audio frame is transient. Determining that the audio frame is a transition frame from a fricative to a non-fricative may include determining that the spectrum tilt frequency of the previous audio frame is greater than the first spectrum tilt frequency threshold and the coding type of the audio frame is transient. Determining that the audio frame is not a transition frame from a fricative to a non-fricative may include determining that the spectrum tilt frequency of the previous audio frame is not greater than the first spectrum tilt frequency threshold and/or the coding type of the audio frame is not transient.
[0044] In another possible implementation manner, determining whether the audio frame is the transition frame from a fricative to a non-fricative may be implemented by determining whether a spectrum tilt frequency of the previous audio frame is greater than a first frequency threshold and determining whether a spectrum tilt frequency of the audio frame is less than a second frequency threshold. Determining that the audio frame is the transition frame from a fricative to a non-fricative may include determining that the spectrum tilt frequency of the previous audio frame is greater than the first spectrum tilt frequency threshold and the spectrum tilt frequency of the audio frame is less than the second spectrum tilt frequency threshold. Determining that the audio frame is not the transition frame from a fricative to a non-fricative may include determining that the spectrum tilt frequency of the previous audio frame is not greater than the first spectrum tilt frequency threshold and/or the spectrum tilt frequency of the audio frame is not less than the second spectrum tilt frequency threshold. Specific values of the first spectrum tilt frequency threshold and the second spectrum tilt frequency threshold are not limited in this embodiment of the present disclosure, and a relationship between the values of the first spectrum tilt frequency threshold and the second spectrum tilt frequency threshold is not limited. Optionally, in an embodiment of the present disclosure, the value of the first spectrum tilt frequency threshold may be 5.0. In another embodiment of the present disclosure, the value of the second spectrum tilt frequency threshold may be 1.0.
[0045] In a possible implementation manner, determining whether the audio frame is the transition frame from a non-fricative to a fricative may be implemented by determining whether a spectrum tilt frequency of the previous audio frame is less than a third frequency threshold, determining whether a coding type of the previous audio frame is one of four types, voiced, generic, transient, and/or audio, and determining whether a spectrum tilt frequency of the audio frame is greater than a fourth frequency threshold. Determining that the audio frame is a transition frame from a non-fricative to a fricative may include determining that the spectrum tilt frequency of the previous audio frame is less than the third spectrum tilt frequency threshold, the coding type of the previous audio frame is one of the four types, voiced, generic, transient, and/or audio, and the spectrum tilt of the audio frame is greater than the fourth spectrum tilt threshold. Determining that the audio frame is not the transition frame from a non-fricative to a fricative may include determining that the spectrum tilt frequency of the previous audio frame is not less than the third spectrum tilt frequency threshold, and/or the coding type of the previous audio frame is not one of the four types, voiced, generic, transient, and/or audio, and/or the spectrum tilt frequency of the audio frame is not greater than the fourth spectrum tilt frequency threshold. Specific values of the third spectrum tilt frequency threshold and the fourth spectrum tilt frequency threshold are not limited in this embodiment of the present disclosure, and a relationship between the values of the third spectrum tilt frequency threshold and the fourth spectrum tilt frequency threshold is not limited. In an embodiment of the present disclosure, the value of the third spectrum tilt frequency threshold may be 3.0. In another embodiment of the present disclosure, the value of the fourth spectrum tilt frequency threshold may be 5.0.
[0046] In step 101, the determining, by an electronic device, a first modification weight according to LSF differences of the audio frame and LSF differences of the previous audio frame may include determining, by the electronic device, the first modification weight according to the LSF differences of the audio frame and the LSF differences of the previous audio frame using the following formula:
where w[i] is the first modification weight, lsf_new_diff[i] is the LSF differences of the audio frame, lsf_new_diff[i]=lsf_new[i]−lsf_new[i−1], lsf_new[i] is the i.sup.th-order LSF parameter of the audio frame, lsf_new[i−1] is the (i−1).sup.th-order LSF parameter of the audio frame, lsf_old_diff[i] is the LSF differences of the previous audio frame, lsf_old_diff[i]=lsf_old[i]−lsf_old[i−1], lsf_old[i] is the i.sup.th-order LSF parameter of the previous audio frame, lsf_old[i−1] is the (i−1).sup.th-order LSF parameter of the previous audio frame, i is an order of the LSF parameter and an order of the LSF differences, a value of i ranges from 0 to M−1, and M is an order of the linear predictive parameter.
[0047] A principle of the foregoing formula is as follows.
[0048] Refer to
[0049] Smaller w[i]=lsf_new_diff[i]/lsf_old_diff[i] indicates a greater spectrum energy difference between a previous frame and a current frame at a frequency point corresponding to lsf_new[i] and that spectrum energy of the audio frame is much greater than spectrum energy of a frequency point corresponding to the previous audio frame.
[0050] Smaller w[i]=lsf_old_diff[i]/lsf_new_diff[i] indicates a smaller spectrum energy difference between the previous frame and the current frame at the frequency point corresponding to lsf_new[i] and that the spectrum energy of the audio frame is much smaller than spectrum energy of the frequency point corresponding to the previous audio frame.
[0051] Therefore, to make a spectrum between the previous frame and the current frame steady, w[i] may be used as a weight of the audio frame lsf_new[i] and 1−w[i] may be used as a weight of the frequency point corresponding to the previous audio frame. Details are shown in formula 2.
[0052] In step 101, determining, by the electronic device, the second modification weight may include determining, by the electronic device, the second modification weight as a preset modification weight value, where the preset modification weight value is greater than 0 and is less than or equal to 1.
[0053] Preferably, the preset modification weight value is a value close to 1.
[0054] In step 102, modifying, by the electronic device, the linear predictive parameter of the audio frame according to the determined first modification weight may include modifying the linear predictive parameter of the audio frame according to the first modification weight using the following formula:
L[i]=(1−w[i])*L_old[i]+w[i]*L_new[i], (2)
where w[i] is the first modification weight, L[i] is the modified linear predictive parameter of the audio frame, L_new[i] is the linear predictive parameter of the audio frame, L_old[i] is a linear predictive parameter of the previous audio frame, i is an order of the linear predictive parameter, the value of i ranges from 0 to M−1, and M is the order of the linear predictive parameter.
[0055] In step 102, modifying, by the electronic device, the linear predictive parameter of the audio frame according to the determined second modification weight may include modifying the linear predictive parameter of the audio frame according to the second modification weight using the following formula:
L[i]=(1−y)*L_old[i]+y*L_new[i], (3)
where y is the second modification weight, L[i] is the modified linear predictive parameter of the audio frame, L_new[i] is the linear predictive parameter of the audio frame, L_old[i] is the linear predictive parameter of the previous audio frame, i is the order of the linear predictive parameter, the value of i ranges from 0 to M−1, and M is the order of the linear predictive parameter.
[0056] In step 103, for how the electronic device codes the audio frame according to the modified linear predictive parameter of the audio frame, refer to a related time domain bandwidth extension technology, and details are not described in the present disclosure.
[0057] The audio coding method in this embodiment of the present disclosure may be applied to a time domain bandwidth extension method shown in
[0058] The LPC quantization corresponds to step 101 and step 102 in this embodiment of the present disclosure, and the MUX performed on the audio signal corresponds to step 103 in this embodiment of the present disclosure.
[0059] Refer to
[0060] The determining unit 310 is configured to, for each audio frame in audio, when a signal characteristic of the audio frame and a signal characteristic of a previous audio frame meet a preset modification condition, determine a first modification weight according to LSF differences of the audio frame and LSF differences of the previous audio frame. When the signal characteristic of the audio frame and the signal characteristic of the previous audio frame do not meet the preset modification condition, determine a second modification weight, where the preset modification condition is used to determine that the signal characteristic of the audio frame is similar to the signal characteristic of the previous audio frame.
[0061] The modification unit 320 is configured to modify a linear predictive parameter of the audio frame according to the first modification weight or the second modification weight determined by the determining unit 310.
[0062] The coding unit 330 is configured to code the audio frame according to a modified linear predictive parameter of the audio frame, where the modified linear predictive parameter is obtained after modification by the modification unit 320.
[0063] Optionally, the determining unit 310 may be configured to determine the first modification weight according to the LSF differences of the audio frame and the LSF differences of the previous audio frame using the following formula, which may be substantially similar to formula 1:
where w[i] is the first modification weight, lsf_new_diff[i] is the LSF differences of the audio frame, lsf_old_diff[i] is the LSF differences of the previous audio frame, i is an order of the LSF differences, a value of i ranges from 0 to M−1, and M is an order of the linear predictive parameter.
[0064] Optionally, the determining unit 310 may be configured to determine the second modification weight as a preset modification weight value, where the preset modification weight value is greater than 0, and is less than or equal to 1.
[0065] Optionally, the modification unit 320 may be configured to modify the linear predictive parameter of the audio frame according to the first modification weight using the following formula, which may be substantially similar to formula 2:
L[i]=(1−w[i])*L_old[i]+w[i]*L_new[i],
where w[i] is the first modification weight, L[i] is the modified linear predictive parameter of the audio frame, L_new[i] is the linear predictive parameter of the audio frame, L_old[i] is a linear predictive parameter of the previous audio frame, i is an order of the linear predictive parameter, the value of i ranges from 0 to M−1, and M is the order of the linear predictive parameter.
[0066] Optionally, the modification unit 320 may be configured to modify the linear predictive parameter of the audio frame according to the second modification weight using the following formula, which may be substantially similar to formula 3:
L[i]=(1−y)*L_old[i]+y*L_new[i],
where y is the second modification weight, L[i] is the modified linear predictive parameter of the audio frame, L_new[i] is the linear predictive parameter of the audio frame, L_old[i] is the linear predictive parameter of the previous audio frame, i is the order of the linear predictive parameter, the value of i ranges from 0 to M−1, and M is the order of the linear predictive parameter.
[0067] Optionally, the determining unit 310 may be configured to, for each audio frame in the audio, when the audio frame is not a transition frame, determine the first modification weight according to the LSF differences of the audio frame and the LSF differences of the previous audio frame. When the audio frame is a transition frame, determine the second modification weight, where the transition frame includes a transition frame from a non-fricative to a fricative, or a transition frame from a fricative to a non-fricative.
[0068] Optionally, the determining unit 310 may be configured to, for each audio frame in the audio, when a spectrum tilt frequency of the previous audio frame is not greater than a first spectrum tilt frequency threshold and/or a coding type of the audio frame is not transient, determine the first modification weight according to the LSF differences of the audio frame and the LSF differences of the previous audio frame. When the spectrum tilt frequency of the previous audio frame is greater than the first spectrum tilt frequency threshold and the coding type of the audio frame is transient, determine the second modification weight.
[0069] Optionally, the determining unit 310 may be configured to, for each audio frame in the audio, when a spectrum tilt frequency of the previous audio frame is not greater than a first spectrum tilt frequency threshold and/or a spectrum tilt frequency of the audio frame is not less than a second spectrum tilt frequency threshold, determine the first modification weight according to the LSF differences of the audio frame and the LSF differences of the previous audio frame. When the spectrum tilt frequency of the previous audio frame is greater than the first spectrum tilt frequency threshold and the spectrum tilt frequency of the audio frame is less than the second spectrum tilt frequency threshold, determine the second modification weight.
[0070] Optionally, the determining unit 310 may be configured to, for each audio frame in the audio, when determining a spectrum tilt frequency of the previous audio frame is not less than a third spectrum tilt frequency threshold, and/or a coding type of the previous audio frame is not one of four types, voiced, generic, transient, and/or audio, and/or a spectrum tilt of the audio frame is not greater than a fourth spectrum tilt threshold, determine the first modification weight according to the LSF differences of the audio frame and the LSF differences of the previous audio frame. When the spectrum tilt frequency of the previous audio frame is less than the third spectrum tilt frequency threshold, the coding type of the previous audio frame is one of the four types, voiced, generic, transient, and/or audio, and the spectrum tilt frequency of the audio frame is greater than the fourth spectrum tilt frequency threshold, determine the second modification weight.
[0071] In this embodiment, for each audio frame in audio, when a signal characteristic of the audio frame and a signal characteristic of a previous audio frame meet a preset modification condition, an electronic device determines a first modification weight according to LSF differences of the audio frame and LSF differences of the previous audio frame. When a signal characteristic of the audio frame and a signal characteristic of a previous audio frame do not meet a preset modification condition, the electronic device determines a second modification weight. The electronic device modifies a linear predictive parameter of the audio frame according to the determined first modification weight or the determined second modification weight and codes the audio frame according to a modified linear predictive parameter of the audio frame. In this way, different modification weights are determined according to whether the signal characteristic of the audio frame and the signal characteristic of the previous audio frame meet the preset modification condition, and the linear predictive parameter of the audio frame is modified so that a spectrum between audio frames is steadier. Moreover, the electronic device codes the audio frame according to the modified linear predictive parameter of the audio frame, and therefore, audio having a wider bandwidth is coded while a bit rate remains unchanged or a bit rate slightly changes.
[0072] Refer to
[0073] The processor 410, the memory 420, and the transceiver 430 are connected to each other using the bus 440, and the bus 440 may be an industry standard architecture (ISA) bus, a peripheral component interconnect (PCI) bus, an extended ISA (EISA) bus, or the like. The bus may be classified into an address bus, a data bus, a control bus, and the like. For ease of representation, the bus in
[0074] The memory 420 is configured to store a program. The program may include program code, and the program code includes a computer operation instruction. The memory 420 may include a high-speed random access memory (RAM), and may further include a non-volatile memory, such as at least one magnetic disk memory.
[0075] The transceiver 430 is configured to connect other devices, and communicate with other devices.
[0076] The processor 410 executes the program code and is configured to, for each audio frame in audio, when a signal characteristic of the audio frame and a signal characteristic of a previous audio frame meet a preset modification condition, determine a first modification weight according to LSF differences of the audio frame and LSF differences of the previous audio frame. When the signal characteristic of the audio frame and the signal characteristic of the previous audio frame do not meet the preset modification condition, determine a second modification weight, where the preset modification condition is used to determine that the signal characteristic of the audio frame is similar to the signal characteristic of the previous audio frame, modify a linear predictive parameter of the audio frame according to the determined first modification weight or the determined second modification weight, and code the audio frame according to a modified linear predictive parameter of the audio frame.
[0077] Optionally, the processor 410 may be configured to determine the first modification weight according to the LSF differences of the audio frame and the LSF differences of the previous audio frame using the following formula, which may be substantially similar to formula 1:
where w[i] is the first modification weight, lsf_new_diff[i] is the LSF differences of the audio frame, lsf_old_diff[i] is the LSF differences of the previous audio frame, i is an order of the LSF differences, a value of i ranges from 0 to M−1, and M is an order of the linear predictive parameter.
[0078] Optionally, the processor 410 may be configured to determine the second modification weight as 1, or determine the second modification weight as a preset modification weight value, where the preset modification weight value is greater than 0, and is less than or equal to 1.
[0079] Optionally, the processor 410 may be configured to modify the linear predictive parameter of the audio frame according to the first modification weight using the following formula, which may be substantially similar to formula 2:
L[i]=(1−w[i])*L_old[i]+w[i]*L_new[i],
where w[i] is the first modification weight, L[i] is the modified linear predictive parameter of the audio frame, L_new[i] is the linear predictive parameter of the audio frame, L_old[i] is a linear predictive parameter of the previous audio frame, i is an order of the linear predictive parameter, the value of i ranges from 0 to M−1, and M is the order of the linear predictive parameter.
[0080] Optionally, the processor 410 may be configured to modify the linear predictive parameter of the audio frame according to the second modification weight using the following formula, which may be substantially similar to formula 3:
L[i]=(1−y)*L_old[i]+y*L_new[i],
where y is the second modification weight, L[i] is the modified linear predictive parameter of the audio frame, L_new[i] is the linear predictive parameter of the audio frame, L_old[i] is the linear predictive parameter of the previous audio frame, i is the order of the linear predictive parameter, the value of i ranges from 0 to M−1, and M is the order of the linear predictive parameter.
[0081] Optionally, the processor 410 may be configured to, for each audio frame in the audio, when the audio frame is not a transition frame, determine the first modification weight according to the LSF differences of the audio frame and the LSF differences of the previous audio frame. When the audio frame is a transition frame, determine the second modification weight, where the transition frame includes a transition frame from a non-fricative to a fricative, or a transition frame from a fricative to a non-fricative.
[0082] Optionally, the processor 410 may be configured to, for each audio frame in the audio, when a spectrum tilt frequency of the previous audio frame is not greater than a first spectrum tilt frequency threshold and/or a coding type of the audio frame is not transient, determine the first modification weight according to the LSF differences of the audio frame and the LSF differences of the previous audio frame. When the spectrum tilt frequency of the previous audio frame is greater than the first spectrum tilt frequency threshold and the coding type of the audio frame is transient, determine the second modification weight, or for each audio frame in the audio, when a spectrum tilt frequency of the previous audio frame is not greater than a first spectrum tilt frequency threshold and/or a spectrum tilt frequency of the audio frame is not less than a second spectrum tilt frequency threshold, determine the first modification weight according to the LSF differences of the audio frame and the LSF differences of the previous audio frame. When the spectrum tilt frequency of the previous audio frame is greater than the first spectrum tilt frequency threshold and the spectrum tilt frequency of the audio frame is less than the second spectrum tilt frequency threshold, determine the second modification weight.
[0083] Optionally, the processor 410 may be configured to, for each audio frame in the audio, when a spectrum tilt frequency of the previous audio frame is not less than a third spectrum tilt frequency threshold, and/or a coding type of the previous audio frame is not one of four types, voiced, generic, transient, and/or audio, and/or a spectrum tilt of the audio frame is not greater than a fourth spectrum tilt threshold, determine the first modification weight according to the LSF differences of the audio frame and the LSF differences of the previous audio frame. When the spectrum tilt frequency of the previous audio frame is less than the third spectrum tilt frequency threshold, the coding type of the previous audio frame is one of the four types, voiced, generic, transient, and/or audio, and the spectrum tilt frequency of the audio frame is greater than the fourth spectrum tilt frequency threshold, determine the second modification weight.
[0084] In this embodiment, for each audio frame in audio, when a signal characteristic of the audio frame and a signal characteristic of a previous audio frame meet a preset modification condition, an electronic device determines a first modification weight according to LSF differences of the audio frame and LSF differences of the previous audio frame. When the signal characteristic of the audio frame and the signal characteristic of the previous audio frame do not meet the preset modification condition, the electronic device determines a second modification weight. The electronic device modifies a linear predictive parameter of the audio frame according to the determined first modification weight or the determined second modification weight and codes the audio frame according to a modified linear predictive parameter of the audio frame. In this way, different modification weights are determined according to whether the signal characteristic of the audio frame and the signal characteristic of the previous audio frame meet the preset modification condition, and the linear predictive parameter of the audio frame is modified so that a spectrum between audio frames is steadier. Moreover, the electronic device codes the audio frame according to the modified linear predictive parameter of the audio frame, and therefore, audio having a wider bandwidth is coded while a bit rate remains unchanged or a bit rate slightly changes.
[0085] A person skilled in the art may clearly understand that, the technologies in the embodiments of the present disclosure may be implemented by software in addition to a necessary general hardware platform. Based on such an understanding, the technical solutions of the present disclosure essentially or the part contributing to the prior art may be implemented in a form of a software product. The software product is stored in a storage medium, such as a read only memory (ROM)/RAM, a hard disk, or an optical disc, and includes several instructions for instructing a computer device (which may be a personal computer, a server, or a network device) to perform the methods described in the embodiments or some parts of the embodiments of the present disclosure.
[0086] In this specification, the embodiments are described in a progressive manner. Reference may be made to each other for a same or similar part of the embodiments. Each embodiment focuses on a difference from other embodiments. Especially, the system embodiment is basically similar to the method embodiments, and therefore is briefly described. For a relevant part, reference may be made to the description in the part of the method embodiments.
[0087] The foregoing descriptions are implementation manners of the present disclosure, but are not intended to limit the protection scope of the present disclosure. Any modification, equivalent replacement, or improvement made without departing from the spirit and principle of the present disclosure shall fall within the protection scope of the present disclosure.