Re: [Lcms-user] LCMS 2.16: CMMException: LCMS error 13: Mismatched alpha channels
An ICC-based CMM for color management
Brought to you by:
mm2
From: <mar...@li...> - 2024-01-08 10:13:55
|
Hi, >ie JDK could (SFAICS) change to specify the flag only when both src and dest have alpha. >I don't know when we actually need it when there's no alpha. Sergey ? That would solve all issues. Problem is, the code has no idea on how alpha should be interpreted, and this includes initializing. So, whatever I do to initialize alpha would be wrong in some cases. At that point I think it is better just flagging the error and let’s user to decide. Please note if you don’t specify the flag, the dest alpha channel is untouched, so the caller is responsible of initializing it. If you specify the flag, then the destination alpha channel is initialized by the CMM by copying it from source. The difference is when using the flag you can just malloc the dest memory, without the flag you have to process it before calling cmsDoTransform. Regards Marti Maria The LittleCMS Project <https://www.littlecms.com> https://www.littlecms.com From: Philip Race <phi...@or...> Sent: Friday, January 5, 2024 8:55 PM To: mar...@li...; Lcm...@li... Subject: Re: [Lcms-user] LCMS 2.16: CMMException: LCMS error 13: Mismatched alpha channels On 1/4/24 1:19 AM, mar...@li... <mailto:mar...@li...> wrote: Hi Phil, The reason was to prevent using this flag when the output has alpha channel and there is no source alpha. Specifically that case ? The JDK code currently and only relies on the opposite case, but the check as written allows neither. Other examples are different number of alpha channels. It is not clear what to do with the alpha in such cases. Should lcms initialize the excess with zero? Some folks began to have ideas of adding a new interface to init spare alpha channels so I just applied Occam’s razor. I am open to changes as long as they make sense. The actual implementation complains if the request cannot be accomplished, user specify to copy alpha and there is no alpha or the number of channels is different, an error is triggered. I guess you don’t like this being reported as an error. Ignoring the request seems also not right because user may think it is being performed whilst is really not. What should I do? Mainly I'd like some quick clarity so we can decide if we should change JDK code or wait for an update to LCMS. I can see the argument that specifying "copy alpha" is inconsistent with "there's no alpha to copy from", or "there's nowhere to copy the alpha to". And I can also see that it could easily be a mistake on the part of the app, that is best flagged in an upfront way. But if there's a sensible default action in some subset of these cases, that's documented and easily understood, meaning not loaded with exceptions and caveats, which would allow the existing usage to function properly, that might be preferable. I am not sure that either choice (keep the check as is, or relax it) would make what Sergey is asking for impossible, but I'll defer to him to comment on that. ie JDK could (SFAICS) change to specify the flag only when both src and dest have alpha. I don't know when we actually need it when there's no alpha. Sergey ? -phil. Regards Marti Maria The LittleCMS Project <https://www.littlecms.com> https://www.littlecms.com From: Philip Race <mailto:phi...@or...> <phi...@or...> Sent: Wednesday, January 3, 2024 9:00 PM To: Lcm...@li... <mailto:Lcm...@li...> Subject: [Lcms-user] LCMS 2.16: CMMException: LCMS error 13: Mismatched alpha channels JDK is using the flag cmsFLAGS_COPY_ALPHA. It is specified in a few cases including if the source has alpha but the destination is opaque, expecting that the alpha channel will be ignored. Here's where JDK started using the flag https://github.com/openjdk/jdk/commit/16acfafb#diff-eed6ddb15e9c5bdab9fc3b3930d5d959966165d9622ddd293e8572489adea98b But in LCMS 2.16 there's a new check that this is running afoul of. https://github.com/mm2/Little-CMS/commit/e55b6fa4d3c5b7e08d9e4bc8c803a79ca908b5a4#diff-3627f903d37617a227e71f0ee1[…]2629b5ee838707e3fcd7dcb46e762f4e It seems to me that likely we could just drop specifying cmsFLAGS_COPY_ALPHA in this case, but I can't find any background information on the reason for the change in LCMS, or awareness that it might be a compatibility issue. Thoughts / comments ? -phil. |