mvysny / photocloud-frame-slideshow

Android Digital Photo Frame
https://www.android-photo-frame.eu
14 stars 1 forks source link

Feature request: Display embedded jpeg in dng files (instead of converting) [$15 awarded] #142

Closed rajdude closed 3 years ago

rajdude commented 3 years ago

Hello Martin, Good work here!

I would like to request a new feature please: It would be very nice if PhotoCloud could display the embedded jpeg preview image inside every dng raw image file.

I know PhotoCloud uses Libraw to show dng...but it seems to me that there is a conversion process happening (using libraw) ...that is why it takes a long time for PhotoCloud to show a dng on screen.

If PhotoCloud would simply read and display the embedded jpeg already available inside the dng file, it may be able to show the dng image on screen almost immediately.

PS: how can we put a "bounty" on this feature request?

--- The **[$15 bounty](https://www.bountysource.com/issues/93854405-feature-request-display-embedded-jpeg-in-dng-files-instead-of-converting?utm_campaign=plugin&utm_content=tracker%2F53303527&utm_medium=issues&utm_source=github)** on this issue has been claimed at [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F53303527&utm_medium=issues&utm_source=github).
mvysny commented 3 years ago

Hello, I'm not sure whether libraw allows access to the embedded jpeg, but I'll investigate.

However, if you're using Android 7 or higher which is able to load raws natively, then PhotoCloud no longer uses libraw. Please find more info here: https://github.com/mvysny/photocloud-frame-slideshow/issues/34#issuecomment-327527656

PS: how can we put a "bounty" on this feature request?

https://www.bountysource.com/ should automatically create the bounty for the issue; I wonder why it didn't do so. However, let's not create a bounty for this just yet - I'd like to investigate first, whether libraw offers an API for this.

mvysny commented 3 years ago

I've found an API that seems to be able to extract the thumbnail from the image: Libraw.getThumbnail(), therefore it just might be possible. Could you please attach an example zipped dng raw image with a thumbnail, so that I can test the fix?

To open a bounty, please click the "Post Bounty" button at https://www.bountysource.com/ and post the link to this ticket.

rajdude commented 3 years ago

Sure Martin, Here is an dng image which I use for definitely checking what any image viewer is doing.

Please see screenshots below.

dng1

dng2

Actual dng file is attached here:

(oops, it does not let me attach a dng),,,,,any other way I can send you the dng?

mvysny commented 3 years ago

Please place the dng file in a zip archive, then attach the zip archive here.... yeah, I know, but github has this kind of limitation.

rajdude commented 3 years ago

oh, that is a simple solution...why did it not occur to me! :-( Here you go...

oops, problem again...10 mb limit...my file is 34 MB...hold on, let me put it on a filesharing site...

rajdude commented 3 years ago

here you go

https://1drv.ms/u/s!AnyjWmU28erbm-U3ly4gqEVNCTK6Ow?e=XTPDtH

mvysny commented 3 years ago

Thank you for finding the workaround :) :+1: I have the file now; I'll try to get to this this week.

mvysny commented 3 years ago

Which Android version are you using please? I'm asking since Android 7 can load the raws natively, and it should work really fast. In fact, that's why PhotoCloud never uses Libraw on Android 7+. However, not using Libraw means no thumbnail preview. Therefore, if you're using a newer Android and you're getting slow decoding speeds, then I need to add a setting to use Libraw regardless of Android version.

https://github.com/mvysny/photocloud-frame-slideshow/issues/34#issuecomment-327527656

rajdude commented 3 years ago

I have many Android devices, the phone I am currently testing PS on is running Android version 9. If I use an app like "File manager +" and try to open the same file off my server...meaning the file is sitting on a network share, accessed via SMB, it takes maybe 30 seconds to load. It is a 33 MB file. I am not sure if the actual network transfer of that file is taking that long or the file conversion done by Android is taking that long. In contrast, if I open the same file on my Windows 10 PC (off the network server)...it takes 1-2 seconds. I open that file in a software called Irfanview.

The tablet I would really like PS to work on is really Samsung model. It is running Android 6.0.1. To be honest, PS does work on that tablet, but it takes over a minute to load a .dng file. That is why I requested you for this enhancement, hoping to speed up the slide show on that tablet.

mvysny commented 3 years ago

In the testing file you sent me, the thumbnail preview image has the size of whopping 18 MB. Therefore, if the network is the bottleneck, we will most probably not observe any speedup. However, it could be that Android is unable to load the RAW, which makes PhotoCloud fall back to the native Libraw library which is quite slow. In such case a speedup should be clearly visible.

I've added a preference setting "Filters/Moments / Try loading thumbnails from RAWs" which activates the thumbnail loading. Try to enable it on your device and let me know whether it helped :+1:

Implemented in PhotoCloud 1.13.18.

rajdude commented 3 years ago

Hi Martin, Thanks for looking into this. I do not think the network is the bottleneck in my home. I have a pretty good wi-fi setup here. I have created a video to demonstrate the difference in the time taken for Photo Cloud to download and display a photo and a file manager app to display the same photo, in my phone. Please take a look at the video here:

https://youtu.be/b9d8ygulFj8

Points to notice: Starting at video time 0:35, the file copy starts and ends at 0:44. So the file took 10 seconds to transfer from my server to my phone. The size of that file is 36 MB. Notice how the "File manager +" app shows the image almost immediately.

Starting at video time 1:26, Photo Cloud starts transferring the same file. Ends at 2:22 with PhotoCloud showing the file on the phone’s screen. So that is around 56 seconds.

10 seconds vs 56 seconds….that is a significant difference. Now, is it the transfer time or PhotoCloud doing some sort of file conversion, I do not know :-(

By the way, when is PhotoCloud 1.13.18 being released to the Google Play Store? It still shows PhotoCloud 1.13.17 to me here in USA.

mvysny commented 3 years ago

I've released PhotoCloud 1.14 yesterday but it's under review by Google.

Thanks for sharing the video - there's definitely something wrong going there. What PhotoCloud does is that it basically downloads the video locally, then loads it into memory as a displayable bitmap. The download shouldn't take more than 10 seconds; could it be that PhotoCloud spends 46 seconds loading the RAW? Depends on your Android version - if it's 7+ then it should be able to open the RAW natively fast; however on lower Androids I'm using Libraw which might be slower... but 46 seconds sounds a lot.

Anyways, please let me know whether the "RAW thumbnails" will save the day.

rajdude commented 3 years ago

Martin, I think it is a combination of Android and PhotoCloud which is taking that long to decode that file. I did more testing and I see "File Manager +" app takes around 25 seconds for similar sized files, provided it is the very first time I am opening a file off my server. Subsequent file open times are almost instantaneous, pointing to some sort of caching in the either Android or inside "File Manager +" app. Note 25 seconds is still much less than the 56 seconds Photocloud is taking.

Lets hope that the new option resolves this issue :-)

PS: that phone in the video is running Android 9, I showed the version in the video, right at the end.

mvysny commented 3 years ago

Hi, have you perhaps found the time to test the new thumbnail loader? Does it work better please?

rajdude commented 3 years ago

Oh, has Google released the new version of your app? Let me check...

⁣ -Raj (Sent from my cellphone)

Get BlueMail for Android ​

On Dec 1, 2020, 1:44 AM, at 1:44 AM, Martin Vysny notifications@github.com wrote:

Hi, have you perhaps found the time to test the new thumbnail loader? Does it work better please?

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/mvysny/photocloud-frame-slideshow/issues/142#issuecomment-736259221

rajdude commented 3 years ago

sorry for the delay in responding, Martin...here are the results of my testing with the new version of your app (with thumbnail option in it):

I used the exact same .dng file sitting on my server on the network. I am listing loading times below as tested on two different devices using two different SMB protocols.

First, some notes :

Anyway here are the results:

On my super old Samsung Note 3 tablet (this is the primary device where I would like PS to work) Over SMB 1.0; more on this later:

With thumbnail loading disabled: 1:07 min With thumbnail loading enabled: 0:56 min

A 16.4% decrease in loading time.

On my Sony Xperia XZ2 compact phone Over SMB 1.0

With thumbnail loading disabled: 29 seconds With thumbnail loading disabled: 29 seconds

no change

Over SMB 3.0

With thumbnail loading disabled: 3 seconds With thumbnail loading disabled: 3 seconds

no change

Observations:

Here is what I would like to request next: Is it possible to resolve this error, happening while trying to connect to my server from the old tablet:

IMG_20201210_112830

rajdude commented 3 years ago

oh by the way, that tablet where the error is happening while trying to use SMB 3.0 is very old, running Android 6.0.1. It is unusable as a tablet, but works perfectly as a photo frame....just that image loading is super slow...over one minute to load a dng.

mvysny commented 3 years ago

Hi Rajdude, thanks for letting me know! Please see the answers below.

Browsing files using SMB 3.0 inside PhotoCloud is extremely slow. For example, sometimes it takes over 30 seconds just to enumerate/display the contents of a folder, which has lots of image files. Same problem is NOT there if I use SMB 1.0. Second time I go into the same folder, contents appear almost immediately. Maybe some caching is happening.

Huh that's weird. The smbj library is ued for SMB 2/3; sounds like there's some kind of caching or other issue in the library itself. I've checked the list of smbj issues but nothing apparent jumped there...

This problem is NOT there if I use FileManager+

It can be that FileManager+ uses some kind of native Samba client perhaps, which seems to be working the best. At least VLC for Android uses native samba client and it works excellent. Perhaps this is something I should investigate in.

With thumbnail loading disabled: 1:07 min; With thumbnail loading enabled: 0:56 min; A 16.4% decrease in loading time.

Looks like the thumbnail loader have not helped that much...

An error happens...shown below

Uh-oh. smbj uses Java 8 features (closures) and I had to enable some kind of special compilation, outlined in https://stackoverflow.com/questions/59448845/no-static-method-metafactory. Perhaps I've missed something out. Could you open a new bug report regarding this, and I'll investigate this further.

So maybe using SMB 3.0 is the "holy grail" instead of attempting to load the jpeg thumbnail in a dng file ! :-)

Haha, yes, certainly looks like it. The difference of 29 seconds vs 3 seconds is absolutely ground-breaking. However, PhotoCloud caches the photos on the tablet locally as JPEGs; displaying cached images in a second pass should be instantenous. Could you verify that Settings / Cache / Photo Cache is enabled and the Cache Size is set to 1 GB or more?