The invention relates to signal-processing systems. More specifically, the invention relates to audio encoders.
The use of digital audio has become widespread in audio and audio-visual systems. Therefore, the demand for more effective and efficient digital audio systems has increased, so that the same memory can be used to store more audio files. Further, an efficient digital audio system enables the same bandwidth to be used for transferring additional audio files. Therefore, system designers, as well as manufacturers, are striving to improve audio data-compression systems.
In conventional systems, perceptive encoding is mostly used for compression of audio signals. In any given situation, the human ear is capable of hearing only certain frequencies within the audible frequency band. This is taken into account in a psycho-acoustic model. This model takes the effects of simultaneous and temporal masking into account to define a masking threshold at different frequency levels. The masking threshold is defined as the minimum level of the particular frequency at which the human ear can hear. Therefore, the model helps an encoder to improve data compression by defining the frequencies that will not be heard by the human ear, so that the encoder can ignore these frequencies during bit allocation.
In a conventional encoder, an inner iteration loop or a rate control loop is carried out. In this loop, the quantization step is varied to match the number of bits available with the demand for bits generated by the coding employed. If the number of bits required by the frequencies selected by the psycho-acoustic model is more than the number of bits available, the quantization step is varied.
Further, the frequency spectrum of the input signal is divided into a number of frequency bands, and a scale factor is calculated for each of the frequency bands. Scale factors are calculated to shape the quantization noise according to the masking threshold. If the quantization noise of any band is above the masking threshold, the scale factor is adjusted to reduce the quantization noise. This iterative process of selecting the scale factors is known as the outer iteration loop or the distortion control loop.
An encoder generally performs various calculations, including the calculation of scale factors. However, the known methods for calculating scale factors are complex and computationally inefficient, which make the overall encoding process time-consuming.
Thus, there is a need for a computationally efficient method for calculation of scale factors.
An object of the invention is to provide a computationally efficient method and system for an estimation of the scale factors in an encoder.
Another object of the invention is to enable efficient calculation of scale factors in a Digital Signal Processor (DSP).
Embodiments of the invention provide a method and a system for computationally efficient estimation of scale factors in an encoder. In the encoder, the input signals are transformed using a Fourier transform. A first variable is defined as the summation of the square root of coefficients of the transform. According to embodiments of the invention, the value of the first variable is approximated. The approximated first variable is then used to calculate the value of the scale factors of the different frequency bands.
According to an embodiment of the invention, the first variable is approximated as the square root of the summation of the coefficients of the transform. This approximated value is used to calculate the value of the scale factors.
According to another embodiment of the invention, the approximated value of the first variable is used to calculate the ratio between the cube root of the square of the first variable and the cube root of the square of the product of the bandwidth and the masking level of each of the frequency bands. Then, the ratio having the minimum value of the first variable is selected. The value of the scale factor for any frequency band is calculated by using the value of the ratio for the particular frequency band and the selected ratio.
The preferred embodiments of the invention will hereinafter be described in conjunction with the appended drawings, provided to illustrate and not to limit the invention, wherein like designations denote like elements, and in which:
The invention relates to a method and a system for the calculation of scale factors in an audio encoder. The scale factors depend on a first variable. The value of the first variable is approximated. The computational complexity of the variable is reduced by this approximation. After this, the approximated first variable is used to calculate the values of the scale factors.
Further, a coding algorithm is selected, based on the input signal. In various embodiments, the coding algorithm may be based on range encoding, arithmetic coding, unary coding, Fibonacci coding, Rice coding, or Huffman coding. In an embodiment of the invention, Huffman coding is used for coding the signals. A number of Huffman Tables are known, and one of them is selected, based on the input signals.
Audio encoder 100 also comprises a distortion control loop 112 and a rate control loop 110. Distortion control loop 112 shapes the quantization noise according to the masking threshold by defining the scale factors of each of the frequency bands. If the quantization noise in any band exceeds the masking threshold, distortion control loop 112 adjusts the scale factor to bring the quantization noise below the masking threshold. Rate control loop 110 is used to control the number of bits assigned to the coded information with the help of a global gain value. If the number of codes from the selected Huffman table exceeds the number of bits available, rate control loop 110 changes the global gain value. The process of scaling by rate control loop 110 and distortion control loop 112 results in the scaled input MDCT coefficients.
Therefore, if the input MDCT coefficients are expressed as c(i), the scaled input MDCT coefficients may be represented as:
c(i)*2Gscl*scl(sfb)
where, Gscl is the global gain value defined by rate control loop 110, sfb is a scale factor band index, and scl(sfb) is a scale factor of a frequency band.
Thereafter, companding of the input MDCT coefficients is carried out after the optimum values of the scale factors and global gain are selected. The order of companding varies with the encoding algorithm. For example, in Moving Picture Experts Group (MPEG) Layer III encoding, the order of companding used is ¾. After this, quantization of the input MDCT coefficients is carried out. The input MDCT coefficients obtained after companding can be expressed as:
{c(i)*A(sfb)}3/4 (1)
where the overall scaling factor, A(sfb)=2Gscl*scl(sfb)
Also, audio encoder 100 comprises a Huffman coder 114, a side information coder 116, and a bit-stream formatting module 118. The companded input MDCT coefficients and the selected values of the coding algorithm, the scale factors, and the global gain are provided to Huffman coder 114, which encodes the companded input MDCT coefficients according to the selected algorithm. Therefore, using equation (1)
m(i)=int[{c(i)*A(sfb)}+0.5] (2)
where m(i) are the scaled, companded and quantized values of the input MDCT coefficients, 0.5 is the average quantization error and the function into is used to convert a value to its nearest integer value.
Side information coder 116 is used to code the other information pertaining to the scaled input MDCT coefficients. In various embodiments of the invention, this other information may include the number of bits allocated to each of the frequency bands, the scale factors of each of the bands, and their global gain value.
Finally, the input MDCT coefficients encoded by Huffman coder 114, and the other information encoded by side information coder 116, are sent to a bit-stream formatting module 118, which performs various checks on both the input MDCT coefficients and the other information. In an embodiment of the invention, bit-stream formatting module 118 performs a cyclic redundancy check. The encoding of the audio signals is complete once the check is performed, and the encoded audio signals may be sent to a decoder.
In the decoder, the de-scaling and de-companding of m(i) is carried out to result in the audio signals cq(i),
cq(i)=(m(i)4/3)/A(sfb) (3)
The total error introduced by the process of encoding and decoding is defined as
Using Taylor series expansion (m(i)−0.5)4/3 can be expressed as:
(m(i)−0.5)4/3≈m(i)4/3− 4/3*m(i)1/3*0.5
Therefore,
The average error in a frequency band (Qa(sfb)) may be defined as 1/B(sfb)*Σ(Q(i))2, where B(sfb) is the bandwidth of the frequency band. Hence, Qa(sfb) may be expressed as,
Qa(sfb)=( 4/9)*[Σ{cq(i)1/2}/{B(sfb)*A(sfb)3/2}]
Further, to keep noise below the masking level, the masking threshold (M(sfb)) of the frequency band sfb should be equal to the average error in the frequency band (Qa(sfb)). Therefore,
M(sfb)=( 4/9)*[Σ{cq(i)1/2}/{B(sfb)*A(sfb)3/2}]
Rearranging the terms, we get the overall scaling factor
A(sfb)=( 4/9)2/3*[{Σ(c(i)1/2)}2/3/{B(sfb)2/3*M(sfb)2/3}]
Replacing the value of the overall scale factor from equation (1), we get:
2Gscl*scl(sfb)=( 4/9)2/3*[{Σ(c(i)1/2)}2/3/{B(sfb)2/3*M(sfb)2/3}] (4)
According to an embodiment of the invention, equation (4) is used to calculate the scale factors of the different frequency bands. Further, a first variable f1 is defined as:
f1=Σ(c(i)1/2)
Therefore, equation (4) can be expressed as:
2Gscl*scl(sfb)=( 4/9)2/3*[(f1)2/3/{B(sfb)2/3*M(sfb)2/3}] (5)
Initially, the global gain value can be assumed to be unity. This value may be changed in subsequent iterations, if required. Hence, the value of the scale factor is calculated, based on the formula derived in equation (5).
2{sclf(sfb)}≈[[(f1)2/3/{B(sfb)2/3*M(sfb)2/3}]]/[[(f1min)2/3/{B(sfbmin)2/3*M(sfbmin)2/3}]] (6)
where f1min is the minimum value of the first variable, B(sfbmin) and M(sfbmin) are the bandwidth and the masking threshold of the frequency band corresponding to f1min, respectively. As mentioned earlier, the global gain, Gscl, is assumed to be unity.
According to another embodiment of the invention, the first variable can be approximated as the square root of the summation of the MDCT coefficients of the different frequency bands. Mathematically, this can be expressed as
f1=Σ(c(i)1/2)=(Σc(i))1/2
Applying this value to equation (6), we get
2{sclf(sfb)}≈[(Σc(i))1/3/{B(sfb)2/3*M(sfb)2/3}]/[(Σc(i)min)1/3/{B(sfbmin)2/3*M(sfbmin)2/3}]
where, c(i)min are the values of the MDCT coefficients corresponding to the frequency band that has the minimum value of first variable, f1.
The above equation can also be expressed as
2{sclf(sfb)}≈[(Σc(i))/{B(sfb)2*M(sfb)2}]1/3/[(Σc(i)min)/{B(sfbmin)2*M(sfbmin)2}]1/3
Further defining two variables smr2(sfb) and smr2(sfbmin) as:
smr2(sfb)=[(Σc(i))/{B(sfb)2*M(sfb)2}], and
smr2(sfbmin)=[(Σc(i)min)/{B(sfbmin)2*M(sfbmin)2}]
the aforementioned equation can be expressed as
2{scf(sfb)}=(smr2(sfb))1/3/(smr2(sfbmin))1/3
Further simplifying, we get
2{3*sclf(sfb)}=smr2(sfb)/smr2(sfbmin) (7)
In an embodiment of the invention, taking logarithm on base 2,
In another embodiment, smr2(sfb) and smr2(sfbmin) are expressed in mantissa and exponent form as smr2.m(sfb)smr2.e(sfb) and smr2.m(sfbmin)smr2.e(sfbmin), respectively.
Therefore,
sclf(sfb)={log2(smr2.m(sfb)smr2.e(sfb))−log2(smr2.m(sfbmin)smr2.(sfbmin))}/3
In yet another embodiment, smr2.m(sfb) and smr2.m(sfbmin) are equal to 2. Therefore, equation (8) may be expressed as
sclf(sfb)=((smr2.e(sfb))−smr2.e(sfbmin))/3 (9)
In another embodiment of the invention, the calculation of scale factors is carried out on a floating-point digital signal processor.
In another embodiment of the invention, a fixed-point digital signal processor, which can work on a pseudo floating-point algorithm with reduced accuracy, can be used for the calculation of the scale factor.
The quality of the audio signals produced by an audio encoder, incorporating an embodiment of the invention, can be checked with the help of an Objective Difference Grade (ODG). ODG provides the degradation of a signal with respect to a reference signal. ODG varies between 0 and −4, where the degree of degradation of the signal increases from 0 to −4. For example, if the ODG is 0, there is an imperceptible degradation in the signal. Similarly, if the ODG is −4, there is a large degradation in the signal with respect to the reference signal.
The embodiments of the invention have the advantage that the complexity of the calculation of the scale factors reduces to one-tenth of the earlier methods of calculation. This enables faster and more efficient calculation. Further, this helps in simpler implementation on a floating-point or a fixed-point digital signal processor.
Although the invention has been discussed with respect to specific embodiments thereof, these embodiments are merely illustrative, and not restrictive, of the invention.
In the description herein, numerous specific details are provided, such as examples of components and/or methods, to provide a thorough understanding of embodiments of the invention. One skilled in the relevant art will recognize, however, that an embodiment of the invention can be practiced without one or more of the specific details, or with other apparatus, systems, assemblies, methods, components, materials, parts, and/or the like. In other instances, well-known structures, materials, or operations are not specifically shown or described in detail to avoid obscuring aspects of embodiments of the invention.
Reference throughout this specification to “one embodiment”, “an embodiment”, or “a specific embodiment” means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the invention and not necessarily in all embodiments. Thus, respective appearances of the phrases “in one embodiment”, “in an embodiment”, or “in a specific embodiment” in various places throughout this specification are not necessarily referring to the same embodiment. Furthermore, the particular features, structures, or characteristics of any specific embodiment of the invention may be combined in any suitable manner with one or more other embodiments. It is to be understood that other variations and modifications of the embodiments of the invention, described and illustrated herein, are possible in light of the teachings herein and are to be considered as part of the spirit and scope of the invention.
It will also be appreciated that one or more of the elements depicted in the drawings/figures can also be implemented in a more separated or integrated manner, or even removed or rendered as inoperable in certain cases, as is useful in accordance with a particular application. It is also within the spirit and scope of the invention to implement a program or code that can be stored in a machine-readable medium to permit a computer to perform any of the methods described above.
Additionally, any signal arrows in the drawings/figures should be considered only as exemplary, and not limiting, unless otherwise specifically noted. Embodiments of the invention may be implemented by using a programmed general purpose digital computer, by using application specific integrated circuits, programmable logic devices, field programmable gate arrays, optical, chemical, biological, quantum or nano-engineered systems, components and mechanisms may be used. In general, the functions of the invention can be achieved by any means as is known in the art. Distributed, or networked systems, components and circuits can be used. Communication, or transfer, of data may be wired, wireless, or by any other means.
A “machine-readable medium” for purposes of embodiments of the invention may be any medium that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, system or device. The machine-readable medium can be, by way of example only but not by limitation, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, system, device, propagation medium, or computer memory.
Any suitable programming language can be used to implement the routines of the invention including C, C++, Java, assembly language, etc. Different programming techniques can be employed such as procedural or object oriented. The routines can execute on a single processing device or multiple processors. Although the steps, operations or computations may be presented in a specific order, this order may be changed in different embodiments. In some embodiments, multipie steps shown as sequential in this specification can be performed at the same time. The sequence of operations described herein can be interrupted, suspended, or otherwise controlled by another process, such as Digital Signal Processing etc. The routines can operate in audio encoding environment or as stand-alone routines occupying all, or a substantial part, of the system processing.
A “processor” or “process” includes any human, hardware and/or software system, mechanism or component that processes data, signals or other information. A processor can include a system with a general-purpose central processing unit, multiple processing units, dedicated circuitry for achieving functionality, or other systems. Processing need not be limited to a geographic location, or have temporal limitations. For example, a processor can perform its functions in “real time,” “offline,” in a “batch mode,” etc. Portions of processing can be performed at different times and at different locations, by different (or the same) processing systems.
Number | Date | Country | Kind |
---|---|---|---|
1758/CHE/2005 | Dec 2005 | IN | national |
Number | Name | Date | Kind |
---|---|---|---|
5065431 | Rollett | Nov 1991 | A |
5774844 | Akagiri | Jun 1998 | A |
5890125 | Davis et al. | Mar 1999 | A |
6098039 | Nishida | Aug 2000 | A |
6308150 | Neo et al. | Oct 2001 | B1 |
6339757 | Teh et al. | Jan 2002 | B1 |
6678648 | Surucu | Jan 2004 | B1 |
6718019 | Heidari et al. | Apr 2004 | B1 |
6732071 | Lopez-Estrada et al. | May 2004 | B2 |
6745162 | Hu | Jun 2004 | B1 |
6850616 | Soman et al. | Feb 2005 | B2 |
7072477 | Kincaid | Jul 2006 | B1 |
7315822 | Li | Jan 2008 | B2 |
7318035 | Andersen et al. | Jan 2008 | B2 |
7353169 | Goodwin et al. | Apr 2008 | B1 |
7472152 | Tsui et al. | Dec 2008 | B1 |
20020120442 | Hotta | Aug 2002 | A1 |
20040015525 | Martens et al. | Jan 2004 | A1 |
20040162720 | Jang et al. | Aug 2004 | A1 |
20080027709 | Baumgarte | Jan 2008 | A1 |
20080031463 | Davis | Feb 2008 | A1 |
20080250090 | Eitel | Oct 2008 | A1 |
Number | Date | Country | |
---|---|---|---|
20070129939 A1 | Jun 2007 | US |