Patent Description:
A reference document for the EVS codec is<NPL>), <NUM>rd generation partnership project; Technical Specification Group Services and System Aspects; Codec for Enhanced Voice Services (EVS); Detailed algorithmic description (release <NUM>).

However, the present invention is additionally useful in other EVS versions as, for example, defined by other releases than release <NUM> and, additionally, the present invention is additionally useful in all other audio encoders different from EVS that, however, rely on a detector, a shaper and a quantizer and coder stage as defined, for example, in the claims.

Additionally, it is to be noted that all embodiments defined not only by the independent but also defined by the dependent claims can be used separately from each other or together as outlined by the interdependencies of the claims or as discussed later on under preferred examples.

The EVS Codec [<NUM>], as specified in 3GPP, is a modern hybrid-codec for narrow-band NB), wide-band (WB), super-wide-band (SWB) or full-band (FB) speech and audio content, which can switch between several coding approaches, based on signal classification:
<FIG> illustrates a common processing and different coding schemes in EVS. Particularly, a common processing portion of the encoder in <FIG> comprises a signal resampling block <NUM>, and a signal analysis block <NUM>. The audio input signal is input at an audio signal input <NUM> into the common processing portion and, particularly, into the signal resampling block <NUM>. The signal resampling block <NUM> additionally has a command line input for receiving command line parameters. The output of the common processing stage is input in different elements as can be seen in <FIG>. Particularly, <FIG> comprises a linear prediction-based coding block (LP-based coding) <NUM>, a frequency domain coding block <NUM> and an inactive signal coding/CNG block <NUM>. Blocks <NUM>, <NUM>, <NUM> are connected to a bitstream multiplexer <NUM>. Additionally, a switch <NUM> is provided for switching, depending on a classifier decision, the output of the common processing stage to either the LP-based coding block <NUM>, the frequency domain coding block <NUM> or the inactive signal coding/CNG (comfort noise generation) block <NUM>. Furthermore, the bitstream multiplexer <NUM> receives a classifier information, i.e., whether a certain current portion of the input signal input at block <NUM> and processed by the common processing portion is encoded using any of the blocks <NUM>, <NUM>, <NUM>.

To provide maximum quality for low and medium bitrates, frequent switching between LP-based Coding and Frequency Domain Coding is performed, based on Signal Analysis in a Common Processing Module. To save on complexity, the codec was optimized to re-use elements of the signal analysis stage also in subsequent modules. For example: The Signal Analysis module features an LP analysis stage. The resulting LP-filter coefficients (LPC) and residual signal are firstly used for several signal analysis steps, such as the Voice Activity Detector (VAD) or speech/music classifier. Secondly, the LPC is also an elementary part of the LP-based Coding scheme and the Frequency Domain Coding scheme. To save on complexity, the LP analysis is performed at the internal sampling rate of the CELP coder (SRCELP).

The CELP coder operates at either <NUM> or <NUM> internal sampling-rate (SRCELP), and can thus represent signals up to <NUM> or <NUM> audio bandwidth directly. For audio content exceeding this bandwidth at WB, SWB or FB, the audio content above CELP's frequency representation is coded by a bandwidth-extension mechanism.

The MDCT-based TCX is a submode of the Frequency Domain Coding. Like for the LP-based coding approach, noise-shaping in TCX is performed based on an LP-filter. This LPC shaping is performed in the MDCT domain by applying gain factors computed from weighted quantized LP filter coefficients to the MDCT spectrum (decoder-side). On encoder-side, the inverse gain factors are applied before the rate loop. This is subsequently referred to as application of LPC shaping gains. The TCX operates on the input sampling rate (SRinp). This is exploited to code the full spectrum directly in the MDCT domain, without additional bandwidth extension. The input sampling rate SRinp, on which the MDCT transform is performed, can be higher than the CELP sampling rate SRCELP, for which LP coefficients are computed. Thus LPC shaping gains can only be computed for the part of the MDCT spectrum corresponding to the CELP frequency range (fCELP). For the remaining part of the spectrum (if any) the shaping gain of the highest frequency band is used.

<FIG> illustrates on a high level the application of LPC shaping gains and for the MDCT based TCX. Particularly, <FIG> illustrates a principle of noise-shaping and coding in the TCX or frequency domain coding block <NUM> of <FIG> on the encoder-side.

Particularly, <FIG> illustrates a schematic block diagram of an encoder. The input signal <NUM> is input into the resampling block <NUM> in order to perform a resampling of the signal to the CELP sampling rate SRCELP, i.e., the sampling rate required by LP-based coding block <NUM> of <FIG>. Furthermore, an LPC calculator <NUM> is provided that calculates LPC parameters and in block <NUM>, an LPC-based weighting is performed in order to have the signal further processed by the LP-based coding block <NUM> in <FIG>, i.e., the LPC residual signal that is encoded using the ACELP processor.

Additionally, the input signal <NUM> is input, without any resampling, to a time-spectral converter <NUM> that is exemplarily illustrated as an MDCT transform. Furthermore, in block <NUM>, the LPC parameters calculated by block <NUM> are applied after some calculations. Particularly, block <NUM> receives the LPC parameters calculated from block <NUM> via line <NUM> or alternatively or additionally from block <NUM> and then derives the MDCT or, generally, spectral domain weighting factors in order to apply the corresponding inverse LPC shaping gains. Then, in block <NUM>, a general quantizer/encoder operation is performed that can, for example, be a rate loop that adjusts the global gain and, additionally, performs a quantization/coding of spectral coefficients, preferably using arithmetic coding as illustrated in the well-known EVS encoder specification to finally obtain the bitstream.

In contrast to the CELP coding approach, which combines a core-coder at SRCELP and a bandwidth-extension mechanism running at a higher sampling rate, the MDCT-based coding approaches directly operate on the input sampling rate SRinp and code the content of the full spectrum in the MDCT domain.

The MDCT-based TCX codes up to <NUM> audio content at low bitrates, such as <NUM> or <NUM> kbit/s SWB. Since at such low bitrates only a small subset of the spectral coefficients can be coded directly by means of the arithmetic coder, the resulting gaps (regions of zero values) in the spectrum are concealed by two mechanisms:.

The Noise Filling is used for lower frequency portions up to the highest frequency, which can be controlled by the transmitted LPC (fCELP). Above this frequency, the IGF tool is used, which provides other mechanisms to control the level of the inserted frequency portions.

There are two mechanisms for the decision on which spectral coefficients survive the encoding procedure, or which will be replaced by noise filling or IGF:.

The weighted LPC follows the spectral envelope of the signal. By applying the inverse LPC shaping gains using the weighted LPC a perceptual whitening of the spectrum is performed. This significantly reduces the dynamics of the MDCT spectrum before the coding-loop, and thus also controls the bit-distribution among the MDCT spectral coefficients in the coding-loop.

As explained above, the weighted LPC is not available for frequencies above fCELP. For these MDCT coefficients, the shaping gain of the highest frequency band below fCELP is applied. This works well in cases where the shaping gain of the highest frequency band below fCELP roughly corresponds to the energy of the coefficients above fCELP, which is often the case due to the spectral tilt, and which can be observed in most audio signals. Hence, this procedure is advantageous, since the shaping information for the upper band need not be calculated or transmitted.

However, in case there are strong spectral components above fCELP and the shaping gain of the highest frequency band below fCELP is very low, this results in a mismatch. This mismatch heavily impacts the work or the rate loop, which focuses on the spectral coefficients having the highest amplitude. This will at low bitrates zero out the remaining signal components, especially in the low-band, and produces perceptually bad quality.

<FIG> illustrate the problem. <FIG> shows the absolute MDCT spectrum before the application of the inverse LPC shaping gains, <FIG> the corresponding LPC shaping gains. There are strong peaks above fCELP visible, which are in the same order of magnitude as the highest peaks below fCELP. The spectral components above fCELP are a result of the preprocessing using the IGF tonal mask. <FIG> shows the absolute MDCT spectrum after applying the inverse LPC gains, still before quantization. Now the peaks above fCELP significantly exceed the peaks below fCELP, with the effect that the rate-loop will primarily focus on these peaks. <FIG> shows the result of the rate loop at low bitrates: All spectral components except the peaks above fCELP were quantized to <NUM>. This results in a perceptually very poor result after the complete decoding process, since the psychoacoustically very relevant signal portions at low frequencies are missing completely.

<FIG> illustrates an MDCT spectrum of a critical frame before the application of inverse LPC shaping gains.

<FIG> illustrates LPC shaping gains as applied. On the encoder-side, the spectrum is multiplied with the inverse gain. The last gain value is used for all MDCT coefficients above fCELP. <FIG> indicates fCELP at the right border.

<FIG> illustrates an MDCT spectrum of a critical frame after application of inverse LPC shaping gains. The high peaks above fCELP are clearly visible.

<FIG> illustrates an MDCT spectrum of a critical frame after quantization. The displayed spectrum includes the application of the global gain, but without the LPC shaping gains. It can be seen that all spectral coefficients except the peak above fCELP are quantized to <NUM>.

<CIT> discloses an audio encoder that comprises: a first encoding processor for encoding a first audio signal portion in a frequency domain, wherein the first encoding processor comprises: a time frequency converter for converting the first audio signal portion into a frequency domain representation having spectral lines up to a maximum frequency of the first audio signal portion; an analyzer for analyzing the frequency domain representation up to the maximum frequency to determine first spectral portions to be encoded with a first spectral resolution and second spectral regions to be encoded with a second spectral resolution, the second spectral resolution being lower than the first spectral resolution; a spectral encoder for encoding the first spectral portions with the first spectral resolution and for encoding the second spectral portions with the second spectral resolution; a second encoding processor for encoding a second different audio signal portion in the time domain; a controller configured for analyzing the audio signal and for determining, which portion of the audio signal is the first audio signal portion encoded in the frequency domain and which portion of the audio signal is the second audio signal portion encoded in the time domain; and an encoded signal former for forming an encoded audio signal comprising a first encoded signal portion for the first audio signal portion and a second encoded signal portion for the second audio signal portion.

It is an object of the present invention to provide an improved audio encoding concept.

This object is achieved by an audio encoder of claim <NUM>, a method for encoding an audio signal of claim <NUM> or a computer program of claim <NUM>.

The present invention is based on the finding that such prior art problems can be addressed by preprocessing the audio signal to be encoded depending on a specific characteristic of the quantizer and coder stage included in the audio encoder. To this end, a peak spectral region in an upper frequency band of the audio signal is detected. Then, a shaper for shaping the lower frequency band using shaping information for the lower band and for shaping the upper frequency band using at least a portion of the shaping information for the lower band is used. Particularly, the shaper is additionally configured to attenuate spectral values in a detected peak spectral region, i.e., in a peak spectral region detected by the detector in the upper frequency band of the audio signal. Then, the shaped lower frequency band and the attenuated upper frequency band are quantized and entropy-encoded.

Due to the fact that the upper frequency band has been attenuated selectively, i.e., within the detected peak spectral region, this detected peak spectral region cannot fully dominate the behavior of the quantizer and coder stage anymore.

Instead, due to the fact that an attenuation has been formed in the upper frequency band of the audio signal, the overall perceptual quality of the result of the encoding operation is improved. Particularly at low bitrates, where a quite low bitrate is a main target of the quantizer and coder stage, high spectral peaks in the upper frequency band would consume all the bits required by the quantizer and coder stage, since the coder would be guided by the high upper frequency portions and would, therefore, use most of the available bits in these portions. This automatically results in a situation where any bits for perceptually more important lower frequency ranges are not available anymore. Thus, such a procedure would result in a signal only having encoded high frequency portions while the lower frequency portions are not coded at all or are only encoded very coarsely. However, it has been found that such a procedure is less perceptually pleasant compared to a situation, where such a problematic situation with predominant high spectral regions is detected and the peaks in the higher frequency range are attenuated before performing the encoder procedure comprising a quantizer and a entropy encoder stage.

Preferably, the peak spectral region is detected in the upper frequency band of an MDCT spectrum. However, other time-spectral converters can be used as well such as a fil-terbank, a QMF filter bank, a DFT, an FFT or any other time-frequency conversion.

Furthermore, the present invention is useful in that, for the upper frequency band, it is not required to calculate shaping information. Instead, a shaping information originally calculated for the lower frequency band is used for shaping the upper frequency band. Thus, the present invention provides a computationally very efficient encoder since a low band shaping information can also be used for shaping the high band, since problems that might result from such a situation, i.e., high spectral values in the upper frequency band are addressed by the additional attenuation additionally applied by the shaper in addition to the straightforward shaping typically based on the spectral envelope of the low band signal that can, for example, be characterized by a LPC parameters for the low band signal. But the spectral envelope can also be represented by any other corresponding measure that is usable for performing a shaping in the spectral domain.

The quantizer and coder stage performs a quantizing and coding operation on the shaped signal, i.e., on the shaped low band signal and on the shaped high band signal, but the shaped high band signal additionally has received the additional attenuation.

Although the attenuation of the high band in the detected peak spectral region is a preprocessing operation that cannot be recovered by the decoder anymore, the result of the decoder is nevertheless more pleasant compared to a situation, where the additional attenuation is not applied, since the attenuation results in the fact that bits are remaining for the perceptually more important lower frequency band. Thus, in problematic situations where a high spectral region with peaks would dominate the whole coding result, the present invention provides for an additional attenuation of such peaks so that, in the end, the encoder "sees" a signal having attenuated high frequency portions and, therefore, the encoded signal still has useful and perceptually pleasant low frequency information. The "sacrifice" with respect to the high spectral band is not or almost not noticeable by listeners, since listeners, generally, do not have a clear picture of the high frequency content of a signal but have, to a much higher probability, an expectation regarding the low frequency content. In other words, a signal that has very low level low frequency content but a significant high level frequency content is a signal that is typically perceived to be unnatural.

Preferred embodiments of the invention comprise a linear prediction analyzer for deriving linear prediction coefficients for a time frame and these linear prediction coefficients represent the shaping information or the shaping information is derived from those linear prediction coefficients.

In a further embodiment, several shaping factors are calculated for several subbands of the lower frequency band, and for the weighting in the higher frequency band, the shaping factor calculated for the highest subband of the low frequency band is used.

In a further embodiment, the detector determines a peak spectral region in the upper frequency band when at least one of a group of conditions is true, where the group of conditions comprises at least a low frequency band amplitude condition, a peak distance condition and a peak amplitude condition. Even more preferably, a peak spectral region is only detected when two conditions are true at the same time and even more preferably, a peak spectral region is only detected when all three conditions are true.

In a further embodiment, the detector determines several values used for examining the conditions either before or after the shaping operation with or without the additional attenuation.

In an embodiment, the shaper additionally attenuates the spectral values using an attenuation factor, where this attenuation factor is derived from a maximum spectral amplitude in the lower frequency band multiplied by a predetermined number being greater than or equal to <NUM> and divided by the maximum spectral amplitude in the upper frequency band.

Furthermore, the specific way, as to how the additional attenuation is applied, can be done in several different ways. One way is that the shaper firstly performs the weighting information using at least a portion of the shaping information for the lower frequency band in order to shape the spectral values in the detected peak spectral region. Then, a subsequent weighting operation is performed using the attenuation information.

An alternative procedure is to firstly apply a weighting operation using the attenuation information and to then perform a subsequent weighting using a weighting information corresponding to the at least the portion of the shaping information for the lower frequency band. A further alternative is to apply a single weighting information using a combined weighting information that is derived from the attenuation on the one hand and the portion of the shaping information for the lower frequency band on the other hand.

In a situation where the weighting is performed using a multiplication, the attenuation information is an attenuation factor and the shaping information is a shaping factor and the actual combined weighting information is a weighting factor, i.e., a single weighting factor for the single weighting information, where this single weighting factor is derived by multiplying the attenuation information and the shaping information for the lower band. Thus, it becomes clear that the shaper can be implemented in many different ways, but, nevertheless, the result is a shaping of the high frequency band using shaping information of the lower band and an additional attenuation.

In an embodiment, the quantizer and coder stage comprises a rate loop processor for estimating a quantizer characteristic so that the predetermined bitrate of an entropy encoded audio signal is obtained. In an embodiment, this quantizer characteristic is a global gain, i.e., a gain value applied to the whole frequency range, i.e., applied to all the spectral values that are to be quantized and encoded. When it appears that the required bitrate is lower than a bitrate obtained using a certain global gain, then the global gain is increased and it is determined whether the actual bitrate is now in line with the requirement, i.e., is now smaller than or equal to the required bitrate. This procedure is performed, when the global gain is used in the encoder before the quantization in such a way the spectral values are divided by the global gain. When, however, the global gain is used differently, i.e., by multiplying the spectral values by the global gain before performing the quantization, then the global gain is decreased when an actual bitrate is too high, or the global gain can be increased when the actual bitrate is lower than admissible.

However, other encoder stage characteristics can be used as well in a certain rate loop condition. One way would, for example, be a frequency-selective gain. A further procedure would be to adjust the band width of the audio signal depending on the required bitrate. Generally, different quantizer characteristics can be influenced so that, in the end, a bit rate is obtained that is in line with the required (typically low) bitrate.

Preferably, this procedure is particularly well suited for being combined with intelligent gap filling processing (IGF processing). In this procedure, a tonal mask processor is applied for determining, in the upper frequency band, a first group of spectral values to be quantized and entropy encoded and a second group of spectral values to be parametrically encoded by the gap-filling procedure. The tonal mask processor sets the second group of spectral values to <NUM> values so that these values do not consume many bits in the quantizer/encoder stage. On the other hand, it appears that typically values belonging to the first group of spectral values that are to be quantized and entropy coded are the values in the peak spectral region that, under certain circumstances, can be detected and additionally attenuated in case of a problematic situation for the quantizer/encoder stage. Therefore, the combination of a tonal mask processor within an intelligent gap-filling framework with the additional attenuation of detected peak spectral regions results in a very efficient encoder procedure which is, additionally, backward-compatible and, nevertheless, results in a good perceptual quality even at very low bitrates.

Embodiments are advantageous over potential solutions to deal with this problem that include methods to extend the frequency range of the LPC or other means to better fit the gains applied to frequencies above fCELP to the actual MDCT spectral coefficients. This procedure, however, destroys backward compatibility, when a codec is already deployed in the market, and the previously described methods would break interoperability to existing implementations.

Subsequently, preferred embodiments of the present invention are illustrated with respect to the accompanying drawings, in which:.

<FIG> illustrates a preferred embodiment of an audio encoder for encoding an audio signal <NUM> having a lower frequency band and an upper frequency band. The audio encoder comprises a detector <NUM> for detecting a peak spectral region in the upper frequency band of the audio signal <NUM>. Furthermore, the audio encoder comprises a shaper <NUM> for shaping the lower frequency band using shaping information for the lower band and for shaping the upper frequency band using at least a portion of the shaping information for the lower frequency band. Additionally, the shaper is configured to additionally attenuate spectral values in the detected peak spectral region in the upper frequency band.

Thus, the shaper <NUM> performs a kind of "single shaping" in the low-band using the shaping information for the low-band. Furthermore, the shaper additionally performs a kind of a "single" shaping in the high-band using the shaping information for the low-band and typically, the highest frequency low-band. This "single" shaping is performed in some embodiments in the high-band where no peak spectral region has been detected by the detector <NUM>. Furthermore, for the peak spectral region within the high-band, a kind of a "double" shaping is performed, i.e., the shaping information from the low-band is applied to the peak spectral region and, additionally, the additional attenuation is applied to the peak spectral region.

The result of the shaper <NUM> is a shaped signal <NUM>. The shaped signal is a shaped lower frequency band and a shaped upper frequency band, where the shaped upper frequency band comprises the peak spectral region. This shaped signal <NUM> is forwarded to a quantizer and coder stage <NUM> for quantizing the shaped lower frequency band and the shaped upper frequency band including the peak spectral region and for entropy coding the quantized spectral values from the shaped lower frequency band and the shaped upper frequency band comprising the peak spectral region again to obtain the encoded audio signal <NUM>.

Preferably, the audio encoder comprises a linear prediction coding analyzer <NUM> for deriving linear prediction coefficients for a time frame of the audio signal by analyzing a block of audio samples in the time frame. Preferably, these audio samples are band-limited to the lower frequency band.

Additionally, the shaper <NUM> is configured to shape the lower frequency band using the linear prediction coefficients as the shaping information as illustrated at <NUM> in <FIG>. Additionally, the shaper <NUM> is configured to use at least the portion of the linear prediction coefficients derived from the block of audio samples band-limited to the lower frequency band for shaping the upper frequency band in the time frame of the audio signal.

As illustrated in <FIG>, the lower frequency band is preferably subdivided into a plurality of subbands such as, exemplarily four subbands SB1, SB2, SB3 and SB4. Additionally, as schematically illustrated, the subband width increases from lower to higher subbands, i.e., the subband SB4 is broader in frequency than the subband SB1. In other embodiments, however, bands having an equal bandwidth can be used as well.

The subbands SB1 to SB4 extend up to the border frequency which is, for example, FCELP. Thus, all the subbands below the border frequency fCELP constitute the lower band and the frequency content above the border frequency constitutes the higher band.

Particularly, the LPC analyzer <NUM> of <FIG> typically calculates shaping information for each subband individually. Thus, the LPC analyzer <NUM> preferably calculates four different kinds of subband information for the four subbands SB1 to SB4 so that each subband has its associated shaping information.

Furthermore, the shaping is applied by the shaper <NUM> for each subband SB1 to SB4 using the shaping information calculated for exactly this subband and, importantly, a shaping for the higher band is also done, but the shaping information for the higher band is not being calculated due to the fact that the linear prediction analyzer calculating the shaping information receives a band limited signal band limited to the lower frequency band. Nevertheless, in order to also perform a shaping for the higher frequency band, the shaping information for subband SB4 is used for shaping the higher band. Thus, the shaper <NUM> is configured to weigh the spectral coefficients of the upper frequency band using a shaping factor calculated for a highest subband of the lower frequency band. The highest subband corresponding to SB4 in <FIG> has a highest center frequency among all center frequencies of subbands of the lower frequency band.

<FIG> illustrates a preferred flowchart for explaining the functionality of the detector <NUM>. Particularly, the detector <NUM> is configured to determine a peak spectral region in the upper frequency band, when at least one of a group of conditions is true, where the group of conditions comprises a low-band amplitude condition <NUM>, a peak distance condition <NUM> and a peak amplitude condition <NUM>.

Preferably, the different conditions are applied in exactly the order illustrated in <FIG>. In other words, the low-band amplitude condition <NUM> is calculated before the peak distance condition <NUM>, and the peak distance condition is calculated before the peak amplitude condition <NUM>. In a situation, where all three conditions must be true in order to detect the peak spectral region, a computationally efficient detector is obtained by applying the sequential processing in <FIG>, where, as soon as a certain condition is not true, i.e., is false, the detection process for a certain time frame is stopped and it is determined that an attenuation of a peak spectral region in this time frame is not required. Thus, when it is already determined for a certain time frame that the low-band amplitude condition <NUM> is not fulfilled, i.e., is false, then the control proceeds to the decision that an attenuation of a peak spectral region in this time frame is not necessary and the procedure goes on without any additional attenuation. When, however, the controller determines for condition <NUM> that same is true, the second condition <NUM> is determined. This peak distance condition is once again determined before the peak amplitude <NUM> so that the control determines that no attenuation of the peak spectral region is performed, when condition <NUM> results in a false result. Only when the peak distance condition <NUM> has a true result, the third peak amplitude condition <NUM> is determined.

In other embodiments, more or less conditions can be determined, and a sequential or parallel determination can be performed, although the sequential determination as exemplarily illustrated in <FIG> is preferred in order to save computational resources that are particularly valuable in mobile applications that are battery powered.

<FIG>, <FIG>, <FIG> provide preferred embodiments for the conditions <NUM>, <NUM> and <NUM>.

In the low-band amplitude condition, a maximum spectral amplitude in the lower band is determined as illustrated at block <NUM>. This value is max_low. Furthermore, in block <NUM>, a maximum spectral amplitude in the upper band is determined that is indicated as max_high.

In block <NUM>, the determined values from blocks <NUM> and <NUM> are processed preferably together with a predetermined number c<NUM> in order to obtain the false or true result of condition <NUM>. Preferably, the conditions in blocks <NUM> and <NUM> are performed before shaping with the lower band shaping information, i.e., before the procedure performed by the spectral shaper <NUM> or, with respect to <FIG>, 804a.

With respect to the predetermined number c<NUM> of <FIG> used in block <NUM>, a value of <NUM> is preferred, but values between <NUM> and <NUM> have been proven useful as well.

<FIG> illustrates a preferred embodiment of the peak distance condition. In block <NUM>, a first maximum spectral amplitude in the lower band is determined that is indicated as max_low.

Furthermore, a first spectral distance is determined as illustrated at block <NUM>. This first spectral distance is indicated as dist -low. Particularly, the first spectral distance is a distance of the first maximum spectral amplitude as determined by block <NUM> from a border frequency between a center frequency of the lower frequency band and a center frequency of the upper frequency band. Preferably, the border frequency is f_celp, but this frequency can have any other value as outlined before.

Furthermore, block <NUM> determines a second maximum spectral amplitude in the upper band that is called max_high. Furthermore, a second spectral distance <NUM> is determined and indicated as dist_high. The second spectral distance of the second maximum spectral amplitude from the border frequency is once again preferably determined with spectral f_celp as the border frequency.

Furthermore, in block <NUM>, it is determined whether the peak distance condition is true, when the first maximum spectral amplitude weighted by the first spectral distance and weighted by a predetermined number being greater than <NUM> is greater than the second maximum spectral amplitude weighted by the second spectral distance.

Preferably, a predetermined number c<NUM> is equal to <NUM> in the most preferred embodiment. Values between <NUM> and <NUM> have been proven as useful.

Preferably, the determination in block <NUM> and <NUM> is performed after shaping with the lower band shaping information, i.e., subsequent to block 804a, but, of course, before block 804b in <FIG>.

<FIG> illustrates a preferred implementation of the peak amplitude condition. Particularly, block <NUM> determines a first maximum spectral amplitude in the lower band and block <NUM> determines a second maximum spectral amplitude in the upper band where the result of block <NUM> is indicated as max_low2 and the result of block <NUM> is indicated as max_high.

Then, as illustrated in block <NUM>, the peak amplitude condition is true, when the second maximum spectral amplitude is greater than the first maximum spectral amplitude weighted by a predetermined number c<NUM> being greater than or equal to <NUM>. c<NUM> is preferably set to a value of <NUM> or to a value of <NUM> depending on different rates where, generally, values between <NUM> and <NUM> have been proven as useful.

Furthermore, as indicated in <FIG>, the determination in blocks <NUM> and <NUM> takes place after shaping with the low-band shaping information, i.e., subsequent to the processing illustrated in block 804a and before the processing illustrated by block 804b or, with respect to <FIG>, subsequent to block <NUM> and before block <NUM>.

In other embodiments, the peak amplitude condition <NUM> and, particularly, the procedure in <FIG>, block <NUM> is not determined from the smallest value in the lower frequency band, i.e., the lowest frequency value of the spectrum, but the determination of the first maximum spectral amplitude in the lower band is determined based on a portion of the lower band where the portion extends from a predetermined start frequency until a maximum frequency of the lower frequency band, where the predetermined start frequency is greater than a minimum frequency of the lower frequency band. In an embodiment, the predetermined start frequency is at least <NUM>% of the lower frequency band above the minimum frequency of the lower frequency band or, in other embodiments, the predetermined start frequency is at a frequency being equal to half a maximum frequency of the lower frequency band within a tolerance range of plus or minus <NUM>% of half the maximum frequency.

Furthermore, it is preferred that the third predetermined number c<NUM> depends on a bitrate to be provided by the quantizer/coder stage, so that the predetermined number is higher for a higher bitrate. In other words, when the bitrate that has to be provided by the quantizer and coder stage <NUM> is high, then c<NUM> is high, while, when the bitrate is to be determined as low, then the predetermined number c<NUM> is low. When the preferred equation in block <NUM> is considered, it becomes clear that the higher predetermined number c<NUM> is, the peak spectral region is determined more rarely. When, however, c<NUM> is small, then a peak spectral region where there are spectral values to be finally attenuated is determined more often.

Blocks <NUM>, <NUM>, <NUM>, <NUM> or <NUM> and <NUM> always determine a spectral amplitude. The determination of the spectral amplitude can be performed differently. One way of the determination of the spectral envelope is the determination of an absolute value of a spectral value of the real spectrum. Alternatively, the spectral amplitude can be a magnitude of a complex spectral value. In other embodiments, the spectral amplitude can be any power of the spectral value of the real spectrum or any power of a magnitude of a complex spectrum, where the power is greater than <NUM>. Preferably, the power is an integer number, but powers of <NUM> or <NUM> additionally have proven to be useful. Preferably, nevertheless, powers of <NUM> or <NUM> are preferred.

Generally, the shaper <NUM> is configured to attenuate at least one spectral value in the detected peak spectral region based on a maximum spectral amplitude in the upper frequency band and/or based on a maximum spectral amplitude in the lower frequency band. In other embodiments, the shaper is configured to determine the maximum spectral amplitude in a portion of the lower frequency band, the portion extending from a predetermined start frequency of the lower frequency band until a maximum frequency of the lower frequency band. The predetermined start frequency is greater than a minimum frequency of the lower frequency band and is preferably at least <NUM>% of the lower frequency band above the minimum frequency of the lower frequency band or the predetermined start frequency is preferably at the frequency being equal to half of a maximum frequency of the lower frequency band within a tolerance of plus or minus <NUM>% of half of the maximum frequency.

The shaper furthermore is configured to determine the attenuation factor determining the additional attenuation, where the attenuation factor is derived from the maximum spectral amplitude in the lower frequency band multiplied by a predetermined number being greater than or equal to one and divided by the maximum spectral amplitude in the upper frequency band. To this end, reference is made to block <NUM> illustrating the determination of a maximum spectral amplitude in the lower band (preferably after shaping, i.e., after block 804a in <FIG> or after block <NUM> in <FIG>).

Furthermore, the shaper is configured to determine the maximum spectral amplitude in the higher band, again preferably after shaping as, for example, is done by block 804a in <FIG> or block <NUM> in <FIG>. Then, in block <NUM>, the attenuation factor fac is calculated as illustrated, where the predetermined number c<NUM> is set to be greater than or equal to <NUM>. In embodiments, c<NUM> in <FIG> is the same predetermined number c<NUM> as in <FIG>. However, in other embodiments, c<NUM> in <FIG> can be set different from c<NUM> in <FIG>. Additionally, c<NUM> in <FIG> that directly influences the attenuation factor is also dependent on the bitrate so that a higher predetermined number c<NUM> is set for a higher bitrate to be done by the quantizer/coder stage <NUM> as illustrated in <FIG>.

<FIG> illustrates a preferred implementation similar to what is shown at <FIG> at blocks 804a and 804b, i.e., that a shaping with the low-band gain information applied to the spectral values above the border frequency such as fcelp is performed in order to obtain shaped spectral values above the border frequency and additionally in a following step <NUM>, the attenuation factor fac as calculated by block <NUM> in <FIG> is applied in block <NUM> of <FIG>. Thus, <FIG> and <FIG> illustrate a situation where the shaper is configured to shape the spectral values in the detected spectral region based on a first weighting operation using a portion of the shaping information for the lower frequency band and a second subsequent weighting operation using an attenuation information, i.e., the exemplary attenuation factor fac.

In other embodiments, however, the order of steps in <FIG> is reversed so that the first weighting operation takes place using the attenuation information and the second subsequent weighting information takes place using at least a portion of the shaping information for the lower frequency band. Or, alternatively, the shaping is performed using a single weighting operation using a combined weighting information depending and being derived from the attenuation information on the one hand and at least a portion of the shaping information for the lower frequency band on the other hand.

As illustrated in <FIG>, the additional attenuation information is applied to all the spectral values in the detected peak spectral region. Alternatively, the attenuation factor is only applied to, for example, the highest spectral value or the group of highest spectral values, where the members of the group can range from <NUM> to <NUM>, for example. Furthermore, embodiments also apply the attenuation factor to all spectral values in the upper frequency band for which the peak spectral region has been detected by the detector for a time frame of the audio signal. Thus, in this embodiment, the same attenuation factor is applied to the whole upper frequency band when only a single spectral value has been determined as a peak spectral region.

When, for a certain frame, no peak spectral region has been detected, then the lower frequency band and the upper frequency band are shaped by the shaper without any additional attenuation. Thus, a switching over from time frame to time frame is performed, where, depending on the implementation, some kind of smoothing of the attenuation information is preferred.

Preferably, the quantizer and encoder stage comprise a rate loop processor as illustrated in <FIG>. In an embodiment, the quantizer and coder stage <NUM> comprises a global gain weighter <NUM>, a quantizer <NUM> and an entropy coder such as an arithmetic or Huffman coder <NUM>. Furthermore, the entropy coder <NUM> provides, for a certain set of quantized values for a time frame, an estimated or measured bitrate to a controller <NUM>.

The controller <NUM> is configured to receive a loop termination criterion on the one hand and/or a predetermined bitrate information on the other hand. As soon as the controller <NUM> determines that a predetermined bitrate is not obtained and/or a termination criterion is not fulfilled, then the controller provides an adjusted global gain to the global gain weighter <NUM>. Then, the global gain weighter applies the adjusted global gain to the shaped and attenuated spectral lines of a time frame. The global gain weighted output of block <NUM> is provided to the quantizer <NUM> and the quantized result is provided to the entropy encoder <NUM> that once again determines an estimated or measured bitrate for the data weighted with the adjusted global gain. In case the termination criterion is fulfilled and/or the predetermined bitrate is fulfilled, then the encoded audio signal is output at output line <NUM>. When, however, the predetermined bitrate is not obtained or a termination criterion is not fulfilled, then the loop starts again. This is illustrated in more detail in <FIG>.

When the controller <NUM> determines that the bitrate is too high as illustrated in block <NUM>, then a global gain is increased as illustrated in block <NUM>. Thus, all shaped and attenuated spectral lines become smaller since they are divided by the increased global gain and the quantizer then quantizes the smaller spectral values so that the entropy coder results in a smaller number of required bits for this time frame. Thus, the procedures of weighting, quantizing, and encoding is performed with the adjusted global gain as illustrated in block <NUM> in <FIG>, and, then, once again it is determined whether the bitrate is too high. If the bitrate is still too high, then once again blocks <NUM> and <NUM> are performed. When, however, it is determined that the bitrate is not too high, the control proceeds to step <NUM> that outlines, whether a termination criterion is fulfilled. When the termination criterion is fulfilled, the rate loop is stopped and the final global gain is additionally introduced into the encoded signal via an output interface such as the output interface <NUM> of <FIG>.

When, however, it is determined that the termination criterion is not fulfilled, then the global gain is decreased as illustrated in block <NUM> so that, in the end, the maximum bitrate allowed is used. This makes sure that time frames that are easy to encode are encoded with a higher precision, i.e., with less loss. Therefore, for such instances, the global gain is decreased as illustrated in block <NUM> and step <NUM> is performed with the decreased global gain and step <NUM> is performed in order to look whether the resulting bitrate is too high or not.

Naturally, the specific implementation regarding the global gain increase or decrease increment can be set as required. Additionally, the controller <NUM> can be implemented to either have blocks <NUM>, <NUM> and <NUM> or to have blocks <NUM>, <NUM>, <NUM> and <NUM>. Thus, depending on the implementation, and also depending on the starting value for the global gain, the procedure can be such that, from a very high global gain it is started until the lowest global gain that still fulfills the bitrate requirements is found. On the other hand, the procedure can be done in such a way in that it is started from a quite low global gain and the global gain is increased until an allowable bitrate is obtained. Additionally, as illustrated in <FIG>, even a mix between both procedures can be applied as well.

<FIG> illustrates the embedding of the inventive audio encoder consisting of blocks <NUM>, 804a, 804b and <NUM> within a switched time domain/frequency domain encoder setting.

Particularly, the audio encoder comprises a common processor. The common processor consists of an ACELP/TCX controller <NUM> and the band limiter such as a resampler <NUM> and an LPC analyzer <NUM>. This is illustrated by the hatched boxes indicated by <NUM>.

Furthermore, the band limiter feeds the LPC analyzer that has already been discussed with respect to <FIG>. Then, the LPC shaping information generated by the LPC analyzer <NUM> is forwarded to a CELP coder <NUM> and the output of the CELP coder <NUM> is input into an output interface <NUM> that generates the finally encoded signal <NUM>. Furthermore, the time domain coding branch consisting of coder <NUM> additionally comprises a time domain bandwidth extension coder <NUM> that provides information and, typically, parametric information such as spectral envelope information for at least the high band of the full band audio signal input at input <NUM>. Preferably, the high band processed by the time domain band width extension coder <NUM> is a band starting at the border frequency that is also used by the band limiter <NUM>. Thus, the band limiter performs a low pass filtering in order to obtain the lower band and the high band filtered out by the low pass band limiter <NUM> is processed by the time domain band width extension coder <NUM>.

On the other hand, the spectral domain or TCX coding branch comprises a time-spectrum converter <NUM> and exemplarily, a tonal mask as discussed before in order to obtain a gap-filling encoder processing.

Then, the result of the time-spectrum converter <NUM> and the additional optional tonal mask processing is input into a spectral shaper 804a and the result of the spectral shaper 804a is input into an attenuator 804b. The attenuator 804b is controlled by the detector <NUM> that performs a detection either using the time domain data or using the output of the time-spectrum convertor block <NUM> as illustrated at <NUM>. Blocks 804a and 804b together implement the shaper <NUM> of <FIG> as has been discussed previously. The result of block <NUM> is input into the quantizer and coder stage <NUM> that is, in a certain embodiment, controlled by a predetermined bitrate. Additionally, when the predetermined numbers applied by the detector also depend on the predetermined bitrate, then the predetermined bitrate is also input into the detector <NUM> (not shown in <FIG>).

Thus, the encoded signal <NUM> receives data from the quantizer and coder stage, control information from the controller <NUM>, information from the CELP coder <NUM> and information from the time domain bandwidth extension coder <NUM>.

Subsequently, preferred embodiments of the present invention are discussed in even more detail.

An option, which saves interoperability and backward compatibility to existing implementations is to do an encoder-side pre-processing. The algorithm, as explained subsequently, analyzes the MDCT spectrum. In case significant signal components below fCELP are present and high peaks above fCELP are found, which potentially destroy the coding of the complete spectrum in the rate loop, these peaks above fCELP are attenuated. Although the attenuation can not be reverted on decoder-side, the resulting decoded signal is perceptually significantly more pleasant than before, where huge parts of the spectrum were zeroed out completely.

The attenuation reduces the focus of the rate loop on the peaks above fCELP and allows that significant low-frequency MDCT coefficients survive the rate loop.

The following algorithm describes the encoder-side pre-processing:.

The encoder-side pre-processing significantly reduces the stress for the coding-loop while still maintaining relevant spectral coefficients above fCELP.

<FIG> illustrates an MDCT spectrum of a critical frame after the application of inverse LPC shaping gains and above described encoder-side pre-processing. Dependent on the numerical values chosen for c<NUM>, c<NUM> and c<NUM> the resulting spectrum, which is subsequently fed into the rate loop, might look as above. They are significantly reduced, but still likely to survive the rate loop, without consuming all available bits.

The inventive encoded audio signal can be stored on a digital storage medium or can be transmitted on a transmission medium such as a wireless transmission medium or a wired transmission medium such as the Internet.

The implementation can be performed using a non-transitory storage medium or a digital storage medium, for example a floppy disk, a DVD, a Blu-Ray, a CD, a ROM, a PROM, an EPROM, an EEPROM or a FLASH memory, having electronically readable control signals stored thereon, which cooperate (or are capable of cooperating) with a programmable computer system such that the respective method is performed.

The above described embodiments are merely illustrative for the principles of the present invention. It is understood that modifications and variations of the arrangements and the details described herein will be apparent to others skilled in the art. It is the intent, therefore, to be limited only by the scope of the impending patent claims and not by the specific details presented by way of description and explanation of the embodiments herein.

It is further to be noted that methods disclosed in the specification or in the claims may be implemented by a device having means for performing each of the respective steps of these methods.

Furthermore, in some embodiments a single step may include or may be broken into multiple sub steps. Such sub steps may be included and part of the disclosure of this single step unless explicitly excluded.

Subsequently, portions of the above standard release <NUM> (3GPP TS <NUM> - Codec for Enhanced Voice Services (EVS); Detailed algorithmic description) are indicated. Section <NUM>. <NUM> describes a preferred embodiment of the shaper, section <NUM>. <NUM> describes a preferred embodiment of the quantizer from the quantizer and coder stage, and section <NUM>. <NUM> describes an arithmetic coder in a preferred embodiment of the coder in the quantizer and coder stage, wherein the preferred rate loop for the constant bit rate and the global gain is described in section <NUM>. The IGF features of the preferred embodiment are described in section <NUM>. <NUM>, where specific reference is made to section <NUM>. <NUM> IGF tonal mask calculation.

LPC shaping is performed in the MDCT domain by applying gain factors computed from weighted quantized LP filter coefficients to the MDCT spectrum. The input sampling rate srinp , on which the MDCT transform is based, can be higher than the CELP sampling rate srcelp , for which LP coefficients are computed. Therefore LPC shaping gains can only be computed for the part of the MDCT spectrum corresponding to the CELP frequency range. For the remaining part of the spectrum (if any) the shaping gain of the highest frequency band is used.

To compute the <NUM> LPC shaping gains the weighted LP filter coefficients ã are first transformed into the frequency domain using an oddly stacked DFT of length <NUM>: <MAT>.

The LPC shaping gains gLPC are then computed as the reciprocal absolute values of XLPC : <MAT>.

The MDCT coefficients XM corresponding to the CELP frequency range are grouped into <NUM> sub-bands.

The coefficients of each sub-band are multiplied by the reciprocal of the corresponding LPC shaping gain to obtain the shaped spectrum X̃M. If the number of MDCT bins corresponding to the CELP frequency range <MAT> is not a multiple of <NUM>, the width of sub-bands varies by one bin as defined by the following pseudo-code:
<IMG>
<IMG>.

The remaining MDCT coefficients above the CELP frequency range (if any) are multiplied by the reciprocal of the last LPC shaping gain: <MAT>.

The purpose of the adaptive low-frequency emphasis and de-emphasis (ALFE) processes is to improve the subjective performance of the frequency-domain TCX codec at low frequencies. To this end, the low-frequency MDCT spectral lines are amplified prior to quantization in the encoder, thereby increasing their quantization SNR, and this boosting is undone prior to the inverse MDCT process in the internal and external decoders to prevent amplification artifacts.

There are two different ALFE algorithms which are selected consistently in encoder and decoder based on the choice of arithmetic coding algorithm and bit-rate. ALFE algorithm <NUM> is used at <NUM> kbps (envelope based arithmetic coder) and at <NUM> kbps and above (context based arithmetic coder). ALFE algorithm <NUM> is used from <NUM> up to incl. <NUM> kbps. In the encoder, the ALFE operates on the spectral lines in vector x [ ] directly before (algorithm <NUM>) or after (algorithm <NUM>) every MDCT quantization, which runs multiple times inside a rate-loop in case of the context based arithmetic coder (see subclause <NUM>.

ALFE algorithm <NUM> operates based on the LPC frequency-band gains, lpcGains[ ]. First, the minimum and maximum of the first nine gains - the low-frequency (LF) gains - are found using comparison operations executed within a loop over the gain indices <NUM> to <NUM>.

Then, if the ratio between the minimum and maximum exceeds a threshold of <NUM>/<NUM>, a gradual boosting of the lowest lines in x is performed such that the first line (DC) is amplified by (<NUM>/max)<NUM> and the <NUM>rd line is not amplified:
<IMG>
<IMG>.

ALFE algorithm <NUM>, unlike algorithm <NUM>, does not operate based on transmitted LPC gains but is signaled by means of modifications to the quantized low-frequency (LF) MDCT lines. The procedure is divided into five consecutive steps:.

For guidance of quantization in the TXC encoding process, a noise measure between <NUM> (tonal) and <NUM> (noise-like) is determined for each MDCT spectral line above a specified frequency based on the current transform's power spectrum. The power spectrum XP(k) is computed from the MDCT coefficients XM(k) and the MDST XS(k) coefficients on the same time-domain signal segment and with the same windowing operation: <MAT>.

Each noise measure in noiseFlags(k) is then calculated as follows. First, if the transform length changed (e.g. after a TCX transition transform following an ACELP frame) or if the previous frame did not use TCX20 coding (e.g. in case a shorter transform length was used in the last frame), all noiseFlags(k) up to <MAT> are reset to zero. The noise measure start line kstart is initialized according to the following table <NUM>.

For ACELP to TCX transitions, kstart is scaled by <NUM>. Then, if the noise measure start line kstart is less than <MAT>, the noiseFlags(k) at and above kstart are derived recursively from running sums of power spectral lines: <MAT> <MAT>.

Furthermore, every time noiseFlags(k) is given the value zero in the above loop, the variable lastTone is set to k. The upper <NUM> lines are treated separately since s(k) cannot be updated any more (c(k) , however, is computed as above): <MAT>.

The uppermost line at <MAT> is defined as being noise-like, hence <MAT>. Finally, if the above variable lastTone (which was initialized to zero) is greater than zero, then noiseFlags(lastTone +<NUM>) = <NUM>. Note that this procedure is only carried out in TCX20, not in other TCX modes <MAT>.

A low pass factor clpf is determined based on the power spectrum for all bitrates below <NUM> kbps. Therefore, the power spectrum XP(k) is compared iteratively against a threshold tlpf for all <MAT>, where tlpf = <NUM> for regular MDCT windows and tlpf = <NUM> for ACELP to MDCT transition windows. The iteration stops as soon as XP(k)>tlpf.

The low pass factor clpf determines as <MAT>, where clpf,prev is the last determined low pass factor. At encoder startup, clpf,prev is set to <NUM>. The low pass factor clpf is used to determine the noise filling stop bin (see subclause <NUM>.

For uniform quantization of the MDCT spectrum X̃M after or before ALFE (depending on the applied emphasis algorithm, see subclause <NUM>. <NUM>), the coefficients are first divided by the global gain gTCX (see subclause <NUM>. <NUM>), which controls the step-size of quantization. The results are then rounded toward zero with a rounding offset which is adapted for each coefficient based on the coefficient's magnitude (relative to gTCX ) and tonality (as defined by noiseFlags(k) in subclause <NUM>. For high-frequency spectral lines with low tonality and magnitude, a rounding offset of zero is used, whereas for all other spectral lines, an offset of <NUM> is employed. More specifically, the following algorithm is executed.

Starting from the highest coded MDCT coefficient at index <MAT>, we set X̃M(k) = <NUM> and decrement k by <NUM> as long as condition noiseFlags(k) > <NUM> and |XM (k)|/ gTCX < <NUM> evaluates to true. Then downward from the first line at index k'≥ <NUM> where this condition is not met (which is guaranteed since noiseFlags(<NUM>) = <NUM>), rounding toward zero with a rounding offset of <NUM> and limiting of the resulting integer values to the range -<NUM> to <NUM> is performed: <MAT> with k = <NUM>. Finally, all quantized coefficients of X̂M(k) at and above <MAT> are set to zero.

The quantized spectral coefficients are noiselessly coded by an entropy coding and more particularly by an arithmetic coding.

The arithmetic coding uses <NUM> bits precision probabilities for computing its code. The alphabet probability distribution can be derived in different ways. At low rates, it is derived from the LPC envelope, while at high rates it is derived from the past context. In both cases, a harmonic model can be added for refining the probability model.

The following pseudo-code describes the arithmetic encoding routine, which is used for coding any symbol associated with a probability model. The probability model is represented by a cumulative frequency table cum_freq[]. The derivation of the probability model is described in the following subclauses. <IMG>
<IMG>.

The helper functions ari_first_symbol() and ari_last_symbol() detect the first symbol and the last symbol of the generated codeword respectively.

The estimation of the global gain gTCX for the TCX frame is performed in two iterative steps. The first estimate considers a SNR gain of 6dB per sample per bit from SQ. The second estimate refines the estimate by taking into account the entropy coding.

The energy of each block of <NUM> coefficients is first computed: <MAT>.

A bisection search is performed with a final resolution of <NUM>.

The first estimate of gain is then given by: <MAT>.

In order to set the best gain gTCX within the constraints of used_bits ≤ target_bits , convergence process of gTCX and used_bits is carried out by using following valuables and constants:.

After the initial estimate of bit consumption by arithmetic coding, stop is set <NUM> when target_bits is larger than used_bits, while stop is set as used_bits when used_bits is larger than target_bits.

If stop is larger than <NUM>, that means used_bits is larger than target_bits ,
gTCX needs to be modified to be larger than the previous one and Lb_found is set as TRUE, gLb is set as the previous gTCX. WLb is set as <MAT>.

When Ub_found was set, that means used_bits was smaller than target_bits, gTCX is updated as an interpolated value between upper bound and lower bound.

Otherwise, that means Ub_found is FALSE, gain is amplified as <MAT> with larger amplification ratio when the ratio of used_bits(= stop) and target_bits is larger to accelerate to attain gUb.

If stop equals to <NUM>, that means used_bits is smaller than target_bits,
gTCX should be smaller than the previous one and Ub_found is set as <NUM>, Ub is set as the previous gTCX and WUb is set as <MAT>.

If Lb_found has been already set, gain is calculated as <MAT> otherwise, in order to accelerate to lower band gain gLb , gain is reduced as, <MAT> with larger reduction rates of gain when the ratio of used_bits and target_bits is small.

After above correction of gain, quantization is performed and estimation of used_bits by arithmetic coding is obtained. As a result, stop is set <NUM> when target_bits is larger than used_bits , and is set as used_bits when it is larger than target_bits. If the loop count is less than <NUM>, either lower bound setting process or upper bound setting process is carried out at the next loop depending on the value stop. If the loop count is <NUM>, the final gain gTCX and the quantized MDCT sequence XQMDCT(k) are obtained.

The quantized spectral coefficients X are noiselessly encoded starting from the lowest-frequency coefficient and progressing to the highest-frequency coefficient. They are encoded by groups of two coefficients a and b gathering in a so-called <NUM>-tuple {a,b}.

Each <NUM>-tuple {a,b} is split into three parts namely, MSB, LSB and the sign. The sign is coded independently from the magnitude using uniform probability distribution. The magnitude itself is further divided in two parts, the two most significant bits (MSBs) and the remaining least significant bitplanes (LSBs, if applicable). The <NUM>-tuples for which the magnitude of the two spectral coefficients is lower or equal to <NUM> are coded directly by the MSB coding. Otherwise, an escape symbol is transmitted first for signalling any additional bit plane.

The relation between <NUM>-tuple, the individual spectral values a and b of a <NUM>-tuple, the most significant bit planes m and the remaining least significant bit planes, r, are illustrated in the example in <FIG>. In this example three escape symbols are sent prior to the actual value m, indicating three transmitted least significant bit planes
<IMG>.

The probability model is derived from the past context. The past context is translated on a <NUM> bits-wise index and maps with the lookup table ari_context_lookup [] to one of the <NUM> available probability models stored in ari_cf_m[].

The past context is derived from two <NUM>-tuples already coded within the same frame. The context can be derived from the direct neighbourhood or located further in the past frequencies. Separate contexts are maintained for the peak regions (coefficients belonging to the harmonic peaks) and other (non-peak) regions according to the harmonic model. If no harmonic model is used, only the other (non-peak) region context is used.

The zeroed spectral values lying in the tail of spectrum are not transmitted. It is achieved by transmitting the index of last non-zeroed <NUM>-tuple. If harmonic model is used, the tail of the spectrum is defined as the tail of spectrum consisting of the peak region coefficients, followed by the other (non-peak) region coefficients, as this definition tends to increase the number of trailing zeros and thus improves coding efficiency. The number of samples to encode is computed as follows: <MAT>.

The following data are written into the bitstream with the following order:.

The following pseudo-code describes how the context is derived and how the bitstream data for the MSBs, signs and LSBs are computed. The input arguments are the quantized spectral coefficients X[], the size of the considered spectrum L, the bit budget target_bits, the harmonic model parameters (pi, hi), and the index of the last non zeroed symbol lastnz.

The helper functions ari_save_states() and ari_restore_states() are used for saving and restoring the arithmetic coder states respectively. It allows cancelling the encoding of the last symbols if it violates the bit budget. Moreover and in case of bit budget overflow, it is able to fill the remaining bits with zeros till reaching the end of the bit budget or till processing lastnz samples in the spectrum.

The other helper functions are described in the following subclauses.

The ii[<NUM>] and ii[<NUM>] counters are initialized to <NUM> at the beginning of ari_context_encode() (and ari_context_decode() in the decoder).

The context is updated as described by the following pseudo-code. It consists of the concatenation of two <NUM> bit-wise context elements.

The final context is amended in two ways:
<IMG>.

The context t is an index from <NUM> to <NUM>.

The bit consumption estimation of the context-based arithmetic coder is needed for the rate-loop optimization of the quantization. The estimation is done by computing the bit requirement without calling the arithmetic coder. The generated bits can be accurately estimated by:
<IMG>
where proba is an integer initialized to <NUM> and m is a MSB symbol.

For both context and envelope based arithmetic coding, a harmonic model is used for more efficient coding of frames with harmonic content. The model is disabled if any of the following conditions apply:.

When the model is enabled, the frequency domain interval of harmonics is a key parameter and is commonly analysed and encoded for both flavours of arithmetic coders.

When pitch lag and gain are used for the post processing, the lag parameter is utilized for representing the interval of harmonics in the frequency domain. Otherwise, normal representation of interval is applied.

If integer part of pitch lag in time domain dint is less than the frame size of MDCT LTCX , frequency domain interval unit (between harmonic peaks corresponding to the pitch lag) TUNIT with <NUM> bit fractional accuracy is given by <MAT> where dfr denotes the fractional part of pitch lag in time domain, res_max denotes the max number of allowable fractional values whose values are either <NUM> or <NUM> depending on the conditions.

Since TUNIT has limited range, the actual interval between harmonic peaks in the frequency domain is coded relatively to TUNIT using the bits specified in table <NUM>. Among candidate of multiplication factors, Ratio() given in the table <NUM> or table <NUM>, the multiplication number is selected that gives the most suitable harmonic interval of MDCT domain transform coefficients. <MAT> <MAT>.

When pitch lag and gain in the time domain is not used or the pitch gain is less than or equals to <NUM>, normal encoding of the interval with un-equal resolution is used.

Unit interval of spectral peaks TUNIT is coded as <MAT> and actual interval TMDCT is represented with fractional resolution of Res as <MAT>.

Each parameter is shown in table <NUM>, where "small size" means when frame size is smaller than <NUM> of the target bit rates is less than or equal to <NUM>.

In search of the best interval of harmonics, encoder tries to find the index which can maximize the weighted sum EPERIOD of the peak part of absolute MDCT coefficients. EABSM(k) denotes sum of <NUM> samples of absolute value of MDCT domain transform coefficients as <MAT> <MAT> where num_peak is the maximum number that <MAT> reaches the limit of samples in the frequency domain.

In case interval does not rely on the pitch lag in time domain, hierarchical search is used to save computational cost. If the index of the interval is less than <NUM>, periodicity is checked by a coarse step of <NUM>. After getting the best interval, finer periodicity is searched around the best interval from -<NUM> to +<NUM>. If index is equal to or larger than <NUM>, periodicity is searched for each index.

At the initial estimation, number of used bits without harmonic model, used_bits , and one with harmonic model, used_bitshm is obtained and the indicator of consumed bits IdicatorB are defined as <MAT> <MAT> <MAT> where Index_bitshm denotes the additional bits for modelling harmonic structure, and stop stophm indicate the consumed bits when they are larger than the target bits. Thus, the larger IdicatorB , the more preferable to use harmonic model. Relative periodicity indicatorhm is defined as the normalized sum of absolute values for peak regions of the shaped MDCT coefficients as <MAT> where TMDCT_max is the harmonic interval that attain the max value of EPERIOD. When the score of periodicity of this frame is larger than the threshold as <MAT> this frame is considered to be coded by the harmonic model. The shaped MDCT coefficients divided by gain gTCX are quantized to produce a sequence of integer values of MDCT coefficients, X̂TCX_hm, and compressed by arithmetic coding with harmonic model. This process needs iterative convergence process (rate loop) to get gTCX and X̂TCX_hm with consumed bits Bhm. At the end of convergence, in order to validate harmonic model, the consumed bits Bno_hm by arithmetic coding with normal (non-harmonic) model for X̂TCX_hm is additionally calculated and compared with Bhm. If Bhm is larger than Bno_hm , arithmetic coding of X̂TCX_hm is revert to use normal model. Bhm-Bno_hm can be used for residual quantization for further enhancements. Otherwise, harmonic model is used in arithmetic coding.

In contrast, if the indicator of periodicity of this frame is smaller than or the same as the threshold, quantization and arithmetic coding are carried out assuming the normal model to produce a sequence of integer values of the shaped MDCT coefficients, X̂TCX_no_hm with consumed bits Bno_hm. After convergence of rate loop, consumed bits Bhm by arithmetic coding with harmonic model for X̂TCX_no_hm is calculated. If Bno_hm is larger than Bhm , arithmetic coding of X̂TCX_nohm is switched to use harmonic model. Otherwise, normal model is used in arithmetic coding.

<NUM> Use of harmonic information in Context based arithmetic coding For context based arithmetic coding, all regions are classified into two categories. One is peak part and consists of <NUM> consecutive samples centered at Uth (U is a positive integer up to the limit) peak of harmonic peak of τU , <MAT>.

The other samples belong to normal or valley part. Harmonic peak part can be specified by the interval of harmonics and integer multiples of the interval. Arithmetic coding uses different contexts for peak and valley regions.

For ease of description and implementation, the harmonic model uses the following index sequences: <MAT> <MAT> <MAT>.

In case of disabled harmonic model, these sequences are pi = ( ), and hi = ip = (<NUM>,. ,LM -<NUM>).

In the MDCT domain, spectral lines are weighted with the perceptual model W(z) such that each line can be quantized with the same accuracy. The variance of individual spectral lines follow the shape of the linear predictor A-<NUM>(z) weighted by the perceptual model, whereby the weighted shape is S(z) = W(z)A-<NUM>(z). W(z) is calculated by transforming <MAT> to frequency domain LPC gains as detailed in subclauses <NUM>. <NUM> and <NUM>. A-<NUM>(z) is derived from <MAT> after conversion to direct-form coefficients, and applying tilt compensation <NUM> - yz-<NUM>, and finally transforming to frequency domain LPC gains. All other frequency-shaping tools, as well as the contribution from the harmonic model, shall be also included in this envelope shape S(z). Observe that this gives only the relative variances of spectral lines, while the overall envelope has arbitrary scaling, whereby we must begin by scaling the envelope.

We will assume that spectral lines xk are zero-mean and distributed according to the Laplace-distribution, whereby the probability distribution function is <MAT>.

The entropy and thus the bit-consumption of such a spectral line is bitsk = <NUM> + log<NUM> <NUM>ebk. However, this formula assumes that the sign is encoded also for those spectral lines which are quantized to zero. To compensate for this discrepancy, we use instead the approximation <MAT> which is accurate for bk ≥ <NUM>. We will assume that the bit-consumption of lines with bk ≤ <NUM> is bitsk = log<NUM> (<NUM>) which matches the bit-consumption at bk = <NUM>. For large bk > <NUM> we use the true entropy bitsk = log<NUM>(<NUM>ebk ) for simplicity.

The variance of spectral lines is then <MAT>. If <MAT> is the k th element of the power of the envelope shape |S(z)|<NUM> then <MAT> describes the relative energy of spectral lines such that <MAT> where γ is scaling coefficient. In other words, <MAT> describes only the shape of the spectrum without any meaningful magnitude and γ is used to scale that shape to obtain the actual variance <MAT>.

Our objective is that when we encode all lines of the spectrum with an arithmetic coder, then the bit-consumption matches a pre-defined level B , that is, <MAT>. We can then use a bi-section algorithm to determine the appropriate scaling factor γ such that the target bit-rate B is reached.

Once the envelope shape bk has been scaled such that the expected bit-consumption of signals matching that shape yield the target bit-rate, we can proceed to quantizing the spectral lines.

Assume that xk is quantized to an integer x̂k such that the quantization interval is [x̂k - <NUM>, x̂k + <NUM>] then the probability of a spectral line occurring in that interval is for |x̂k| ≥ <NUM> <MAT> and for |x̂k| = <NUM> <MAT>.

It follows that the bit-consumption for these two cases is in the ideal case <MAT>.

By pre-computing the terms <MAT> and <MAT>, we can efficiently calculate the bit-consumption of the whole spectrum.

The rate-loop can then be applied with a bi-section search, where we adjust the scaling of the spectral lines by a factor ρ , and calculate the bit-consumption of the spectrum pxk , until we are sufficiently close to the desired bit-rate. Note that the above ideal-case values for the bit-consumption do not necessarily perfectly coincide with the final bit-consumption, since the arithmetic codec works with a finite-precision approximation. This rate-loop thus relies on an approximation of the bit-consumption, but with the benefit of a computationally efficient implementation.

When the optimal scaling σ has been determined, the spectrum can be encoded with a standard arithmetic coder. A spectral line which is quantized to a value x̂k ≠ <NUM> is encoded to the interval <MAT> and x̂k = <NUM> is encoded onto the interval <MAT>.

The sign of xk ≠ <NUM> will be encoded with one further bit.

Observe that the arithmetic coder must operate with a fixed-point implementation such that the above intervals are bit-exact across all platforms. Therefore all inputs to the arithmetic coder, including the linear predictive model and the weighting filter, must be implemented in fixed-point throughout the system.

In case of envelope base arithmetic coding, harmonic model can be used to enhance the arithmetic coding. The similar search procedure as in the context based arithmetic coding is used for estimating the interval between harmonics in the MDCT domain. However, the harmonic model is used in combination of the LPC envelope as shown in <FIG>. The shape of the envelope is rendered according to the information of the harmonic analysis.

Harmonic shape at k in the frequency data sample is defined as <MAT> when τ - <NUM> ≤ k ≤ τ + <NUM> , otherwise Q(k) = <NUM> , where τ denotes center position of Uth harmonics. <MAT> h and σ are height and width of each harmonics depending on the unit interval as shown, <MAT> <MAT>.

Height and width get larger when interval gets larger.

The spectral envelope S(k) is modified by the harmonic shape Q(k) at k as <MAT> where gain for the harmonic components gharm is always set as <NUM> for Generic mode, and gharm is selected from {<NUM>, <NUM>, <NUM>, <NUM>} that minimizes Enorm for Voiced mode using <NUM> bits, <MAT> <MAT>
<IMG>.

The optimum global gain gopt is computed from the quantized and unquantized MDCT coefficients. For bit rates up to <NUM> kbps, the adaptive low frequency de-emphasis (see subclause <NUM>. <NUM>) is applied to the quantized MDCT coefficients before this step. In case the computation results in an optimum gain less than or equal to zero, the global gain gTCX determined before (by estimate and rate loop) is used. <MAT> <MAT>.

For transmission to the decoder the optimum global gain gopt is quantized to a <NUM> bit index ITCX,gain : <MAT>.

The dequantized global gain ĝTCX is obtained as defined in subclause <NUM>.

The residual quantization is a refinement quantization layer refining the first SQ stage. It exploits eventual unused bits target_bits-nbbits, where nbbits is the number of bits consumed by the entropy coder. The residual quantization adopts a greedy strategy and no entropy coding in order to stop the coding whenever the bit-stream reaches the desired size.

The residual quantization can refine the first quantization by two means. The first mean is the refinement of the global gain quantization. The global gain refinement is only done for rates at and above <NUM>. At most three additional bits is allocated to it. The quantized gain ĝTCX is refined sequentially starting from n=<NUM> and incrementing n by one after each following iteration:
<IMG>.

The second mean of refinement consists of re-quantizing the quantized spectrum line per line. First, the non-zeroed quantized lines are processed with a <NUM> bit residual quantizer:
<IMG>.

Finally, if bits remain, the zeroed lines are considered and quantized with on <NUM> levels. The rounding offset of the SQ with deadzone was taken into account in the residual quantizer design:
<IMG>.

On the decoder side noise filling is applied to fill gaps in the MDCT spectrum where coefficients have been quantized to zero. Noise filling inserts pseudo-random noise into the gaps, starting at bin kNFstart up to bin kNFstop -<NUM>. To control the amount of noise inserted in the decoder, a noise factor is computed on encoder side and transmitted to the decoder.

To compensate for LPC tilt, a tilt compensation factor is computed. For bitrates below <NUM> kbps the tilt compensation is computed from the direct form quantized LP coefficients â , while for higher bitrates a constant value is used: <MAT><MAT>.

The noise filling start and stop bins are computed as follows: <MAT> <MAT>.

At each side of a noise filling segment a transition fadeout is applied to the inserted noise. The width of the transitions (number of bins) is defined as: <MAT> where HM denotes that the harmonic model is used for the arithmetic codec and previous denotes the previous codec mode.

The noise filling segments are determined, which are the segments of successive bins of the MDCT spectrum between kNFstart and kNFstop,LP for which all coefficients are quantized to zero. The segments are determined as defined by the following pseudo-code:
<IMG>
where kNF<NUM>(j) and kNF<NUM>(j) are the start and stop bins of noise filling segment j, and nNF is the number of segments.

The noise factor is computed from the unquantized MDCT coefficients of the bins for which noise filling is applied.

If the noise transition width wNF is <NUM> or less bins, an attenuation factor is computed based on the energy of even and odd MDCT bins: <MAT> <MAT> <MAT>.

For each segment an error value is computed from the unquantized MDCT coefficients, applying global gain, tilt compensation and transitions: <MAT>.

A weight for each segment is computed based on the width of the segment: <MAT>.

The noise factor is then computed as follows: <MAT>.

For transmission the noise factor is quantized to obtain a <NUM> bit index: <MAT>.

The Intelligent Gap Filling (IGF) tool is an enhanced noise filling technique to fill gaps (regions of zero values) in spectra. These gaps may occur due to coarse quantization in the encoding process where large portions of a given spectrum might be set to zero to meet bit constraints. However, with the IGF tool these missing signal portions are reconstructed on the receiver side (RX) with parametric information calculated on the transmission side (TX). IGF is used only if TCX mode is active.

See table <NUM> below for all IGF operating points:.

On transmission side, IGF calculates levels on scale factor bands, using a complex or real valued TCX spectrum. Additionally spectral whitening indices are calculated using a spectral flatness measurement and a crest-factor. An arithmetic coder is used for noiseless coding and efficient transmission to receiver (RX) side.

If there is a transition from CELP to TCX coding (isCelpToTCX = true) or a TCX <NUM> frame is signalled ( isTCX<NUM> = true ), the TCX frame length may change. In case of frame length change, all values which are related to the frame length are mapped with the function tF : <MAT> where n is a natural number, for example a scale factor band offset, and f is a transition factor, see table <NUM>.

The power spectrum P ∈ P n of the current TCX frame is calculated with: <MAT> where n is the actual TCX window length, R ∈ P n is the vector containing the real valued part (cos-transformed) of the current TCX spectrum, and I e P n is the vector containing the imaginary (sin-transformed) part of the current TCX spectrum.

Let P ∈ P n be the TCX power spectrum as calculated according to subclause <NUM>. <NUM> and b the start line and e the stop line of the SFM measurement range.

The SFM function, applied with IGF, is defined with: <MAT> where n is the actual TCX window length and p is defined with: <MAT>.

Let P e P n be the TCX power spectrum as calculated according to subclause <NUM>. <NUM> and b the start line and e the stop line of the crest factor measurement range.

The CREST function, applied with IGF, is defined with: <MAT> where n is the actual TCX window length and Emax is defined with: <MAT>.

The hT mapping function is defined with: <MAT> where s is a calculated spectral flatness value and k is the noise band in scope. For threshold values ThMk , ThSk refer to table <NUM> below.

IGF scale factor tables are available for all modes where IGF is applied.

The table <NUM> above refers to the TCX <NUM> window length and a transition factor <NUM>. For all window lengths apply the following remapping <MAT> where tF is the transition factor mapping function described in subclause <NUM>.

For every mode a mapping function is defined in order to access source lines from a given target line in IGF range.

The mapping function m<NUM> is defined with: <MAT>.

The mapping function m<NUM>a is defined with: <MAT>.

The mapping function m<NUM>b is defined with: <MAT>.

The mapping function m<NUM>c is defined with: <MAT>.

The mapping function m<NUM>d is defined with: <MAT>.

The value f is the appropriate transition factor, see table <NUM> and tF is described in subclause <NUM>.

Please note, that all values t(<NUM>),t(<NUM>),. ,t(nB) shall be already mapped with the function tF, as described in subclause <NUM>. Values for nB are defined in table <NUM>.

The here described mapping functions will be referenced in the text as "mapping function m" assuming, that the proper function for the current mode is selected.

The IGF encoder module expects the following vectors and flags as an input:.

Listed in table <NUM>, the following combinations signalled through flags isTCX <NUM> , isTCX <NUM> and isCelpToTCX are allowed with IGF:.

All function declaration assumes that input elements are provided by a frame by frame basis. The only exceptions are two consecutive TCX <NUM> frames, where the second frame is encoded dependent on the first frame.

This subclause describes how the IGF scale factor vector g(k), k = <NUM>,<NUM>,. ,nB - <NUM> is calculated on transmission (TX) side.

In case the TCX power spectrum P is available the IGF scale factor values g are calculated using P : <MAT> and let m : N → N[be the mapping function which maps the IGF target range into the IGF source range described in subclause <NUM>. <NUM>, calculate: <MAT> <MAT> where t(<NUM>),t(<NUM>),. ,t(nB) shall be already mapped with the function tF, see subclause <NUM>. <NUM>, and nB are the number of IGF scale factor bands, see table <NUM>.

Calculate g(k) with: <MAT> and limit g(k) to the range [<NUM>,<NUM>]⊂Z with
<MAT>.

The values g(k), k = <NUM>,<NUM>,. ,nB-<NUM>, will be transmitted to the receiver (RX) side after further lossless compression with an arithmetic coder described in subclause <NUM>.

If the TCX power spectrum is not available calculate: <MAT> where t(<NUM>),t(<NUM>),. ,t(nB) shall be already mapped with the function tF, see subclause <NUM>. <NUM>, and nB are the number of bands, see table <NUM>.

Calculate g(k) with: <MAT> and limit g(k) to the range [<NUM>,<NUM>]⊂Z with <MAT>.

The values g(k), k = <NUM>,<NUM>,. ,nB -<NUM>, will be transmitted to the receiver (RX) side after further lossless compression with an arithmetic coder described in subclause <NUM>.

In order to determine which spectral components should be transmitted with the core coder, a tonal mask is calculated. Therefore all significant spectral content is identified whereas content that is well suited for parametric coding through IGF is quantized to zero.

In case the TCX power spectrum P is not available, all spectral content above t(<NUM>) is deleted: <MAT> where R is the real valued TCX spectrum after applying TNS and n is the current TCX window length. In case the TCX power spectrum P is available, calculate: <MAT> where t(<NUM>) is the first spectral line in IGF range.

Given EHP, apply the following algorithm:
Initialize last and next :
<IMG>.

For the IGF spectral flatness calculation two static arrays, prevFIR and prevIIR , both of size nT are needed to hold filter-states over frames. Additionally a static flag wasTransient is needed to save the information of the input flag isTransient from the previous frame.

The vectors prevFIR and prevIIR are both static arrays of size nT in the IGF module and both arrays are initialised with zeroes: <MAT>.

The vector currWLevel shall be initialised with zero for all tiles, <MAT>.

The following steps <NUM>) to <NUM>) shall be executed consecutive:.

After executing step <NUM>) the whitening level index vector currWLevel is ready for transmission.

IGF whitening levels, defined in the vector currWLevel, are transmitted using <NUM> or <NUM> bits per tile. The exact number of total bits required depends on the actual values contained in currWLevel and the value of the isIndep flag. The detailed processing is described in the pseudo code below:
<IMG>
<IMG>.

The temporal envelope of the reconstructed signal by the IGF is flattened on the receiver (RX) side according to the transmitted information on the temporal envelope flatness, which is an IGF flatness indicator.

The temporal flatness is measured as the linear prediction gain in the frequency domain. Firstly, the linear prediction of the real part of the current TCX spectrum is performed and then the prediction gain ηigf is calculated: <MAT> where ki = i-th PARCOR coefficient obtained by the linear prediction.

From the prediction gain ηigf and the prediction gain ηtns described in subclause <NUM>. <NUM>, the IGF temporal flatness indicator flag isIgfTemFlat is defined as <MAT>.

The IGF scale factor vector g is noiseless encoded with an arithmetic coder in order to write an efficient representation of the vector to the bit stream.

The module uses the common raw arithmetic encoder functions from the infrastructure, which are provided by the core encoder. The functions used are ari_encode_<NUM>bits_sign(bit), which encodes the value bit, ari_encode_14bits_ext(value,cumulativeFrequencyTable), which encodes value from an alphabet of <NUM> symbols ( SYMBOLS_IN_TABLE) using the cumulative frequency table cumulativeFrequencyTable , ari_start _encoding_<NUM>bits() , which initializes the arithmetic encoder, and ari_finish _encoding _14bits() , which finalizes the arithmetic encoder.

The internal state of the arithmetic encoder is reset in case the isIndepFlag flag has the value true. This flag may be set to false only in modes where TCX10 windows (see table <NUM>) are used for the second frame of two consecutive TCX <NUM> frames.

The IGF all-Zero flag signals that all of the IGF scale factors are zero: <MAT>.

The allZero flag is written to the bit stream first. In case the flag is true , the encoder state is reset and no further data is written to the bit stream, otherwise the arithmetic coded scale factor vector g follows in the bit stream.

The arithmetic encoder states consist of t ∈ {<NUM>,<NUM>} , and the prev vector, which represents the value of the vector g preserved from the previous frame. When encoding the vector g , the value <NUM> for t means that there is no previous frame available, therefore prev is undefined and not used. The value <NUM> for t means that there is a previous frame available therefore prev has valid data and it is used, this being the case only in modes where TCX10 windows (see table <NUM>) are used for the second frame of two consecutive TCX <NUM> frames. For resetting the arithmetic encoder state, it is enough to set t = <NUM>.

If a frame has isIndepFlag set, the encoder state is reset before encoding the scale factor vector g. Note that the combination t = <NUM> and isIndepFlag = false is valid, and may happen for the second frame of two consecutive TCX <NUM> frames, when the first frame had allZero=<NUM>. In this particular case, the frame uses no context information from the previous frame (the prev vector), because t = <NUM> , and it is actually encoded as an independent frame.

The arith_encode _bits function encodes an unsigned integer x , of length nBits bits, by writing one bit at a time.

Saving the encoder state is achieved using the function iisIGFSCFEncoderSaveContextState , which copies t and prev vector into tSave and prevSave vector, respectively. Restoring the encoder state is done using the complementary function iisIGFSCFEncoderRestoreContextState , which copies back tSave and prevSave vector into t and prev vector, respectively.

Please note that the arithmetic encoder should be capable of counting bits only, e.g., performing arithmetic encoding without writing bits to the bit stream. If the arithmetic encoder is called with a counting request, by using the parameter doRealEncoding set to false, the internal state of the arithmetic encoder shall be saved before the call to the top level function iisIGFSCFEncoderEncode and restored and after the call, by the caller. In this particular case, the bits internally generated by the arithmetic encoder are not written to the bit stream.

The arith _encode _residual function encodes the integer valued prediction residual x , using the cumulative frequency table cumulativeFrequencyTable , and the table offset tableOffset. The table offset tableOffset is used to adjust the value x before encoding, in order to minimize the total probability that a very small or a very large value will be encoded using escape coding, which slightly is less efficient. The values which are between MIN _ENC _SEPARATE = -<NUM> and MAX _ENC _SEPARATE= <NUM>, inclusive, are encoded directly using the cumulative frequency table cumulativeFrequencyTable , and an alphabet size of SYMBOLS_IN_TABLE= <NUM>.

For the above alphabet of SYMBOLS_IN_TABLE symbols, the values <NUM> and SYMBOLS_IN_TABLE-<NUM> are reserved as escape codes to indicate that a value is too small or too large to fit in the default interval. In these cases, the value extra indicates the position of the value in one of the tails of the distribution. The value extra is encoded using <NUM> bits if it is in the range {<NUM>,. ,<NUM>} , or using <NUM> bits with value <NUM> followed by extra <NUM> bits if it is in the range {<NUM>,. ,<NUM> + <NUM>} , or using <NUM> bits with value <NUM> followed by extra <NUM> bits with value <NUM> followed by extra <NUM> bits if it is larger or equal than <NUM> + <NUM>. The last of the three cases is mainly useful to avoid the rare situation where a purposely constructed artificial signal may produce an unexpectedly large residual value condition in the encoder.

The function encode_sfe_vector encodes the scale factor vector g , which consists of nB integer values. The value t and the prev vector, which constitute the encoder state, are used as additional parameters for the function. Note that the top level function iisIGFSCFEncoderEncode must call the common arithmetic encoder initialization function ari _start _encoding _<NUM>bits before calling the function encode _sfe _vector , and also call the arithmetic encoder finalization function αri _done _encoding _<NUM>bits afterwards.

The function quant_ctx is used to quantize a context value ctx , by limiting it to {-<NUM>,. ,<NUM>}, and it is defined as:
<IMG>
<IMG>.

The definitions of the symbolic names indicated in the comments from the pseudo code, used for computing the context values, are listed in the following table <NUM>:.

There are five cases in the above function, depending on the value of t and also on the position f of a value in the vector g :.

Please note that the predefined cumulative frequency tables cf _se<NUM> , cf _se<NUM> , and the table offsets cf _off _se<NUM> , cf _off _se<NUM> depend on the current operating point and implicitly on the bitrate, and are selected from the set of available options during initialization of the encoder for each given operating point. The cumulative frequency table cf _se<NUM> is common for all operating points, and cumulative frequency tables cf _se<NUM> and cf _se<NUM> , and the corresponding table offsets cf _off _se<NUM> and cf _off _se<NUM> are also common, but they are used only for operating points corresponding to bitrates larger or equal than <NUM> kbps, in case of dependent TCX <NUM> frames (when t = <NUM> ).

The arithmetic coded IGF scale factors, the IGF whitening levels and the IGF temporal flatness indicator are consecutively transmitted to the decoder side via bit stream. The coding of the IGF scale factors is described in subclause <NUM>. The IGF whitening levels are encoded as presented in subclause <NUM>. Finally the IGF temporal flatness indicator flag, represented as one bit, is written to the bit stream.

Claim 1:
Audio encoder for encoding an audio signal having a lower frequency band and an upper frequency band, comprising:
a detector (<NUM>) for detecting a peak spectral region in the upper frequency band of an MDCT spectrum of the audio signal;
a shaper (<NUM>) for shaping the lower frequency band of the MDCT spectrum using shaping information for the lower frequency band to obtain a shaped lower frequency band and for shaping the upper frequency band of the MDCT spectrum using at least a portion of the shaping information for the lower frequency band, wherein the shaper (<NUM>) is configured to additionally attenuate spectral values in the detected peak spectral region in the upper frequency band to obtain a shaped upper frequency band of the MDCT spectrum; and
a quantizer and coder stage (<NUM>) for quantizing the shaped lower frequency band and the shaped upper frequency band and for entropy coding quantized spectral values from the shaped lower frequency band and the shaped upper frequency band.