I am studying about scalar vs vector quantization, and I have an assignment to implement (in MATLAB) a scalar quantizer , using the Lloyd-Max algorithm, and a vector quantizer via k-means clustering.
The vector quantizer works in the R2 vector space, so its input is a tuple of samples (input vector) and its output is also a two dimensional vector, corresponding to the centroid vector of the quantization region.
I am told that in order for the comparisons between the two quantizers to be accurate, I need to keep the number of bits per sample, constant. For example, in a n-bit scalar quantizer, there are 2n quantization regions, in one of which, a sample will get quantized into.
The equivalent vector quantizer, will have 2n bits per input tuple, so that each sample is still represented by n bits. So, with that logic, I think that the vector quantizer should have 22n quantization/Voronoi regions.
I have to quantize an equal number of samples from a Gaussian source (source A), and from an AR(5) Random process (source B). From what I've studied, I think that the scalar quantizer is expected to perform a better quantization of source A (in the MSE-sense) and the vector quantizer should perform better in the AR process (source B), where the samples are correlated with each other.
However, when I quantize both of the forementioned sources, and compute the MSE between the original and the quantized signal, the vector quantizer gives a smaller MSE for both sources. So the vector quantizer, is more efficient (in the MSE-sense) for both the sources, which I think is wrong, as it should be more efficient only for the Autoregressive Random process and not for the Gaussian source, as well.
(I calculate the MSE as :mse(input_signal - quantized_signal)
, so there's nothing wrong there.)
So my questions are:
- Should (theoretically) the vector quantizer be more efficient in quantizing both the sources or only in the case of the AR process?
- The vector quantizer equivalent of a n-bit scalar quantizer, should have 2n or 22n quantization/Voronoi regions (second argument/cluster number of kmeans() ).
If needed I will post the MATLAB code, as well.
Any help will be greatly appreciated, as I am stuck on this for some days.
Thanks in advance .