Re: [Lcms-user] Lcms2-2.4 release candidate - feedback
An ICC-based CMM for color management
Brought to you by:
mm2
|
From: Mark <de...@ci...> - 2012-09-03 19:57:15
|
One more addition: indeed, changing the define for TYPE_RGBA_FLT caused the packing to be correct. But it also leads to only 3/4 of the pixels being converted at all. So the bottom quarter of my image is all black.
So no real solution.
On 03.09.2012, at 21:44, Mark Munte <m....@me...> wrote:
> Hello Marti
>
> I could reproduce it with your code - kind of.
> The single pixel convertion is working fine, the problem only shows up converting multiple pixels:
>
> Heres a printout of the first 12 RGBA floats from the source, then the same pixels after RGBA => LabA => RGBA:
> 0.6054169536 0.3002517819 0.2647287846 0.0000000000 0.2757610381 0.1638818979 0.1508964747 0.0000000000 0.4944380820 0.1766842157 0.1336690336 0.0000000000
> 0.6054169536 0.3002517521 0.2647288144 0.0000000000 0.0000000000 0.2757610381 0.1638818979 0.1508965045 0.0000000000 0.0000000000 0.4944380820 0.1766842157
>
> Looks like lcms is inserting one component per result pixel.
>
> Here the first 12 floats of the image after conversion RGBA => LabA
> 42.5072898865 32.5295295715 21.1147441864 0.0000000000 20.5950908661 13.3275184631 8.0124092102 0.0000000000 30.9475460052 35.2622528076 26.1845855713 0.0000000000
>
> So looks like the problem is only happening when going from LabA => RGBA
>
> I could also reproduce the bug going using TYPE_Lab_FLT (instead of TYPE_LabA_FLT)
> But, when going from TYPE_Lab_FLT or TYPE_LabA_FLT to TYPE_RGB_FLT all is correctly packed.
> Interestingly, TYPE_ARGB_FLT is working fine.
>
> If I take out the EXTRA_SH from the TYPE_RGBA_FLT, all seems to work fine.
> From
> #define TYPE_RGBA_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4))
> To
> #define TYPE_RGBA_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(4))
>
> Does that make any sense?
>
> Hope that helps
> mark
>
>
> On 31.08.2012, at 17:46, Marti Maria <mar...@li...> wrote:
>
>>
>> Hi Mark, I've tried to reproduce the bug, but with no success...
>>
>> That is the code I've been checking. Could please verify this is what you reported failing?T
>> Thanks,
>> Marti
>>
>> /*
>> Bug reported
>>
>> 1)
>> sRGB built-in V4.3 -> Lab identity built-in V4.3
>> Flags: "cmsFLAGS_NOCACHE", "cmsFLAGS_NOOPTIMIZE"
>> Input format: TYPE_RGBA_FLT
>> Output format: TYPE_LabA_FLT
>>
>> 2) and back
>> Lab identity built-in V4.3 -> sRGB built-in V4.3
>> Flags: "cmsFLAGS_NOCACHE", "cmsFLAGS_NOOPTIMIZE"
>> Input format: TYPE_LabA_FLT
>> Output format: TYPE_RGBA_FLT
>>
>> */
>> static
>> cmsInt32Number ChecksRGB2LabFLT(void)
>> {
>> cmsHPROFILE hSRGB = cmsCreate_sRGBProfile();
>> cmsHPROFILE hLab = cmsCreateLab4Profile(NULL);
>>
>> cmsHTRANSFORM xform1 = cmsCreateTransform(hSRGB, TYPE_RGBA_FLT, hLab, TYPE_LabA_FLT, 0, cmsFLAGS_NOCACHE|cmsFLAGS_NOOPTIMIZE);
>> cmsHTRANSFORM xform2 = cmsCreateTransform(hLab, TYPE_LabA_FLT, hSRGB, TYPE_RGBA_FLT, 0, cmsFLAGS_NOCACHE|cmsFLAGS_NOOPTIMIZE);
>>
>> cmsFloat32Number RGBA1[4], RGBA2[4], LabA[4];
>> int i;
>>
>>
>> for (i = 0; i <= 100; i++)
>> {
>> RGBA1[0] = i / 100.0F;
>> RGBA1[1] = i / 100.0F;
>> RGBA1[2] = i / 100.0F;
>> RGBA1[3] = 0;
>>
>> cmsDoTransform(xform1, RGBA1, LabA, 1);
>> cmsDoTransform(xform2, LabA, RGBA2, 1);
>>
>> if (!IsGoodVal("Float RGB->RGB", RGBA1[0], RGBA2[0], FLOAT_PRECISSION) ||
>> !IsGoodVal("Float RGB->RGB", RGBA1[1], RGBA2[1], FLOAT_PRECISSION) ||
>> !IsGoodVal("Float RGB->RGB", RGBA1[2], RGBA2[2], FLOAT_PRECISSION))
>> return 0;
>> }
>>
>>
>> cmsDeleteTransform(xform1);
>> cmsDeleteTransform(xform2);
>> cmsCloseProfile(hSRGB);
>> cmsCloseProfile(hLab);
>>
>> return 1;
>> }
>>
>>
>>
>> El 24/08/2012 12:45, Mark escribió:
>>> Hello,
>>>
>>> I am working at a set of Cocoa Wrappers for LCMS. I started some months ago with lcms2 2.1.
>>> Just updated to lcms2 2.4rc1. Nice. I see some matrix shader transform bugs where solved in the meantime.
>>>
>>> I have around 10 tests involving transformation from sRGB to LAB / XYZ / some other profile and back, with different bit depths and flags.
>>>
>>> All my tests, but one, run fine with 2.4rc1:
>>>
>>> 1)
>>> sRGB built-in V4.3 -> Lab identity built-in V4.3
>>> Flags: "cmsFLAGS_NOCACHE", "cmsFLAGS_NOOPTIMIZE"
>>> Input format: TYPE_RGBA_FLT
>>> Output format: TYPE_LabA_FLT
>>>
>>> 2) and back
>>> Lab identity built-in V4.3 -> sRGB built-in V4.3
>>> Flags: "cmsFLAGS_NOCACHE", "cmsFLAGS_NOOPTIMIZE"
>>> Input format: TYPE_LabA_FLT
>>> Output format: TYPE_RGBA_FLT
>>>
>>> 3)
>>> save resulting RGBA float image.
>>>
>>> The image is corrupted. Sample attached.
>>>
>>>
>>> Thx for this terrific library.
>>>
>>> Kind regards
>>> Mark
>>
>
|