Some optimizations (#880)

This commit is contained in:
Murat Seker
2020-07-19 16:14:54 +02:00
committed by GitHub
parent 4880e31562
commit 95688c0f1e
4 changed files with 230 additions and 130 deletions

View File

@@ -39,6 +39,7 @@
// Boblight
#include <boblightserver/BoblightServer.h>
Hyperion::Hyperion(const quint8& instance)
: QObject()
, _instIndex(instance)

View File

@@ -60,8 +60,7 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i
// calculate the output size
int outputWidth = (width - _cropLeft - cropRight - (_horizontalDecimation >> 1) + _horizontalDecimation - 1) / _horizontalDecimation;
int outputHeight = (height - _cropTop - cropBottom - (_verticalDecimation >> 1) + _verticalDecimation - 1) / _verticalDecimation;
if ((outputImage.height() != unsigned(outputHeight)) && (outputImage.width() != unsigned(outputWidth)))
outputImage.resize(outputWidth, outputHeight);
outputImage.resize(outputWidth, outputHeight);
for (int yDest = 0, ySource = _cropTop + (_verticalDecimation >> 1); yDest < outputHeight; ySource += _verticalDecimation, ++yDest)
{
@@ -71,7 +70,7 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i
switch (pixelFormat)
{
case PixelFormat::UYVY:
case PixelFormat::UYVY:
{
int index = lineLength * ySource + (xSource << 1);
uint8_t y = data[index+1];
@@ -123,7 +122,7 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i
break;
#ifdef HAVE_JPEG_DECODER
case PixelFormat::MJPEG:
break;
break;
#endif
case PixelFormat::NO_CHANGE:
Error(Logger::getInstance("ImageResampler"), "Invalid pixel format given");