Simple quantization without dithering - divide into 4 levels The thresholds are fine-tuned to the X4 display
| 55 | // Simple quantization without dithering - divide into 4 levels |
| 56 | // The thresholds are fine-tuned to the X4 display |
| 57 | uint8_t quantizeSimple(int gray) { |
| 58 | if (gray < 45) { |
| 59 | return 0; |
| 60 | } else if (gray < 70) { |
| 61 | return 1; |
| 62 | } else if (gray < 140) { |
| 63 | return 2; |
| 64 | } else { |
| 65 | return 3; |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | // Hash-based noise dithering - survives downsampling without moiré artifacts |
| 70 | // Uses integer hash to generate pseudo-random threshold per pixel |