mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-06 23:57:39 +03:00
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)
|
// Quantize to 4 levels (0, 85, 170, 255)
|
||||||
uint8_t quantized;
|
uint8_t quantized;
|
||||||
int quantizedValue;
|
int quantizedValue;
|
||||||
if (adjusted < 43) {
|
if (adjusted < 30) {
|
||||||
quantized = 0;
|
quantized = 0;
|
||||||
quantizedValue = 0;
|
quantizedValue = 15;
|
||||||
} else if (adjusted < 128) {
|
} else if (adjusted < 50) {
|
||||||
quantized = 1;
|
quantized = 1;
|
||||||
quantizedValue = 85;
|
quantizedValue = 30;
|
||||||
} else if (adjusted < 213) {
|
} else if (adjusted < 140) {
|
||||||
quantized = 2;
|
quantized = 2;
|
||||||
quantizedValue = 170;
|
quantizedValue = 80;
|
||||||
} else {
|
} else {
|
||||||
quantized = 3;
|
quantized = 3;
|
||||||
quantizedValue = 255;
|
quantizedValue = 210;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate error
|
// Calculate error
|
||||||
|
|||||||
@ -86,7 +86,7 @@ void SleepActivity::renderCustomSleepScreen() const {
|
|||||||
if (SdMan.openFileForRead("SLP", filename, file)) {
|
if (SdMan.openFileForRead("SLP", filename, file)) {
|
||||||
Serial.printf("[%lu] [SLP] Randomly loading: /sleep/%s\n", millis(), files[randomFileIndex].c_str());
|
Serial.printf("[%lu] [SLP] Randomly loading: /sleep/%s\n", millis(), files[randomFileIndex].c_str());
|
||||||
delay(100);
|
delay(100);
|
||||||
Bitmap bitmap(file, true, 50);
|
Bitmap bitmap(file, true);
|
||||||
if (bitmap.parseHeaders() == BmpReaderError::Ok) {
|
if (bitmap.parseHeaders() == BmpReaderError::Ok) {
|
||||||
renderBitmapSleepScreen(bitmap);
|
renderBitmapSleepScreen(bitmap);
|
||||||
dir.close();
|
dir.close();
|
||||||
@ -101,7 +101,7 @@ void SleepActivity::renderCustomSleepScreen() const {
|
|||||||
// render a custom sleep screen instead of the default.
|
// render a custom sleep screen instead of the default.
|
||||||
FsFile file;
|
FsFile file;
|
||||||
if (SdMan.openFileForRead("SLP", "/sleep.bmp", file)) {
|
if (SdMan.openFileForRead("SLP", "/sleep.bmp", file)) {
|
||||||
Bitmap bitmap(file, true, 50);
|
Bitmap bitmap(file, true, 0);
|
||||||
if (bitmap.parseHeaders() == BmpReaderError::Ok) {
|
if (bitmap.parseHeaders() == BmpReaderError::Ok) {
|
||||||
Serial.printf("[%lu] [SLP] Loading: /sleep.bmp\n", millis());
|
Serial.printf("[%lu] [SLP] Loading: /sleep.bmp\n", millis());
|
||||||
renderBitmapSleepScreen(bitmap);
|
renderBitmapSleepScreen(bitmap);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user