Fine-tuned Floyd Steinberg quantization values for better gamma curve.
This commit is contained in:
parent
7838660ff5
commit
79e9c6dcc8
@ -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
|
||||
|
||||
@ -86,7 +86,7 @@ void SleepActivity::renderCustomSleepScreen() const {
|
||||
if (SdMan.openFileForRead("SLP", filename, file)) {
|
||||
Serial.printf("[%lu] [SLP] Randomly loading: /sleep/%s\n", millis(), files[randomFileIndex].c_str());
|
||||
delay(100);
|
||||
Bitmap bitmap(file, true, 50);
|
||||
Bitmap bitmap(file, true);
|
||||
if (bitmap.parseHeaders() == BmpReaderError::Ok) {
|
||||
renderBitmapSleepScreen(bitmap);
|
||||
dir.close();
|
||||
@ -101,7 +101,7 @@ void SleepActivity::renderCustomSleepScreen() const {
|
||||
// render a custom sleep screen instead of the default.
|
||||
FsFile file;
|
||||
if (SdMan.openFileForRead("SLP", "/sleep.bmp", file)) {
|
||||
Bitmap bitmap(file, true, 50);
|
||||
Bitmap bitmap(file, true, 0);
|
||||
if (bitmap.parseHeaders() == BmpReaderError::Ok) {
|
||||
Serial.printf("[%lu] [SLP] Loading: /sleep.bmp\n", millis());
|
||||
renderBitmapSleepScreen(bitmap);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user