1. A machine-implemented encoding method, comprising: quantizing an image by assigning sub-ranges of pixel values in the image to respective quantization levels; and encoding the quantized image based at least in part on a mask lookup table assigning index values to respective masks, each mask corresponding to a respective spatial distribution of the quantization levels.