Hi Magne,

Sorry about the delay, I have little free time lately and I'm checking the
lcms mailing list once a week and even less sometimes...

Ok, so now for your question. Yes, you are right Lab to whatever, as long as
you begin with Lab, takes longer than some other transforms.

The reason is tricky: basically Lab as input needs a additional
interpolation across three tone curves. Why? Well, that's the tricky part.
All precalculated transforms uses 3D (or N-D) tables with trilinear or
tetrahedral interpolation. The input  space is used to index the cube and
each grid node of cube is populated with values of output space. This is
very convenient for spaces like, for example, RGB, where each component goes
from (in 16 bits) zero to 0xFFFF. Then 0 indexes the first node and 0xFFFF
the last node. All middle nodes are placed in intermediate locations. 
Then comes Lab. ICC did choose a weird encoding for V2 Lab, so L* for
example, which goes from 0 to 100, is encoded 0x0000 for zero and 0xFF00 for
100. 
Please note with this encoding 0xFF00 does NOT index the last node on the
grid (that would be 0xFFFF). lcms needs to do something  to place white over
a node. That is important to avoid "scum dot" and other artifacts. So, in
order to map 0...0xFF00 to 0..0xFFFF range, lcms uses a tone curve  with 257
entries.

Obviously that doesn't apply on RGB to RGB or even on CMYK to CMYK
transforms, only when the indexing space is Lab (as is your case) you have
this penalty in order to increase accuracy. Next versions of lcms would use
V4 ICC encoding, which solves partially the problem, but I suspect that
would not apply in your case since you need V2 Lab encoding for doing your
calculations.

Hope this helps
All the best

Marti Maria
The littleCMS project
www.littlecms.com





-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Magne
Nilsen/ETC
Sent: Friday, February 29, 2008 2:38 AM
To: lcms-user@lists.sourceforge.net
Subject: [Lcms-user] Speed of RGB -> Lab ->RGB

Hi,

I have data converted into 16 bit ProPhoto RGB. I want to as fast as
possible convert this to Lab, do some changes in Lab mode and convert back
to ProPhoto RGB again.

The first conversion is fine:
-------------------------------------------------------
      //Convert ProPhotoRGB to ProPhotoLAB  
      lcmsPPProfile :=
cmsOpenProfileFromMem(rStreamProPhoto.Memory,rStreamProPhoto.Size);
      lcmsLABProfile := cmsCreateLabProfile(NIL);
      lcmsTransform := cmsCreateTransform( lcmsPPProfile, TYPE_RGB_16,
                                           lcmsLABProfile, TYPE_Lab_16,
                                           INTENT_PERCEPTUAL, 0 ); //normal
precalc
      for y := 0 to CurrentBitmap.Height-1 do
        cmsDoTransform(lcmsTransform, CurrentBitmap.ScanLine[y],
                                      CurrentBitmap.ScanLine[y],
                                      CurrentBitmap.Width); 
      cmsDeleteTransform(lcmsTransform);

      //Timing inc createTransform on 6MP image
      //1340 ms  w/ 0 in precalc!!
-------------------------------------------------------

and 1340 ms is much faster than I am able to do this... and if I have the
transform cached, the time goes down a little more for the Transform only as
well. The LAB image is verified to be exactly as expected.

BUT, even when doing nothing to the image, I have problems getting this
equally fast back to ProPhoto RGB:

-------------------------------------------------------
      lcmsTransform := cmsCreateTransform( lcmsLABProfile, TYPE_Lab_16, 
                                           lcmsPPProfile, TYPE_RGB_16,
                                           INTENT_PERCEPTUAL, 0 ); //normal
precalc
      for y := 0 to CurrentBitmap.Height-1 do
        cmsDoTransform(lcmsTransform, CurrentBitmap.ScanLine[y],
                                      CurrentBitmap.ScanLine[y],
                                      CurrentBitmap.Width); 
      cmsDeleteTransform(lcmsTransform);

      //Timing inc createTransform on 6MP image
      //3230 ms  w/ 0 in precalc!!
-------------------------------------------------------

Why does that 2nd transform take that much more time? 3230 ms vs. 1340 ms ?

Is this just the nature of things, or am I doing something wrong?

Or - is there any alternative ways of doing this... ?

Any hints would be appreciated...


regards
 
Magne


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user

Reply via email to