Fine-tuned Floyd Steinberg quantization values for better gamma curve.

This commit is contained in:
Jonas Diemer
2026-01-09 16:12:41 +01:00
parent 7838660ff5
commit 79e9c6dcc8
2 changed files with 9 additions and 9 deletions

View File

@@ -74,18 +74,18 @@ static inline uint8_t quantizeFloydSteinberg(int gray, int x, int width, int16_t
// Quantize to 4 levels (0, 85, 170, 255)
uint8_t quantized;
int quantizedValue;
if (adjusted < 43) {
if (adjusted < 30) {
quantized = 0;
quantizedValue = 0;
} else if (adjusted < 128) {
quantizedValue = 15;
} else if (adjusted < 50) {
quantized = 1;
quantizedValue = 85;
} else if (adjusted < 213) {
quantizedValue = 30;
} else if (adjusted < 140) {
quantized = 2;
quantizedValue = 170;
quantizedValue = 80;
} else {
quantized = 3;
quantizedValue = 255;
quantizedValue = 210;
}
// Calculate error