Quantization

Keywords: quantize compress expand compand

Theory of Operations

doc/quantization/quantization_psd.png

Figure [fig-quantization-psd]. Quantization power spectral density

doc/quantization/quantization_adc.png

Figure [fig-quantization-adc]. Quantization analog-to-digital conversion.

doc/quantization/quantization_compander.png

Figure [fig-quantization-compander]. Quantization compression/expansion (compand)

#include <liquid/liquid.h>

int main() {
    unsigned int num_bits    =      4;
    float        mu          = 255.0f;
    unsigned int num_samples =     64;

    // input sample
    float x = 0.7f;

    // compress sample
    float v = compress_mulaw(x,mu);

    // quantize: analog to digital converter
    unsigned int q = quantize_adc(v,num_bits);

    // quantize: digital to analog converter
    float u = quantize_dac(q,num_bits);

    // expand sample
    float y = expand_mulaw(u,mu);

    // compute error
    float e = y - x;

    return 0;
}