Rate-Distortion Optimal Adaptive Quantization and Coefficient Thresholding for MPEG Coding