Re: Change PCS of CLUT input profile
Re: Change PCS of CLUT input profile
- Subject: Re: Change PCS of CLUT input profile
- From: Graeme Gill <email@hidden>
- Date: Thu, 11 Oct 2007 09:45:34 +1000
Mark wrote:
I want to apply an input profile to a live video stream. So far all
digital camera/scanner profiling packages I analyzed will generate
profiles with LAB PCS.
Often this is because for completely generally device behaviour,
such profiles have a higher accuracy.
The "end product" shall be video in one of the many video standards
(Rec 709 or SDTV,... ). So I am thinking that for performance reasons
it might be smart to have the input profile directly output XYZ - that
makes me get rid of the LAB to XYZ conversion - that way I can get from
XYZ to any of those R'G'B's directly.
> If any of what I am assuming is totally wrong - please let me know.
> I've just started digging into color management...
If you're doing this whole thing properly, then I'd advise
against going the XYZ PCS route. In fact, the input profile PCS
shouldn't matter very much, since you aren't wanting to go
camera -> XYZ, you want to go camera -> RGB space.
There are two reasons behind this:
A minor one is that the gamut of the XYZ space is
even less well matched to the gamut of your outputs
space than L*a*b*, and if any of your output
transforms need to use a CLUT based profile, this
is then a major cause of inaccuracy in the PCS->RGB
space transform. If all your output spaces are
nicely mathematical in XYZ space, this won't count much.
The major one is that if you have an arbitrary
CLUT based input profile, then you should be
linking this with your output profile (even if
it is a nice mathematical profile), and then
do the pixel level conversion from input space to output
space in one hit (ie. one pixel level set of
input curve lookup, clut lookup, output curve lookup).
It will be much faster, and can be much more
accurate, since you are transforming from a
perfectly contained gamut to perfectly
contained gamut, and you can spend time and
memory setting up the overall transform.
[ Of course different rules apply if some of
your pipeline is to be done with fixed function hardware,
as opposed to normal SW or GPU code etc.]
Allow me to ask a somewhat related question: applying a CLUT profile to
live video is certainly computationally expensive - I'm planing to do
it on the GPU (OpenGL shaders). Shouldn't be so hard to do, I just have
to parse the profile and create the LUT-textures... and well, do the
math in the shader(s). I am looking for some code where I can see what
it really takes to apply a A2BX to an input XYZ (or LAB) value. Can you
give me a pointer where I might find such code in argyllcms? That would
be very helpful.
Unfortunately I haven't got around to doing a GPU implementation
yet, but the pixel level code is in imdi. It's rather optimized,
so it may not be easy to follow (it uses a code generator to
generate the optimized pixel conversion kernels).
Looking at the generated code in imdi_k.c may be the most
understandable, although the table setup is not obvious.
Another approach is to look at the general code in icc/icc.c,
functions icmLut_lookup_clut_nl() or icmLut_lookup_clut_sx().
The closest to a GPU example I've located is in "GPU Gems 2",
Page 381 "Using Lookup Tables to Accelerate Color Transformations",
by Jeremy Selan. Of course a texture lookup is ideal for
implementing a CLUT :-)
I see, so the best would be to create the profile in XYZ right away right?
You get a different/better result generally, since the per channel
curves can be optimized appropriately, and they change a bit
depending on the PCS.
Hum, I've lately been helping out the Lprof guys a bit to get a
working, well behaved, statically built Lprof for OS X. Maybe I can
persuade the Lprof guys to allow creation of XYZ CLUT profiles...:)
Argyll is statically linked, and runs on OS X - it's just not as pretty yet :-)
Graeme Gill.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Colorsync-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden