Log in

View Full Version : MPEG-1 DC predictors


Bester
29th June 2006, 10:15
I'm trying to write a MPEG-1 encoder and don't know how to encode the DC values.
The Documentation tells:

...At the beginning of each slice, all three DC predictors for Y, Cb and Cr, are set to 1024 (128*8).
My thoughts:
After the FDCT the DC values have a dynamic range of [0, ..., 2040] and are then quantized by 8 giving a range of [0, ..., 255].
Now, if I use 1024 as the first predictor at the beginning of a slice and the DC value has any value in the quantized range, the difference diff=DCValue-1024 is smaller than -769. But there are only VLC codes for values abs(0,...,255).
It would only make sense if 1024 also has to be quantized (divided by 8 = 128).

Any ideas?

Sulik
29th June 2006, 18:33
The pre-quantization predictor is 1024.
Use 1024 if you're subtracting the predictor pre-quantization, or 128 if you're doing it post-quantization. The final range of the coded value should be in the range [-128 .. +127]

Bester
29th June 2006, 19:17
Now it is clear.
Thanks!

Amnon82
30th June 2006, 19:55
Why mpeg1. Never mind. Hope you'll search for testers. Tell us when you ready ;)