Refactoring and proper handling of quantization.
Moving color and dithering related helpers into dedicated file. In case of 2bpp (i.e. file generated from JPG), we don't apply any color adjustments. In other cases, they are applied based on selected algorithm.
This commit is contained in:
@@ -7,8 +7,7 @@
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
#include "Bitmap.h"
|
||||
#include "Dithering.h"
|
||||
#include "BitmapHelpers.h"
|
||||
|
||||
// Context structure for picojpeg callback
|
||||
struct JpegReadContext {
|
||||
@@ -356,7 +355,7 @@ bool JpegToBmpConverter::jpegFileToBmpStream(FsFile& jpegFile, Print& bmpOut) {
|
||||
}
|
||||
} else {
|
||||
for (int x = 0; x < outWidth; x++) {
|
||||
const uint8_t gray = mcuRowBuffer[bufferY * imageInfo.m_width + x];
|
||||
const uint8_t gray = adjustPixel(mcuRowBuffer[bufferY * imageInfo.m_width + x]);
|
||||
uint8_t twoBit;
|
||||
if (atkinsonDitherer) {
|
||||
twoBit = atkinsonDitherer->processPixel(gray, x);
|
||||
|
||||
Reference in New Issue
Block a user