MCPcopy Create free account
hub / github.com/crosspoint-reader/crosspoint-reader / quantizeSimple

Function quantizeSimple

lib/GfxRenderer/BitmapHelpers.cpp:57–67  ·  view source on GitHub ↗

Simple quantization without dithering - divide into 4 levels The thresholds are fine-tuned to the X4 display

Source from the content-addressed store, hash-verified

55// Simple quantization without dithering - divide into 4 levels
56// The thresholds are fine-tuned to the X4 display
57uint8_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

Callers 1

quantizeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected