Fix compiler error with float16
This commit is contained in:
+13
-13
@@ -411,7 +411,7 @@ void RawImage::convertToThumbnail()
|
||||
|
||||
if(m_thumbAspect == 0.0f)
|
||||
m_thumbAspect = (float)width() / height();
|
||||
std::unique_ptr<PixelType[]> outptr = std::make_unique<PixelType[]>(THUMB_SIZE * THUMB_SIZE * 4 * sizeof(qfloat16));
|
||||
std::unique_ptr<PixelType[]> outptr = std::make_unique<PixelType[]>(THUMB_SIZE * THUMB_SIZE * 4 * sizeof(F16));
|
||||
F16 *out = reinterpret_cast<F16*>(outptr.get());
|
||||
|
||||
auto loop = [&](F16 *out, auto *in, float scale)
|
||||
@@ -425,15 +425,15 @@ void RawImage::convertToThumbnail()
|
||||
|
||||
if(m_channels == 1)
|
||||
{
|
||||
out[idx] = out[idx + 1] = out[idx + 2] = in[idx2] * scale;
|
||||
out[idx] = out[idx + 1] = out[idx + 2] = (F16)(in[idx2] * scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
out[idx] = in[idx2] * scale;;
|
||||
out[idx + 1] = in[idx2 + 1] * scale;;
|
||||
out[idx + 2] = in[idx2 + 2] * scale;;
|
||||
out[idx] = (F16)(in[idx2] * scale);
|
||||
out[idx + 1] = (F16)(in[idx2 + 1] * scale);
|
||||
out[idx + 2] = (F16)(in[idx2 + 2] * scale);
|
||||
}
|
||||
out[idx + 3] = 1.0f;
|
||||
out[idx + 3] = (F16)1.0f;
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -502,7 +502,7 @@ void RawImage::convertToGLFormat()
|
||||
uint16_t *src = reinterpret_cast<uint16_t*>(m_original.get());
|
||||
|
||||
for(size_t i = 0; i < s; i++)
|
||||
dst[i] = src[i] / (float)UINT16_MAX;
|
||||
dst[i] = (F16)(src[i] / (float)UINT16_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -901,19 +901,19 @@ void RawImage::generateLUT()
|
||||
|
||||
const int LUT_SIZE = 32;
|
||||
const float LUT_SIZEF = LUT_SIZE - 1;
|
||||
std::vector<qfloat16> lut(LUT_SIZE * LUT_SIZE * LUT_SIZE * 4);
|
||||
std::vector<F16> lut(LUT_SIZE * LUT_SIZE * LUT_SIZE * 4);
|
||||
m_lut.resize(lut.size());
|
||||
for(int z = 0; z < LUT_SIZE; z++)
|
||||
{
|
||||
for(int y = 0; y < LUT_SIZE; y++)
|
||||
{
|
||||
qfloat16 *line = &lut[(z*LUT_SIZE*LUT_SIZE + y*LUT_SIZE) * 4];
|
||||
F16 *line = &lut[(z*LUT_SIZE*LUT_SIZE + y*LUT_SIZE) * 4];
|
||||
for(int x = 0; x < LUT_SIZE; x++)
|
||||
{
|
||||
line[x*4 + 0] = x / LUT_SIZEF;
|
||||
line[x*4 + 1] = y / LUT_SIZEF;
|
||||
line[x*4 + 2] = z / LUT_SIZEF;
|
||||
line[x*4 + 3] = 1.0f;
|
||||
line[x*4 + 0] = (F16)(x / LUT_SIZEF);
|
||||
line[x*4 + 1] = (F16)(y / LUT_SIZEF);
|
||||
line[x*4 + 2] = (F16)(z / LUT_SIZEF);
|
||||
line[x*4 + 3] = (F16)1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user