-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[imageio] Modify the libraw loader so that it can work as a fallback loader #16334
[imageio] Modify the libraw loader so that it can work as a fallback loader #16334
Conversation
This is not without risk: when/if RawSpeed gets the same functionality, there is no guarantee the parameters (crop, black/white point, input colour matrix) will be identical, so LibRaw edits might not be future proof? |
@kmilos Why would these parameters be different? |
At least crops are determined manually (and somewhat arbitrarily) separately by owners of both libraries. To make it worse, all prams are hard-coded in LibRaw, while tweakable in XML for RawSpeed. |
@kmilos OK, to be honest, the ideal solution would be to improve the rawspeed code so that it can handle the possibly somewhat, shall we say, somewhat malformed files that libraw successfully handles. Then there will be no need at all for a fallback loader or support for ignoring certain extensions by the rawspeed loader. Is it feasible? If there is no movement in this direction, for risk management we can add to this PR a parameter in the preferences with a tooltip that clearly warns about the risk you mentioned. And the default value of which will be not to enable fallback. |
they are as future proof as cr3 edits - and these aren’t just fallback cases… |
It's a good feature, but I also feel hiding it behind a warning/disclaimer the user has to explicitly accept would maybe be the best? |
Another solution would be to store which raw library was used for editing in the sidecar file: |
Fully agreed, I was about to propose this. As for all other default changed in the IOP we do that only if the module is reset otherwise we just keep the stored default in XMP or DB. @victoryforce : I think this is the way to go. |
That's a good option as well. One more piece of the puzzle: we also rely on RawSpeed to normalize maker and model strings and handle model aliases. For CR3s only we keep a hard-coded table in this loader, but if it's to get wider use, perhaps one could also use the LibRaw built-in normalisation? Doesn't work exactly the same though - don't think we end with both the clean model and clean alias... Edit: Edit2: We could maybe consider adding all the known, not yet working cameras to the RawSpeed database anyway w/ |
(Note: i do not receive notifications for this repository, i've seen this accidentally.) Much like with many of the recent darktable changes, i really don't understand what is going on, Concretely:
This is not the project i've once contributed to. |
@LebedevRI At least from my point of view, this is still a "last resort" solution, and I agree w/ most of your points, except
Many users are missing and asking for support for completely valid, non-corrupt, OOC raws from modern gear:
It started w/ CR3s only, but the list of codecs and camera models is relentlessly growing as time goes by unfortunately. So, while we desperately need/want to have RawSpeed contributors for those, dt can't really stand idly by either. Is there an alternative you can envisage or propose? P.S. Note that the CR3 issue also made the vkdt project have two backends: RawSpeed and rawler. |
Well, i can't conjure up new contributors from thin air, so the options are limited :) It was perhaps unfortunate how much i course-corrected after merging that rapid-fire of external PR's Finally, after many years, i'm looking into the second half of the puzzle, encoding, I think, as the pr log shows, i do merge external PR's, |
Very true! For starters, for the non-trivial PRs, maybe try to be more transparent in why it's not trivial and what needs to happen first, provide an update/timeline every once in a while? If the bar is too high or there is no feedback/interest, they will either not come or go away? Maybe have an "up for grabs" label for the possibly low-impact stuff while you work on the architecture? We can perhaps then advertise these "up for grabs" bounties on discuss.pixls.us etc. |
Yeah believe me, i know :( I have, ..., communication issues, let's put it that way. |
You are not alone, I think everyone is familiar with this feeling! I guess the trick is to recognize/remind oneself there are still more important/grander things in life so that wall becomes less significant ;) |
Uh, no, i don't think so. |
I would like to contribute (although not sure that i have the skills) but the lack of documentation would make it very difficult to know where to start. |
This pull request has been marked as stale due to inactivity for the last 60 days. It will be automatically closed in 300 days if no update occurs. Please verify it has no conflicts with the master branch and rebase if needed. Mention it now if you need help or give permission to other people to finish your work. |
I like the idea but I see the possible issue with file being later supported by rawspeed. My proposal would be:
This would give the us the best options for our users. Supporting more formats and have a safe move if needed, user will be aware that this change could be affecting the image rendering and so he will be prepared to adjust the developement. |
@victoryforce : Can you comment about my last proposal? |
@victoryforce : Is that still on your radar? Or do you want to close this? |
In fact, the need for this PR (or the alternative proposed by @TurboGit) should not arise at all. Currently rawspeed does not support CR3 files and libraw works here. Also, there may be some compression schemes and codecs that are not yet supported in rawspeed for other raw file formats, but are supported in libraw. In such cases, users can use the option to switch certain raw extensions to work with libraw. In the above-mentioned cases, there is no need to implement the use of the libraw fallback loader after the failure of the rawspeed loader. If something is not supported in rawspeed but is supported in libraw, you simply switch to using an alternative loader. The problem that this PR tried to solve is the following. There are cases when the raw of a certain camera is supported by both rawspeed and libraw. But there are times when, due to rawspeed's stricter requirements for data correctness, it rejects certain files, while libraw loads them successfully. My guess is that the most likely cause of such problem files are bugs in certain versions of the cameras' microcode. I want to emphasize that such files are usually not visually damaged and there is no reason to punish the user for camera bugs by throwing such pictures in the trash.
Will a large number of users experience these issues? Surely not. So is it worth implementing this proposal for a better user experience? I'm not sure. I definitely won't do that. P.S. In most of the programs, the code of which I reviewed, where there is reading of certain file formats, the decoders try to correct as much as possible even if the format contains certain errors or does not strictly comply with the standard. So, in my opinion, the best solution would be to change the rawspeed approach. It is fundamentally important to always adhere to the principle: the interpretation of the spec should be as strict as possible on the side of the data creator and as permissive as possible on the side of the data reader. |
The libraw loader was originally added to handle only the
cr3
format, which is not supported by rawspeed. But there are cases where rawspeed failed to handle certain files of supported formats, while libraw loaded them successfully. So, an option was added to allow the rawspeed loader to ignore the processing of certain formats and offload them to the libraw loader. However, all this time we restricted the libraw loader from trying to process files that rawspeed previously worked with. This PR improves the user experience by giving libraw a chance (by removing the self-restriction) to better handle a file on which rawspeed failed.For testing, you can use the files from #14848. They were not opened in darktable by the rawspeed loader, but they are opened with this PR because libraw works as a fallback and opens them successfully.