reilandeubank / unprocess

Apache License 2.0
15 stars 0 forks source link

RAW to JPEG conversion is slow and could use improvement from an external library #7

Open reilandeubank opened 2 days ago

reilandeubank commented 2 days ago

At the moment, the RAW to JPEG conversion simply converts the raw data to a bitmap before jpeg compression. The conversion dates a few seconds, which may be unintuitive to users as it appears the app is stuck on the viewfinder after they took the photo. This may be sped up and made cleaner with the use of an external library.

Here is the code in question

Ytrog commented 1 day ago

Where does this happen in code? It might help any other contributers 👀

Also, what is slow? Are we talking seconds or minutes?

reilandeubank commented 1 day ago

Where does this happen in code? It might help any other contributers 👀

Also, what is slow? Are we talking seconds or minutes?

I updated the issue with more details, thanks!

Ytrog commented 1 day ago

Am I correct that it is in these lines?: https://github.com/reilandeubank/unprocess/blob/1d6e2ae2f5a5556536093b650e6df7f25b52c5ad/app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fexample%2Fandroid%2Fcamera2%2Fbasic%2Ffragments%2FCameraFragment.kt#L446-L475

Is it possible to do it in an asynchronous way so the UI doesn't freeze while this is going on in the background. I have no experience in Kotlin (mainly C#, Lisp, Erlang, Rust, Haskell and such), but it reads well.

After some searching maybe launching it "main-safe" in a coroutine would solve it 🤔

I found this about it: https://developer.android.com/kotlin/coroutines#kts

Alas I am at my gf's place, so I have no access to my dev-pc and am phone bound atm otherwise I would try it rn 🤓