fig2 presents the general structure of a stereo audio coding system , in which the invention can be implemented . the stereo audio coding system can be employed for transmitting a stereo audio signal which is composed of a left channel signal and a right channel signal . all details which will be given by way of example are valid for stereo signals which are sampled at 32 khz . the stereo audio coding system of fig2 comprises a stereo encoder 20 and a stereo decoder 21 . the stereo encoder 20 encodes stereo audio signals and transmits them to the stereo decoder 21 , while the stereo decoder 21 receives the encoded signals , decodes them and makes them available again as stereo audio signals . alternatively , the encoded stereo audio signals could also be provided by the stereo encoder 20 for storage in a storing unit , from which they can be extracted again by the stereo decoder 21 . the stereo encoder 20 comprises a summing point 22 , which is connected via a scaling unit 23 to an amr - wb + mono encoder component 24 . the amr - wb + mono encoder component 24 is further connected to an amr - wb + bitstream multiplexer ( mux ) 25 . in addition , the stereo encoder 20 comprises a superframe stereo extension encoder 26 , which is equally connected to the amr - wb + bitstream multiplexer 25 . the stereo decoder 21 comprises an amr - wb + bitstream demultiplexer ( demux ) 27 , which is connected on the one hand to an amr - wb + mono decoder component 28 and on the other hand to a stereo extension decoder 29 . the amr - wb + mono decoder component 28 is further connected to the superframe stereo extension decoder 29 . when a stereo audio signal is to be transmitted , the left channel signal l and the right channel signal r of the stereo audio signal are provided to the stereo encoder 20 . the left channel signal l and the right channel signal r are assumed to be arranged in frames . the left and right channel signals l , r are summed by the summing point 22 and scaled by a factor 0 . 5 in the scaling unit 23 to form a mono audio signal m . the amr - wb + mono encoder component 24 is then responsible for encoding the mono audio signal in a known manner to obtain a mono signal bitstream . the left and right channel signals l , r provided to the stereo encoder 20 are processed in addition in the superframe stereo extension encoder 26 , in order to obtain a bitstream containing side information for a stereo extension . the bitstreams provided by the amr - wb + mono encoder component 24 and the superframe stereo extension encoder 26 are multiplexed by the amr - wb + bitstream multiplexer 25 for transmission . the transmitted multiplexed bitstream is received by the stereo decoder 21 and demultiplexed by the amr - wb + bitstream demultiplexer 27 into a mono signal bitstream and a side information bitstream again . the mono signal bitstream is forwarded to the amr - wb + mono decoder component 28 and the side information bitstream is forwarded to the superframe stereo extension decoder 29 . the mono signal bitstream is then decoded in the amr - wb + mono decoder component 28 in a known manner . the resulting mono audio signal m is provided to the superframe stereo extension decoder 29 . the superframe stereo extension decoder 29 decodes the bitstream containing the side information for the stereo extension and extends the received mono audio signal m based on the obtained side information into a left channel signal l and a right channel signal r . the left and right channel signals l , r are then output by the stereo decoder 21 as reconstructed stereo audio signal . the superframe stereo extension encoder 26 and the superframe stereo extension decoder 29 are designed according to an embodiment of the invention , as will be explained in the following . the structure of the superframe stereo extension encoder 26 is illustrated in more detail in fig3 . the superframe stereo extension encoder 26 comprises a first modified discrete cosine transform ( mdct ) portion 30 and a second mdct portion 31 . both are connected to a grouping portion 32 . the grouping portion 32 is further connected to a high frequency ( hf ) encoding portion 33 , to a middle frequency ( mf ) encoding portion 34 and to a low frequency ( lf ) encoding portion 35 . the output of all three encoding portions 33 to 35 is connected to a stereo extension multiplexer mux 36 . a received left channel signal l is transformed by the mdct portion 30 by means of a frame based mdct into the frequency domain , resulting in a spectral channel signal . in parallel , a received right channel signal r is transformed by the mdct portion 31 by means of a frame based mdct into the frequency domain , resulting in a spectral channel signal . the mdct has been described in detail for instance by j . p . princen , a . b . bradley in “ analysis / synthesis filter bank design based on time domain aliasing cancellation ”, ieee trans . acoustics , speech , and signal processing , 1986 , vol . assp - 34 , no . 5 , october 1986 , pp . 1153 - 1161 , and by s . shlien in “ the modulated lapped transform , its time - varying forms , and its applications to audio coding standards ”, ieee trans . speech , and audio processing , vol . 5 , no . 4 , july 1997 , pp . 359 - 366 . the grouping portion 32 then groups the frequency domain signals of a certain number of successive frames to form a superframe , which is further processed as one entity . a superframe may comprise for example four successive frames of 20 ms . thereafter , the frequency spectra of a superframe is divided into three spectral regions , namely into an hf region , an mf region and an lf region . the lf region covers spectral frequencies from 0 hz to 800 hz , including frequency bins 0 to 31 . the mf region covers spectral frequencies from 800 hz to 6 . 05 khz , including frequency bins 32 to 241 . the hf region covers spectral frequencies from 6 . 05 khz to 16 khz , beginning with a frequency bin 242 . the respective first frequency bin in a region will be referred to as startbin . the hf region is dealt with by the hf encoder 33 , the mf region is dealt with by the mf encoder 34 and the lf region is dealt with by the lf encoder 35 . each encoding portion 33 , 34 , 35 applies a dedicated extension coding scheme in order to obtain stereo extension information for the respective frequency region . the frame size for the stereo extension is 20 ms , which corresponds to 640 samples . the bitrate for the stereo extension is 6 . 75 kbps . thus , the total number of bits which is available for the stereo extension information for each superframe is : bits_available = 6750 32000 · 640 · 4 = 540 ⁢ ⁢ bits ( 1 ) the stereo extension information generated by the encoding portion 33 , 34 , 35 is then multiplexed by the stereo extension multiplexer 36 for provision to the amr - wb + bitstream multiplexer 25 . the respective processing in the mf encoder 34 and the hf encoder 33 is illustrated in more detail in fig4 . the mf encoder 34 and the hf encoder 33 comprise a similar arrangement of processing portions 40 to 45 , which operate partly in the same manner and partly differently . first , the common operations in processing portions 40 to 44 will be described . the spectral channel signals l f and r f for the respective region are first processed within the current frame in several adjacent frequency bands . the frequency bands follow the boundaries of critical bands , as explained in detail by e . zwicker , h . fastl in “ psychoacoustics , facts and models ”, springer - verlag , 1990 . for example , for coding of mid frequencies from 800 hz to 6 . 05 khz at a sample rate of 32 khz , the widths cbstwidthbuf_mid [ ] in samples of the frequency bands for a total number of frequency bands numtotalbands of 27 are as follows : cbstwidthbuf_mid [ 27 ]={ 3 , 3 , 3 , 3 , 3 , 3 , 3 , 4 , 4 , 5 , 5 , 5 , 6 , 6 , 7 , 7 , 8 , 9 , 9 , 10 , 11 , 14 , 14 , 15 , 15 , 17 , 18 }. for coding of high frequencies from 6 . 05 khz to 16 khz at a sample rate of 32 khz , the widths cbstwidthbuf_mid [ ] in samples of the frequency bands for a total number of frequency bands numtotalbands of 7 are as follows : a first processing portion 40 computes channel weights for each frequency band for the spectral channel signals l f and r f , in order to determine the respective influence of the left and right channel signals l and r in the original stereo audio signal in each frequency band . the two channels weights for each frequency band are computed according to the following equations : is_flag ⁢ ( fband ) = { left , if ⁢ ⁢ a ⁢ ⁢ and ⁢ ⁢ gl ratio & gt ; threshold right , if ⁢ ⁢ b ⁢ ⁢ and ⁢ ⁢ gr ratio & gt ; threshold center , otherwise ( 3 ) gl ratio = g l ( fband )/ g r ( fband ) gr ratio = g r ( fband )/ g l ( fband ) the parameter threshold in equation ( 2 ) determines how good the reconstruction of the stereo image should be . in the current embodiment , the value of the parameter threshold is set to 1 . 5 . thus , if the weight of one of the spectral channels does not exceed the weight of the respective other one of the spectral channels by at least 50 %, the state flag represents the center state . in case the state flag represents a left state or a right state , in addition level modification gains are calculated in a subsequent processing portion 42 . the level modification gains allow a reconstruction of the stereo audio signal within the frequency bands when proceeding from the mono audio signal m . the level modification gain g lr ( fband ) is calculated for each frequency band fband according to the equation : g lr ⁡ ( fband ) = { 0 . 0 , if ⁢ ⁢ is_flag ⁢ ( fband ) ⩵ center gl ratio if ⁢ ⁢ is_flag ⁢ ( fband ) ⩵ left gr ratio , otherwise ( 4 ) { g l ⁡ ( fband ) = e l e l + e r g r ⁡ ( fband ) = e r e l + e r ( 2 ) fband = 0 , … ⁢ , numtotalbands - 1 with e l = ∑ i = 0 cbstwidthbuf ⁡ [ fband ] - 1 ⁢ l f ⁡ ( n + i ) 2 e r = ∑ i = 0 cbstwidthbuf ⁡ [ fband ] - 1 ⁢ r f ⁡ ( n + i ) 2 , where fband is a number associated to the respectively considered frequency band , where n is the offset in spectral samples to the start of this frequency band fband , and where cbstwidthbuf is cbstwidthbuf_high or cbstwidthbuf_mid , depending on the respective frequency region . that is , the intermediate values e l and e r represent the sum of the squared level of each spectral sample in a respective frequency band and a respective spectral channel signal . in a subsequent processing portion 41 , to each frequency band one of the states left , right and center is assigned . the left state indicates a dominance of the left channel signal in the respective frequency band , the right state indicates a dominance of the right channel signal in the respective frequency band , and the center state represents mono audio signals in the respective frequency band . the assigned states are represented by a respective state flag is_flag ( fband ) which is generated for each frequency band . the state flags are generated more specifically based on the following equation : the generated level modification gains g lr ( fband ) and the generated stage flags is_flag ( fband ) are further processed on a frame basis for transmission . the level modification gains are used for determining a common gain value for all frequency bands , which is transmitted once per frame . the common level modification gain g lr — average is calculated in processing portion 43 for each frame according to the equation : g lr_average = 1 n · ∑ i = 0 numtotalbands - 1 ⁢ g lr ⁡ ( i ) with n = ∑ i = 0 numtotalbands - 1 ⁢ { 1 , if ⁢ ⁢ is_flag ⁢ ( i ) ≠ center 0 otherwise ( 5 ) thus , the common level modification gain g lr — average constitutes the average of all frequency band associated level modification gains g lr ( fband ) which are not equal to zero . such an average gain , however , represents only the spatial strength within the frame . if large spatial differences are present between the frequency bands , at least the most significant bands are advantageously considered in addition separately . to this end , for those frequency bands which have a very high or a very low gain compared to the common level modification gain , an additional gain value can be transmitted which represents a ratio indicating by how much the gain of a frequency band is higher or lower than the common level modification gain . in addition , processing portion 44 applies a post - processing to the state flags , since the assignment of the spectral bands to left , right and center states is not perfect . as mentioned above , the state flags is_flag ( fband ) are determined separately for each frame in the subframe . now , based on the state flags is_flag ( fband ), an n × s matrix stflags is defined which contains the state flags for the spectral bands covering the targeted spectral frequencies for all frames of a superframe . n represents the number of frames in the current subframe and s the number of frequency bands in the respective frequency region . for the mf region , the size of the matrix is thus 4 × 27 and for the hf region , the size of the matrix is 4 × 7 . a post - processing is then performed by processing portion 44 according to the following pseudo code : where stflags [− 1 ][ j ] corresponds to stflags [ 3 ][ j ] of the previous superframe . equation ( 6 ) is repeated for all frequency bands j , that is for 0 ≦ j & lt ; s . while the processing described so far is the same in the hf encoder 33 and the mf encoder 34 , the following processing is somewhat different in both portions and will thus be described separately . when the state flags have been post - processed in processing portion 44 , a bitstream is formed by the encoding portion 45 of the mf encoder 34 for transmission . to this end , for each spectral band , a two - bit value is first provided to indicate whether the state flags for a frequency band are the same for all four frames of the superframe . a value of ‘ 11 ’ is used to indicate that the state flags for a specific frequency band are not all the same . in this case , the distribution of the state flags for the respective frequency band is coded by a bitstream as defined in the following pseudo code : /*-- stereo flags not same . --*/ send a ‘ 11 ’ value prevflag = stflags [− 1 ][ j ]; for ( i = 0 ; i & lt ; n ; i ++) { uint8 isstate = stflags [ i ][ j ]; if ( isstate == prevflag ) send a ‘ 1 ’ bit else { send a ‘ 0 ’ bit if ( prevflag == center ) { if ( isstate == left ) send a ‘ 0 ’ bit else send a ‘ 1 ’ bit } if ( prevflag == left ) { if ( isstate == center ) send a ‘ 0 ’ bit else send a ‘ 1 ’ bit } if ( prevflag == right ) { if ( isstate == center ) send a ‘ 0 ’ bit else send a ‘ 1 ’ bit } } prevflag = isstate ; } here , is state represents the state flag of the currently considered frame and prevflag the state flag of the preceding frame for a particular frequency band . moreover , i refers to the i th frame in the superframe and j to the jth middle frequency band . thus , for after a two - bit indication ‘ 11 ’ that the state flag for a specific frequency band j is not the same for all frames i of the superframe , a ‘ 1 ’ is used for indicating that the state flag for a frame i is equal to the state flag for a preceding frame i , while a ‘ 0 ’ is used for indicating that the state flag for a frame i is not equal to the state flag for a preceding frame i . in the latter case , a further bit indicates specifically which other state is represented by the state flag for the current frame i . a corresponding bitstream is provided by the encoding portion 45 for each frequency band j to the stereo extension multiplexer 36 . moreover , the encoding portion 45 of the mf encoder 34 quantizes the common level modification gain g lr — average for each frame and possible additional gain values for significant frequency bands in each frame using scalar or , preferably , vector quantization techniques . the quantized gain values are coded into a bit sequence and provided as additional side information bitstream to the stereo extension multiplexer 36 of fig3 . the high - level bitstream syntax for the coded gain for one frame is defined by the following pseudo - code : mid_band_present 1 - bit if ( mid_band_present == ‘ 1 ’) { midgain 5 - bits band specific gains } here , midgain represents the average gain for the middle frequency bands of a respective frame . the encoding is performed such that no more than 60 bits are used for the band specific gain values . a corresponding bitstream is provided by the encoding portion 45 for each frame i in the superframe to the stereo extension multiplexer 36 . the encoding portion 45 of the hf encoder 33 , in contrast , checks first whether the encoding scheme used by the encoding portion 45 of the mf encoder 34 , should be used as well for the high frequencies . the described coding scheme will be employed only if it requires less bits than a second encoding scheme . according to the second encoding scheme , for each frame first one bit is transmitted to indicate whether the state flags of the previous frame should be used again . if this bit has a value of ‘ 1 ’, the state flags of the previous frame shall be used for the current frame . otherwise , an additional two bits will be used for each frequency band for representing the respective state flag . moreover , the encoding portion 45 of the hf encoder 33 quantizes the common level modification gain g lr — average for each frame and possible additional gain values for significant frequency bands in each frame using scalar or , preferably , vector quantization techniques . the following pseudo - code defines the high - level bitstream syntax for the second coding scheme for the high frequency bands of a respective frame : high_band_present 1 - bit if ( high_band_present == ‘ 1 ’) { if ( decodestinfo ) { flags_present 1 - bit if ( flags_present == ‘ 1 ’) use flags from previous frame else for ( j = 0 ; j & lt ; 7 ; j ++) stflags_high [ i ][ j ] 2 - bits } gain_present 1 - bit if ( gain_present == ‘ 1 ’) highgain 5 - bits else use gain value of previous frame band specific gains } here , decodestinfo indicates whether the state flags should be decoded for a frame or whether the state flags of the previous frame should be used . moreover , i refers to the i th frame in the superframe and j to the j th high frequency band highgain represents the average gain for the high frequency bands of a respective frame . the encoding is done such that no more than 15 bits are used for the band specific gain values . this limits the number of frequency bands for which a band specific gain value is transmitted to two or three bands at a maximum . the pseudo - code is repeated for each frame in the superframe . a two - bit indication of the employed coding scheme and the coded state flags for all frequency bands are provided together with the coded gain values for each frame to the stereo extension multiplexer 36 of fig3 . while the coding described above with reference to fig3 is suitable for high and middle frequencies , respectively , the frequency response would not match the requirements on a good stereo quality at low frequencies . at low frequencies , only a coarse representation of the stereo image could be achieved with the described type of coding . in addition , when a high time resolution is used , namely by using short frame lengths , the stereo image would tend to move more than what is typically allowed for an acceptable quality . the processing in the lf encoder 35 is illustrated in more detail in the schematic block diagram of fig5 . the lf encoder 35 comprises a combining portion 51 , a quantization portion 52 a huffman coding portion 53 and a refinement portion 54 . the combining portion 51 receives left and right channel matrices l f , r f for each superframe , each having a size of n × m , for example 4 × 32 . the matrices lf and r f comprise the frequency domain signals of the left and the right channel , respectively , of an audio signal . the n columns comprise samples for n different frames of a superframe , while the m rows comprise samples for m different frequency bands of the low frequency region . the combining portion 51 forms a single matrix ccoef having a size of n × m out of these left and right channel matrices l f , r f by determining the difference between the signals for each sample : ccoef ⁡ [ i ] ⁡ [ j ] = l f ⁡ [ i ] ⁡ [ j ] - r f ⁡ [ i ] ⁡ [ j ] 2 , 0 ≤ i & lt ; 4 0 ≤ j & lt ; 32 ( 7 ) the samples in the resulting matrix ccoef are the spectral samples which are to be encoded by the lf encoder 35 . as will be explained in more detail with reference to fig6 and 7 , the quantization portion 52 quantizes the received samples to integer values , the huffman coding portion 53 encodes the quantized samples and the refinement portion 54 produces additional information in case there are remaining bits available for the transmission . fig6 is a flow chart illustrating the quantization by the quantization portion 52 and its relation to the huffman encoding and the generation of refinement information . for each superframe formed by the grouping portion 32 , a matrix ccoef is generated and provided to the quantization portion 52 for quantization . the quantization portion 52 calculates first the spectral energy e s [ i ] [ j ] of each sample in the matrix ccoef , and sorts the resulting energy array e s according to the following equations : e s ⁡ [ i ] ⁡ [ j ] = ccoef ⁡ [ i ] ⁡ [ j ] · ccoef ⁡ [ i ] ⁡ [ j ] , 0 ≤ i & lt ; n 0 ≤ j & lt ; m ⁢ sort ( ) represents a sorting function which sorts the energy array e s in a decreasing order of energies . a helper variable is also used in the sorting operation to make sure that the encoder knows to which spectral location the first energy in the sorted array corresponds , to which spectral location the second energy in the sorted array corresponds , and so on . this helper variable is not explicitly shown in equations ( 8 ). next , the quantization portion 52 determines the quantization gain which is to be employed in the quantization . an initial quantizer gain is calculated according to the following equation : qgain = ⌊ 1 log 10 ⁡ ( 2 ) · 0 . 25 · log 10 ⁡ ( max ⁡ ( ccoef ) a + 2 ) + 0 . 5 ⌋ ( 9 ) where max ( ccoef ) returns the maximum absolute value of all samples in the matrix ccoef and where a describes the maximum allowed amplitude level for the samples . a can be assigned for example a value of 10 . then , the quantization portion 52 adapts the initial gain to a targeted amplitude level qmax . to this end , the initial gain qgain is incremented by one , if the above function └( x )┘ provides the next lower integer of the operand x . qmax can be assigned for example a value of 5 . to avoid sudden changes in the quantizer gain from frame to frame , the quantization portion 52 moreover performs a smoothing of the gain . to this end , the quantization gain qgain determined for the current frame is compared with the quantization gain qgainprev used for the preceding frame and adjusted such that large changes in the quantization gain are avoided . this can be achieved for instance in accordance with the following pseudo code : dgain = qgain − qgainidx ; if (! ( dgain & lt ; qgainprev & amp ;& amp ; qgainprev & gt ; mingain & amp ;& amp ; qgainidx )) qgain −= qgainidx ; if ( qgainidx == 0 ) { gaindiff = | qgain − qgainprev |; if ( gaindiff & gt ; 5 ) { ( 16 ) if ( qgain & gt ; qgainprev ) { if ( prevgain ≦ mingain ) { gaindiff = sqrt ( qgain ); qgain −= gaindiff ; qgainidx = gaindiff − 1 : } else qgainidx = gaindiff − 1 ; } } } qgainidx −= 1 ; if ( qgainidx & lt ; 0 ) qgainidx = 0 ; here , qgainprev is the transmitted quantization gain of the previous frame and qgainidx describes the smoothing index for the gain on a frame - by - frame basis . the variable qgainidx is initialized to zero at the start of the encoding process . the minimum gain mingain can be set for example to 22 . the quantization portion 52 provides to the stereo extension multiplexer 36 for each frame one bit samples_present for indicating whether samples are present in the current frame and six bits indicating the final quantization gain qgain minus the minimum gain mingain . using the resulting gain qgain , the spectral samples in the matrix ccoef are quantized below the targeted amplitude level qmax according to the following equation : qcoef ⁡ [ i ] ⁡ [ j ] = sign ⁡ ( ccoef ⁡ [ i ] ⁡ [ j ] ) · ⌊  ccoef ⁡ [ i ] ⁡ [ j ]  · 2 - 0 . 25 · qgain + 0 . 2554 ⌋ sign ⁡ ( x ) = { - 1 , if ⁢ ⁢ x ≤ 0 1 , otherwise ( 11 ) the above equation is applied to all samples in the matrix ccoef , that is , to all samples with 0 ≦ i & lt ; n and 0 ≦ j & lt ; m , resulting in a quantized matrix qcoef having equally a size of n × m . the quantized matrix qcoef is now provided to the huffman encoding portion 53 for encoding . this encoding will be explained in more detail further below with reference to fig7 . the encoding by the huffman encoding portion 53 may result in more bits that are available for the transmission . therefore , the huffman encoding portion 53 provides a feedback about the number of required bits to the quantization portion 52 . in case the number of bits is larger that the number of allowed bits , that is , 540 bits minus the bits required for the hf region and the mf region , the quantization portion 52 has to modify the quantized spectra in a way that it results in less bits in the encoding . to this end , the quantization portion 52 modifies the quantized spectra more specifically such that the least significant spectral sample in the quantized matrix qcoef is set to zero in accordance with the following equation : where leastidx_i and leastidx_j describe the row and the column , respectively , of the spectral sample that has the smallest energy according to the sorted energy array e s . once the sample has been set to zero , the spectral bin is removed from the sorted energy array e s so that next time equation ( 12 ) is called , the smallest spectral sample among the remaining samples can be removed . now , encoding the samples based on the new quantized matrix qcoef by the huffman encoding portion 53 and modifying the quantized spectra by the quantization portion 52 is repeated in a loop , until the number of resulting bits does not exceed the number of allowed bits anymore . the encoded spectra and any related information are provided by the quantization portion 52 and the huffman encoding portion 53 to the stereo extension multiplexer 36 for transmission . after the final quantization and encoding , it is possible that the number of used bits is significantly lower than the number of available bits . in this case , it is of advantage to transmit additional information about the quantized spectra instead of pure padding bits for achieving exactly the target bitrate . such additional information may refine the quantization accuracy of the transmitted spectral samples . if the encoding part requires a total of n bits and there are m bits available , then the number of bits which are available after encoding the quantized spectral samples is bits_available = m − n . if the number of available bits is larger than some threshold value , a bit refinement_present having a value of ‘ 1 ’ is provided for transmission to indicate that refinement bits are transmitted as well . if the number of available bits is smaller than the threshold value , a bit having a value of ‘ 1 ’ is provided for transmission to indicate that no refinement bits are present in the bitstream . an example of refinement information which may be generated will be presented in the following . in the final quantized spectra qcoef , a maximum amplitude value of b was allowed . the accuracy of this spectrum can now be improved by defining another quantized spectra qcoef2 , in which the maximum allowed amplitude value is c , which is larger than b . if b is set to 5 , c may be set for example to 9 . the difference between the underlying quantization gain and the difference between the matrices qcoef and qcoef2 can then be used as refinement information . corresponding refinement bits can determined for example in accordance with the following pseudo code : if ( bits_available & gt ; ( gainbits + ampbits )) { qgain2 gainbits - bits qgain2 = − qgain2 + qgain ; bits_available −= gainbits ; for ( j = 0 ; j & lt ; m ; j ++) for ( i = 0 ; i & lt ; n ; i ++) { if ( qcoef [ i ][ j ] != 0 ) { if ( bits_available & gt ; ampbits ) { bits_available −= ampbits ; bscoef ampbits - bits if ( qcoef [ i ][ j ] & gt ; 0 ) qcoef [ i ][ j ] += bscoef ; else qcoef [ i ][ j ] −= bscoef ; dequantize ‘ qcoef [ i ][ j ]’ with qgain2 } } if ( bits_available & gt ; 3 ) { for ( j = 0 ; j & lt ; m ; j ++) for ( i = 0 ; i & lt ; n ; i ++) { if ( qcoef [ i ][ j ] == 0 ) { if ( bits_available & gt ; 3 ) { bits_available −= 2 ; bscoef 2 - bits if ( bscoef == ‘ 00 ’ or bscoef == ‘ 01 ’) qcoef [ i ][ j ] = bscoef ; else if ( bscoef == ‘ 11 ’) qcoef [ i ][ j ] = − 1 ; else { bits_available −= 1 ; bscoefsign 1 - bit qcoef [ i ][ j ] = bscoef ; if ( bscoefsign == ‘ 1 ’) qcoef [ i ][ j ]= − qcoef [ i ][ j ]; } dequantize ‘ qcoef [ i ][ j ]’ with qgain2 } } } } the gainbits can be set for example to 4 and the ampbits can be set for example to 2 . as can be seen from the above pseudo code , the difference between qcoef2 and qcoef is provided on a time - frequency dimension . also the quantizer gain is provided as a difference . if the differences for all non - zero spectral samples have been provided and there are still bits available , the refinement module may start to send bits for spectral samples that were transmitted as zero in the original spectra . as mentioned above , the processing in the huffman encoding portion 53 is illustrated by the flow chart of fig7 . the huffman encoding portion 53 receives from the quantization portion 52 the matrix scoef having the size n × m . for encoding , the matrix scoef is first divided into frequency subblocks . the boundaries of each subblock are set approximately to the critical band boundaries of human hearing . the number of blocks can be set for example to 7 . the subblock sizes can be represented by a table cbbandwidths [ 8 ], in which each table index contains a pointer to the respective first frequency band of the subblocks as follows : the size of an n th subblock can then be calculated in accordance with the following equation : next , for each of the subblocks the following operations are performed . first , the samples belonging to the nth subblock are gathered in a matrix x in accordance with the following equation : x ⁡ [ i ] ⁡ [ j ] = scoef ⁡ [ i ] ⁡ [ cbbandwidths ⁡ [ n ] + j ] ⁢ ⁢ with ⁢ ⁢ 0 ≤ i & lt ; n 0 ≤ j & lt ; subblock_width ⁢ _nth ( 15 ) in this equation , the parameter subblock_width_nth is calculated according to equation ( 14 ). next , the maximum value present in matrix x is located . if this value is equal to zero , a ‘ 0 ’ bit is transmitted for the subblock for indicating that the value of all samples within the sublock are equal to zero . otherwise a ‘ 1 ’ bit is transmitted to indicate that the subblock contains non - zero spectral samples . in this case a huffman coding scheme is selected for the subblock spectral samples . there are eight huffman coding schemes available and , advantageously , the scheme which results in a minimum bit usage is selected for encoding . therefore , the samples of a respective subblock are first encoded with each of the eight huffman coding schemes , and the scheme resulting in the lowest bit number is selected . each huffman coding scheme operates on a pairwise sample basis . that is , first , two successive spectral samples are grouped and a huffman index is determined for this group . the huffman index is determined according to the following equation : where y and z are the amplitude values of 2 successive grouped spectral samples , and where xamp is the maximum absolute value allowed for the quantized samples . after the huffman index has been calculated for the 2 - tuple samples , a huffman symbol is selected which is associated according to a specific huffman coding scheme to this huffman index . in addition , a sign has to be provided for each non - zero spectral sample , as the calculation of the huffman index does not take account of the sign of the original samples . next , the eight huffman coding schemes are explained in more detail . for a first huffman coding scheme , the spectral samples in a matrix x of a respective subblock are used to fill a sample buffer according to the following equation : samplebuffer ⁡ [ sboffset ] = x ⁡ [ i ] ⁡ [ j ] , 0 ≤ i & lt ; n 0 ≤ j & lt ; subblock_width sboffset = i · m + j ( 17 ) then , the huffman index is calculated with equation ( 16 ) for each pair of two successive samples in this buffer . the huffman symbol corresponding to this index is retrieved from a table hindextable which is associated in fig8 to a huffman scheme 1 . in this table , the first column contains the number of bits of a huffman symbol reserved for an index and the second column contains the corresponding huffman symbol that will be provided for transmission . in addition the signs of both samples are determined . the encoding based on the first huffman coding scheme can be carried out in accordance with the following pseudo - code : /**-- encode samples via 2 - dimensional huffman table . --*/ for ( i = 0 ; i & lt ; sboffset ; i += 2 ) { /*-- get huffman index for samplebuffer [ i ] and samplebuffer [ i + 1 ]. --*/ hcbidx = equation ( 16 ); /*-- count bits and write huffman symbol to bitstream . -- */ hufbits += hindextable [ hcbidx ][ 0 ]; hufsymbol = hindextable [ hcbidx ][ 1 ]; send ‘ hufsymbol ’ of ‘ hindextable [ hcbidx ][ 0 ]’ bits /*-- write sign bits . --*/ if ( samplebuffer [ i ]) { if ( samplebuffer [ i ] & lt ; 0 ) send a ‘ 0 ’ bit else send a ‘ 1 ’ bit } if ( samplebuffer [ i + 1 ]) { if ( samplebuffer [ i + 1 ] & lt ; 0 ) send a ‘ 0 ’ bit else send a ‘ 1 ’ bit } } in this pseudo - code , hufbits is used for counting the bits required for the coding and hufsymbol indicates the respective huffman symbol . the second huffman coding scheme is similar to the first scheme . in the first scheme , however , the spectral samples are arranged for encoding in a frequency - time dimension , whereas in the second scheme , the samples are arranged for encoding in a time - frequency dimension . to this end , the spectral samples in a matrix x of a respective subblock are used to fill a sample buffer according to the following equation : samplebuffer ⁡ [ sboffset ] = x ⁡ [ i ] ⁡ [ j ] , 0 ≤ j & lt ; subblock_width 0 ≤ i & lt ; n sboffset = j · n + i ( 18 ) the samples in the samplebuffer are then encoded as described for the first huffman coding scheme but using the table hindextable which is associated in fig8 to a huffman scheme 2 for retrieving the huffman symbols . for the third huffman coding scheme , the buffer is filled again in accordance with equation ( 16 ). the third huffman coding scheme , however , assigns in addition a flag bit to each frequency line , that is to each frequency band , for indicating whether non - zero spectral samples are present for a respective frequency band . a ‘ 0 ’ bit is transmitted if all samples of a frequency band are equal to zero and a ‘ 1 ’ bit is transmitted for those frequency bands in which non - zero spectral samples are present . if a ‘ 0 ’ is transmitted for a frequency band , no additional huffman symbols are transmitted for the samples from the respective frequency band . the encoding is based on the huffman scheme 3 depicted in fig8 and can be achieved in accordance with the following pseudo - code : /*-- encode samples via 2 - dimensional huffman table . --*/ for ( row = 0 ; row & lt ; n ; row ++) { int16 * flinespec = samplebuffer + row * subblock_width ; for ( column = 0 , allzero = true ; column & lt ; subblock_width ; column ++) if ( flinespec [ column ]) { allzero = false ; break ; } hufbits += 1 ; if (! allzero ) { bool useext ; int16 hcbidx , lines ; /*-- freqency line within subblock significant . --*/ send a ‘ 1 ’ bit useext = subblock_width & amp ; 0x1 ; lines = subblock_width − useext ; /*-- count and code non - zero spectral line . --*/ for ( column = 0 ; column & lt ; lines ; column += 2 ) { /*-- get huffman index for flinespec [ column ] and flinespec [ column + 1 ]. --*/ hcbidx = equation ( 16 ); /*-- count bits and write huffman symbol to bitstream . --*/ hufbits += hindextable [ hcbidx ][ 0 ]; hufsymbol = hindextable [ hcbidx ][ 1 ]; send ‘ hufsymbol ’ of ‘ hindextable [ hcbidx ][ 0 ]’ bits /*-- write sign bits . --*/ if ( flinespec [ column ]) { if ( flinespec [ column ] & lt ; 0 ) send a ‘ 0 ’ bit else send a ‘ 1 ’ bit } if ( flinespec [ column + 1 ]) { if ( flinespec [ column + 1 ] & lt ; 0 ) send a ‘ 0 ’ bit else send a ‘ 1 ’ bit } } /*-- use symmetric extension for the last coefficient . --*/ if ( useext ) { /*-- get huffman index for flinespec [ column ] and flinespec [ column ]. --*/ hcbidx = equation ( 16 ); /*-- count bits and write huffman symbol to bitstream . --*/ hufbits += hindextable [ hcbidx ] [ 0 ]; hufsymbol = hindextable [ hcbidx ] [ 1 ]; send ‘ hufsymbol ’ of ‘ hindextable [ hcbidx ] [ 0 ]’ bits /*-- write sign bits . --*/ if ( flinespec [ column ]) { if ( flinespec [ column ] & lt ; 0 ) send a ‘ 0 ’ bit else send a ‘ 1 ’ bit } } } else /*-- freqency line within subblock insignificant . -- */ send a ‘ 0 ’ bit } in this pseudo - code , hufbits is used again for counting the bits required for the coding and hufsymbol indicates again the respective huffman symbol . as can be seen from the above pseudo code , if the width of the subblock is not a multiple of 2 , a symmetric extension will be used for the last coefficient to obtain the huffman index . the fourth huffman coding scheme is similar to the third huffman coding scheme . for the fourth scheme , however , a flag bit is assigned to each time line , that is to each frame , instead of to each frequency band . the spectral samples are buffered as for the second huffman coding scheme according to equation ( 18 ). the samples in the sample buffer samplebuffer are then coded as described for the third coding scheme based on the table hindextable for the huffman scheme 4 depicted in fig9 . the fifth to eight huffman coding schemes operate in a similar manner as the first to fourth huffman coding schemes . the main difference is the gathering of the spectral samples which form the basis for the huffman schemes . huffman schemes five to eight determine for each sample of a subblock the difference between this sample in the current superframe and a corresponding sample in the previous superframe to obtain the samples which are to be coded . the fifth huffman coding scheme fills the sample buffer based on the following equation : samplebuffer ⁡ [ sboffset ] = x ⁡ [ i ] ⁡ [ j ] - x prevframe ⁡ [ i ] ⁡ [ j ] , ⁢ with ⁢ ⁢ 0 ≤ i & lt ; n 0 ≤ j & lt ; subblock_width sboffset = i · m + j ( 19 ) where x prevframe contains the quantized samples transmitted for the previous superframe . the samples are then coded as described for the first huffman coding scheme , but based on the table hindextable for the huffman scheme 5 depicted in fig9 . the sixth huffman coding scheme fills the sample buffer based on the following equation : samplebuffer ⁡ [ sboffset ] = x ⁡ [ i ] ⁡ [ j ] - x prevframe ⁡ [ i ] ⁡ [ j ] , ⁢ with ⁢ ⁢ 0 ≤ j & lt ; subblock_width 0 ≤ i & lt ; n sboffset = j · n + i ( 20 ) the samples are then coded as described for the first scheme , but based on the table hindextable for the huffman scheme 6 depicted in fig1 . the seventh huffman coding scheme arranges the samples again according to equation ( 19 ), but codes the samples as described for the third scheme , based on the table hindextable for the huffman scheme 7 depicted in fig1 . finally , the eight huffman coding scheme arranges the samples again according to equation ( 20 ), but codes the samples as described for the third scheme , based on the table hindextable for the huffman scheme 8 depicted in fig1 . to obtain the best performance , the huffman coding scheme for which the parameter hufbits indicates that it results in the minimum bit consumption is selected for transmission . two bits hufscheme are reserved for signaling the selected scheme . for this signaling , the above presented first and fifth scheme , the above presented second and sixth scheme , the above presented third and seventh scheme as well as the above presented fourth and eighth scheme , respectively , are considered as the same scheme . in order to differentiate between the respective two schemes , one further bit diffsamples is reserved for signaling whether a difference signal with respect to the previous superframe is used or not . the high - level bitstream syntax for each subblock is then defined according to the following pseudo - code : subblock_present 1 - bit if ( subblock_present == ‘ 1 ’) { hufscheme 2 - bits diffsamples 1 - bit if ( hufscheme == ‘ 00 ’ and diffsamples == ‘ 0 ’) huffman coding scheme 1 else if ( hufscheme == ‘ 01 ’ and diffsamples == ‘ 0 ’) huffman coding scheme 2 else if ( hufscheme == ‘ 10 ’ and diffsamples == ‘ 0 ’) huffman coding scheme 3 else if ( hufscheme == ‘ 11 ’ and diffsamples == ‘ 0 ’) huffman coding scheme 4 else if ( hufscheme == ‘ 00 ’ and diffsamples == ‘ 1 ’) huffman coding scheme 5 else if ( hufscheme == ‘ 01 ’ and diffsamples == ‘ 1 ’) huffman coding scheme 6 else if ( hufscheme == ‘ 10 ’ and diffsamples == ‘ 1 ’) hufffman coding scheme 7 else if ( hufscheme == ‘ 11 ’ and diffsamples == ‘ 1 ’) huffman coding scheme 8 } summarized , the huffman encoding portion 53 transmits to the stereo extension multiplexer 36 for each subblock one bit subblock_present indicating whether the subblock is present , and possibly in addition two bits hufscheme indicating the selected huffman coding scheme , one bit diffsamples indicating whether the selected huffman coding scheme is used as differential coding scheme , and a number of bits hufsymbols for the selected huffman symbols . if the number of bits resulting the selected huffmann coding scheme is nevertheless higher than the number of available bits , the quantization portion 52 sets some samples to zero , as described above with reference to fig6 . the stereo extension multiplexer 36 multiplexes the bitstreams output by the hf encoding portion 33 , the mf encoding portion 34 and the lf encoding portion 35 , and provides the resulting stereo extension information bitstream to the amr - wb + bitstream multiplexer 25 . the amr - wb + bitstream multiplexer 25 then multiplexes the received stereo extension information bitstream with the mono signal bitstream for transmission , as described above with reference to fig2 . the structure of the superframe stereo extension decoder 29 is illustrated in more detail in fig1 . the superframe stereo extension decoder 12 comprises a stereo extension demultiplexer 66 , which is connected to an hf decoder 63 , to an mf decoder 64 and to an lf decoder 65 . the output of the decoders 63 to 64 is connected via a degrouping portion 62 to a first inverse modified discrete cosine transform ( imdct ) portion 60 and a second idmct portion 61 . the superframe stereo extension decoder 29 moreover comprises an mdct portion 67 , which is connected as well to each of the decoding portions . the superframe stereo extension decoder 29 reverses the operations of the superframe stereo extension encoder 26 . an incoming bitstream is demultiplexed and the bitstream elements are passed to each decoding block 28 , 29 as described with reference to fig2 . in the superframe stereo extension decoder 29 , the stereo extension part is further demultiplexed by the stereo extension demultiplexer 66 and distributed to the decoders 63 to 65 . in addition , the decoded mono m signal output by the amr - wb + decoder 28 is passed on to the superframe stereo extension decoder 29 , transformed to the frequency domain by the mdct portion 67 and provided as further input to each of the decoders 63 to 65 . each of the decoders 63 to 65 then reconstructs those stereo frequency bands for which it is responsible . more specifically , first , the bitstream elements of the mf range and the hf range are decoded in the mf decoder 64 and the hf decoder 63 , respectively . corresponding stereo frequencies are reconstructed from the mono signal . next , the number of bits available for the lf coding block is determined in the same manner as it was determined at the encoder side , and the samples for the lf region are decoded and dequantized . finally , the spectrum is combined by the degrouping portion 62 to remove the superframe grouping , and an inverse mdct is applied by the imdct portions 60 and 61 to each frame to obtain the time domain stereo signals l and r . in the mf decoder 64 , two bits are first read on a spectral band basis . if the bit value ‘ 11 ’ is read , the state information is decoded in accordance with the pseudo - code presented above for the mf encoder 34 . otherwise the two - bit value is used to assign the correct states to each time line of frequency band j in accordance with the following equations : stflags ⁡ [ 0 ] ⁡ [ j ] = { center , bit_value == &# 39 ; 0 ⁢ ⁢ 0 &# 39 ; left , bit_value == &# 39 ; 0 ⁢ ⁢ 1 &# 39 ; right , bit_value == &# 39 ; 1 ⁢ ⁢ 0 &# 39 ; stflags ⁡ [ 1 ] ⁡ [ j ] = stflags ⁡ [ 2 ] ⁡ [ j ] = stflags ⁡ [ 3 ] ⁡ [ j ] = stflags ⁡ [ 0 ] ⁡ [ j ] ( 21 ) the two - channel representation of the mono signal for the spectral frequency bands covered by the stereo flags can then be achieved in accordance with the following pseudo - code : /*-- extend mono input to stereo output . --*/ for ( i = 0 ; i & lt ; n ; i ++) for ( j = 0 , offset = startbin ; j & lt ; s ; j ++) { int16 sblen , k , offset2 ; float gaina , gainb , bgain2 , bgain0 ; sblen = cbstwidthbuf [ i ]; /*-- smoothing parameters ... */ /*-- ... for no smoothing . --*/ offset2 = 0 ; bgain2 = 0 . 0f ; gaina = stgain [ i ][ j ]; gainb = stgain [ i ][ j ]; bgain0 = stgain [ i ][ j ]; if ( stflags [ i ][ j ] != center ) { if ( allzeros == false ) { /*-- ... for the start of a frequency band . --*/ if ( j == 0 ) { if ( stflags [ i ][ j ]) { offset2 = ( j & lt ; 20 ) ? 1 : 2 ; gaina = ( float ) sqrt ( stgain [ i ][ j ]); } } else if ( stflags [ i ][ j ] & amp ;& amp ; stflags [ i ][ j − 1 ] == 0 ) { offset2 = ( j & lt ; 20 ) ? 1 : 2 ; gaina = ( float ) sqrt (( stgain [ i ][ j ] + stgain [ i ][ j − 1 ]) * 0 . 5f ); } } } if ( stflags [ i ][ j ] & amp ;& amp ; stflags [ i − 1 ][ j ] == 0 ) { gaina = ( float ) sqrt ( gaina ); bgain0 = ( float ) sqrt ( stain [ i ][ j ]); } if ( stflags [ i ][ j ] { gainb = 2 . 0f / ( gaina + 1 . 0f ); bgain2 = 2 . 0f / ( bgain0 + 1 . 0f ); } switch ( stflags [ i ][ j ]) { case left : for ( k = 0 ; k & lt ; offset2 ; k ++) { left [ offset + k ] = mono [ offset + k ] * gainb ; right [ offset + k ] = left [ offset + k ] * gaina ; } for ( ; k & lt ; sblen ; k ++) { left [ offset + k ] = mono [ offset + k ] * bgain2 ; right [ offset + k ] = left [ offset + k ] * bgain0 ; } break ; case right : for ( k = 0 ; k & lt ; offset2 ; k ++) { right [ offset + k ] = mono [ offset + k ] * gainb ; left [ offset + k ] = right [ offset + k ] * gaina ; } for ( ; k & lt ; sblen ; k ++) { right [ offset + k ] = mono [ offset + k ] * bgain2 ; left [ offset + k ] = right [ offset + k ] * bgain0 ; } break ; case center : default : for ( k = 0 ; k & lt ; sblen ; k ++) { left [ offset + k ] = mono [ offset + k ]; right [ offset + k ] = mono [ offset + k ]; } break ; } offset += sblen ; } here , mono is the spectral representation of the mono signal m , and left and right are the output channels corresponding to left and right channels , respectively . further , startbin is the offset to the start of the stereo frequency bands , which are covered by the stereo flags , cbstwidthbuf describes the band boundaries of each stereo band , stgain represents the gain for each spectral stereo band , stflags represents the state flags and thus the stereo image location for each band , and allzeros indicates whether all frequency bands use the same gain or whether there are frequency bands which have different gains . as can be seen , abrupt changes in time and frequency dimension are smoothed in case the stereo images move from center to left or right in the time dimension or in the frequency dimension . in the hf decoder 63 , the bitstream is decoded correspondingly , or in accordance with the second encoding scheme for the hf encoder 33 described above . in the lf decoder 65 , reverse operations to the lf encoder 35 are carried out to regain the transmitted quantized spectral samples . first , a flag bit is read to see whether non - zero spectral samples are present . if non - zero spectral samples are present , the quantizer gain is decoded . the value range for the quantizer gain is from mingain to mingain + 63 . next , huffman symbols are decoded and quantized samples are obtained . the huffman symbols are decoded by retrieving the corresponding huffman index from the respective table and by converting the huffman index to spectral samples in accordance with the following equation : once the unsigned spectral samples are known , the sign bits are read for all non - zero samples . in case a differential coding was used for the samples , the subblock samples are reconstructed by adding the subblock samples from the previous superframe to the decoded samples . finally , the spectra is inverse quantized to obtain the reconstructed spectral samples as follows ccoef decoder ⁡ [ i ] ⁡ [ j ] = sign ⁡ ( qcoef decoder ⁡ [ i ] ⁡ [ j ] ) ·  qcoef decoder ⁡ [ i ] ⁡ [ j ]  · 2 0 . 25 · qgain ⁢ ⁢ sign ⁡ ( x ) = { - 1 , if ⁢ ⁢ x ≤ 0 1 , otherwise ( 23 ) equation ( 23 ) is repeated for 0 ≦ i & lt ; n and 0 ≦ j & lt ; m , that is for all frequency bands and all frames . if refinement information is present in addition , which is indicated by a refinement bit of ‘ 1 ’, this information is taken into account as well in equation ( 23 ). finally , the dequantized spectra is used to reconstruct the left and right channels at the low frequencies in accordance with the following equations : l ^ f ⁡ [ i ] ⁡ [ j ] = { m ^ f ⁡ [ i ] ⁡ [ j ] + ccoef decoder ⁡ [ i ] ⁡ [ j ] , if ⁢ ⁢ ccoef decoder ⁡ [ i ] ⁡ [ j ] != 0 m ^ f ⁡ [ i ] ⁡ [ j ] , otherwise r ^ f ⁡ [ i ] ⁡ [ j ] = { m ^ f ⁡ [ i ] ⁡ [ j ] - ccoef decoder ⁡ [ i ] ⁡ [ j ] , if ⁢ ⁢ ccoef decoder ⁡ [ i ] ⁡ [ j ] != 0 m ^ f ⁡ [ i ] ⁡ [ j ] , otherwise ( 24 ) where { circumflex over ( m )} f is the decoded mono signal transformed to the frequency domain . in order to ensure that there are no abrupt changes in the decoded signal , a smoothing is performed on a frame - by - frame basis based on the following equation : spanning = { true , if ⁢ ⁢ sum & gt ; 1 . 49 ⁢ ⁢ and ⁢ ⁢ count & gt ; 3 false , otherwise sum = 0 . 25 · ∑ j = 0 4 - 1 ⁢ midgain ⁡ [ j ] count = ∑ j = 0 4 - 1 ⁢ { 1 , if ⁢ ⁢ lcount ⁡ [ j ] == 27 ⁢ ⁢ or ⁢ ⁢ rcount ⁡ [ j ] == 27 0 , otherwise lcount ⁡ [ i ] = ∑ j = 0 27 - 1 ⁢ { 1 , if ⁢ ⁢ stflags_mid ⁡ [ i ] ⁡ [ j ] == left 0 , otherwise rcount ⁡ [ i ] = ∑ j = 0 27 - 1 ⁢ { 1 , if ⁢ ⁢ stflags_mid ⁡ [ i ] ⁡ [ j ] == right 0 , otherwise ( 25 ) the smoothing steps can then be summarized with the following pseudo - code : /*-- decode each spectral line within the group . --*/ for ( i = 0 ; i & lt ; 4 ; i ++) { hpanning [ i ] = 0 ; glow = ( 1 . 0f / ( float ) pow ( 2 . 0f , 0 . 25 * 2 . 25 )); if ( spanning ) { float glow2 , glow3 ; if ( panningflag & gt ; 1 ) { hpanning [ i ] = ( lcount [ i ] == 27 ) ? right : left ; glow = 1 . 0e − 10f ; for ( j = 0 ; j & lt ; 32 ; j ++) glow += monocoef [ i ][ j ] * monocoef [ i ][ j ]; glow3 = glow = glow / 32 ; glow = ( float ) ( 1 . 0f / pow ( glow , 0 . 03f )); glow2 = glow ; if ( sum & lt ; 1 . 7f ) glow = ( float ) ( 1 . 0f / sum ); else { glow = ( glow + ( 1 . 0f / max ( 1 . 9f , sum ))) * 0 . 5f ; if (( sum / glow ) & gt ; 4 . 8f ) glow = sum / 4 . 8f ; } } } else if ( hpanning [ i ] == 0 ) { if ( midgain [ i ] & gt ; 1 . 4f ) { if ( lcount [ i ] & gt ;= ( 27 − 1 ) & amp ;& amp ; lcount [ i ] != 27 ) hpanning [ i ] = 2 ; else if ( rcount [ i ] & gt ;= ( 27 − 1 ) & amp ;& amp ; rcount [ i ] != 27 ) hpanning [ i ] = 1 ; if ( hpanning [ i ]) glow = ( float ) ( 1 . 0f / sqrt ( sqrt ( sqrt ( midgain [ i ])))); } } if ( hpanning [ i ]) { if ( spanning ) fadein = 4 ; else fadein = 3 ; if ( prevgain != 0 . 0f ) glow = ( glow + prevgain ) * 0 . 5f ; else if ( fadevalue != 0 . 0f ) glow = ( glow + fadevalue ) * 0 . 5f ; prevgain = glow ; fadevalue = glow ; } else prevgain = 0 . 0f ; /*-- inverse ms matrix . --*/ for ( j = 0 ; j & lt ; 32 ; j ++) } float l , r ; if ( ccoef decoder [ i ][ j ] != 0 ) { l = ccoef decoder [ i ][ j ] + monocoef [ i ][ j ]; r = − ccoef decoder [ i ][ j ] + monocoef [ i ][ j ]; leftcoef [ j ] = 1 ; rightcoef [ j ] = r ; } if ( hpanning [ i ] == left ) rightcoef [ i ] *= glow ; else if ( hpanning [ i ] == right ) leftcoef [ j ] *= glow ; else if ( fadein ) { rightcoef [ j ] *= fadevalue ; leftcoef [ j ] *= fadevalue ; } } fadein −= 1 ; fadevalue = sqrt ( fadevalue ); if ( fadein & lt ; 0 ) { fadein = 0 ; fadevalue = 0 . 0f ; } } if ( spanning ) { panningflag & lt ;& lt ;= 1 ; panningflag |= 1 ; } else { panningflag & lt ;& lt ;= 1 ; panningflag |= 0 ; } here , fadein , fadevalue , panningflag , and prevgain describe the smoothing parameters over time . these values are set to zero at the beginning of the decoding . monocoef is the decoded mono signal transferred to the frequency domain , and leftcoef and rightcoef are the output channels corresponding to left and right channels , respectively . after the degrouping of the superframe by the degrouping portion 52 , each frame in the superframe is subjected to an inverse transform by the imdct portions 50 and 51 , respectively , to obtain the time domain stereo signals . on the whole , the presented system ensures an excellent quality of the transmitted stereo audio signal with a stable stereo image over a wide bandwidth and thus a wide range of stereo content . it is to be noted that the described embodiment constitutes only one of a variety of possible embodiments of the invention .