Skip to content

Commit

Permalink
Fix critical issue #63
Browse files Browse the repository at this point in the history
  • Loading branch information
awawa-dev committed May 20, 2021
1 parent fcca7de commit 6e22b3f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
37 changes: 19 additions & 18 deletions libsrc/utils/ImageResampler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,17 +405,9 @@ void ImageResampler::processQImage(



#define LUT() \
{\
*((uint32_t*)&buffer) = *((uint32_t*)startSource);\
uint32_t ind_lutd = LUT_INDEX(buffer[0],buffer[1],buffer[2]);\
*((uint16_t*)startSource) = *((uint16_t*)(&(lutBuffer[ind_lutd])));\
startSource += 3;\
}

void ImageResampler::applyLUT(unsigned char* _source, unsigned int width, unsigned int height, const uint8_t* lutBuffer, const int _hdrToneMappingEnabled)
{
uint8_t buffer[4];
void ImageResampler::applyLUT(uint8_t* _source, unsigned int width, unsigned int height, const uint8_t* lutBuffer, const int _hdrToneMappingEnabled)
{
uint8_t buffer[8];

if (lutBuffer != NULL && _hdrToneMappingEnabled)
{
Expand All @@ -430,17 +422,26 @@ void ImageResampler::applyLUT(unsigned char* _source, unsigned int width, unsign
if (_hdrToneMappingEnabled != 2 || y < sizeY || y > height - sizeY)
{
while (startSource < endSource)
LUT();
{
*((uint32_t*)&buffer) = *((uint32_t*)startSource);
uint32_t ind_lutd = LUT_INDEX(buffer[0], buffer[1], buffer[2]);
memcpy(startSource, &(lutBuffer[ind_lutd]), 3);
startSource += 3;
}
}
else
{
for (unsigned int x = 0; x < sizeX; x++)
LUT();

startSource += (width - 2 * static_cast<size_t>(sizeX)) * 3;

unsigned int x = 0;
while (startSource < endSource)
LUT();
{
if (x++ == sizeX)
startSource += (width - 2 * static_cast<size_t>(sizeX)) * 3;

*((uint32_t*)&buffer) = *((uint32_t*)startSource);
uint32_t ind_lutd = LUT_INDEX(buffer[0], buffer[1], buffer[2]);
memcpy(startSource, &(lutBuffer[ind_lutd]), 3);
startSource += 3;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.0.0.0
16.0.0.1

0 comments on commit 6e22b3f

Please sign in to comment.