Computational Principles Underlying Contextual Modulations in Visual Perception