dburckh / AndroidLibRaw

Another Android LibRaw implementation. LibRaw is used to render raw camera files (e.g NEF, CR2, ARW). Contains a sample app that show a simple implementation.
4 stars 5 forks source link

Allow easy reading of white balance settings from camera with color temps #5

Closed caraesten closed 3 months ago

caraesten commented 3 months ago

Well, this didn't actually end up helping me (the raw files I'm working with don't have white balance multipliers pre-set), but I figured it might help someone.

This reads and nicely formats a set of white balance multipliers and includes color temp info alongside it.

Testing with camera raw file from Fuji X-Pro 2, got the following results: Screenshot 2024-04-10 172701

_DSF5079.zip

(zip contains tested raw file)

please go ahead and feel free to modify this in keeping with the style of the project :)

caraesten commented 3 months ago

New diff for your perusal.

Also have a PR coming to add a getSoftwareBitmap method for API26+, just because I found there's situations where I need it.

Thank you SO much for your attention on this!

caraesten commented 3 months ago

Oh, and the new outputs of each getAvailable* method: Screenshot 2024-04-15 094136

dburckh commented 3 months ago

New diff for your perusal.

Also have a PR coming to add a getSoftwareBitmap method for API26+, just because I found there's situations where I need it.

Thank you SO much for your attention on this!

Just a warning, the latest version of the NDK supports weak symbol for APIs. This means we can selectively call newer APIs on the C side like we do in Java. This would eliminate the need for the LibRaw26 / androidraw26.cpp, so that code might be changing.

I'm in the weeds at the moment. I'll try to spend more time on this Friday.

dburckh commented 3 months ago

I made some changes to a branch called ndk26update. Might want to check those out. In particular getBitmap() now ONLY returns a software bitmap.

I'm going to update gradle and the LibRaw version, then commit those. Let me know if you have any issues.

caraesten commented 2 months ago

I made some changes to a branch called ndk26update. Might want to check those out. In particular getBitmap() now ONLY returns a software bitmap.

I'm going to update gradle and the LibRaw version, then commit those. Let me know if you have any issues.

hey! just had time to check out the new version and this is great, thank you. I was able to get our build running on the main library rather than my fork :).

one thing I do want to ask though: is there room to maybe clarify the API a little bit? for example, if I call decodeBitmap(<some ARGB8888 config>) on API29+, I get a hardware bitmap. but if I call getBitmap, I'll get a software one. this is actually ideal for my use case (various image analysis tasks running on a software bitmap while the hardware bitmap is directly rendered to a GL surface), but it's a bit confusing from a method name standpoint.

other than that (very small) nit, the new version looks perfect! thank you so much! and thank you for updating the code in this PR to use the EXIF constants too, that's extremely nice!

dburckh commented 2 months ago

I see your point. At a minimum getHardwareBitmap(...) should be public. I'm thinking I might deprecate getBitmap() and getBitmap16() in favor of getSoftwareBitmap(Bitmap.Config). That makes the API clearer and allows for future expansion.