factor out common expressions in coefficient quantization