Fixed bug ExecCMSTransform for non raw files

This commit is contained in:
Desmis
2018-05-01 09:39:15 +02:00
parent 7ca1492138
commit 9e5506aa35
3 changed files with 50 additions and 2 deletions

View File

@@ -504,7 +504,7 @@ void Imagefloat::calcCroppedHistogram(const ProcParams &params, float scale, LUT
}
// Parallelized transformation; create transform with cmsFLAGS_NOCACHE!
void Imagefloat::ExecCMSTransform(cmsHTRANSFORM hTransform)
void Imagefloat::ExecCMSTransform2(cmsHTRANSFORM hTransform)
{
// LittleCMS cannot parallelize planar setups -- Hombre: LCMS2.4 can! But it we use this new feature, memory allocation
@@ -527,6 +527,53 @@ void Imagefloat::ExecCMSTransform(cmsHTRANSFORM hTransform)
*(p++) = *(pR++)/ 65535.f;
*(p++) = *(pG++)/ 65535.f;
*(p++) = *(pB++)/ 65535.f;
}
cmsDoTransform (hTransform, pBuf.data, pBuf.data, width);
p = pBuf.data;
pR = r(y);
pG = g(y);
pB = b(y);
for (int x = 0; x < width; x++) {
*(pR++) = *(p++);
*(pG++) = *(p++);
*(pB++) = *(p++);
}
} // End of parallelization
}
}
// Parallelized transformation; create transform with cmsFLAGS_NOCACHE!
void Imagefloat::ExecCMSTransform(cmsHTRANSFORM hTransform)
{
// LittleCMS cannot parallelize planar setups -- Hombre: LCMS2.4 can! But it we use this new feature, memory allocation
// have to be modified too to build temporary buffers that allow multi processor execution
#ifdef _OPENMP
#pragma omp parallel
#endif
{
AlignedBuffer<float> pBuf(width * 3);
#ifdef _OPENMP
#pragma omp for schedule(static)
#endif
for (int y = 0; y < height; y++)
{
float *p = pBuf.data, *pR = r(y), *pG = g(y), *pB = b(y);
for (int x = 0; x < width; x++) {
*(p++) = *(pR++);
*(p++) = *(pG++);
*(p++) = *(pB++);
}
cmsDoTransform (hTransform, pBuf.data, pBuf.data, width);