Uniform Mid-Rise Quantizer (8 Levels, Range [-8, +8])
Your function implements a uniform mid-rise quantizer over:
\[ V_{\min} = -8, \quad V_{\max} = 8 \]
with:
\[ L = 8 \text{ total quantization levels} \]
Step Size (Resolution)
\[ \Delta = \frac{V_{\max} - V_{\min}}{L} \]
Substitute values:
\[ \Delta = \frac{16}{8} = 2 \]
Each quantization interval has width 2.
Decision Boundaries (Partitions)
\[ P_i = V_{\min} + i\Delta \]
For \( L = 8 \):
\[ [-8, -6, -4, -2, 0, 2, 4, 6, 8] \]
Representation Levels (Midpoints)
\[ C_i = V_{\min} + (i + 0.5)\Delta \]
The 8 quantized output levels:
\[ [-7, -5, -3, -1, 1, 3, 5, 7] \]
- 4 negative levels
- 4 positive levels
- No level exactly at 0 → mid-rise quantizer
Quantization Rule
Step 1 — Compute interval index
\[ k = \left\lfloor \frac{x - V_{\min}}{\Delta} \right\rfloor \]
Step 2 — Compute quantized value
\[ Q(x) = V_{\min} + (k + 0.5)\Delta \]
Step 3 — Clip to valid range
\[ Q(x) \in [-7, 7] \]
Full Numerical Example
signal = [-7.2, -3.1, -0.5, 1.3, 5.9] L = 8 Î = 2
Intervals and Levels
| Interval | Output |
|---|---|
| [-8, -6) | -7 |
| [-6, -4) | -5 |
| [-4, -2) | -3 |
| [-2, 0) | -1 |
| [0, 2) | 1 |
| [2, 4) | 3 |
| [4, 6) | 5 |
| [6, 8] | 7 |
Final Quantized Signal
\[ [-7, -3, -1, 1, 5] \]
Quantization Error
\[ e = x - Q(x) \]
Maximum possible error:
\[ |e_{max}| = \frac{\Delta}{2} \]
Since \( \Delta = 2 \):
\[ |e_{max}| = 1 \]
Error is bounded by ±1.
Compact Mathematical Form
\[ Q(x) = \Delta \left( \left\lfloor \frac{x - V_{\min}}{\Delta} \right\rfloor + \frac{1}{2} \right) + V_{\min} \]
With clipping:
\[ Q(x) = \text{clip}(Q(x), -7, 7) \]
Relation to Bits
\[ L = 8 \]
\[ 8 = 2^3 \]
This is a 3-bit uniform quantizer.