Hi,

Congratulations. That's the first question ever
on this list about MPE :-)

For those of you that don't know what he is talking
about, latest ICC revision does allow a extended
type of profiles that can store data in floating
point encoding and can deal with new structures like
segmented parametric curves. AFAIK Photoshop CS5
does support such profiles.LittleCMS 2.0 allows
you tou use and create those profiles.


The process should be straightforward. Basically
you have to create a pipeline with desired elements,
segmented curves and a matrix in your case, then
savethe pipeline as MPE in a cmsBToDTag. Please see
some code below. Creation of segmented curves takes
most of code. All parameters of cmsCurveSegment are
described in the documentation.

static
void CreateBToD0(cmsHPROFILE hProfile)
{
   cmsPipeline* p;
   cmsFloat64Number m[] = { 1, 0, 0,
                            0, 1, 0,
                            0, 0, 1};
   cmsFloat64Number o[] = { 0, 0, 0};
   cmsStage* Matrix;
   cmsStage* Curves;
   cmsToneCurve* t[3];
   cmsCurveSegment Seg[2];


    // Initialize segmented curve
    // Segment 0: Force from minus infinite to 0 to be zero
    Seg[0].x0 = -1;
    Seg[0].x1 = 0;
    Seg[0].Type = 6;

    Seg[0].Params[0] = 1;
    Seg[0].Params[1] = 0;
    Seg[0].Params[2] = 0;
    Seg[0].Params[3] = 0;
    Seg[0].Params[4] = 0;

    // Segment 1: From zero to any, power function
    Seg[1].x0 = 0;
    Seg[1].x1 = 1.0;
    Seg[1].Type = 6;

    Seg[1].Params[0] = 1;
    Seg[1].Params[1] = 1;
    Seg[1].Params[2] = 0;
    Seg[1].Params[3] = 0;
    Seg[1].Params[4] = 0;

   // Create segmented curve
   t[0] = t[1] = t[2] = cmsBuildSegmentedToneCurve(0, 2, Seg);

   // Create empty pipeline
   p = cmsPipelineAlloc(0, 3, 3);

   // Create stages
   Curves = cmsStageAllocToneCurves(0, 3, t);
   Matrix = cmsStageAllocMatrix(0, 3, 3, m, o);

   // Populate pipeline with stages
   cmsPipelineInsertStage(p,  cmsAT_END, Curves);
   cmsPipelineInsertStage(p,  cmsAT_END, Matrix);

   // Write the pipeline as BToD0 tag
   if (!cmsWriteTag(hProfile, cmsSigBToD0Tag, p))
   {
         printf("Error!");
   }

   // Free resources
   cmsPipelineFree(p);
   cmsFreeToneCurve(t[0]);
}


Note that MPE only accepts parametric curves of type
6, 7 and 8, which corresponds with formula 0, 1, and
2 in ICCSpecRevision_02_11_06_Float.pdf I did that in
such way to allow both types of curves to coexist in
pipeline structures.

Also, those profiles will only work in lcms if you
specify float or double types when creating the
transform. The spec requires to include a reduced
precision LUT16 for CMM that does not support such
advanced features.

Good luck in your efforts, you are using rather new
and unexplored features of lcms. Please let  me know
if it worked to you.

Best regards
Marti

Quoting Auke Nauta <a...@nautanet.info>:

> Hi group,
>
> I really could use some help in creating a B2Dx tag(s) in a profile.
> It just needs a segmented tone curve (output unbounded) and a matrix.
>
> For regular B2Ax or A2Bx tags I have no difficulties, I just don't know
> how to create the B2Dx ones.
> I also could not find much information in the docs regarding this.
>
> Can anyone help?
>
> Thanks and greetings,
> Auke Nauta
>
>
> --
> Everyone knew it was impossible.
> Then an idiot came along who didn’t know...
> [original: Marcel Pagnol]
>
>
> -------------------------------------------------------------------------
-----
>
> _______________________________________________
> Lcms-user mailing list
> Lcms-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lcms-user
>



------------------------------------------------------------------------------

_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user

Reply via email to