RGB24 and BGR24 cleanup

This commit is contained in:
LordGrey
2024-05-31 18:56:49 +02:00
parent 897e4aac8a
commit a5b42e3024
4 changed files with 48 additions and 10 deletions

View File

@@ -133,6 +133,22 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i
break;
}
case PixelFormat::RGB24:
{
for (int yDest = yDestStart, ySource = cropTop + (_verticalDecimation >> 1); yDest <= yDestEnd; ySource += _verticalDecimation, ++yDest)
{
for (int xDest = xDestStart, xSource = cropLeft + (_horizontalDecimation >> 1); xDest <= xDestEnd; xSource += _horizontalDecimation, ++xDest)
{
ColorRgb & rgb = outputImage(abs(xDest), abs(yDest));
int index = lineLength * ySource + (xSource << 1) + xSource;
rgb.red = data[index ];
rgb.green = data[index+1];
rgb.blue = data[index+2];
}
}
break;
}
case PixelFormat::BGR24:
{
for (int yDest = yDestStart, ySource = cropTop + (_verticalDecimation >> 1); yDest <= yDestEnd; ySource += _verticalDecimation, ++yDest)