mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-06 23:57:39 +03:00
Remove brightness boost parameter.
This commit is contained in:
parent
40a92f3d34
commit
ec8e19ed46
@ -32,16 +32,6 @@ static inline int applyGamma(int gray) {
|
||||
return x > 255 ? 255 : x;
|
||||
}
|
||||
|
||||
// TODO: remove
|
||||
static inline uint8_t boostBrightness(int gray, uint8_t boost) {
|
||||
if (boost > 0) {
|
||||
gray += boost;
|
||||
if (gray > 255) gray = 255;
|
||||
gray = applyGamma(gray);
|
||||
}
|
||||
return gray;
|
||||
}
|
||||
|
||||
// Apply contrast adjustment around midpoint (128)
|
||||
// factor > 1.0 increases contrast, < 1.0 decreases
|
||||
static inline int applyContrast(int gray) {
|
||||
@ -320,11 +310,10 @@ BmpReaderError Bitmap::readNextRow(uint8_t* data, uint8_t* rowBuffer) const {
|
||||
uint8_t color;
|
||||
if (useFS) {
|
||||
// Floyd-Steinberg error diffusion
|
||||
color = quantizeFloydSteinberg(boostBrightness(lum, brightnessBoost), currentX, width, errorCurRow, errorNextRow,
|
||||
false);
|
||||
color = quantizeFloydSteinberg(adjustPixel(lum), currentX, width, errorCurRow, errorNextRow, false);
|
||||
} else {
|
||||
// Simple quantization or noise dithering
|
||||
color = quantize(boostBrightness(lum, brightnessBoost), currentX, prevRowY);
|
||||
color = quantize(adjustPixel(lum), currentX, prevRowY);
|
||||
}
|
||||
currentOutByte |= (color << bitShift);
|
||||
if (bitShift == 0) {
|
||||
|
||||
@ -30,8 +30,7 @@ class Bitmap {
|
||||
public:
|
||||
static const char* errorToString(BmpReaderError err);
|
||||
|
||||
explicit Bitmap(FsFile& file, bool useFloydSteinberg = false, uint8_t brightnessBoost = 0)
|
||||
: file(file), useFloydSteinberg(useFloydSteinberg), brightnessBoost(brightnessBoost) {}
|
||||
explicit Bitmap(FsFile& file, bool useFloydSteinberg = false) : file(file), useFloydSteinberg(useFloydSteinberg) {}
|
||||
~Bitmap();
|
||||
BmpReaderError parseHeaders();
|
||||
BmpReaderError readNextRow(uint8_t* data, uint8_t* rowBuffer) const;
|
||||
@ -48,7 +47,6 @@ class Bitmap {
|
||||
|
||||
FsFile& file;
|
||||
bool useFloydSteinberg = false;
|
||||
uint8_t brightnessBoost = 0;
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
bool topDown = false;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user