Programming assignment 4 - MP3 encoder - Quantization: Instructions Help Center

In this final programming assignment, you will implement the uniform quantization step for the subband samples.

Start by downloading the assignment file available here and place it in the assignments folder (please review the general instructions page if this confuses you). This is the only file you should modify to perform this assignment.

The function you must write will have the following interface:

Input :

  • s, the sample to quantize
  • S_f, the scaling factor (scalar)
  • R, the number of bits for the sample
  • Q_{a}, Q_b, the quantization parameters

Output :
  • q, uniformly quantized output


The function must implement the following quantization formula: q = \mbox{floor}\left[ \left(Q_a \frac{s}{S_f} + Q_b\right) 2^{R-1} \right]