mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
- Image format NV12 and I420 added
- Flip mode - Scaling factor for MJPEG - VSCode (compile before run) - CI (push) dependency libjpeg-turbo added
This commit is contained in:
@@ -46,8 +46,7 @@ private:
|
||||
|
||||
#ifdef HAVE_TURBO_JPEG
|
||||
tjhandle _decompress;
|
||||
int _scalingFactorsCount = 0;
|
||||
tjscalingfactor* _scalingFactors = nullptr;
|
||||
tjscalingfactor* _scalingFactors;
|
||||
#endif
|
||||
|
||||
static volatile bool _isActive;
|
||||
@@ -57,6 +56,7 @@ private:
|
||||
PixelFormat _pixelFormat;
|
||||
uint8_t* _localData;
|
||||
int _localDataSize;
|
||||
int _scalingFactorsCount;
|
||||
int _size;
|
||||
int _width;
|
||||
int _height;
|
||||
@@ -78,16 +78,7 @@ class MFThreadManager : public QObject
|
||||
public:
|
||||
MFThreadManager() : _threads(nullptr)
|
||||
{
|
||||
int select = QThread::idealThreadCount();
|
||||
|
||||
if (select >= 2 && select <= 3)
|
||||
select = 2;
|
||||
else if (select > 3 && select <= 5)
|
||||
select = 3;
|
||||
else if (select > 5)
|
||||
select = 4;
|
||||
|
||||
_maxThreads = qMax(select, 1);
|
||||
_maxThreads = qBound(1, ((QThread::idealThreadCount() * 3) / 2), 12);
|
||||
}
|
||||
|
||||
~MFThreadManager()
|
||||
@@ -100,6 +91,7 @@ public:
|
||||
_threads[i]->deleteLater();
|
||||
_threads[i] = nullptr;
|
||||
}
|
||||
|
||||
delete[] _threads;
|
||||
_threads = nullptr;
|
||||
}
|
||||
|
@@ -9,12 +9,13 @@ class ImageResampler
|
||||
{
|
||||
public:
|
||||
ImageResampler();
|
||||
~ImageResampler();
|
||||
~ImageResampler() {}
|
||||
|
||||
void setHorizontalPixelDecimation(int decimator);
|
||||
void setVerticalPixelDecimation(int decimator);
|
||||
void setHorizontalPixelDecimation(int decimator) { _horizontalDecimation = decimator; }
|
||||
void setVerticalPixelDecimation(int decimator) { _verticalDecimation = decimator; }
|
||||
void setCropping(int cropLeft, int cropRight, int cropTop, int cropBottom);
|
||||
void setVideoMode(VideoMode mode);
|
||||
void setVideoMode(VideoMode mode) { _videoMode = mode; }
|
||||
void setFlipMode(FlipMode mode) { _flipMode = mode; }
|
||||
void processImage(const uint8_t * data, int width, int height, int lineLength, PixelFormat pixelFormat, Image<ColorRgb> & outputImage) const;
|
||||
|
||||
private:
|
||||
@@ -25,5 +26,6 @@ private:
|
||||
int _cropTop;
|
||||
int _cropBottom;
|
||||
VideoMode _videoMode;
|
||||
FlipMode _flipMode;
|
||||
};
|
||||
|
||||
|
@@ -12,6 +12,8 @@ enum class PixelFormat {
|
||||
BGR24,
|
||||
RGB32,
|
||||
BGR32,
|
||||
NV12,
|
||||
I420,
|
||||
#ifdef HAVE_JPEG_DECODER
|
||||
MJPEG,
|
||||
#endif
|
||||
@@ -47,6 +49,14 @@ inline PixelFormat parsePixelFormat(const QString& pixelFormat)
|
||||
{
|
||||
return PixelFormat::BGR32;
|
||||
}
|
||||
else if (format.compare("i420") == 0)
|
||||
{
|
||||
return PixelFormat::I420;
|
||||
}
|
||||
else if (format.compare("nv12") == 0)
|
||||
{
|
||||
return PixelFormat::NV12;
|
||||
}
|
||||
#ifdef HAVE_JPEG_DECODER
|
||||
else if (format.compare("mjpeg") == 0)
|
||||
{
|
||||
@@ -63,35 +73,97 @@ inline QString pixelFormatToString(const PixelFormat& pixelFormat)
|
||||
|
||||
if ( pixelFormat == PixelFormat::YUYV)
|
||||
{
|
||||
return "yuyv";
|
||||
return "YUYV";
|
||||
}
|
||||
else if (pixelFormat == PixelFormat::UYVY)
|
||||
{
|
||||
return "uyvy";
|
||||
return "UYVY";
|
||||
}
|
||||
else if (pixelFormat == PixelFormat::BGR16)
|
||||
{
|
||||
return "bgr16";
|
||||
return "BGR16";
|
||||
}
|
||||
else if (pixelFormat == PixelFormat::BGR24)
|
||||
{
|
||||
return "bgr24";
|
||||
return "BGR24";
|
||||
}
|
||||
else if (pixelFormat == PixelFormat::RGB32)
|
||||
{
|
||||
return "rgb32";
|
||||
return "RGB32";
|
||||
}
|
||||
else if (pixelFormat == PixelFormat::BGR32)
|
||||
{
|
||||
return "bgr32";
|
||||
return "BGR32";
|
||||
}
|
||||
else if (pixelFormat == PixelFormat::I420)
|
||||
{
|
||||
return "I420";
|
||||
}
|
||||
else if (pixelFormat == PixelFormat::NV12)
|
||||
{
|
||||
return "NV12";
|
||||
}
|
||||
#ifdef HAVE_JPEG_DECODER
|
||||
else if (pixelFormat == PixelFormat::MJPEG)
|
||||
{
|
||||
return "mjpeg";
|
||||
return "MJPEG";
|
||||
}
|
||||
#endif
|
||||
|
||||
// return the default NO_CHANGE
|
||||
return "NO_CHANGE";
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumeration of the possible flip modes
|
||||
*/
|
||||
|
||||
enum class FlipMode
|
||||
{
|
||||
HORIZONTAL = 1,
|
||||
VERTICAL = 2,
|
||||
BOTH = HORIZONTAL | VERTICAL,
|
||||
NO_CHANGE = 4
|
||||
};
|
||||
|
||||
inline FlipMode parseFlipMode(const QString& flipMode)
|
||||
{
|
||||
// convert to lower case
|
||||
QString mode = flipMode.toLower();
|
||||
|
||||
if (flipMode.compare("horizontal") == 0)
|
||||
{
|
||||
return FlipMode::HORIZONTAL;
|
||||
}
|
||||
else if (flipMode.compare("vertical") == 0)
|
||||
{
|
||||
return FlipMode::VERTICAL;
|
||||
}
|
||||
else if (flipMode.compare("both") == 0)
|
||||
{
|
||||
return FlipMode::BOTH;
|
||||
}
|
||||
|
||||
// return the default NO_CHANGE
|
||||
return FlipMode::NO_CHANGE;
|
||||
}
|
||||
|
||||
inline QString flipModeToString(const FlipMode& flipMode)
|
||||
{
|
||||
|
||||
if ( flipMode == FlipMode::HORIZONTAL)
|
||||
{
|
||||
return "horizontal";
|
||||
}
|
||||
else if (flipMode == FlipMode::VERTICAL)
|
||||
{
|
||||
return "vertical";
|
||||
}
|
||||
else if (flipMode == FlipMode::BOTH)
|
||||
{
|
||||
return "both";
|
||||
}
|
||||
|
||||
// return the default NO_CHANGE
|
||||
return "NO_CHANGE";
|
||||
}
|
||||
|
Reference in New Issue
Block a user