A method comprising: accessing a quantization parameter for encoding a current sample, comprising: obtaining a measure that indicates a characteristic of other samples within a particular distance from the current sample; and when the measure meets a predetermined criterion: adjusting the quantization parameter; encoding a pixel after adjusting the quantization parameter; and explicitly indicating the adjusting of the quantization parameter to a decoding system (152, 800, 1400), characterized in that obtaining the measure comprises: determining whether a first set of samples surrounding the current sample meets a high flatness threshold; and when the first set of samples meets the high flatness threshold: determining that the measure meets the predetermined criterion; and when the first set of samples does not meet the high flatness threshold: determining whether a second set of samples surrounding the current sample meets the high flatness threshold; and when the second set of samples meets the high flatness threshold: determining that the measure meets the predetermined criterion; and when the second set of samples does not meet the high flatness threshold: determining that the measure does not meet the predetermined criterion. accessing a quantization parameter for encoding a current sample, comprising: obtaining a measure that indicates a characteristic of other samples within a particular distance from the current sample; and when the measure meets a predetermined criterion: adjusting the quantization parameter; encoding a pixel after adjusting the quantization parameter; and explicitly indicating the adjusting of the quantization parameter to a decoding system (152, 800, 1400), characterized in that obtaining the measure comprises: determining whether a first set of samples surrounding the current sample meets a high flatness threshold; and when the first set of samples meets the high flatness threshold: determining that the measure meets the predetermined criterion; and when the first set of samples does not meet the high flatness threshold: determining whether a second set of samples surrounding the current sample meets the high flatness threshold; and when the second set of samples meets the high flatness threshold: determining that the measure meets the predetermined criterion; and when the second set of samples does not meet the high flatness threshold: determining that the measure does not meet the predetermined criterion. adjusting the quantization parameter; encoding a pixel after adjusting the quantization parameter; and explicitly indicating the adjusting of the quantization parameter to a decoding system (152, 800, 1400), characterized in that obtaining the measure comprises: determining whether a first set of samples surrounding the current sample meets a high flatness threshold; and when the first set of samples meets the high flatness threshold: determining that the measure meets the predetermined criterion; and when the first set of samples does not meet the high flatness threshold: determining whether a second set of samples surrounding the current sample meets the high flatness threshold; and when the second set of samples meets the high flatness threshold: determining that the measure meets the predetermined criterion; and when the second set of samples does not meet the high flatness threshold: determining that the measure does not meet the predetermined criterion. determining whether a first set of samples surrounding the current sample meets a high flatness threshold; and when the first set of samples meets the high flatness threshold: determining that the measure meets the predetermined criterion; and when the first set of samples does not meet the high flatness threshold: determining whether a second set of samples surrounding the current sample meets the high flatness threshold; and when the second set of samples meets the high flatness threshold: determining that the measure meets the predetermined criterion; and when the second set of samples does not meet the high flatness threshold: determining that the measure does not meet the predetermined criterion. determining that the measure meets the predetermined criterion; and when the first set of samples does not meet the high flatness threshold: determining whether a second set of samples surrounding the current sample meets the high flatness threshold; and when the second set of samples meets the high flatness threshold: determining that the measure meets the predetermined criterion; and when the second set of samples does not meet the high flatness threshold: determining that the measure does not meet the predetermined criterion.