Always make 4 channels

This commit is contained in:
2025-03-24 22:08:54 +01:00
parent 0047607c1d
commit 4488c2e6af
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -1,8 +1,8 @@
#include "rawimage.h" #include "rawimage.h"
#include <cstring> #include <cstring>
#include <lcms2.h>
#include <algorithm> #include <algorithm>
#ifndef NO_QT #ifndef NO_QT
#include <lcms2.h>
#include <QDebug> #include <QDebug>
#include <QElapsedTimer> #include <QElapsedTimer>
#include <QFloat16> #include <QFloat16>
@@ -55,7 +55,7 @@ void RawImage::allocate(uint32_t w, uint32_t h, uint32_t ch, DataType type)
m_width = w; m_width = w;
m_height = h; m_height = h;
m_channels = ch; m_channels = ch;
m_ch = ch == 3 ? 4 : ch; m_ch = ch > 1 ? 4 : ch;
m_origType = m_type = type; m_origType = m_type = type;
m_pixels = std::make_unique<PixelType[]>((size_t)m_width * m_height * m_ch * typeSize(type)); m_pixels = std::make_unique<PixelType[]>((size_t)m_width * m_height * m_ch * typeSize(type));
} }
@@ -1071,7 +1071,6 @@ void RawImage::setICCProfile(const QByteArray &icc)
if(icc.size()) if(icc.size())
m_iccProfile = std::vector<uint8_t>(icc.begin(), icc.end()); m_iccProfile = std::vector<uint8_t>(icc.begin(), icc.end());
} }
#endif
void RawImage::setICCProfile(const LibXISF::ByteArray &icc) void RawImage::setICCProfile(const LibXISF::ByteArray &icc)
{ {
@@ -1180,6 +1179,7 @@ void RawImage::generateLUT()
cmsCloseProfile(inProfile); cmsCloseProfile(inProfile);
cmsCloseProfile(outProfile); cmsCloseProfile(outProfile);
} }
#endif
void RawImage::applySTF(const MTFParam &mtfParams) void RawImage::applySTF(const MTFParam &mtfParams)
{ {
+1 -1
View File
@@ -125,10 +125,10 @@ public:
bool valid() const; bool valid() const;
#ifndef NO_QT #ifndef NO_QT
void setICCProfile(const QByteArray &icc); void setICCProfile(const QByteArray &icc);
#endif
void setICCProfile(const LibXISF::ByteArray &icc); void setICCProfile(const LibXISF::ByteArray &icc);
void convertTosRGB(); void convertTosRGB();
void generateLUT(); void generateLUT();
#endif
void applySTF(const MTFParam &mtfParams); void applySTF(const MTFParam &mtfParams);
MTFParam calcMTFParams(bool linked = false, bool debayer = false) const; MTFParam calcMTFParams(bool linked = false, bool debayer = false) const;
const std::vector<uint16_t>& getLUT() const; const std::vector<uint16_t>& getLUT() const;