Scale factor explaination 
Scale factor explaination 
Jul 8 2011, 18:15
Post
#1


Group: Members Posts: 57 Joined: 19January 11 Member No.: 87451 
Hi,
Can anybody explain me the concept of scale factors in AAC? I mean how the scale factors are determined for spectral values? Also in the distortion control loop how incrementing the scale factors and then scaling with it reduces distortion? Please explain.. 


Jul 8 2011, 19:51
Post
#2


Winamp Developer Group: Developer Posts: 670 Joined: 17July 05 From: Brooklyn, NY Member No.: 23375 
scale factors are basically the MDCT coefficients, with some math involved to quantize the values to reduce entropy. The amount of quantization necessary for each band/scalefactor (and therefore the amount of precision it will have) is determined as part of your psychoacoustic algorithm.



Jul 9 2011, 12:13
Post
#3


Group: Members Posts: 145 Joined: 3April 09 Member No.: 68627 
I think benski's answer is not very clear. I'll try to explain a little further.
The scale factors are just what they're called  the scale factors. The resolution is controlled by scaling. Assume we have a set of real numbers from the range of [0, 1]. If we quantize them to, say, 10bit integer with a uniform quantizer we'll obtain a corresponding set of integer numbers in range [0, 1023]. If, however, we scale the initial set by factor of 0.5 prior to quantization, the resulting integers will fit into [0, 511], occupying not more than 9 bits. Every multiplication by 0.5 effectively shaves off a single bit from the result, at the cost of increased error in reconstruction of the original set. Now what exactly is called a "scale factor" may differ from implementation to implementation. In the above example we could say that the scale factor is 0.5, or we could say that it's 511, or we could call the exponent log2(0.5) = 1 a scale factor, or we could define the scale factor as reciprocal value (1/0.5) etc. Also in actual audio compression algorithms the quantization is nonuniform, and the scale factors are not necessarily restricted to integer powers of two. But the principle is still the same. As for the particular scale factor values, as benski said, they are assigned by the encoder according to psychoacoustic model that determines the allowed amount of error in each spectrum band depending on the computed masking thresholds. 


Jul 12 2011, 07:52
Post
#4


Group: Members Posts: 57 Joined: 19January 11 Member No.: 87451 
Thanks to both of you for this useful information..



Jul 12 2011, 08:01
Post
#5


Group: Members Posts: 57 Joined: 19January 11 Member No.: 87451 
Hi,
But can you explain me how every multiplication with 0.5 increases error? because to the decoder we are passing that scale factor as side info and it multiplies it with the inverse quantized spectral coefficients..So where does the error come from?Please explain... Thank you 


Jul 12 2011, 09:21
Post
#6


Group: Developer Posts: 723 Joined: 6December 08 From: Erlangen Germany Member No.: 64012 
The increased error happens in the quantization (i.e. rounding) of the prescaled MDCT coefficients. Example:
Encoder Input MDCT coefficients: [3, 1, 4, 1, 5, 9, 2, 6, 5] Divide by scale factor sf1 = 2: [1.5, 0.5, 2, 0.5, 2.5, 4.5, 1, 3, 2.5] (AAC: apply a power law on the MDCT coefficients here) Quantize coefficients by e.g. truncating to integer: [1, 0, 2, 0, 2, 4, 1, 3, 2] Decoder (AAC: apply inverse power law on the quantized coefficients here) Multiply by scale factor sf1 = 2: [2, 0, 4, 0, 4, 8, 2, 6, 4] What you get is the dequantized (or inverse quantized) MDCT spectrum. Notice that it has only 5 different values, whereas the original MDCT had 7 different values. If you would use a scale factor sf2 = 4 = sf1 / 0.5, the quantization would lead to only 3 different values => sf2 leads to more distortion (error) than sf1. Chris This post has been edited by C.R.Helmrich: Jul 12 2011, 09:27  If I don't reply to your reply, it means I agree with you.



Jul 12 2011, 09:45
Post
#7


Group: Members Posts: 57 Joined: 19January 11 Member No.: 87451 
Thanks chris, it was really a good explaination...



Mar 31 2015, 08:08
Post
#8


Group: Members Posts: 11 Joined: 5February 15 Member No.: 118556 
Are spectral coefficients and scalefactor bands same? I'm confused with the scalefactor bands.
Which ones are acutally huffman coded into bitstream? Thank you. 


Mar 31 2015, 10:40
Post
#9


Group: Members Posts: 145 Joined: 3April 09 Member No.: 68627 
Are spectral coefficients and scalefactor bands same? I'm confused with the scalefactor bands. With AAC you have a block of 1024 audio samples, which are transformed to frequency domain; hence you obtain 1024 frequency components (let's forget about overlapping and short blocks for now). These frequency components are then grouped into 49 bands, approximately corresponding to the human auditory system's critical bands. Each of these bands is then assigned its own scale factor. So, every scale factor band contains multiple frequency components (coefficients), but all components within a band are quantized with the same scale factor. QUOTE Which ones are acutally huffman coded into bitstream? The quantized spectral coefficients are being Huffmancoded and packed into a frame, along with the scale factors. 


Mar 31 2015, 12:59
Post
#10


Group: Members Posts: 11 Joined: 5February 15 Member No.: 118556 
Are spectral coefficients and scalefactor bands same? I'm confused with the scalefactor bands. With AAC you have a block of 1024 audio samples, which are transformed to frequency domain; hence you obtain 1024 frequency components (let's forget about overlapping and short blocks for now). These frequency components are then grouped into 49 bands, approximately corresponding to the human auditory system's critical bands. Each of these bands is then assigned its own scale factor. So, every scale factor band contains multiple frequency components (coefficients), but all components within a band are quantized with the same scale factor. QUOTE Which ones are acutally huffman coded into bitstream? The quantized spectral coefficients are being Huffmancoded and packed into a frame, along with the scale factors. Thank you very much, alexeysp. 


May 6 2015, 08:31
Post
#11


Group: Members Posts: 11 Joined: 5February 15 Member No.: 118556 
What is the difference between lines and scale factor bands in AAC? I don't understand lines in FDK AAC library. Please help me explain it. Thank you.



LoFi Version  Time is now: 1st December 2015  21:57 