Black-point compensation: theory and application