mimungr
28th January 2005, 08:48
Let me begin by briefly summarizing my understanding of quantization.
There are two 8x8 quantization matrices (QMs), one used for predicted blocks and the other for non-predicted. The DC element of the QM is fixed at 8 for non-predicted blocks and 16 for predicted blocks. All other elements are greater than or equal to the DC element. There is also a scalar quantization parameter (QP), which is either statically configured by the user or dynamically selected by the rate control mechanism of the encoder. Each DCT coefficient is quantized by dividing it by the product of the QP and the corresponding element from the QM and then rounding to the nearest integer. In other words, if Y is the matrix of luma DCT coefficients,
Yout[i][j] = floor((Yin[i][j] / (QM[i][j] * QP)) + 0.5)
For chroma, there is only a 4x4 matrix of DCT coefficients. The same QM is used, but only the even rows and columns:
Uout[i][j] = floor((Uin[i][j] / (QM[i*2][j*2] * QP)) + 0.5)
Is this correct? I’m trying to be precise, so if I’ve made even a minor error, please correct me.
I don’t understand how the minimum quantizer can be 8. It’s widely considered that a QP of 2 yields excellent quality. However, given that YV12 uses 8 bits for each YUV value, if we quantize with 8 * 2, we’re throwing away half the bits. I realize that it’s difficult to conceptualize how changes in the frequency domain translate to the spatial domain, but consider the degenerate case of a uniform block. In this case, the DC element is the same as all the spatial elements. If we throw away the low order 4 bits, we’re left with just 2^4 = 16 grey scales. This just can’t be. What am I missing?
Is QP constant for a frame? The concept of adaptive quantization implies it isn’t, yet the status window of Xvid shows a histogram plotting the number of frames at each QP, which implies it is a property of the frame.
Are there any inexpensive sources for technical information about MPEG-4? My initial inclination to answer the above was to read the spec rather than wasting your time, but ANSI charges $300 just for part 2, and at the current exchange rate, ISO wants even more. I’m not trying to write my own encoder or anything like that, but I do like to understand the technology I’m working with. Clearly, many of the posters to these fora have a detailed understanding of MPEG-4; where did you get that information?
Thank you so much for any help.
There are two 8x8 quantization matrices (QMs), one used for predicted blocks and the other for non-predicted. The DC element of the QM is fixed at 8 for non-predicted blocks and 16 for predicted blocks. All other elements are greater than or equal to the DC element. There is also a scalar quantization parameter (QP), which is either statically configured by the user or dynamically selected by the rate control mechanism of the encoder. Each DCT coefficient is quantized by dividing it by the product of the QP and the corresponding element from the QM and then rounding to the nearest integer. In other words, if Y is the matrix of luma DCT coefficients,
Yout[i][j] = floor((Yin[i][j] / (QM[i][j] * QP)) + 0.5)
For chroma, there is only a 4x4 matrix of DCT coefficients. The same QM is used, but only the even rows and columns:
Uout[i][j] = floor((Uin[i][j] / (QM[i*2][j*2] * QP)) + 0.5)
Is this correct? I’m trying to be precise, so if I’ve made even a minor error, please correct me.
I don’t understand how the minimum quantizer can be 8. It’s widely considered that a QP of 2 yields excellent quality. However, given that YV12 uses 8 bits for each YUV value, if we quantize with 8 * 2, we’re throwing away half the bits. I realize that it’s difficult to conceptualize how changes in the frequency domain translate to the spatial domain, but consider the degenerate case of a uniform block. In this case, the DC element is the same as all the spatial elements. If we throw away the low order 4 bits, we’re left with just 2^4 = 16 grey scales. This just can’t be. What am I missing?
Is QP constant for a frame? The concept of adaptive quantization implies it isn’t, yet the status window of Xvid shows a histogram plotting the number of frames at each QP, which implies it is a property of the frame.
Are there any inexpensive sources for technical information about MPEG-4? My initial inclination to answer the above was to read the spec rather than wasting your time, but ANSI charges $300 just for part 2, and at the current exchange rate, ISO wants even more. I’m not trying to write my own encoder or anything like that, but I do like to understand the technology I’m working with. Clearly, many of the posters to these fora have a detailed understanding of MPEG-4; where did you get that information?
Thank you so much for any help.