mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-07 16:17:38 +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;
|
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)
|
// Apply contrast adjustment around midpoint (128)
|
||||||
// factor > 1.0 increases contrast, < 1.0 decreases
|
// factor > 1.0 increases contrast, < 1.0 decreases
|
||||||
static inline int applyContrast(int gray) {
|
static inline int applyContrast(int gray) {
|
||||||
@ -320,11 +310,10 @@ BmpReaderError Bitmap::readNextRow(uint8_t* data, uint8_t* rowBuffer) const {
|
|||||||
uint8_t color;
|
uint8_t color;
|
||||||
if (useFS) {
|
if (useFS) {
|
||||||
// Floyd-Steinberg error diffusion
|
// Floyd-Steinberg error diffusion
|
||||||
color = quantizeFloydSteinberg(boostBrightness(lum, brightnessBoost), currentX, width, errorCurRow, errorNextRow,
|
color = quantizeFloydSteinberg(adjustPixel(lum), currentX, width, errorCurRow, errorNextRow, false);
|
||||||
false);
|
|
||||||
} else {
|
} else {
|
||||||
// Simple quantization or noise dithering
|
// Simple quantization or noise dithering
|
||||||
color = quantize(boostBrightness(lum, brightnessBoost), currentX, prevRowY);
|
color = quantize(adjustPixel(lum), currentX, prevRowY);
|
||||||
}
|
}
|
||||||
currentOutByte |= (color << bitShift);
|
currentOutByte |= (color << bitShift);
|
||||||
if (bitShift == 0) {
|
if (bitShift == 0) {
|
||||||
|
|||||||
@ -30,8 +30,7 @@ class Bitmap {
|
|||||||
public:
|
public:
|
||||||
static const char* errorToString(BmpReaderError err);
|
static const char* errorToString(BmpReaderError err);
|
||||||
|
|
||||||
explicit Bitmap(FsFile& file, bool useFloydSteinberg = false, uint8_t brightnessBoost = 0)
|
explicit Bitmap(FsFile& file, bool useFloydSteinberg = false) : file(file), useFloydSteinberg(useFloydSteinberg) {}
|
||||||
: file(file), useFloydSteinberg(useFloydSteinberg), brightnessBoost(brightnessBoost) {}
|
|
||||||
~Bitmap();
|
~Bitmap();
|
||||||
BmpReaderError parseHeaders();
|
BmpReaderError parseHeaders();
|
||||||
BmpReaderError readNextRow(uint8_t* data, uint8_t* rowBuffer) const;
|
BmpReaderError readNextRow(uint8_t* data, uint8_t* rowBuffer) const;
|
||||||
@ -48,7 +47,6 @@ class Bitmap {
|
|||||||
|
|
||||||
FsFile& file;
|
FsFile& file;
|
||||||
bool useFloydSteinberg = false;
|
bool useFloydSteinberg = false;
|
||||||
uint8_t brightnessBoost = 0;
|
|
||||||
int width = 0;
|
int width = 0;
|
||||||
int height = 0;
|
int height = 0;
|
||||||
bool topDown = false;
|
bool topDown = false;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user