hash
stringlengths
32
32
doc_id
stringlengths
7
13
section
stringlengths
3
121
content
stringlengths
0
2.2M
64c5405618784b24a18fe0e72433f605
103 634
5.3.7.2.2 Padding
In case the configuration of the codec results in a number of bands  < 64, the energy array )  is extended by repeating the entries, starting from the lowest ones, until the vector has reached its dedicated size of 64. Two cases need to be considered. For  < 32, the lowest values need to be repeated four times an...
64c5405618784b24a18fe0e72433f605
103 634
5.3.7.2.3 Smoothing
The energy per band  is first smoothed using:  =  0,75 βˆ™0 + 0,25 βˆ™1 ,   = 0 0,25 βˆ™62 + 0,75 βˆ™63 ,   = 63 0,25 βˆ™ βˆ’1 + 0,5 βˆ™ + 0,25 βˆ™ + 1 , β„Ž  17
64c5405618784b24a18fe0e72433f605
103 634
5.3.7.2.4 Pre-emphasis
The smoothed energy per band  is then pre-emphasized using:  =  βˆ™10 βˆ™βˆ™   = 0 … 63 18 with  given in Table 5.7. Table 5.7: Pre-emphasis tilt factor table (Hz)  8 000 14 16 000 18 24 000 22 32 000 26 44 100, 48 000 30 ETSI ETSI TS 103 634 V1.4.1 (2023-03) 30
64c5405618784b24a18fe0e72433f605
103 634
5.3.7.2.5 Noise floor
A noise floor at -40 dB is added to  using:  = max,       = 0 … 63 19 with the noise floor being calculated by:    = max  βˆ‘   64 βˆ™10 , 2  20
64c5405618784b24a18fe0e72433f605
103 634
5.3.7.2.6 Logarithm
A transformation into the logarithm domain is then performed using:  = log 2   = 0 … 63 21
64c5405618784b24a18fe0e72433f605
103 634
5.3.7.2.7 Band Energy Grouping
The vector , with  ∈[0, 63] is then grouped and decimated by a factor of 4 using:  = ⎩ βŽͺβŽͺβŽͺ ⎨ βŽͺβŽͺβŽͺ ⎧ (0)(0) + ( )   4 + βˆ’1 ,   = 0 ( )   4 + βˆ’1 + 5(63) ,   = 15 ( )   4 + βˆ’1 , β„Ž  22 with  ∈[0, 15], and   = 1 12 , 2 12 , 3 12 , 3 12 , 2 12 , 1 12 23
64c5405618784b24a18fe0e72433f605
103 634
5.3.7.2.8 Mean removal and scaling, attack handling
Mean removal and scaling is performed according to:   = 0,85  βˆ’ βˆ‘    16    = 0. . .15. 24 If the attack detection is not active or if it is active and    = 0, then the final scale factors are given by:   =     = 0 … 15. 25 Otherwise, if attack detection is active and  ...
64c5405618784b24a18fe0e72433f605
103 634
5.3.7.3 SNS quantization
64c5405618784b24a18fe0e72433f605
103 634
5.3.7.3.1 General
The SNS scale factors scf(n) (obtained in clause 5.3.7.2) are quantized using a two-stage vector quantizer employing a total of 38 bits (R = 2,375 bits/coefficient), the first stage is a 10 bit split VQ and the second stage is a low complexity algorithmic Pyramid Vector Quantizer (PVQ). To further maintain low overall ...
64c5405618784b24a18fe0e72433f605
103 634
5.3.7.3.2 Stage 1
The first stage is a split VQ employing two off-line trained stochastic codebooks LFCB and HFCB. Each codebook row has dimension 8 and the number of codebook columns is limited to 32, requiring 5 bits for each split for transmission. The MSE distortions for the two code books are defined as follows: _    ...
64c5405618784b24a18fe0e72433f605
103 634
5.3.7.3.3 Stage 2
5.3.7.3.3.1 General On a high level the overall mean square error that is minimized by the second stage is: β„Ž_, _, ,   = 1 βˆ’ _,  _ βˆ™ !" ,  ,,   βˆ™#$%   39 where Ggain_i,shape_j is a scalar value, D is a 16-by-16 rotation matrix (realizing an IDCT rot...
64c5405618784b24a18fe0e72433f605
103 634
5.3.7.3.4 Multiplexing of SNS VQ Codewords
The SNS VQ Stage 1 codewords are multiplexed in the following order: _(5 bits) followed by _(5 bits). The second stage SNS VQ codeword multiplexing is performed differently depending on the selected shape shape_j. To efficiently use the available 38 bits for the second stage SNS scale factor quantizer, the fr...
64c5405618784b24a18fe0e72433f605
103 634
5.3.7.3.5 Synthesis of the Quantized SNS scale factor vector
The quantized first stage vector st1, the quantized second stage unit energy shape vector ,_ , the quantized adjustment gain _,_ (with gain index gain_i), and the rotation matrix D (now used to implement the synthesis IDCT transform) are used to establish the quantized scale factor vector  as fo...
64c5405618784b24a18fe0e72433f605
103 634
5.3.7.4 SNS scale factors interpolation
The quantized scale factors  (obtained in clause 5.3.7.3) are interpolated using: 0 = 0 1 = 0 4 + 2 =  + 1 8  + 1 βˆ’    = 0. . 14 4 + 3 =  + 3 8  + 1 βˆ’    = 0. . 14 4 + 4 =  + 5 8  + 1 βˆ’    ...
64c5405618784b24a18fe0e72433f605
103 634
5.3.7.5 Spectral shaping
The SNS scale factors  are applied on the MDCT frequency coefficients for each band separately in order to generate the shaped spectrum () as outlined by the following code: for b=0 to βˆ’1 do for k= ( ) to + 1 βˆ’1  () =   βˆ™   ETSI ETSI TS 103 634 V1.4.1 (2023-03) 40
64c5405618784b24a18fe0e72433f605
103 634
5.3.8 Bandwidth control
For specific scenarios a bandwidth restricted LC3plus frame might be required. The bandwidth is controlled by the parameter  representing the audio bandwidth in Hz. Depending on , the start frequency index  is calculated by  =  βˆ™  . A short roll-off is applied on the shaped MDCT spectrum and the remaini...
64c5405618784b24a18fe0e72433f605
103 634
5.3.9 Temporal Noise Shaping (TNS)
64c5405618784b24a18fe0e72433f605
103 634
5.3.9.1 Overview
Temporal Noise Shaping (TNS) is used to control the temporal shape of the quantization noise within each window of the transform. If TNS is active in the current frame, up to two filters per MDCT-spectrum will be applied. The processing steps are outlined in Figure 5.6. Figure 5.6: TNS encoder overview The number of fi...
64c5405618784b24a18fe0e72433f605
103 634
5.3.9.2 TNS analysis
The complete TNS analysis described below is repeated for every TNS filter , with  = 0 … num_tns_filters-1 (um_filters is given in Table 5.15). The normalized autocorrelation function is calculated as follows, for each  = 0 … 8:  = ⎩ βŽͺ ⎨ βŽͺ ⎧ , if   = 0   βˆ‘  +  sub_stop(f,s)-1-k sub_start...
64c5405618784b24a18fe0e72433f605
103 634
5.3.9.3 Quantization
For each TNS filter , the reflection coefficients obtained in clause 5.3.9.2 are quantized using scalar uniform quantization in the arcsine domain:  ,  = nint arcsin  ,  Ξ” + 8   = 0 … 7 71 and  ,  = nint!2 βˆ™sin!Ξ” ,  βˆ’8"" 2   = 0 … 7 72 where Ξ” =   and nint(.) is the rounding-t...
64c5405618784b24a18fe0e72433f605
103 634
5.3.9.4 Filtering
The MDCT spectrum () is filtered using the following algorithm: for  = 0 to (  βˆ’1) do  =   = = β‹―=  = 0 for = 0 to num_tns_filters-1 do if     > 0 for  = start_freq  to stop_freqf βˆ’1 do =   = for  = 0 to     βˆ’1 do st = ,  βˆ™t + st t = t + , st st = st st = st...
64c5405618784b24a18fe0e72433f605
103 634
5.3.10 Long Term Post Filter (LTPF)
64c5405618784b24a18fe0e72433f605
103 634
5.3.10.1 Overview
A Long Term Post Filter (LTPF) module controls a pitch based postfilter on the decoder side which perceptually shapes quantization noise in spectral valleys. Figure 5.7 outlines the processing steps of the LTPF encoder. Figure 5.7: LTPF encoder overview NOTE: The processing of the LTPF decoder (clause 5.4.9) depends on...
64c5405618784b24a18fe0e72433f605
103 634
5.3.10.2 Time-domain signals
Several time-domain signals are computed in the LTPF encoder described below. These are processed with filters which contain a memory and thus operate on audio samples computed in the previous frames. For simplicity, audio samples of past frames are accessed by negative indexing, e.g. 'βˆ’1 is the most recent sample o...
64c5405618784b24a18fe0e72433f605
103 634
5.3.10.3 Resampling
The input signal at sampling rate  is resampled at a fixed sampling rate of 12,8 kHz (for input sampling rates of 8, 16, 24, 32 and 48 kHz and to about 11,76 kHz for input sampling rate of 44,1 kHz). The resampling is performed using an upsampling step followed by a low-pass-filtering step followed by a downsampling ...
64c5405618784b24a18fe0e72433f605
103 634
5.3.10.4 High-pass filtering
The resampled signal is high-pass filtered using a 2-order IIR filter with a cut-off frequency of 50 Hz and a transfer function given by: ./ = 0,9827947082978771 βˆ’1,965589416595754/ + 0,9827947082978771/ 1 βˆ’1,9652933726226904/ + 0,9658854605688177/ 78 The high-pass filtered signal is denoted as '1,  ...
64c5405618784b24a18fe0e72433f605
103 634
5.3.10.5 Pitch detection algorithm
The delayed 12,8 kHz signal '1, _"() is downsampled by a factor of 2 to 6,4 kHz using: '%,& = '1, _"2 +  βˆ’3β„Ž &   = 0 … - %,& βˆ’1 80 where: - %,& = - , 2 80.1 with the FIR filter coefficients given by: β„Ž [5] = { 0,1236796411180537, 0,2353512128364889, 0,2819382920909148, 0,2353512128364889...
64c5405618784b24a18fe0e72433f605
103 634
5.3.10.6 LTPF bitstream
The first bit of the LTPF bitstream signals the presence of the pitch-lag parameter in the bitstream. It is obtained by: pitch_present = 1 if normcorr '%,&, (, 4  > 0,6 0 otherwise 88 If pitch_present is 0, no more bits are encoded, resulting in a LTPF bitstream of only one bit. ETSI ETSI TS 103 634 V1.4.1 (...
64c5405618784b24a18fe0e72433f605
103 634
5.3.10.7 LTPF pitch-lag parameter
The integer part of the LTPF pitch-lag parameter is given by: pitch_int = argmax   …   3,  90 with: 3,  = βˆ‘ '1, _"'1, _" βˆ’ (, ), 9βˆ‘ '1.    (, ), βˆ‘ '1,    βˆ’ (, ),   = (  ,, βˆ’4) … ( ' ,, + 4) 91 and   ,, = max (32, 24  βˆ’4),  ' ...
64c5405618784b24a18fe0e72433f605
103 634
5.3.10.8 LTPF activation bit
A normalized correlation is first computed as follows: = βˆ‘ ' , 0'  βˆ’pitch_int, βˆ’pitch_fr (, ), 9βˆ‘ ' , 0 (, ), βˆ‘ '  βˆ’pitch_int, βˆ’pitch_fr (, ), 97 with: ' , = = '1, _" + β„Ž 4 βˆ’=   98 and β„Ž is the impulse response of a FIR low-pass filter given by: β„Ž ...
64c5405618784b24a18fe0e72433f605
103 634
5.3.11 Spectral quantization
64c5405618784b24a18fe0e72433f605
103 634
5.3.11.1 Overview
The MDCT spectrum after TNS filtering ((), see clause 5.3.9.4) is quantized using dead-zone plus uniform threshold scalar quantization and the quantized MDCT spectrum  is then encoded using arithmetic encoding. A global gain ?? controls the step size of the quantizer. This global gain is quantized with 8 bits a...
64c5405618784b24a18fe0e72433f605
103 634
5.3.11.2 Bit budget
The number of bits available for coding the spectrum is given by: # - = # βˆ’# 0 βˆ’#  βˆ’# # $ βˆ’#  βˆ’# 1  βˆ’#  βˆ’#  100 with # given in clause 5.2.5, # 0 given in clause 5.3.5, #  given in clause 5.3.9.3, # # $ given in clause 5.3.10.6, #  = 38, # 1  = 8, #...
64c5405618784b24a18fe0e72433f605
103 634
5.3.11.3 First global gain estimation
An offset is first computed using: # 3 = 0,8 βˆ™# 3 ( + 0,2 βˆ™min 40, max βˆ’40, # 3 ( + # - ( βˆ’# 3 ( , if  3 ( = 0 0 , otherwise 102 with # 3 ( is the value of # 3 in the previous frame, # - ( is the value of # - in the previous frame, ...
64c5405618784b24a18fe0e72433f605
103 634
5.3.11.4 Quantization
The quantized global gain index found in clause 5.3.11.3 is first unquantized using: = 10    108 The spectrum  is then quantized using:  = ⎩βŽͺ⎨ βŽͺ⎧  + 0,375 , if  β‰₯0  βˆ’0,375 , otherwise   = 0 …  βˆ’1 109
64c5405618784b24a18fe0e72433f605
103 634
5.3.11.5 Bit consumption
The number of bits  needed to encode the quantized MDCT spectrum  can be accurately estimated using the algorithm below. ETSI ETSI TS 103 634 V1.4.1 (2023-03) 50 Two bitrate flags are first computed using: if (nbits > (160 +   * 160)) { rateFlag = 512; } else { rateFlag = 0; } if (nbits >= (480 +   ...
64c5405618784b24a18fe0e72433f605
103 634
5.3.11.6 Truncation
The quantized spectrum is truncated such that the number of bits needed to encode it is within the available bit budget. for (k = lastnz_trunc; k < lastnz; k++) { [k] = 0; } with lastnz and lastnz_trunc given in clause 5.3.11.5. A flag which allows the truncation of the LSBs in the arithmetic encoding/decoding is obt...
64c5405618784b24a18fe0e72433f605
103 634
5.3.11.7 Global gain adjustment
The number of bits  (computed in clause 5.3.11.5) is compared with the available bit budget  (computed in clause 5.3.11.2). If they are far from each other (as defined by the conditions given below), then the quantized global gain index  is adjusted and the spectrum is requantized using clauses 5.3....
64c5405618784b24a18fe0e72433f605
103 634
5.3.12 Residual coding
Residual coding uses the remaining non-used bits to refine the non-zero quantized coefficients. It is performed only when lsbMode is 0. Firstly, the maximum number of bits available for residual coding is calculated using: nbits_residual_max =  -  + 4; Then, the residual bits are computed using: k = 0; ...
64c5405618784b24a18fe0e72433f605
103 634
5.3.13 Noise level estimation
64c5405618784b24a18fe0e72433f605
103 634
5.3.13.1 Overview
The noise level estimator controls the noise filling on decoder side. On encoder side, the noise level parameter is estimated, quantized and transmitted in the bit stream. ETSI ETSI TS 103 634 V1.4.1 (2023-03) 53
64c5405618784b24a18fe0e72433f605
103 634
5.3.13.2 Relevant spectral lines
The noise level is estimated based on the spectral coefficients which have been quantized to zero, i.e.  == 0. The indices for the relevant spectral coefficients are given by:  = 1 if   ≀ <   !  == 0  ""  =  βˆ’  … min _#,  +  _ !β„Ž 0 otherwise 110 where  _# depends on th...
64c5405618784b24a18fe0e72433f605
103 634
5.3.13.3 Noise level calculation
For the identified indices, the mean level of the missing coefficients is estimated based on the spectrum after TNS filtering ( (), see clause 5.3.9.4) and normalized by the global gain. If nbytes is larger than 20 or if the frame length is not 10 ms, the noise level is calculated as: *  = βˆ‘  βˆ™  βˆ‘  ...
64c5405618784b24a18fe0e72433f605
103 634
5.3.14 Bitstream encoding
64c5405618784b24a18fe0e72433f605
103 634
5.3.14.1 Overview
The bitstream of an encoded audio frame consists of the four parts: β€’ initial side information; β€’ a dynamic data block for which is arithmetically coded; β€’ a dynamic data block with signs and least significant bits of the encoded spectrum; β€’ residual data. An overview on the bitstream structure and layout is provided i...
64c5405618784b24a18fe0e72433f605
103 634
5.3.14.2 Initialization
bp = 0; bp_side = nbytes – 1; mask_side = 1; c = 0; nlsbs = 0; for (i = 0; f < nbytes; i++) { bytes[i] = 0; }
64c5405618784b24a18fe0e72433f605
103 634
5.3.14.3 Side information
/* Bandwidth */ if ( > 0) { write_uint_backward(bytes, &bp_side, &mask_side,  , ); } /* Last non-zero tuple */ write_uint_backward(bytes, &bp_side, &mask_side, (lastnz_trunc >> 1) - 1, ceil(log2(/2))); /* LSB mode bit */ write_bit_backward(bytes, &bp_side, &mask_side, lsbMode); /* Global Gain */ write...
64c5405618784b24a18fe0e72433f605
103 634
5.3.14.4 Arithmetic encoding
64c5405618784b24a18fe0e72433f605
103 634
5.3.14.4.1 Overview
The TNS data (if TNS is active) and the quantized spectral coefficients  are noiselessly encoded.  is encoded starting from the lowest-frequency coefficient, progressing to the highest-frequency coefficient. They are encoded by groups of two coefficients a and b resulting in a so-called 2-tuple {a, b}. Each frequency...
64c5405618784b24a18fe0e72433f605
103 634
5.3.14.4.2 Pseudo code implementation
/* Arithmetic Encoder Initialization */ ac_enc_init(&st); /* TNS data */ for (f = 0; f < num_tns_filters; f++) { if (    > 0) { ac_encode(bytes, &bp, &st, ac_tns_order_cumfreq[tns_lpc_weighting][   -1], ac_tns_order_freq[tns_lpc_weighting][   -1]); for (k = 0; k <   ; k++) { ac_encode(bytes, &bp...
64c5405618784b24a18fe0e72433f605
103 634
5.3.14.5 Residual data and finalization
/* Residual bits */ nbits_side = nbits – (8 * bp_side + 8 – log2(mask_side)); nbits_ari = bp * 8; nbits_ari += 25 – floor(log2(st->range)); if (st->cache >= 0) { nbits_ari += 8; } if (st->carry_count > 0) { nbits_ari += st->carry_count * 8; } nbits_residual_enc = nbits – (nbits_side + nbits_ari); if (lsbMode == 0) { nb...
64c5405618784b24a18fe0e72433f605
103 634
5.3.14.6 Functions
write_bit_backward(bytes[], *bp, *mask, bit) { if (bit == 0) { bytes[*bp] &= ~*mask; } else { bytes[*bp] |= *mask; } if (*mask == 0x80) { *mask = 1; *bp -= 1; } else { *mask <<= 1; } } ETSI ETSI TS 103 634 V1.4.1 (2023-03) 58 write_uint_backward(bytes[], *bp, *mask, val, numbits) { for (k = 0; k < numbits; k++) { bit =...
64c5405618784b24a18fe0e72433f605
103 634
5.3.15 Encoding of Low Frequency Effects (LFE)
For the optimal support of a Low Frequency Effects (LFE) channel, the following encoder modules should be modified as follows: β€’ Bandwidth detector is deactivated and the bandwidth index 0% is set to 0 (narrow band) (see clause 5.3.5). β€’ TNS is deactivated by setting 10 = 0, num_tns_filters = 1, & ' = 1 ...
64c5405618784b24a18fe0e72433f605
103 634
5.4 Decoding process
64c5405618784b24a18fe0e72433f605
103 634
5.4.1 Decoder modules
A high-level overview of all decoder modules is given in Figure 5.9. The decoder is reversing the encoding process and essentially transforms the spectral coefficients into a time domain signal. First the transmitted parameters are decoded and the spectral coefficients are restored. The Noise Filling module inserts noi...
64c5405618784b24a18fe0e72433f605
103 634
5.4.2 Bitstream decoding
64c5405618784b24a18fe0e72433f605
103 634
5.4.2.1 Overview
The bitstream of a coded audio frame consists of the four parts: β€’ side information; β€’ a dynamic data block for which is arithmetically coded; β€’ a dynamic data block with signs and least significant bits of the encoded spectrum; β€’ residual data. An overview of the bitstream structure and layout is provided in clause 5....
64c5405618784b24a18fe0e72433f605
103 634
5.4.2.2 Initialization
bp = 0; bp_side = nbytes – 1; mask_side = 1; c = 0; BEC_detect = 0; Bitstream Multiplex Inv. LD- MDCT Output Signal SNS Dec Global Gain Arithm. Decode & Residual Noise filling LTPF TNS Dec Restored Spectrum BW info Signal path Data path Control path ETSI ETSI TS 103 634 V1.4.1 (2023-03) 61
64c5405618784b24a18fe0e72433f605
103 634
5.4.2.3 Side information
/* Bandwidth */ if ( > 0) {  = read_uint(bytes, &bp_side, &mask_side, ); if (   <  ) { BEC_detect = 1; } } else {  = 0; } /* Last non-zero tuple */ nbits_lastnz = ceil(log2(/2)); tmp_lastnz = read_uint(bytes, &bp_side, &mask_side, nbits_lastnz); lastnz = (tmp_lastnz + 1) << 1; if (lastnz > )...
64c5405618784b24a18fe0e72433f605
103 634
5.4.2.4 Special decoder mode indicators
The indicated modes in this clause may be set by an external application layers to trigger a specific behaviour of the decoder, e.g. the decoder shall apply packet loss concealment due to a broken payload. ETSI ETSI TS 103 634 V1.4.1 (2023-03) 62 For that, the bit stream element tmp_lastnz (see clause 5.4.2.3) is used ...
64c5405618784b24a18fe0e72433f605
103 634
5.4.2.5 Padding pattern
For specific transports scenarios a padding might be required to reach a certain frame size. At decoder side this pattern needs to be removed before the side information can be interpreted. In case the special mode PADDING is detected, the decoder shall read the remaining bits to complete the first two bytes of the sid...
64c5405618784b24a18fe0e72433f605
103 634
5.4.2.6 Bandwidth interpretation
Depending on the transmitted parameter  (see clause 5.4.2.3) and the sample frequency , the bandwidth information can be interpreted as outlined in Table 5.21. ETSI ETSI TS 103 634 V1.4.1 (2023-03) 63 Table 5.21: Mapping  to bandwidth  (Hz)   Bandwidth ( ) 8 000 0 {NB} 16 000 1 {NB, WB} 24 000 2 {NB,...
64c5405618784b24a18fe0e72433f605
103 634
5.4.2.7 Arithmetic decoding
/* Arithmetic Decoder Initialization */ ac_dec_init(bytes, &bp, &st); /* TNS data */ maxTnsOrder = 8; if  <= 5 { maxTnsOrder = maxTnsOrder >> 1 } for (f = 0; f < num_tns_filters; f++) { if ( > 0) {  = ac_decode(bytes, &bp, &st, ac_tns_order_cumfreq[tns_lpc_weighting], ac_tns_order_freq[tns_lpc_we...
64c5405618784b24a18fe0e72433f605
103 634
5.4.2.8 Residual data and finalization
for (k = lastnz; k < ; k++) {  [k] = 0; } /* Number of residual bits */ nbits_side = nbits – (8 * bp_side + 8 – log2(mask_side)); nbits_ari = (bp – 3) * 8; nbits_ari += 25 – floor(log2(st->range)); nbits_residual = nbits – (nbits_side + nbits_ari); if (nbits_residual < 0) { BEC_detect = 1; } /* Decode residual bits ...
64c5405618784b24a18fe0e72433f605
103 634
5.4.2.9 Functions
read_bit(bytes[], *bp, *mask) { if (bytes[*bp] & *mask) { bit = 1; } else { bit = 0; } if (*mask == 0x80) { *mask = 1; *bp -= 1; } else { *mask <<= 1; } return bit; } read_uint(bytes[], *bp, *mask, numbits) { value = read_bit(bytes, bp, mask); for (i = 1; i < numbits; i++) { bit = read_bit(bytes, bp, mask); value += bi...
64c5405618784b24a18fe0e72433f605
103 634
5.4.3 Residual decoding
Residual decoding is performed only when lsbMode is 0. k = = n = 0; while (k <  && n < nResBits) { if ( [k] != 0) { if (resBits[n++] == 0) { if ( [k] > 0) {  [k] -= 0.1875; } else {  [k] -= 0.3125; } } else { if ( [k] > 0) {  [k] += 0.3125; } else {  [k] += 0.1875; } } } k++; }
64c5405618784b24a18fe0e72433f605
103 634
5.4.4 Noise filling
Noise filling is performed only when zeroFrame is 0. The indices for the relevant spectral coefficients are given by:   = 1 if _  ≀ < _     == 0    =  βˆ’ _ β„Ž. . min_ ,  + _ β„Ž 0 otherwise 113 where _  depends on the bandwidth information (see clause 5.4.2.4) as defined in Tabl...
64c5405618784b24a18fe0e72433f605
103 634
5.4.5 Global gain
The global gain is applied to the spectrum after the noise filling has been applied using formula (114):   =   βˆ™10       = 0 …  βˆ’1 114 where  is the global gain index retrieved in the side information described in clause 5.4.2.3, and  = βˆ’min 115, !  10 βˆ™( + 1)"# βˆ’105 βˆ’5 βˆ™(  +...
64c5405618784b24a18fe0e72433f605
103 634
5.4.6 TNS decoder
The quantized reflection coefficients are obtained for each TNS filter  using: $ ,  = nint%2 βˆ™sin%Ξ”$,  βˆ’8&& 2  = 0 … 7 116 with $,  are the quantizer output indices. The TNS parameters depend on the transmitted bandwidth information (see clause 5.4.2.4) as shown in Table 5.24. Table 5.24: TNS...
64c5405618784b24a18fe0e72433f605
103 634
5.4.7 SNS decoder
64c5405618784b24a18fe0e72433f605
103 634
5.4.7.1 Overview
The SNS decoder performs the following three steps. A set of 16 quantized scale factors is first decoded as described in clause 5.4.7.2. Note that these quantized scale factors are the same as the quantized scale factors as determined by the encoder (see clause 5.3.7.3). Similarly to the encoder (see clauses 5.3.7.4 an...
64c5405618784b24a18fe0e72433f605
103 634
5.4.7.2 SNS scale factor decoding
64c5405618784b24a18fe0e72433f605
103 634
5.4.7.2.1 SNS VQ decoding
Figure 5.10 provides an overview of the SNS scale factor decoding. Figure 5.10: High level overview of Decoder SNS scale factor synthesis
64c5405618784b24a18fe0e72433f605
103 634
5.4.7.2.2 Stage 1 SNS VQ decoding
The first stage parameters are decoded as follows: ind_LF = read_uint(bytes, &bp_side, &mask_side, 5); /* stage1 LF */ ind_HF = read_uint(bytes, &bp_side, &mask_side, 5); /* stage1 HF */ The first stage indices ind_LF and ind_HF are converted into signal st1(n) according to equations 36 and (37) in clause 5.3.7.3.2. ...
64c5405618784b24a18fe0e72433f605
103 634
5.4.7.2.3 Stage 2 SNS VQ decoding
5.4.7.2.3.1 Stage 2 SNS-VQ index demultiplexing To efficiently use the available total bit space for the scale factor quantizer (38 bits), in combination with the fractional sized MPVQ-indices, the shape selection LSB, the second stage shape codewords and the adjustment gain least significant bit were jointly encoded a...
64c5405618784b24a18fe0e72433f605
103 634
5.4.7.2.4 Unit energy normalization of the received shape
The de-enumerated signed integer vector y shape_j is normalized to a unit energy vector xq, shape_j over dimension 16 according to equation (41).
64c5405618784b24a18fe0e72433f605
103 634
5.4.7.2.5 Reconstruction of the Quantized SNS Scalefactors
The adjustment gain value _ ,_ for gain index gain_i and shape index shape_j is determined based on table lookup (see clause 5.3.7.3.3.6, Table 5.11). Finally, the synthesis of the quantized scale factor vector scfQ(n) is performed in the same way as on the encoder side, see clause 5.3.7.3.5.
64c5405618784b24a18fe0e72433f605
103 634
5.4.7.3 SNS scale factors interpolation
The quantized scale factors  (obtained in clause 5.4.7.2) are interpolated using:   0 = 0   1 = 0   4 + 2 =  + 1 8  + 1 βˆ’    = 0 … 14   4 + 3 =  + 3 8  + 1 βˆ’    = 0 … 14   4 + 4 =  + 5 8  + 1 βˆ’ ...
64c5405618784b24a18fe0e72433f605
103 634
5.4.7.4 Spectral Shaping
The SNS scale factors   are applied on the TNS filtered MDCT frequency lines for each band separately in order to generate the shaped spectrum () as outlined by the following code: for (b=0; b< ; b++) { for (k= ( ); k< ( + 1); k++) { () =  βˆ™    } }
64c5405618784b24a18fe0e72433f605
103 634
5.4.8 Low delay MDCT synthesis
The reconstructed spectrum () is transformed to the time domain by the following steps: 1) Generation of time domain aliasing buffer Μ‚ Μ‚ =  2   () cos     + 1 2 +  2   + 1 2      = 0 … 2 βˆ’1 119 2) Windowing of time-aliased buffer Μ‚ = 2 βˆ’1 βˆ’ βˆ™ Μ‚    = 0 … 2 βˆ’1 ...
64c5405618784b24a18fe0e72433f605
103 634
5.4.9 Long term postfilter
64c5405618784b24a18fe0e72433f605
103 634
5.4.9.1 Overview
The decoded signal after MDCT synthesis is postfiltered in the time-domain using an IIR filter whose parameters depend on the LTPF bitstream data "pitch_index" and "ltpf_active". As the filter coefficients are a pre-defined set, the result of the IIR filter is always stable. To avoid any discontinuity when the paramete...
64c5405618784b24a18fe0e72433f605
103 634
5.4.9.2 Transition handling
The transition corresponds to the first 2,5 ms of the current frame (  0 … βˆ™   1). Note that mem_ ltpf_active corresponds to the value of ltpf_active in the previous frame (it is initialized to zero before the first frame is processed),  is the filter input signal (i.e. the decoded signal after MDCT s...
64c5405618784b24a18fe0e72433f605
103 634
5.4.9.3 Remaining of the frame
The remainder of the frame corresponds to the remaining samples of the current frame ( = βˆ™  …  βˆ’1). Two different cases are considered: 1) First case: ltpf_active = 0   =  130 2) Second case: ltpf_active = 1   ←  βˆ’   βˆ’   +   ,      βˆ’ +   2 βˆ’   ...
64c5405618784b24a18fe0e72433f605
103 634
5.4.10 Output signal scaling and rounding
The LTPF output signal   for all samples with index  ∈[0,  βˆ’1] is clipped to upper integer value range:   = 2 βˆ’1,   > 2 βˆ’1 βˆ’2 ,   < βˆ’2  , β„Ž  143 Afterwards, the signal   is scaled to the proper range using:   =  (  βˆ™ 2  ) 144 The output si...
64c5405618784b24a18fe0e72433f605
103 634
5.5 Frame structure
The frame structure of the codec consists of four parts, i.e.: β€’ Side information containing static bits about the configuration of the frame data. This data block starts at the end of the frame and is read backwards. It includes information audio bandwidth, global gain, noise level, TNS activity, LTPF, SNS data, the i...
64c5405618784b24a18fe0e72433f605
103 634
5.6 Error concealment
64c5405618784b24a18fe0e72433f605
103 634
5.6.1 General consideration
The purpose of the Packet Loss Concealment (PLC) is to conceal the effect of unavailable or corrupted frame data for decoding. The overall composite PLC algorithm is described in clause 5.6.3 and when this composite algorithm shall be applied for the LC3, is described in clause 5.6.2. The frame loss concealment procedu...
64c5405618784b24a18fe0e72433f605
103 634
5.6.2 PLC trigger
The decoder shall apply a packet loss concealment algorithm for the following three events: a) The decoder receives an externally determined Bad Frame Indicator (BFI=1) flag signalling a lost frame or the presence of any detected bit error in the received compressed frame to the decoder. b) The special decoder mode for...
64c5405618784b24a18fe0e72433f605
103 634
5.6.3 PLC method selection and method application
64c5405618784b24a18fe0e72433f605
103 634
5.6.3.1 Method selection
The selection of the PLC method is performed only in the first lost frame after a good frame and remains unchanged in subsequently lost frames. The criteria for the method selection are: β€’ Pitch value :  =  0, pitch_present = 0 pitch_int, pitch_present = 1 145 where pitch_present and pitch_int are the LTPF param...
64c5405618784b24a18fe0e72433f605
103 634
5.6.3.2 MDCT frame repetition with sign scrambling
The intermediate spectrum of the concealed frame #β€²$ () is derived by sign scrambling of the last received shaped spectrum #%#$ () of clause 5.4.8: for k=0..  βˆ’1 plc_seed = (16831 + plc_seed*12821) & 0xFFFF; if plc_seed < 0 if pitch_present == 0 || plc_seed < randThreshold β€² () = βˆ’  ; else β€² () =  ...
64c5405618784b24a18fe0e72433f605
103 634
5.6.3.3 Time domain concealment
64c5405618784b24a18fe0e72433f605
103 634
5.6.3.3.1 Overview
The time domain concealment method is a pitch-based PLC technique operating in the time domain. It is best suited for signals with a dominant harmonic structure. The general description of the algorithm is as follow: the synthesized signal of the last decoded frames is inverse filtered with the Linear Prediction (LP) f...
64c5405618784b24a18fe0e72433f605
103 634
5.6.3.3.2 LPC parameter calculation
The time domain concealment method is operating in the excitation domain of the time domain, therefore an LP filter is calculated in the first lost frame after a good frame and remains for the subsequently lost frames. The order of the LP filter is: . =  8,   = 8 000  " = 2,5 16, " 165 The autocorrelation fu...
64c5405618784b24a18fe0e72433f605
103 634
5.6.3.3.3 Construction of the periodic part of the excitation
5.6.3.3.3.1 Processing in the first lost frame The last  +  +  decoded time samples are first pre-emphasized with the pre-emphasis factor from Table 5.26 using the filter:    = 1 βˆ’ 171 to obtain the signal ,  = 0 …  +  +  , where  is the pitch-lag value pitch_int or pitch_int + 1 if pitc...
64c5405618784b24a18fe0e72433f605
103 634
5.6.3.3.4 Construction of the random part of the excitation
The random part of the excitation is generated with a simple random generator with approximately uniform distribution as follows: ,() = (16 831 + , βˆ’1 βˆ™12 821) & 0xFFFF,   = 0 …  + 10 180 where ,βˆ’1 is initialized with 24 607 for the very first frame concealed with this method. For further ...
64c5405618784b24a18fe0e72433f605
103 634
5.6.3.3.5 Construction of the total excitation, synthesis and post-processing
The random excitation,  %  , is added to the periodic excitation,   %  , to form the total excitation signal    . The synthesized signal .β„Ž  for the concealed frame is obtained by filtering the total excitation with the LP filter, /  , from clause 5.6.3.3.2 and post-processed with the de-emphasis filt...
64c5405618784b24a18fe0e72433f605
103 634
5.6.3.3.6 Time domain alias cancelation
To get a proper overlap add in the case the next frame is a good frame, the time domain alias cancelation part   has to be generated. For that,  βˆ’0 additional samples are created the same way as described above to obtain the signal   *  = 0 … 2 βˆ’0. On that, the time domain alias cancelation part is create...
64c5405618784b24a18fe0e72433f605
103 634
5.6.3.3.7 Handling of multiple frame losses
In general, the constructed signal fades out towards zero for multiple frame losses. The fade out speed is controlled by an attenuation factor  which is dependent on the previous attenuation factor  , the gain of pitch  calculated on the last correctly received frame and updated in every consecutive frame loss, th...