Dear group,
Probably I'm doing something dead wrong, but using your lcms2 library in
my own application, I seem to note a 50%-100% performance drop going
from lcms to lcms2.
The piece of code is, I think, pretty straightforward and goes
hereafter. What am I doing wrong or what are the suggestions ?
(For your reference, it's a piece of code that transforms a linear image
representation to a screen, using a profile). OMP I took out of the
equation.
Thanks for the library, thanks for the feedback !
Code :
QTime Time;
Time.start();
if (m_OutProfile) {
// Some lcms initialization.
cmsCIExyY D65;
cmsCIExyY D50;
cmsSetLogErrorHandler(lcmsError);
cmsWhitePointFromTemp(&D65,6503);
cmsWhitePointFromTemp(&D50,5003);
cmsToneCurve* GammaCurve = cmsBuildGamma(NULL,1.0);
cmsToneCurve* GammaCurves[] = {GammaCurve,GammaCurve,GammaCurve};
cmsHPROFILE InProfile = 0;
cmsCIExyY DFromReference;
short ColorSpace = m_RelatedImage->m_ColorSpace;
switch (ColorSpace) {
case dlSpace_sRGB_D65 :
case dlSpace_AdobeRGB_D65 :
DFromReference = D65;
break;
case dlSpace_WideGamutRGB_D50 :
case dlSpace_ProPhotoRGB_D50 :
DFromReference = D50;
break;
default:
DL_ERROR(Error_SwitchCase,"Unexpected switch
case","%d",ColorSpace);
}
InProfile =
cmsCreateRGBProfile(&DFromReference,
(cmsCIExyYTRIPLE*)&RGBPrimaries[ColorSpace],
GammaCurves);
if (!InProfile) {
DL_ERROR(Error_Profile,"Could not open profile","%s","InProfile");
}
cmsFreeToneCurve(GammaCurve);
cmsHTRANSFORM Transform;
Transform = cmsCreateTransform(InProfile,
TYPE_RGBA_8,
m_OutProfile,
TYPE_RGBA_8,
m_Intent,
0);
// Addition of those drops
performance even further.
//cmsFLAGS_NOOPTIMIZE |
//cmsFLAGS_BLACKPOINTCOMPENSATION);
TRACEKEYVALS("Elapsed","%d",Time.elapsed());
TRACEKEYVALS("cmsDoTransform on QImage","%p",m_QImageZoomed);
const uint32_t Size = m_ZoomWidth*m_ZoomHeight;
short NrTiles = 1;
#ifdef _OPENMP
// XXX JDLA NrTiles = omp_get_num_threads();
#endif
uint32_t Step = Size/NrTiles;
#pragma omp parallel for default(shared) schedule(static)
for (short Tile=0; Tile<NrTiles; Tile++) {
uint32_t Start = Tile*Step;
uint32_t End = (Tile == NrTiles-1) ? Size : Start+Step;
cmsDoTransform(Transform,
m_QImageZoomed->bits()+Start*4,
m_QImageZoomed->bits()+Start*4,
End-Start);
}
cmsDeleteTransform(Transform);
cmsCloseProfile(InProfile);
}
TRACEKEYVALS("Elapsed","%d",Time.elapsed());
}
--
Jos De Laender
www.jodela.net
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today. Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Lcms-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lcms-user