pedrocr/rawloader

Thanks for this!

mpizenberg opened this issue · 3 comments

Hi, I mostly wanted to thank you for having done this raw decoder in Rust! (don't hesitate to close the issue)

In case you have a little more time I'd love to know how you managed to do the NEF decoder. In particular, I've been trying to understand how to decompress the strips without much success. I've detailed my issue in this post where someone redirected me here.

I've found the source code of dcraw very intimidating and not easy to understand for me (I'm not coding much in C also). Did you have other sources of information to help you? I haven't found much on the Web, but maybe just as with this library I didn't search for the right things.

Regarding the licensing of this code, are you set on LGPL?

Best regards

Thanks for the kind words!

The original source of decoding details is indeed the dcraw codebase. It's not great code, but it's a great living documentation of a lot of arcane stuff. I know these formats from spending a bunch of time getting the rawspeed codebase to decode most of what dcraw does and some new stuff as well, figured out from other sources:

https://github.com/klauspost/rawspeed

After getting it mostly complete I spent way too much time fuzzing C++ code and finding more and more soundness/safety issues. rawloader was my project to learn rust and it completely sold me on it. A third of the code, almost none of the safety problems, great expressiveness and features, just as fast as C/C++ and sometimes effectively faster because you can do trickier stuff easily.

I've started on a full raw photo processing workflow, that I really need to get to an MVP state:

https://github.com/pedrocr/chimper
https://github.com/pedrocr/imagepipe
https://github.com/pedrocr/syncer

rawspeed was also where LGPL came from, and rawloader is a derived work, so relicensing isn't really feasible without asking permission from a bunch of people. I wouldn't want to do it anyway. I think LGPL is fine for this kind of code, and don't really see something someone would want to do with it and can't because of the license that I wouldn't find objectionable. It basically only prevents you from improving on the code in a closed source way, distributing it to users, and keeping those improvements closed source. Which would suck. Other than that everything anyone would want to use this for in open-source and commercial software works fine with the license.

Thanks for the detailed answer! I've discussed a bit with other people on the subject of NEF decoding and realized that most (all?) open source implementation either come from dcraw or from some smart reverse engineering so I won't be able to reimplement it from scratch and documentation anywhere. It sucks a bit that camera maker would not document their format. I sure would choose a camera with open an open format if the price and characteristics were similar (looking at you Leica ^^).

Regarding LGPL, I thought that any binary based on LGPL library should be able to be re-linked to new versions of that library and so it was a bit complicated to use in the context of Rust. Usually, for the reason you mentioned I like the MPL2 license. But it's clear that since most of your code is coming from LGPL-licensed C++ code, it has to be LGPL anyway.

I hope you'll be able to complete your MVP. As for my usage, I'll be making some webapp demo of our research code and so will be using rawloader with wasm if I manage to do what I want.

Thanks again, cheers,
Matthieu

Compiling to wasm is something I've been meaning to try. With all this rust wasm stuff having a full webapp version of chimper from the same code base would be cool.

I created #chimper on irc.freenode.net if you need help with anything or just to chat about these kinds of things.