Quoting Steve Mills <smi...@multi-ad.com>:

> I'll explain why we need this and see if there might be some other 
> way to do this. ...

One way would be to get the iohandler and then use it on
cmsOpenProfileFromIOhandlerTHR(), then you have not to know
whatever the profile was memory, file or stream based.

But anyway, I think there is a more efficient and clean way,
that is by using reference counting. The profile handle
approach is there because in many situations you would share
the same profile on different transforms. An open profile
only loads on memory the tables/tags needed by the transform,
but after this preloading, data remains on memory after profile
is closed. Then if 3 transforms  are using the same profile,
say as perceptual input, then the AToB0 tag is loaded only
once and shared between transforms. The decoding ad file
IO happens only on first call, calls 2 and 3 get cached data.

If your copy constructor opens 3 different instances of same
profile, a lot of memory for the tag directory, etc. Is wasted
without any evident benefit.

I would, instead, use a reference counting class.
http://www.codeproject.com/KB/cpp/rcptr.aspx

The copy constructor only increase the count. The
destructor decreases it. When the count reaches 0, you close
the profile. This needs no internal functions, is fast and very
memory-efficient.


Regards
Marti


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user

Reply via email to