## Topic: Global gain, scale factors, signal, quantization (Read 3573 times)previous topic - next topic

0 Members and 1 Guest are viewing this topic.
• Gabriel
• Developer
Global gain, scale factors, signal, quantization
##### 26 August, 2003, 06:01:47 AM
This could belong to both mp3 and aac forums, so I am asking here.

My question is about how to quantize (and dequantize) the signal. I have some doubts regarding how factors are interacting with each others.

*global gain and scalefactors:
How is the scaling done?
Is the scaling done by (global gain * scalefactor) or by (global gain - scalefactor)?

*scaling:
What is scaled, signal or quantizer step size?

• Ivan Dimkovic
• Developer
Global gain, scale factors, signal, quantization
##### Reply #1 – 26 August, 2003, 06:40:47 AM
Quote
*global gain and scalefactors:
How is the scaling done?
Is the scaling done by (global gain * scalefactor) or by (global gain - scalefactor)?

It should be:

actual_local_sf = global_gain - stored_local_sf;

Where - actual local sf would be an actual scaling factor for the particual band, and stored_local_sf would be a value stored in the encoded bitstream.

Quote
*scaling:
What is scaled, signal or quantizer step size?

During encoding, MDCT floating-point signal is scaled according to the quantizer step size, and the scaled representation is quantized (converted to integer domain).

• Gabriel
• Developer
Global gain, scale factors, signal, quantization
##### Reply #2 – 26 August, 2003, 06:56:12 AM
I think that I am still missing a part:

let's call ix the mdct output signal (floating point), do we quantize:
actual_local_sf * ix  ? (of course actual_local_sf is varying between sf bands)

• Ivan Dimkovic
• Developer
Global gain, scale factors, signal, quantization
##### Reply #3 – 26 August, 2003, 08:17:59 AM
Quote
I think that I am still missing a part:

let's call ix the mdct output signal (floating point), do we quantize:
actual_local_sf * ix  ? (of course actual_local_sf is varying between sf bands)

do for every frequency coef w:
QuantSignal[w] = NINT( pow( ix[w] / actual_local_sf, 0.75 ) - 0.0946 )

Where:

int QuantSignal[w]  --> integerized, quantized value of spectrum
float ix[w] --> input MDCT signal, floating point
actual_local_sf --> global_gain - scale_factor[sfb]

• Gabriel
• Developer
Global gain, scale factors, signal, quantization
##### Reply #4 – 26 August, 2003, 08:31:46 AM
Thank you very much for those clarifications Ivan.

• Ivan Dimkovic
• Developer
Global gain, scale factors, signal, quantization
##### Reply #5 – 26 August, 2003, 09:07:53 AM
Quote
QuantSignal[w] = NINT( pow( ix[w] / actual_local_sf, 0.75 ) - 0.0946 )

Ah, yes - I forgot

So, it can be seen that if you increase scale_factor[sb],  the actual_local_sf value will be decreased (actual_local_sf = global_gain - scale_factor[sb]), and the quantized signal will be amplified - and therefore closer to the original MDCT signal.

That's why in the loop iteration process, the distorted bands get amplified and re-checked for distortion.

• Gabriel
• Developer
Global gain, scale factors, signal, quantization
##### Reply #6 – 26 August, 2003, 09:47:32 AM
Language is strange sometimes.
It seems to me that by increasing the scale_factor (so decreasing the global scale value) the signal is not really amplified but less devided.
Overall it is equivalent, but still strange.

(I was asking those clarifications because I was wondering about the sfb21 strangeness)

• Ivan Dimkovic
• Developer
Global gain, scale factors, signal, quantization
##### Reply #7 – 26 August, 2003, 10:04:52 AM
Quote
It seems to me that by increasing the scale_factor (so decreasing the global scale value) the signal is not really amplified but less devided.
Overall it is equivalent, but still strange.

Well, it is a power-law quantizer,  in reality it is really an amplification - and in the same time the deviation gets smaller